Explorar o código

Merge pull request #2572 from vcmi/nkai-fix-heroes-not-recruiting

Nkai fix heroes not recruiting
Andrii Danylchenko %!s(int64=2) %!d(string=hai) anos
pai
achega
6c025fd768

+ 1 - 1
AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp

@@ -84,7 +84,7 @@ Goals::TGoalVec RecruitHeroBehavior::decompose() const
 				}
 			}
 
-			if(treasureSourcesCount < 5)
+			if(treasureSourcesCount < 5 && (town->garrisonHero || town->getUpperArmy()->getArmyStrength() < 10000))
 				continue;
 
 			if(cb->getHeroesInfo().size() < cb->getTownsInfo().size() + 1

+ 4 - 0
lib/battle/CBattleInfoCallback.cpp

@@ -1732,6 +1732,10 @@ SpellID CBattleInfoCallback::getRandomCastedSpell(CRandomGenerator & rand,const
 	TConstBonusListPtr bl = caster->getBonuses(Selector::type()(BonusType::SPELLCASTER));
 	if (!bl->size())
 		return SpellID::NONE;
+
+	if(bl->size() == 1)
+		return SpellID(bl->front()->subtype);
+
 	int totalWeight = 0;
 	for(const auto & b : *bl)
 	{