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:
@@ -57,7 +57,7 @@ public class MatchContextBuilderTests
|
||||
var ctx = await builder.BuildForTwoPickAsync(vid);
|
||||
|
||||
Assert.That(ctx.SelfDeckCardIds, Is.EqualTo(deck));
|
||||
Assert.That(ctx.ClassId, Is.EqualTo("5"));
|
||||
Assert.That(ctx.ClassId, Is.EqualTo(CardClass.Shadowcraft));
|
||||
Assert.That(ctx.CharaId, Is.EqualTo("5000001")); // LeaderSkinId set
|
||||
Assert.That(ctx.CountryCode, Is.EqualTo("KOR"));
|
||||
Assert.That(ctx.UserName, Is.EqualTo("Drafter"));
|
||||
@@ -132,7 +132,7 @@ public class MatchContextBuilderTests
|
||||
|
||||
Assert.That(ctx.UserName, Is.EqualTo("Ranker"));
|
||||
Assert.That(ctx.BattleModeId, Is.EqualTo(BattleModes.TakeTwo), "rank-battle carries the same mode id as TK2 on the wire.");
|
||||
Assert.That(ctx.ClassId, Is.Not.Null.And.Not.Empty, "ClassId from the selected deck's class.");
|
||||
Assert.That(ctx.ClassId, Is.Not.EqualTo(CardClass.None), "ClassId from the selected deck's class.");
|
||||
Assert.That(ctx.CardMasterName, Is.EqualTo("card_master_node_10015"));
|
||||
Assert.That(ctx.FieldId, Is.EqualTo(43));
|
||||
}
|
||||
@@ -198,8 +198,8 @@ public class MatchContextBuilderTests
|
||||
var deck1Ctx = await builder.BuildForRankBattleAsync(viewerId, Format.Unlimited, deckNo: 1);
|
||||
var deck5Ctx = await builder.BuildForRankBattleAsync(viewerId, Format.Unlimited, deckNo: 5);
|
||||
|
||||
Assert.That(deck1Ctx.ClassId, Is.EqualTo("1"), "deckNo=1 → class 1.");
|
||||
Assert.That(deck5Ctx.ClassId, Is.EqualTo("6"), "deckNo=5 → class 6 (the wire-bug case).");
|
||||
Assert.That(deck1Ctx.ClassId, Is.EqualTo(CardClass.Forestcraft), "deckNo=1 → class 1.");
|
||||
Assert.That(deck5Ctx.ClassId, Is.EqualTo(CardClass.Bloodcraft), "deckNo=5 → class 6 (the wire-bug case).");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user