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:
@@ -93,8 +93,8 @@ public class MatchingBridgeTests
|
||||
|
||||
private static MatchContext FixtureCtx() => new(
|
||||
SelfDeckCardIds: 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);
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ public class WaitingRoomTests
|
||||
var ws = new TestWebSocket();
|
||||
var ctx = new MatchContext(
|
||||
SelfDeckCardIds: Array.Empty<long>(),
|
||||
ClassId: "1", CharaId: "1", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "KOR", UserName: "Player", SleeveId: "0",
|
||||
ClassId: CardClass.Forestcraft, CharaId: "1", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: CountryCodes.Korea, UserName: "Player", SleeveId: "0",
|
||||
EmblemId: "0", DegreeId: "0", FieldId: 0, IsOfficial: 0,
|
||||
BattleModeId: BattleModes.TakeTwo);
|
||||
return new RealParticipant(ws, viewerId, ctx, NullLogger<RealParticipant>.Instance);
|
||||
|
||||
@@ -23,8 +23,8 @@ public class BattleNodeFlowTests
|
||||
|
||||
internal 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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ public class BattleSessionDispatchConcurrencyTests
|
||||
|
||||
private static MatchContext CtxA() => new(
|
||||
SelfDeckCardIds: Enumerable.Range(1, 30).Select(_ => 100_011_010L).ToList(),
|
||||
ClassId: "3", CharaId: "3", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "KOR", UserName: "PlayerA", SleeveId: "3000011",
|
||||
ClassId: CardClass.Runecraft, CharaId: "3", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: CountryCodes.Korea, UserName: "PlayerA", SleeveId: "3000011",
|
||||
EmblemId: "701441011", DegreeId: "300003", FieldId: 43, IsOfficial: 0, BattleModeId: BattleModes.TakeTwo);
|
||||
|
||||
private static MatchContext CtxB() => new(
|
||||
SelfDeckCardIds: Enumerable.Range(1, 30).Select(_ => 200_011_010L).ToList(),
|
||||
ClassId: "5", CharaId: "5", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "JPN", UserName: "PlayerB", SleeveId: "3000022",
|
||||
ClassId: CardClass.Shadowcraft, CharaId: "5", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: CountryCodes.Japan, UserName: "PlayerB", SleeveId: "3000022",
|
||||
EmblemId: "701441022", DegreeId: "300004", FieldId: 44, IsOfficial: 0, BattleModeId: BattleModes.TakeTwo);
|
||||
|
||||
/// <summary>Tracks the peak number of dispatches in flight at once. Records the count under a
|
||||
|
||||
@@ -892,7 +892,7 @@ public class BattleSessionDispatchTests
|
||||
|
||||
private static MatchContext NoOpBotContext() => new(
|
||||
SelfDeckCardIds: Array.Empty<long>(),
|
||||
ClassId: "0", CharaId: "0", CardMasterName: "card_master_node_10015",
|
||||
ClassId: CardClass.None, CharaId: "0", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "", UserName: "Bot", SleeveId: "0",
|
||||
EmblemId: "0", DegreeId: "0", FieldId: 0, IsOfficial: 0, BattleModeId: 0);
|
||||
|
||||
@@ -1048,22 +1048,22 @@ public class BattleSessionDispatchTests
|
||||
|
||||
private static MatchContext PlayerACtx() => new(
|
||||
SelfDeckCardIds: Enumerable.Range(1, 30).Select(_ => 100_011_010L).ToList(),
|
||||
ClassId: "3", CharaId: "3", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "KOR", UserName: "PlayerA", SleeveId: "3000011",
|
||||
ClassId: CardClass.Runecraft, CharaId: "3", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: CountryCodes.Korea, UserName: "PlayerA", SleeveId: "3000011",
|
||||
EmblemId: "701441011", DegreeId: "300003", FieldId: 43, IsOfficial: 0,
|
||||
BattleModeId: BattleModes.TakeTwo);
|
||||
|
||||
private static MatchContext PlayerBCtx() => new(
|
||||
SelfDeckCardIds: Enumerable.Range(1, 30).Select(_ => 200_011_010L).ToList(),
|
||||
ClassId: "5", CharaId: "5", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "JPN", UserName: "PlayerB", SleeveId: "3000022",
|
||||
ClassId: CardClass.Shadowcraft, CharaId: "5", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: CountryCodes.Japan, UserName: "PlayerB", SleeveId: "3000022",
|
||||
EmblemId: "701441022", DegreeId: "300004", FieldId: 44, IsOfficial: 0,
|
||||
BattleModeId: BattleModes.TakeTwo);
|
||||
|
||||
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);
|
||||
|
||||
|
||||
@@ -22,8 +22,8 @@ public class BattleSessionStateTests
|
||||
}
|
||||
|
||||
private static MatchContext Ctx(params long[] deck) => new(
|
||||
SelfDeckCardIds: deck, ClassId: "1", CharaId: "1", CardMasterName: "cm",
|
||||
CountryCode: "KOR", UserName: "P", SleeveId: "0", EmblemId: "0", DegreeId: "0",
|
||||
SelfDeckCardIds: deck, ClassId: CardClass.Forestcraft, CharaId: "1", CardMasterName: "cm",
|
||||
CountryCode: CountryCodes.Korea, UserName: "P", SleeveId: "0", EmblemId: "0", DegreeId: "0",
|
||||
FieldId: 0, IsOfficial: 0, BattleModeId: BattleModes.TakeTwo);
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -52,7 +52,7 @@ public class BattleSessionTerminateCascadeTests
|
||||
|
||||
private static MatchContext MakeFakeContext() => new(
|
||||
SelfDeckCardIds: Array.Empty<long>(),
|
||||
ClassId: "1", CharaId: "1", CardMasterName: "card_master_node_10015",
|
||||
ClassId: CardClass.Forestcraft, CharaId: "1", CardMasterName: "card_master_node_10015",
|
||||
CountryCode: "JP", UserName: "Test", SleeveId: "0",
|
||||
EmblemId: "0", DegreeId: "0", FieldId: 0, IsOfficial: 0, BattleModeId: BattleModes.TakeTwo);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ public class InMemoryBattleSessionStoreTests
|
||||
|
||||
private static MatchContext FixtureCtx() => new(
|
||||
SelfDeckCardIds: 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);
|
||||
}
|
||||
|
||||
@@ -147,8 +147,8 @@ public class RealParticipantHandEventTests
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -171,8 +171,8 @@ public class RealParticipantTests
|
||||
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user