feat(battle-engine-port): M5 COMPLETE — summon_token spell resolves headless (board-count delta oracle)

Card 800134010 (clan-1 cost-1 ungated spell, summon_token=100011020): a when_play
summon places one new neutral 2/2 follower token on the caster board. New oracle
dimension = board-count + token-identity delta from a SKILL-CREATED card. 5/5 green;
engine 0 errors; check_drift clean; zero new Engine copies.

This is the first headless run of the PUBLIC prefab card-creation path
(CardCreatorBase.CreateCard, createNullView:false) — engine-internal card creation
(summon/draw/token) has no null-view path in solo mode, unlike the M2-M4 hand-card
seam. Built that path headless:
- Self-consistent no-op Unity object graph (UnityShim.cs): Component.gameObject/
  transform, GameObject.transform, Transform.parent/Find now lazily non-null +
  cached; GetComponent routed through the GameObject component model.
- Targeted NGUI material backing-field wiring (UIFont.mMat / UILabel.mMaterial) so
  the copied material getters return non-null via their simple branch (blanket/deep
  wiring would make them delegate down a re-nulling chain).
- getUIBase_CardManager() default! -> field-wired no-op via new ShimView.Create<T>().
- Test-side seeds: SBattleLoad card templates + 3D scene GameObjects (InitCardTemplates).

Load-bearing proof: swapping to the M3 non-summoning spell fails the board-count
(Expected 2, was 1) + token-not-found assertions; reverted to green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
gamer147
2026-06-06 03:19:12 -04:00
parent b13cfa0fad
commit 62a28fe2d4
4 changed files with 249 additions and 13 deletions

View File

@@ -1,4 +1,5 @@
using System.Reflection;
using UnityEngine;
using Wizard;
using Wizard.Battle;
using Wizard.Battle.Phase;
@@ -32,6 +33,23 @@ namespace SVSim.BattleEngine.Tests
public const int BuffAddOffense = 1;
public const int BuffAddLife = 1;
// M5 next-hardest deterministic card: a when_play SUMMON_TOKEN spell. 800134010 is an ELF
// (clan 1) cost-1 spell whose sole skill is `when_play` `summon_token=100011020` with
// `skill_target=none` and an UNGATED condition (`character=me`, trivially the caster): it
// summons exactly ONE neutral 2/2 follower TOKEN onto the caster's board — no target
// selection, no RNG (Skill_summon_token's random branch is `num >= 0 && !IsForecast`, and
// this option carries no `random_count`, so num=-1 => the deterministic literal-id path).
// The new oracle dimension over M2/M3/M4 is a BOARD-COUNT DELTA from a SKILL-CREATED card:
// a token that was never in the hand/deck appears in play. This is also the first headless
// exercise of the PUBLIC prefab card-creation path (CardCreatorBase.CreateCard,
// createNullView:false, via BattlePlayerBase.CreateNextIndexCard) — class-card construction
// hits `default: return null` and the M2-M4 hand cards used the private null-view seam, so
// the view-building creation path is genuinely new here.
public const int TokenSpellId = 800134010;
public const int SummonedTokenId = 100011020; // neutral 2/2 follower token
public const int SummonedTokenAtk = 2;
public const int SummonedTokenLife = 2;
private static bool _done;
public static void EnsureInitialized()
@@ -47,9 +65,11 @@ namespace SVSim.BattleEngine.Tests
.SetValue(null, new Wizard.Crossover());
BattleManagerBase.IsForecast = true;
// CardMaster must be non-null before construction (the leader/class card looks up id 0).
// Load the M2 vanilla follower + the M3 fixed-damage spell + the M4 self-buff follower so
// each oracle can create + look up its real stats.
HeadlessCardMaster.Load(FollowerId, SpellId, BuffFollowerId);
// Load the M2 vanilla follower + the M3 fixed-damage spell + the M4 self-buff follower +
// the M5 summon-token spell AND the token it summons so each oracle can create + look up
// real stats. The summoned token id must be present: Skill_summon_token resolves it
// through CardMaster.GetCardParameterFromId during creation.
HeadlessCardMaster.Load(FollowerId, SpellId, BuffFollowerId, TokenSpellId, SummonedTokenId);
// Master reference data (class-character list) for leader/class card resolution.
HeadlessMasterData.Install();
// Player/enemy leaders (chara ids must map to a ClassCharacterMasterData in Master).
@@ -77,6 +97,34 @@ namespace SVSim.BattleEngine.Tests
((ClassBattleCardBase)mgr.BattleEnemy.Class).InitBaseMaxLife(life);
}
// The PUBLIC prefab card-creation path (CardCreatorBase.CreateCard, createNullView:false) —
// used by anything the engine creates INTERNALLY (summons, token-draws, etc.), as opposed to
// the test's direct private null-view seam for hand cards — clones card-template prefabs held
// on BattleManagerBase.SBattleLoad. The real async battle load (CoLoad) builds these; the bare
// `new SingleBattleMgr(...)` construction path leaves SBattleLoad null (the M2 NRE was here).
// Seed it with non-null no-op CardTemplates: their `.gameObject` is a lazy shim no-op, and the
// shim's CloneObjectToParent + self-consistent object graph carry the rest. Nothing here
// computes game state — the token's authoritative stats come from CardCSVData, not the view.
public static void InitCardTemplates(BattleManagerBase mgr)
{
mgr.SBattleLoad = new SBattleLoad
{
UnitCardTemplate = new CardTemplate(),
SpellCardTemplate = new CardTemplate(),
FieldCardTemplate = new CardTemplate(),
};
// The created card's transform is positioned/parented under the battle's 3D scene-graph
// containers (CardCreatorBase.CreateCardTypeBuildInfo reads ins.CardHolder/ECardHolder/
// PCardPlace/Battle3DContainer). The real battle load instantiates these; seed non-null
// no-op GameObjects so the positioning resolves (no-op transforms; nothing rendered).
mgr.Battle3DContainer = new GameObject();
mgr.CardHolder = new GameObject();
mgr.ECardHolder = new GameObject();
mgr.PCardPlace = new GameObject();
mgr.ChoiceCardHolder = new GameObject();
mgr.EvolveCardHolder = new GameObject();
}
// The shared headless card-creation primitive. CardCreatorBase.CreateCardWithoutResources is
// the engine's own null-view creation path (CreateBase -> new *BattleCard(buildInfo).Setup(
// createNullView:true)); it's private, so reflect it rather than reimplement the 14-arg