diff --git a/Server/src/SOR.Ai/Heuristics/ScoringFunctions.cs b/Server/src/SOR.Ai/Heuristics/ScoringFunctions.cs index b22d20d..8498eda 100644 --- a/Server/src/SOR.Ai/Heuristics/ScoringFunctions.cs +++ b/Server/src/SOR.Ai/Heuristics/ScoringFunctions.cs @@ -314,8 +314,24 @@ internal static class ScoringFunctions if (sacrificeableCount == 0) return 0f; + // Compute actual ST return for each sacrificeable unit. + // ST earned per sacrifice depends on the card's SpiritSacValue AND the running ST total, + // so we accumulate in order (cheapest → most generous return first is irrelevant here; + // we just sum what each unit actually yields given the ST state at the time it's sacrificed). + int runningSt = aiPlayer.CurrentSt; + foreach (var fc in aiPlayer.Field.OfType()) + { + if (fc.IsLeader || !fc.CanBeSacrificed || fc.Position is null) continue; + if (!fc.Position.Value.IsOrthogonallyAdjacentTo(archSpirit.Position.Value)) continue; + + int stGained = fc.FixedSacrificeReturn + ?? SOR.Game.Combat.SacrificeSystem.GetSTReturn( + runningSt, + SOR.Game.Combat.SacrificeSystem.GetSacrificeValue(fc.StCost, fc.SpCost)); + runningSt += stGained; + } + int projectedSt = runningSt; float score = 0f; - int projectedSt = aiPlayer.CurrentSt + sacrificeableCount; foreach (var card in aiPlayer.Hand) {