Browse Source

* fixed bug with lightning bolt

mateuszb 16 years ago
parent
commit
2d54b31b17
2 changed files with 26 additions and 10 deletions
  1. 25 9
      client/CBattleInterface.cpp
  2. 1 1
      config/AC_desc.txt

+ 25 - 9
client/CBattleInterface.cpp

@@ -146,6 +146,11 @@ bool CSpellEffectAnim::init()
 				}
 			}
 		}
+		else //there is nothing to play
+		{
+			endAnim();
+			return false;
+		}
 	}
 	else // Effects targeted at a specific creature/hex.
 	{
@@ -161,6 +166,8 @@ bool CSpellEffectAnim::init()
 				be.anim = CDefHandler::giveDef(graphics->battleACToDef[effect][0]);
 			be.frame = 0;
 			be.maxFrame = be.anim->ourImages.size();
+			if(effect == 1)
+				be.maxFrame = 3;
 
 			switch (effect)
 			{
@@ -188,6 +195,11 @@ bool CSpellEffectAnim::init()
 
 			owner->battleEffects.push_back(be);
 		}
+		else //there is nothing to play
+		{
+			endAnim();
+			return false;
+		}
 	}
 	//battleEffects 
 	return true;
@@ -197,18 +209,22 @@ void CSpellEffectAnim::nextFrame()
 {
 	for(std::list<SBattleEffect>::iterator it = owner->battleEffects.begin(); it != owner->battleEffects.end(); ++it)
 	{
-		++(it->frame);
-
-		if(it->frame == it->maxFrame)
+		if(it->effectID == ID)
 		{
-			endAnim();
+			++(it->frame);
+
+			if(it->frame == it->maxFrame)
+			{
+				endAnim();
+				break;
+			}
+			else
+			{
+				it->x += dx;
+				it->y += dy;
+			}
 			break;
 		}
-		else
-		{
-			it->x += dx;
-			it->y += dy;
-		}
 	}
 }
 

+ 1 - 1
config/AC_desc.txt

@@ -37,7 +37,7 @@
 35 2 C01SPF.DEF C01SPF0.DEF
 36 2 C01SPW.DEF C01SPW0.DEF
 37 0
-38 0
+38 1 C11SPA1.DEF
 39 2 C03SPW.DEF C03SPW0.DEF
 40 2 C04SPW.DEF C04SPW0.DEF
 41 2 C05SPW.DEF C05SPW0.DEF