From 2d9e42b6236e11414dc1c15458540a14595ae405 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Fri, 5 Apr 2024 19:48:38 +0300 Subject: [PATCH 1/5] Do not attempt to show extra options in campaign scenario information screen --- client/lobby/CBonusSelection.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/lobby/CBonusSelection.cpp b/client/lobby/CBonusSelection.cpp index 496d2d7e6..fc3fcd1d8 100644 --- a/client/lobby/CBonusSelection.cpp +++ b/client/lobby/CBonusSelection.cpp @@ -119,7 +119,7 @@ CBonusSelection::CBonusSelection() if (!getCampaign()->getMusic().empty()) CCS->musich->playMusic( getCampaign()->getMusic(), true, false); - if(settings["general"]["enableUiEnhancements"].Bool()) + if(CSH->getState() != EClientState::GAMEPLAY && settings["general"]["enableUiEnhancements"].Bool()) { tabExtraOptions = std::make_shared(); tabExtraOptions->recActions = UPDATE | SHOWALL | LCLICK | RCLICK_POPUP; From 1a6aae936339d89f5102806d2733e1bb1cd5d796 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sat, 6 Apr 2024 14:49:36 +0300 Subject: [PATCH 2/5] Fix crash on selecting scenario with "start with strongest hero from scenario X" starting bonus --- lib/campaign/CampaignState.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/campaign/CampaignState.cpp b/lib/campaign/CampaignState.cpp index b3e4fe3a2..335722d24 100644 --- a/lib/campaign/CampaignState.cpp +++ b/lib/campaign/CampaignState.cpp @@ -369,7 +369,7 @@ JsonNode CampaignState::crossoverSerialize(CGHeroInstance * hero) const CGHeroInstance * CampaignState::crossoverDeserialize(const JsonNode & node, CMap * map) const { JsonDeserializer handler(nullptr, const_cast(node)); - auto * hero = new CGHeroInstance(map->cb); + auto * hero = new CGHeroInstance(map ? map->cb : nullptr); hero->ID = Obj::HERO; hero->serializeJsonOptions(handler); if (map) From 2685721bf2c10b5d2dff2b000cc6b8d90bd28685 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sat, 6 Apr 2024 15:20:51 +0300 Subject: [PATCH 3/5] Erdamon now increases both min and max damage, as in H3 --- config/heroes/conflux.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/heroes/conflux.json b/config/heroes/conflux.json index 1bda11cee..394f81e13 100755 --- a/config/heroes/conflux.json +++ b/config/heroes/conflux.json @@ -176,7 +176,7 @@ "bonuses" : { "damage" : { "type" : "CREATURE_DAMAGE", - "subtype" : "creatureDamageMin", + "subtype" : "creatureDamageBoth", "val" : 5 }, "attack" : { From 907438c6f5b2c2f7625c79910f5c141378d7c6da Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sat, 6 Apr 2024 15:42:39 +0300 Subject: [PATCH 4/5] Fix crash on attempt to compute movement range for siege tower --- lib/battle/CBattleInfoCallback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/battle/CBattleInfoCallback.cpp b/lib/battle/CBattleInfoCallback.cpp index 1e34d06e5..2e7ab844a 100644 --- a/lib/battle/CBattleInfoCallback.cpp +++ b/lib/battle/CBattleInfoCallback.cpp @@ -742,7 +742,7 @@ DamageEstimation CBattleInfoCallback::battleEstimateDamage(const battle::Unit * { RETURN_IF_NOT_BATTLE({}); auto reachability = battleGetDistances(attacker, attacker->getPosition()); - int getMovementRange = reachability[attackerPosition]; + int getMovementRange = attackerPosition.isValid() ? reachability[attackerPosition] : 0; return battleEstimateDamage(attacker, defender, getMovementRange, retaliationDmg); } From 03786fb63bed8b08a78ba7cf6d53799f22d3e7a5 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sat, 6 Apr 2024 15:43:24 +0300 Subject: [PATCH 5/5] VCAI will now check whether it actually has enough gold to buy a hero --- AI/VCAI/VCAI.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AI/VCAI/VCAI.cpp b/AI/VCAI/VCAI.cpp index 7ce4679dd..2cfb7cd10 100644 --- a/AI/VCAI/VCAI.cpp +++ b/AI/VCAI/VCAI.cpp @@ -2031,6 +2031,9 @@ void VCAI::tryRealize(Goals::Explore & g) void VCAI::tryRealize(Goals::RecruitHero & g) { + if(cb->getResourceAmount(EGameResID::GOLD) < GameConstants::HERO_GOLD_COST) + throw cannotFulfillGoalException("Not enough gold to recruit hero!"); + if(const CGTownInstance * t = findTownWithTavern()) { recruitHero(t, true);