浏览代码

Quick fix for https://bugs.vcmi.eu/view.php?id=3041

AlexVinS 6 年之前
父节点
当前提交
f36a86412e
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      AI/VCAI/Goals/AdventureSpellCast.cpp

+ 3 - 0
AI/VCAI/Goals/AdventureSpellCast.cpp

@@ -44,6 +44,9 @@ TSubgoal AdventureSpellCast::whatToDoToAchieve()
 	if(hero->mana < hero->getSpellCost(spell))
 		throw cannotFulfillGoalException("Hero has not enough mana to cast " + spell->name);
 
+	if(spellID == SpellID::TOWN_PORTAL && town && town->visitingHero)
+		throw cannotFulfillGoalException("The town is already occupied by " + town->visitingHero->name);
+
 	return iAmElementar();
 }