refactor(battlenode): type MatchContext.ClassId as CardClass enum (§C)
Behavior-preserving; full solution builds, 1013 tests green. ClassId is the one genuinely-closed set of the three flagged stringly fields, so it becomes a CardClass enum (1..8). Wire stays "1".."8": producer casts (CardClass)run.ClassId, ServerBattleFrames renders via CardClassWire.ToWireValue(). RankBattleController's AI-start path drops a fragile int.TryParse(...)?:-1 for (int)cast. CharaId (free-form leader/skin id, e.g. "5000123") and CountryCode (open-ended account data) stay string with proper XML docs; CountryCodes.Korea/Japan name the captured values. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -82,7 +82,7 @@ public class ServerBattleFramesTests
|
||||
{
|
||||
var ctx = FixtureCtx() with
|
||||
{
|
||||
ClassId = "7", CharaId = "5000123",
|
||||
ClassId = CardClass.Havencraft, CharaId = "5000123",
|
||||
CardMasterName = "card_master_test_v2",
|
||||
BattleModeId = 42,
|
||||
};
|
||||
@@ -168,8 +168,8 @@ public class ServerBattleFramesTests
|
||||
|
||||
private static MatchContext FixtureCtx(IReadOnlyList<long>? deck = null) => new(
|
||||
SelfDeckCardIds: deck ?? Enumerable.Range(1, 30).Select(i => 100_011_010L).ToList(),
|
||||
ClassId: "1", CharaId: "1", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "KOR", UserName: "Player", SleeveId: "3000011",
|
||||
ClassId: CardClass.Forestcraft, CharaId: "1", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: CountryCodes.Korea, UserName: "Player", SleeveId: "3000011",
|
||||
EmblemId: "701441011", DegreeId: "300003", FieldId: 43, IsOfficial: 0,
|
||||
BattleModeId: BattleModes.TakeTwo);
|
||||
|
||||
@@ -177,8 +177,8 @@ public class ServerBattleFramesTests
|
||||
// helpers read from for the oppo half.
|
||||
private static MatchContext FakeOpponentCtx() => new(
|
||||
SelfDeckCardIds: Enumerable.Range(1, 30).Select(_ => 0L).ToList(),
|
||||
ClassId: "8", CharaId: "8", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "JPN", UserName: "Opponent", SleeveId: "704141010",
|
||||
ClassId: CardClass.Portalcraft, CharaId: "8", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: CountryCodes.Japan, UserName: "Opponent", SleeveId: "704141010",
|
||||
EmblemId: "400001100", DegreeId: "120027", FieldId: 5, IsOfficial: 0,
|
||||
BattleModeId: 0);
|
||||
}
|
||||
|
||||
@@ -155,8 +155,8 @@ public class TypedBodyWireShapeTests
|
||||
/// </summary>
|
||||
private static MatchContext FixtureCtx() => new(
|
||||
SelfDeckCardIds: Enumerable.Range(1, 30).Select(_ => 100_011_010L).ToList(),
|
||||
ClassId: "1", CharaId: "1", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "KOR", UserName: "Player", SleeveId: "3000011",
|
||||
ClassId: CardClass.Forestcraft, CharaId: "1", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: CountryCodes.Korea, UserName: "Player", SleeveId: "3000011",
|
||||
EmblemId: "701441011", DegreeId: "300003", FieldId: 43, IsOfficial: 0,
|
||||
BattleModeId: BattleModes.TakeTwo);
|
||||
|
||||
@@ -166,8 +166,8 @@ public class TypedBodyWireShapeTests
|
||||
// signature change.
|
||||
private static MatchContext FakeOpponentCtx() => new(
|
||||
SelfDeckCardIds: Enumerable.Range(1, 30).Select(_ => 0L).ToList(),
|
||||
ClassId: "8", CharaId: "8", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "JPN", UserName: "Opponent", SleeveId: "704141010",
|
||||
ClassId: CardClass.Portalcraft, CharaId: "8", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: CountryCodes.Japan, UserName: "Opponent", SleeveId: "704141010",
|
||||
EmblemId: "400001100", DegreeId: "120027", FieldId: 5, IsOfficial: 0,
|
||||
BattleModeId: 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user