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

* LEVEL_SPELL_IMMUNITY (e.g. Dragon spell immunity) implemented.

* Modified the positioning of battle effects, they should look about right now.
This commit is contained in:
OnionKnight
2009-08-29 22:00:46 +00:00
parent 8fac12f957
commit c1b112d266
2 changed files with 29 additions and 20 deletions

View File

@ -2692,7 +2692,14 @@ static std::vector<ui32> calculateResistedStacks(const CSpell * sp, const CGHero
std::vector<ui32> ret;
for(std::set<CStack*>::const_iterator it = affectedCreatures.begin(); it != affectedCreatures.end(); ++it)
{
//non-negative spells on friendly stacks should always succeed
if ((*it)->hasFeatureOfType(StackFeature::SPELL_IMMUNITY, sp->id) //100% sure spell immunity
|| ((*it)->valOfFeatures(StackFeature::LEVEL_SPELL_IMMUNITY) >= sp->level))
{
ret.push_back((*it)->ID);
continue;
}
//non-negative spells on friendly stacks should always succeed, unless immune
if(sp->positiveness >= 0 && (*it)->owner == caster->tempOwner)
continue;
@ -2724,8 +2731,7 @@ static std::vector<ui32> calculateResistedStacks(const CSpell * sp, const CGHero
if(prob > 100) prob = 100;
if( (*it)->hasFeatureOfType(StackFeature::SPELL_IMMUNITY, sp->id) //100% sure spell immunity
|| rand()%100 < prob) //immunity from resistance
if(rand()%100 < prob) //immunity from resistance
ret.push_back((*it)->ID);
}