浏览代码

Use clearAffected flag

AlexVinS 11 年之前
父节点
当前提交
9e8b09d747
共有 3 个文件被更改,包括 11 次插入7 次删除
  1. 5 6
      client/battle/CBattleInterface.cpp
  2. 3 1
      lib/CSpellHandler.cpp
  3. 3 0
      lib/CSpellHandler.h

+ 5 - 6
client/battle/CBattleInterface.cpp

@@ -1553,8 +1553,12 @@ void CBattleInterface::castThisSpell(int spellID)
 	
 	const CSpell::TargetInfo ti = sp->getTargetInfo(castingHero->getSpellSchoolLevel(sp));
 	
-	if(ti.massive)
+	if(ti.massive || ti.type == CSpell::NO_TARGET)
 		spellSelMode = NO_LOCATION;	
+	else if(ti.type == CSpell::LOCATION && ti.clearAffected)
+	{
+		spellSelMode = FREE_LOCATION;		
+	}
 	else if(ti.type == CSpell::CREATURE)
 	{
 		if(ti.smart)
@@ -1566,11 +1570,6 @@ void CBattleInterface::castThisSpell(int spellID)
 	{
 		spellSelMode = OBSTACLE;
 	} 
-	//todo: move to JSON config
-	if(spellID == SpellID::FIRE_WALL  ||  spellID == SpellID::FORCE_FIELD)
-	{
-		spellSelMode = FREE_LOCATION;
-	}
 
 	if (spellSelMode == NO_LOCATION) //user does not have to select location
 	{

+ 3 - 1
lib/CSpellHandler.cpp

@@ -503,7 +503,9 @@ void CSpell::TargetInfo::init(const CSpell * spell, const int level)
 	smart = levelInfo.smartTarget;
 	massive = levelInfo.range == "X";
 	onlyAlive = !spell->isRisingSpell();
-	alwaysHitDirectly = false;	
+	alwaysHitDirectly = false;
+	clearAffected = levelInfo.clearAffected;
+	clearTarget = levelInfo.clearTarget;
 }
 
 

+ 3 - 0
lib/CSpellHandler.h

@@ -139,6 +139,9 @@ public:
 		///no immunity on primary target (mostly spell-like attack)
 		bool alwaysHitDirectly;
 		
+		bool clearTarget;
+		bool clearAffected;
+		
 		TargetInfo(const CSpell * spell, const int level);
 		TargetInfo(const CSpell * spell, const int level, ECastingMode::ECastingMode mode);