Pārlūkot izejas kodu

Fix casting of massive spells by creatures

Ivan Savenko 2 gadi atpakaļ
vecāks
revīzija
6b2490903d

+ 10 - 5
client/battle/BattleAnimationClasses.cpp

@@ -810,14 +810,19 @@ void CatapultAnimation::createProjectile(const Point & from, const Point & dest)
 	owner.projectilesController->createCatapultProjectile(attackingStack, from, dest);
 }
 
-CastAnimation::CastAnimation(BattleInterface & owner_, const CStack * attacker, BattleHex dest_, const CStack * defender, const CSpell * spell)
-	: RangedAttackAnimation(owner_, attacker, dest_, defender),
+CastAnimation::CastAnimation(BattleInterface & owner_, const CStack * attacker, BattleHex dest, const CStack * defender, const CSpell * spell)
+	: RangedAttackAnimation(owner_, attacker, dest, defender),
 	  spell(spell)
 {
-	assert(dest.isValid());// FIXME: when?
+	if(!dest.isValid())
+	{
+		assert(spell->animationInfo.projectile.empty());
 
-	if(!dest_.isValid() && defender)
-		dest = defender->getPosition();
+		if (defender)
+			dest = defender->getPosition();
+		else
+			dest = attacker->getPosition();
+	}
 }
 
 ECreatureAnimType CastAnimation::getUpwardsGroup() const

+ 0 - 5
lib/spells/CSpellHandler.cpp

@@ -572,11 +572,6 @@ CSpell::TargetInfo::TargetInfo(const CSpell * spell, const int level, spells::Mo
 	massive = levelInfo.range == "X";
 	clearAffected = levelInfo.clearAffected;
 	clearTarget = levelInfo.clearTarget;
-
-	if(mode == spells::Mode::CREATURE_ACTIVE)
-	{
-		massive = false;//FIXME: find better solution for Commander spells
-	}
 }
 
 bool DLL_LINKAGE isInScreenRange(const int3 & center, const int3 & pos)