Make sure the AI doesn't value 3rd level shrine higher than everything (#11017)

This commit is contained in:
Zenseii
2026-09-26 20:47:18 +08:00
committed by GitHub
parent 8812e65883
commit 0ebad92920
2 changed files with 10 additions and 1 deletions
+4
View File
@@ -1943,6 +1943,10 @@ namespace
return;
}
// A hero might have stepped on the object by accident.
// We need to minimize the damage being made by this object.
// TODO: add logic to avoid extensive army loss.
const uint32_t experience = hero.GetArmy().ActionToSirens();
DEBUG_LOG( DBG_AI, DBG_INFO, hero.GetName() << " got " << experience << " experience" )
+6 -1
View File
@@ -442,6 +442,9 @@ namespace
return false;
}
// TODO: we should check whether a hero has all the spells of the required level.
// If he does, then we don't need to visit the shrine.
if ( !kingdom.isVisited( index, objectType ) ) {
// This shrine has not been visited by any hero. It's worth to do it.
return true;
@@ -1999,7 +2002,9 @@ double AI::Planner::getFighterObjectValue( const Heroes & hero, const int32_t in
case MP2::OBJ_SHRINE_SECOND_CIRCLE:
case MP2::OBJ_SHRINE_THIRD_CIRCLE: {
const Spell & spell = getSpellFromTile( tile );
return spell.getStrategicValue( hero.GetArmy().GetStrength(), hero.GetMaxSpellPoints(), hero.GetPower() ) * 1.1;
// This value needs a cap so that in games where there is a very strong AI opponent, E.G. Price of Loyalty scenario 8, the hero's most important
// goal won't be to learn a level 4 spell. Thus we cap this value slightly lower than the value of a pyramid's 10000 because that has a level 5 spell.
return std::min( 8500.0, spell.getStrategicValue( hero.GetArmy().GetStrength(), hero.GetMaxSpellPoints(), hero.GetPower() ) * 1.1 );
}
case MP2::OBJ_ARENA:
case MP2::OBJ_FORT: