refactor(engine-ambient): IsForecast/IsRandomDraw read ambient first, static fallback

Step 2 of multi-instancing migration. Both flags now resolve through
BattleAmbient.Current when a scope is active, otherwise hit a static fallback
that preserves today's behavior unchanged for unwrapped callers.

Suite green: SVSim.BattleEngine.Tests pass; SVSim.UnitTests baseline holds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-07 21:11:49 -04:00
parent 4829e8c263
commit 3b5f2e18b3
2 changed files with 66 additions and 2 deletions

View File

@@ -412,9 +412,25 @@ public class BattleManagerBase
private static BattleManagerBase main;
public static bool IsRandomDraw = false;
private static bool _isRandomDrawFallback = false;
public static bool IsRandomDraw {
get => SVSim.BattleEngine.Ambient.BattleAmbient.Current?.IsRandomDraw ?? _isRandomDrawFallback;
set {
var c = SVSim.BattleEngine.Ambient.BattleAmbient.Current;
if (c != null) c.IsRandomDraw = value;
else _isRandomDrawFallback = value;
}
}
public static bool IsForecast = false;
private static bool _isForecastFallback = false;
public static bool IsForecast {
get => SVSim.BattleEngine.Ambient.BattleAmbient.Current?.IsForecast ?? _isForecastFallback;
set {
var c = SVSim.BattleEngine.Ambient.BattleAmbient.Current;
if (c != null) c.IsForecast = value;
else _isForecastFallback = value;
}
}
public BattleLifeTimeSharedObject BattleLifeTimeSharedObject;