1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Handling of area attack animation & effect

This commit is contained in:
DjWarmonger 2011-07-02 17:40:33 +00:00
parent 4f24501cae
commit 81180de8be
2 changed files with 9 additions and 2 deletions

View File

@ -835,11 +835,14 @@ void CPlayerInterface::battleAttack(const BattleAttack *ba)
for(std::vector<BattleStackAttacked>::const_iterator i = ba->bsa.begin(); i != ba->bsa.end(); i++)
{
const CStack * attacked = cb->battleGetStackByID(i->stackAttacked);
if (!i->isSecondary()) //display projectile only for primary target
{
battleInt->stackAttacking(attacker, cb->battleGetPos(i->stackAttacked), attacked, true);
}
}
}
else
{//WARNING: does not support multiple attacked creatures
{//TODO: support multiple attacked creatures
int shift = 0;
if(ba->counter() && THex::mutualPosition(curAction->destinationTile, attacker->position) < 0)
{

View File

@ -546,6 +546,9 @@ void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CSt
const Bonus * bonus = att->getBonus(Selector::type(Bonus::SPELL_LIKE_ATTACK));
if (bonus)
{
bsa->flags |= BattleStackAttacked::EFFECT;
bsa->effect = VLC->spellh->spells[bonus->subtype]->mainEffectAnim; //hopefully it does not interfere with any other effect?
BattleStackAttacked bss = *bsa; // copy some parameters, such as attacker
std::set<CStack*> attackedCreatures = gs->curB->getAttackedCreatures(VLC->spellh->spells[bonus->subtype], bonus->val, att->owner, def->position);
@ -3489,6 +3492,7 @@ void CGameHandler::handleSpellCasting( int spellID, int spellLvl, int destinatio
continue;
BattleStackAttacked bsa;
//TODO: display effect only upon primary target of area spell
bsa.flags |= BattleStackAttacked::EFFECT;
bsa.effect = spell->mainEffectAnim;
bsa.damageAmount = gs->curB->calculateSpellDmg(spell, caster, *it, spellLvl, usedSpellPower);