1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-05-13 22:06:58 +02:00

Fixed #1342. Animate Dead won't affect living creatures.

This commit is contained in:
DjWarmonger 2013-07-28 10:05:37 +00:00
parent abaa5b1c59
commit 257be7a968
3 changed files with 9 additions and 8 deletions

View File

@ -1325,7 +1325,8 @@
{ {
"type" : "NEGATE_ALL_NATURAL_IMMUNITIES", "type" : "NEGATE_ALL_NATURAL_IMMUNITIES",
"val" : 0, "val" : 0,
"valueType" : "BASE_NUMBER" "valueType" : "BASE_NUMBER",
"propagator": "BATTLE_WIDE"
} }
], ],
"index" : 93, "index" : 93,

View File

@ -430,8 +430,8 @@
"effect": 1, "effect": 1,
"anim": 79, "anim": 79,
"ranges": [ "0", "0", "0", "0" ], "ranges": [ "0", "0", "0", "0" ],
"flags" : ["rising"] "flags" : ["rising"],
//TODO: immunity for living creatures "limit":["UNDEAD"]
}, },
"sacrifice" : "sacrifice" :
{ {
@ -439,7 +439,8 @@
"effect": 1, "effect": 1,
"anim": 79, "anim": 79,
"ranges": [ "0", "0", "0", "0" ], "ranges": [ "0", "0", "0", "0" ],
"flags" : ["rising"] "flags" : ["rising"],
"immunity":["UNDEAD", "NON_LIVING"]
}, },
"bless" : "bless" :
{ {

View File

@ -281,6 +281,9 @@ bool CSpell::isImmuneBy(const IBonusBearer* obj) const
return true; return true;
} }
if (obj->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES)) //Orb of vulnerability
return false; //TODO: some creaures are unaffected always, for example undead to resurrection.
for(auto b : immunities) for(auto b : immunities)
{ {
if (obj->hasBonusOfType(b)) if (obj->hasBonusOfType(b))
@ -322,10 +325,6 @@ bool CSpell::isImmuneBy(const IBonusBearer* obj) const
} }
TBonusListPtr levelImmunities = obj->getBonuses(Selector::type(Bonus::LEVEL_SPELL_IMMUNITY)); TBonusListPtr levelImmunities = obj->getBonuses(Selector::type(Bonus::LEVEL_SPELL_IMMUNITY));
if(obj->hasBonusOfType(Bonus::NEGATE_ALL_NATURAL_IMMUNITIES))
{
levelImmunities->remove_if([](const Bonus* b){ return b->source == Bonus::CREATURE_ABILITY; });
}
if(obj->hasBonusOfType(Bonus::SPELL_IMMUNITY, id) if(obj->hasBonusOfType(Bonus::SPELL_IMMUNITY, id)
|| ( levelImmunities->size() > 0 && levelImmunities->totalValue() >= level && level)) || ( levelImmunities->size() > 0 && levelImmunities->totalValue() >= level && level))