fix(ai): use real ST return formula in SacrificeOpportunityScore
Previously assumed each sacrifice always yields +1 ST regardless of the unit's costs or the player's running ST total. Now calls SacrificeSystem.GetSacrificeValue / GetSTReturn exactly as the engine does, and respects FixedSacrificeReturn overrides. The projected ST total is accumulated unit-by-unit so the diminishing-return curve is correctly applied. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -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<FieldCard>())
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user