From 1eabb738dcaa7c1c3bafc6366d62b426efb09387 Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Sat, 12 Aug 2023 22:02:37 +0300 Subject: [PATCH 1/2] NKAI: fix heroes not recruited --- AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp b/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp index 581c725e6..8f9b80f6d 100644 --- a/AI/Nullkiller/Behaviors/RecruitHeroBehavior.cpp +++ b/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 From a7859dae39ec37101f7d879d9a8ebab341403d44 Mon Sep 17 00:00:00 2001 From: Andrii Danylchenko Date: Sat, 12 Aug 2023 22:08:15 +0300 Subject: [PATCH 2/2] Battle AI: archangels cast again --- lib/battle/CBattleInfoCallback.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/battle/CBattleInfoCallback.cpp b/lib/battle/CBattleInfoCallback.cpp index f207c7170..ff44c2ba9 100644 --- a/lib/battle/CBattleInfoCallback.cpp +++ b/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) {