Procházet zdrojové kódy

Fixed #832. War machines will now be immune to a number of effects.

DjWarmonger před 14 roky
rodič
revize
1e45674a7c
2 změnil soubory, kde provedl 11 přidání a 2 odebrání
  1. 9 0
      lib/BattleState.cpp
  2. 2 2
      lib/HeroBonus.cpp

+ 9 - 0
lib/BattleState.cpp

@@ -2122,11 +2122,20 @@ SpellCasting::ESpellCastProblem BattleInfo::battleIsImmune(const CGHeroInstance
 					return SpellCasting::STACK_IMMUNE_TO_SPELL;
 				break;
 			case 24: // Death Ripple
+				if (subject->hasBonusOfType(Bonus::SIEGE_WEAPON))
+					return SpellCasting::STACK_IMMUNE_TO_SPELL; //don't break here - undeads and war machines are immune, non-living are not
 			case 41:
 			case 42: //undeads are immune to bless & curse
 				if (subject->hasBonusOfType(Bonus::UNDEAD))
 					return SpellCasting::STACK_IMMUNE_TO_SPELL; 
 				break;
+			case 53: //haste
+			case 54: //slow
+			case 63: // Teleport
+			case 65: //clone
+				if (subject->hasBonusOfType(Bonus::SIEGE_WEAPON))
+					return SpellCasting::STACK_IMMUNE_TO_SPELL; //war machines are mmune to some spells than involve movement
+				break;
 			case 61: //Forgetfulness
 				if (!subject->hasBonusOfType(Bonus::SHOOTER))
 					return SpellCasting::STACK_IMMUNE_TO_SPELL;

+ 2 - 2
lib/HeroBonus.cpp

@@ -418,8 +418,8 @@ si32 IBonusBearer::magicResistance() const
 bool IBonusBearer::isLiving() const //TODO: theoreticaly there exists "LIVING" bonus in stack experience documentation
 {
 	std::stringstream cachingStr;
-	cachingStr << "type_" << Bonus::UNDEAD << "s_-1Otype_" << Bonus::NON_LIVING;
-	return(!hasBonus(Selector::type(Bonus::UNDEAD) || Selector::type(Bonus::NON_LIVING), cachingStr.str()));
+	cachingStr << "type_" << Bonus::UNDEAD << "s_-1Otype_" << Bonus::NON_LIVING << "s_-11type_" << Bonus::SIEGE_WEAPON; //I don't relaly get what string labels mean?
+	return(!hasBonus(Selector::type(Bonus::UNDEAD) || Selector::type(Bonus::NON_LIVING) || Selector::type(Bonus::SIEGE_WEAPON), cachingStr.str()));
 }
 
 const TBonusListPtr IBonusBearer::getSpellBonuses() const