Browse Source

Handling of area attack animation & effect

DjWarmonger 14 years ago
parent
commit
81180de8be
2 changed files with 9 additions and 2 deletions
  1. 5 2
      client/CPlayerInterface.cpp
  2. 4 0
      server/CGameHandler.cpp

+ 5 - 2
client/CPlayerInterface.cpp

@@ -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);
-			battleInt->stackAttacking(attacker, cb->battleGetPos(i->stackAttacked), attacked, true);
+			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)
 		{

+ 4 - 0
server/CGameHandler.cpp

@@ -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);