ソースを参照

Fix casting of massive spells by creatures

Ivan Savenko 2 年 前
コミット
6b2490903d
2 ファイル変更10 行追加10 行削除
  1. 10 5
      client/battle/BattleAnimationClasses.cpp
  2. 0 5
      lib/spells/CSpellHandler.cpp

+ 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);
 	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)
 	  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
 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";
 	massive = levelInfo.range == "X";
 	clearAffected = levelInfo.clearAffected;
 	clearAffected = levelInfo.clearAffected;
 	clearTarget = levelInfo.clearTarget;
 	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)
 bool DLL_LINKAGE isInScreenRange(const int3 & center, const int3 & pos)