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:
parent
61af4ee89a
commit
b94432b4ba
@ -966,7 +966,7 @@ bool CGHeroInstance::canCastThisSpell(const CSpell * spell) const
|
||||
{//hero has this spell in spellbook
|
||||
logGlobal->errorStream() << "Banned spell " << spell->name << " in spellbook.";
|
||||
}
|
||||
return specificBonus;
|
||||
return specificBonus || schoolBonus || levelBonus;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3900,21 +3900,23 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
||||
if(message == "vcmiistari") //give all spells and 999 mana
|
||||
{
|
||||
SetMana sm;
|
||||
ChangeSpells cs;
|
||||
|
||||
GiveBonus giveBonus(GiveBonus::HERO);
|
||||
|
||||
CGHeroInstance *h = gs->getHero(currObj);
|
||||
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
|
||||
cs.learn = 1;
|
||||
for(auto spell : VLC->spellh->objects)
|
||||
//give all spells with bonus (to allow banned spells)
|
||||
giveBonus.bonus = Bonus(Bonus::PERMANENT, Bonus::SPELLS_OF_LEVEL, Bonus::OTHER, 0, 0);
|
||||
//start with level 0 to skip abilities
|
||||
for(int level = 1; level <= GameConstants::SPELL_LEVELS; level++)
|
||||
{
|
||||
if(!spell->creatureAbility)
|
||||
cs.spells.insert(spell->id);
|
||||
giveBonus.bonus.subtype = level;
|
||||
sendAndApply(&giveBonus);
|
||||
}
|
||||
|
||||
//give mana
|
||||
sm.val = 999;
|
||||
sm.absolute = true;
|
||||
@ -3922,7 +3924,6 @@ void CGameHandler::playerMessage( PlayerColor player, const std::string &message
|
||||
if(!h->hasSpellbook()) //hero doesn't have spellbook
|
||||
giveHeroNewArtifact(h, VLC->arth->artifacts.at(0), ArtifactPosition::SPELLBOOK); //give spellbook
|
||||
|
||||
sendAndApply(&cs);
|
||||
sendAndApply(&sm);
|
||||
}
|
||||
else if (message == "vcmiarmenelos") //build all buildings in selected town
|
||||
|
Loading…
Reference in New Issue
Block a user