1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

* new spell: fire shield

This commit is contained in:
mateuszb 2010-02-26 15:52:48 +00:00
parent d8edfbf38a
commit 4171a1959f
2 changed files with 19 additions and 0 deletions

View File

@ -927,6 +927,9 @@ static std::vector<StackFeature> stackEffectToFeature(const CStack::StackEffect
case 28: //air shield
sf.push_back(featureGenerator(StackFeature::GENERAL_DAMAGE_REDUCTION, 1, VLC->spellh->spells[sse.id].powers[sse.level], sse.turnsRemain));
break;
case 29: //fire shield
sf.push_back(featureGenerator(StackFeature::FIRE_SHIELD, 0, VLC->spellh->spells[sse.id].powers[sse.level], sse.turnsRemain));
break;
case 30: //protection from air
sf.push_back(featureGenerator(StackFeature::SPELL_DAMAGE_REDUCTION, 0, VLC->spellh->spells[sse.id].powers[sse.level], sse.turnsRemain));
break;

View File

@ -599,7 +599,22 @@ void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CSt
bsa->damageAmount *= 2;
bat.flags |= 4;
}
int dmg = bsa->damageAmount;
prepareAttacked(*bsa, def);
//fire shield handling
if ( !bat.shot() && def->hasFeatureOfType(StackFeature::FIRE_SHIELD) && !bsa->killed() )
{
bat.bsa.push_back(BattleStackAttacked());
BattleStackAttacked *bsa = &bat.bsa.back();
bsa->stackAttacked = att->ID;
bsa->attackerID = def->ID;
bsa->flags |= 2;
bsa->effect = 11;
bsa->damageAmount = (dmg * def->valOfFeatures(StackFeature::FIRE_SHIELD)) / 100;
prepareAttacked(*bsa, att);
}
}
void CGameHandler::handleConnection(std::set<int> players, CConnection &c)
{
@ -3403,6 +3418,7 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, int destinatio
}
case 27: //shield
case 28: //air shield
case 29: //fire shield
case 30: //protection from air
case 31: //protection from fire
case 32: //protection from water