void BagArtifacts::RemoveScroll(const Artifact & art) { Spell spell(art.GetSpell()); if(spell.isValid()) { iterator it = std::find(begin(), end(), spell); if(it != end()) (*it).Reset(); } }
bool HeroBase::CanTranscribeScroll(const Artifact & art) const { Spell spell = art.GetSpell(); if(spell.isValid() && CanCastSpell(spell)) { int learning = GetLevelSkill(Skill::Secondary::LEARNING); return ((3 < spell.Level() && Skill::Level::EXPERT == learning) || (3 == spell.Level() && Skill::Level::ADVANCED <= learning) || (3 > spell.Level() && Skill::Level::BASIC <= learning)); } return false; }
void HeroBase::TranscribeScroll(const Artifact & art) { Spell spell = art.GetSpell(); if(spell.isValid()) { // add spell spell_book.Append(spell); // remove art bag_artifacts.RemoveScroll(art); // reduce mp and resource SpellCasted(spell); } }