int hero::HasSpell(int spell) { //The game zeroes out captains at the start of battle //This is workaround part 2 if(this->spellsLearned == NULL) return 0; if(HasArtifact(ARTIFACT_MAGIC_BOOK)) { if(this->spellsLearned[spell]) { return 1; } else { for(int i = 0; i < MAX_ARTIFACTS; i++) { if(this->artifacts[i] == ARTIFACT_SPELL_SCROLL && this->scrollSpell[i] == spell) return 1; } return HasArtifact(ARTIFACT_BATTLE_GARB_OF_ANDURAN) && spell == SPELL_TOWN_PORTAL; } } else { return 0; } }
bool HeroBase::HaveSpellBook(void) const { return HasArtifact(Artifact::MAGIC_BOOK); }