1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00
* allow banned spells by Tomes (XXX_SPELLS bonus), Spelbinders Hat (SPELLS_OF_LEVEL bonus)
* allow banned spells by cheat-code (now also SPELLS_OF_LEVEL bonus)
This commit is contained in:
AlexVinS 2015-10-13 13:16:46 +03:00
parent 61af4ee89a
commit b94432b4ba
2 changed files with 12 additions and 11 deletions

View File

@ -966,7 +966,7 @@ bool CGHeroInstance::canCastThisSpell(const CSpell * spell) const
{//hero has this spell in spellbook {//hero has this spell in spellbook
logGlobal->errorStream() << "Banned spell " << spell->name << " in spellbook."; logGlobal->errorStream() << "Banned spell " << spell->name << " in spellbook.";
} }
return specificBonus; return specificBonus || schoolBonus || levelBonus;
} }
else else
{ {

View File

@ -3900,21 +3900,23 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
if(message == "vcmiistari") //give all spells and 999 mana if(message == "vcmiistari") //give all spells and 999 mana
{ {
SetMana sm; SetMana sm;
ChangeSpells cs; GiveBonus giveBonus(GiveBonus::HERO);
CGHeroInstance *h = gs->getHero(currObj); CGHeroInstance *h = gs->getHero(currObj);
if(!h && complain("Cannot realize cheat, no hero selected!")) return; if(!h && complain("Cannot realize cheat, no hero selected!")) return;
sm.hid = cs.hid = h->id; sm.hid = h->id;
giveBonus.id = h->id.getNum();
//give all spells //give all spells with bonus (to allow banned spells)
cs.learn = 1; giveBonus.bonus = Bonus(Bonus::PERMANENT, Bonus::SPELLS_OF_LEVEL, Bonus::OTHER, 0, 0);
for(auto spell : VLC->spellh->objects) //start with level 0 to skip abilities
for(int level = 1; level <= GameConstants::SPELL_LEVELS; level++)
{ {
if(!spell->creatureAbility) giveBonus.bonus.subtype = level;
cs.spells.insert(spell->id); sendAndApply(&giveBonus);
} }
//give mana //give mana
sm.val = 999; sm.val = 999;
sm.absolute = true; sm.absolute = true;
@ -3922,7 +3924,6 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
if(!h->hasSpellbook()) //hero doesn't have spellbook if(!h->hasSpellbook()) //hero doesn't have spellbook
giveHeroNewArtifact(h, VLC->arth->artifacts.at(0), ArtifactPosition::SPELLBOOK); //give spellbook giveHeroNewArtifact(h, VLC->arth->artifacts.at(0), ArtifactPosition::SPELLBOOK); //give spellbook
sendAndApply(&cs);
sendAndApply(&sm); sendAndApply(&sm);
} }
else if (message == "vcmiarmenelos") //build all buildings in selected town else if (message == "vcmiarmenelos") //build all buildings in selected town