Squashes 146 commits from battle-engine-extraction. Net: 2,045 files changed, +11,896 / -158,687 lines. Ships engine passes 4-7 (dead-code cull, view-layer stub, receive-path shrink) plus the Phase-5 AsyncLocal ambient deletion that turns concurrent battles into a type-system property rather than a scope contract. ## What landed **Passes 4-7 (chunks 1-34):** Extended the Phase-4 const-false collapse into a cascading cull across the skill graph, view layer, and receive-path periphery. Six mode flags (IsWatchBattle/IsReplayBattle/IsAdmin/IsAdminWatch/IsPuzzleQuest/ IsAINetwork) became `const false`, every guarded block deleted. Field*.cs subclass ctors + BackGroundBase + ObjectChecker culled to no-ops. Mulligan family reworked to take a mgr param through IMulliganMgr.InitMulligan. Emotion/Recovery/Resource clusters null-stubbed. Prediction/OperationSimulator/ skill filters converted from static ambient reads to per-mgr reads via SkillPrm.ownerCard.SelfBattlePlayer.BattleMgr / ins.BattleMgr / this.BattleMgr. **Phase-5 ambient rip (chunks 35-47):** Deleted BattleAmbient / BattleAmbient- Context / TestBattleScope in full. Every per-battle mutable slot now lives on the mgr instance itself: mgr.InstanceIsForecast / InstanceIsRandomDraw / InstanceRecoveryInfo / InstanceViewerId / InstanceNetworkAgent / GameMgr BattleManagerBase.GetIns() returns null unconditionally; the residual static flags + 3 façades (Certification.ViewerId, Data.BattleRecoveryInfo, ToolboxGame.RealTimeNetworkAgent) are null-tolerant defaults kept for the handful of engine-internal readers that still reference their types. Zero BattleAmbient references anywhere in engine + node + tests. Added pre-seeded GameMgr ctor overload threaded through the mgr chain (BattleManagerBase → SingleBattleMgr / NetworkBattleManagerBase → NetworkStandard- BattleMgr → HeadlessBattleMgr / HeadlessNetworkBattleMgr). Fixtures build a GameMgr, seed it via HeadlessEngineEnv.SeedCharaIds/SeedNetUser, and pass it to the mgr's ctor — no ambient reach. Node side (SVSim.BattleNode/SessionBattleEngine): _ctx replaced with a plain GameMgr field; 34 `using var _ambient = BattleAmbient.Enter(_ctx)` scope wraps ripped from every accessor and mutator; EngineGlobalInit.WirePerSessionGameMgr takes GameMgr as a param and runs from SessionBattleEngine.SetupInternal BEFORE mgr construction. Test side: TestBattleScope deleted; 18 fixture [SetUp]s migrated to `HeadlessEngineEnv.EnsureProcessGlobals()`; MultiInstanceEngineTests rewritten around per-mgr construction (GetIns() → null is the pinned invariant). ## Regression fixes - **chunk-48** (MulliganCtrl): chunk-35's `= null` stubs on card lookups broke the live receive-driven Deal path (BattlePlayerBase.DrawCard NRE'd downstream of NetworkPlayerMulliganCtrl.StartMulliganVfx). Restored the three lookups via `_battlePlayer.BattleMgr.GetBattleCardIdx`. Engine tests were satisfied by the WireMulliganPhase seam; unit tests exposed the live-path gap. ## Ship state - SVSim.BattleEngine.Tests: 56/56 pass, 2 skip - SVSim.UnitTests: 1554/1554 pass (was 1523/31-fail before chunk 48) - Solution build: 0 source warnings (40 pre-existing NU1902 MessagePack CVEs in SVSim.EmulatedEntrypoint, unrelated) - Sequential PVP smoke: verified live (two back-to-back battles, no regression on cleanup/spinup) - Concurrent PVP smoke: verified live Adds tools/engine-port/ClosureAnalyzer/ — the Roslyn transitive-type-closure analyzer needed to make future cascade cleanup safe (per feedback memory "Engine cleanup needs closure tool" from the 2026-06-28 pass-3 failure). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
348 lines
9.6 KiB
C#
348 lines
9.6 KiB
C#
using System.Collections.Generic;
|
|
using DeckBuilder;
|
|
using LitJson;
|
|
using UnityEngine;
|
|
using Wizard.Scripts.Network.Data.TableData.Ranking;
|
|
using Wizard.Scripts.Network.Data.TaskData;
|
|
using Wizard.Scripts.Network.Data.TaskData.Arena;
|
|
using Wizard.Scripts.Network.Data.TaskData.Arena.TwoPick;
|
|
using Wizard.Scripts.Network.Data.TaskData.Battle;
|
|
using Wizard.Scripts.Network.Data.TaskData.BuildDeckPurchase;
|
|
using Wizard.Scripts.Network.Data.TaskData.ItemPurchase;
|
|
using Wizard.Scripts.Network.Data.TaskData.Ranking;
|
|
using Wizard.Scripts.Network.Data.TaskData.SkinPurchase;
|
|
using Wizard.Scripts.Network.Data.TaskData.SleevePurchase;
|
|
using Wizard.Story;
|
|
// TODO(engine-cleanup-pass2): 156 of 165 methods unrun in baseline
|
|
// Type: Wizard.Data
|
|
// See data_dumps/reports/engine-cleanup/live-methods.baseline.txt
|
|
|
|
|
|
namespace Wizard;
|
|
|
|
public static class Data
|
|
{
|
|
private static Format _currentFormat;
|
|
|
|
public static Master Master { get; set; }
|
|
|
|
public static Mastershop ShopMaster { get; set; }
|
|
|
|
public static SystemText SystemText { get; set; }
|
|
|
|
public static Load Load { get; set; }
|
|
|
|
public static MyPage MyPage { get; set; }
|
|
|
|
public static MyPageNotifications MyPageNotifications { get; set; }
|
|
|
|
public static RankMatchFinish RankMatchFinish { get; set; }
|
|
|
|
public static FreeMatchFinish FreeMatchFinish { get; set; }
|
|
|
|
public static ColosseumBattleFinish ColosseumBattleFinish { get; set; }
|
|
|
|
public static CompetitionBattleFinish CompetitionBattleFinish { get; set; }
|
|
|
|
public static RedEtherCampaignResultData RedEtherCampaignResultData { get; set; }
|
|
|
|
public static DoMatchingData DoMatchingDetail { get; set; }
|
|
|
|
public static AIBattleStartData AIBattleStartData { get; set; }
|
|
|
|
public static SelectedStoryInfo SelectedStoryInfo { get; set; }
|
|
|
|
public static StoryWorldDataManager StoryWorldDataManager { get; set; }
|
|
|
|
public static StoryInfo StoryInfo { get; set; }
|
|
|
|
public static StoryFinish StoryFinish { get; set; }
|
|
|
|
public static StoryLeaderSelect StoryLeaderSelect { get; set; }
|
|
|
|
public static QuestMissionInfo QuestMissionInfo { get; set; }
|
|
|
|
public static QuestFinish QuestFinish { get; set; }
|
|
|
|
public static ArenaData ArenaData { get; set; }
|
|
|
|
public static MailTop MailTop { get; set; }
|
|
|
|
public static ReadMail ReadMail { get; set; }
|
|
|
|
public static PackInfo PackInfo { get; set; }
|
|
|
|
public static PackOpen PackOpen { get; set; }
|
|
|
|
public static SleevePurchaseInfo SleevePurchaseInfo { get; set; }
|
|
|
|
public static SkinPurchaseInfo SkinPurchaseInfo { get; set; }
|
|
|
|
public static BuildDeckPurchaseInfo BuildDeckPurchaseInfo { get; set; }
|
|
|
|
public static ItemPurchaseInfo ItemPurchaseInfo { get; set; }
|
|
|
|
public static EmptyDeckInfo EmptyDeckInfo { get; set; }
|
|
|
|
public static MissionInfo MissionInfo { get; set; }
|
|
|
|
public static AchievementInfo AchievementInfo { get; set; }
|
|
|
|
public static User User { get; set; }
|
|
|
|
public static UserConfig UserConfig { get; set; }
|
|
|
|
public static UserTutorial UserTutorial { get; set; }
|
|
|
|
public static FriendInfo FriendInfo { get; set; }
|
|
|
|
public static PlayedTogetherInfo PlayedTogetherInfo { get; set; }
|
|
|
|
public static ReceiveFriendApplyInfo ReceiveFriendApplyInfo { get; set; }
|
|
|
|
public static SendFriendApplyInfo SendFriendApplyInfo { get; set; }
|
|
|
|
public static EmblemInfo EmblemInfo { get; set; }
|
|
|
|
public static DegreeInfo DegreeInfo { get; set; }
|
|
|
|
public static SearchUserInfo SearchUserInfo { get; set; }
|
|
|
|
public static RankingPeriodList RankingPeriodList { get; set; }
|
|
|
|
public static Dictionary<Format, MonthlyRanking> RankingRankMatchClassInfo { get; set; }
|
|
|
|
public static Dictionary<Format, MonthlyRanking> RankingMasterInfo { get; set; }
|
|
|
|
public static MonthlyRanking RankingTwoPickInfo { get; set; }
|
|
|
|
public static MonthlyRanking RankingSealedInfo { get; set; }
|
|
|
|
public static Dictionary<int, MyMasterPointHistories> RankingMasterMyHistories { get; set; }
|
|
|
|
public static TwoPickInfo TwoPickInfo { get; set; }
|
|
|
|
public static Entry TwoPickEntry { get; set; }
|
|
|
|
public static RoomTwoPickInfo RoomTwoPickInfo { get; set; }
|
|
|
|
public static RoomTwoPickBeforeBattleInfo RoomTwoPickBeforeBattleInfo { get; set; }
|
|
|
|
public static RoomTwoPickMultiDeckInfo RoomTwoPickMultiDeckInfo { get; set; }
|
|
|
|
public static DoMatchingResponse TwoPickDoMatching { get; set; }
|
|
|
|
public static Finish ArenaBattleFinish { get; set; }
|
|
|
|
public static ItemAcquireHistoryInfo ItemAcquireHistoryInfo { get; set; }
|
|
|
|
public static PracticeDataMgr PracticeDataMgr { get; set; }
|
|
|
|
public static PracticeFinish PracticeFinish { get; set; }
|
|
|
|
public static PracticePuzzleFinishData PracticePuzzleFinishData { get; set; }
|
|
|
|
public static GenerateDeckCode GenerateDeckCode { get; set; }
|
|
|
|
public static InviteFriendBattle InviteFriendBattle { get; set; }
|
|
|
|
public static InitializeRoomBattle InitializeRoomBattle { get; set; }
|
|
|
|
public static ReplayInfo ReplayInfo { get; set; }
|
|
|
|
public static ReplayDetailInfo ReplayBattleInfo { get; set; }
|
|
|
|
public static BattleRecoveryInfo BattleRecoveryInfo
|
|
{
|
|
// Instance-backed via BattleManagerBase.InstanceRecoveryInfo (Phase 5, chunk 40 — ambient
|
|
// fallback dropped after chunk 39 converted the last direct consumer).
|
|
get => BattleManagerBase.GetIns()?.InstanceRecoveryInfo;
|
|
set {
|
|
var m = BattleManagerBase.GetIns();
|
|
if (m is not null) m.InstanceRecoveryInfo = value;
|
|
}
|
|
}
|
|
|
|
public static VoteData VoteInfo { get; set; }
|
|
|
|
public static List<DeckGroup> DeckGroupDataBase { get; set; } = new List<DeckGroup>();
|
|
|
|
public static List<NetworkDefine.MAINTENANCE_TYPE> MaintenanceCodeList { get; private set; } = null;
|
|
|
|
public static Crossover Crossover { get; private set; } = null;
|
|
|
|
public static MyRotationAllInfo MyRotationAllInfo { get; set; } = null;
|
|
|
|
public static AvatarBattleAllInfo AvatarBattleAllInfo { get; set; } = null;
|
|
|
|
public static TreasureBoxCp TreasureBoxCp { get; set; } = null;
|
|
|
|
public static Format CurrentFormat
|
|
{
|
|
get
|
|
{
|
|
return _currentFormat;
|
|
}
|
|
set
|
|
{
|
|
if (value == Format.Hof)
|
|
{
|
|
_currentFormat = Format.Max;
|
|
}
|
|
else
|
|
{
|
|
_currentFormat = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
public static bool IsBattlePassPeriod { get; private set; }
|
|
|
|
public static void Clear()
|
|
{
|
|
Master = null;
|
|
ShopMaster = null;
|
|
SystemText = null;
|
|
Load = null;
|
|
MyPage = null;
|
|
MyPageNotifications = null;
|
|
RankMatchFinish = null;
|
|
FreeMatchFinish = null;
|
|
AIBattleStartData = null;
|
|
DoMatchingDetail = null;
|
|
SelectedStoryInfo = null;
|
|
StoryWorldDataManager = null;
|
|
StoryInfo = null;
|
|
StoryFinish = null;
|
|
QuestMissionInfo = null;
|
|
QuestFinish = null;
|
|
ArenaData = null;
|
|
MailTop = null;
|
|
ReadMail = null;
|
|
PackInfo = null;
|
|
PackOpen = null;
|
|
SleevePurchaseInfo = null;
|
|
SkinPurchaseInfo = null;
|
|
BuildDeckPurchaseInfo = null;
|
|
ItemPurchaseInfo = null;
|
|
EmptyDeckInfo = null;
|
|
FriendInfo = null;
|
|
PlayedTogetherInfo = null;
|
|
ReceiveFriendApplyInfo = null;
|
|
SendFriendApplyInfo = null;
|
|
User = null;
|
|
UserConfig = null;
|
|
UserTutorial = null;
|
|
MissionInfo = null;
|
|
AchievementInfo = null;
|
|
EmblemInfo = null;
|
|
DegreeInfo = null;
|
|
SearchUserInfo = null;
|
|
RankingPeriodList = null;
|
|
RankingRankMatchClassInfo = null;
|
|
RankingMasterInfo = null;
|
|
RankingTwoPickInfo = null;
|
|
RankingSealedInfo = null;
|
|
RankingMasterMyHistories = null;
|
|
TwoPickInfo = null;
|
|
TwoPickEntry = null;
|
|
TwoPickDoMatching = null;
|
|
ArenaBattleFinish = null;
|
|
RoomTwoPickInfo = null;
|
|
RoomTwoPickBeforeBattleInfo = null;
|
|
RoomTwoPickMultiDeckInfo = null;
|
|
ItemAcquireHistoryInfo = null;
|
|
PracticeDataMgr = null;
|
|
PracticeFinish = null;
|
|
PracticePuzzleFinishData = null;
|
|
InitializeRoomBattle = null;
|
|
ReplayInfo = null;
|
|
CurrentFormat = Format.Max;
|
|
BattleRecoveryInfo = null;
|
|
MaintenanceCodeList = null;
|
|
DeckGroupDataBase = new List<DeckGroup>();
|
|
Crossover = null;
|
|
MyRotationAllInfo = null;
|
|
TreasureBoxCp = null;
|
|
CardMaster.DeleteAllInstance();
|
|
PlayerStaticData.Clear();
|
|
Prerelease.Clear();
|
|
DeckGroupDataBase.Clear();
|
|
}
|
|
|
|
public static int FormatConvertApi(Format format)
|
|
{
|
|
switch (format)
|
|
{
|
|
case Format.Rotation:
|
|
case Format.Max:
|
|
return 1;
|
|
case Format.Unlimited:
|
|
return 2;
|
|
case Format.PreRotation:
|
|
return 3;
|
|
case Format.Crossover:
|
|
return 4;
|
|
case Format.Sealed:
|
|
return 20;
|
|
case Format.TwoPick:
|
|
return 10;
|
|
case Format.Hof:
|
|
return 31;
|
|
case Format.All:
|
|
return 0;
|
|
case Format.Windfall:
|
|
return 33;
|
|
case Format.MyRotation:
|
|
case Format.Avatar:
|
|
return (int)format;
|
|
default:
|
|
UnityEngine.Debug.LogWarning("不明なフォーマットが指定されています:" + format);
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
public static Format ParseApiFormat(int format)
|
|
{
|
|
switch (format)
|
|
{
|
|
case 1:
|
|
return Format.Rotation;
|
|
case 2:
|
|
return Format.Unlimited;
|
|
case 3:
|
|
return Format.PreRotation;
|
|
case 4:
|
|
return Format.Crossover;
|
|
case 10:
|
|
return Format.TwoPick;
|
|
case 20:
|
|
return Format.Sealed;
|
|
case 31:
|
|
return Format.Hof;
|
|
case 33:
|
|
return Format.Windfall;
|
|
case 5:
|
|
case 39:
|
|
return (Format)format;
|
|
case 0:
|
|
return Format.Max;
|
|
default:
|
|
UnityEngine.Debug.LogWarning("不明なフォーマットが指定されています:" + format);
|
|
return Format.Max;
|
|
}
|
|
}
|
|
|
|
public static void UpdateMaintenance(List<NetworkDefine.MAINTENANCE_TYPE> checkList, List<NetworkDefine.MAINTENANCE_TYPE> maintenanceList)
|
|
{
|
|
for (int i = 0; i < checkList.Count; i++)
|
|
{
|
|
MaintenanceCodeList.Remove(checkList[i]);
|
|
if (maintenanceList.Contains(checkList[i]))
|
|
{
|
|
MaintenanceCodeList.Add(checkList[i]);
|
|
}
|
|
}
|
|
}
|
|
}
|