feat(battle-node): BuildReady overload carrying the opponent's hand
Adds BuildReady(selfHand, oppoHand) for the mulligan barrier; the single-arg overload keeps the InitialHand placeholder for non-interactive opponents. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -113,11 +113,17 @@ public static class ScriptedLifecycle
|
|||||||
EnvelopeForPush(NetworkBattleUri.Swap,
|
EnvelopeForPush(NetworkBattleUri.Swap,
|
||||||
new SwapResponseBody(Self: BuildPosIdxList(hand)));
|
new SwapResponseBody(Self: BuildPosIdxList(hand)));
|
||||||
|
|
||||||
public static MsgEnvelope BuildReady(IReadOnlyList<long> hand) =>
|
/// <summary>Non-interactive opponent (scripted single / AINetwork): oppo is the
|
||||||
|
/// placeholder <see cref="InitialHand"/> (v1 behaviour).</summary>
|
||||||
|
public static MsgEnvelope BuildReady(IReadOnlyList<long> hand) => BuildReady(hand, InitialHand);
|
||||||
|
|
||||||
|
/// <summary>Both hands known (the mulligan barrier supplies the opponent's
|
||||||
|
/// post-mulligan hand).</summary>
|
||||||
|
public static MsgEnvelope BuildReady(IReadOnlyList<long> selfHand, IReadOnlyList<long> oppoHand) =>
|
||||||
EnvelopeForPush(NetworkBattleUri.Ready,
|
EnvelopeForPush(NetworkBattleUri.Ready,
|
||||||
new ReadyBody(
|
new ReadyBody(
|
||||||
Self: BuildPosIdxList(hand),
|
Self: BuildPosIdxList(selfHand),
|
||||||
Oppo: BuildPosIdxList(InitialHand),
|
Oppo: BuildPosIdxList(oppoHand),
|
||||||
IdxChangeSeed: ScriptedProfiles.ReadyIdxChangeSeed,
|
IdxChangeSeed: ScriptedProfiles.ReadyIdxChangeSeed,
|
||||||
Spin: ScriptedProfiles.ReadySpin));
|
Spin: ScriptedProfiles.ReadySpin));
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,27 @@ public class ScriptedLifecycleTests
|
|||||||
Assert.That(body.Self[1].Idx, Is.EqualTo(4));
|
Assert.That(body.Self[1].Idx, Is.EqualTo(4));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void BuildReady_two_arg_sets_oppo_to_supplied_hand()
|
||||||
|
{
|
||||||
|
var env = ScriptedLifecycle.BuildReady(new long[] { 1, 4, 3 }, new long[] { 1, 2, 6 });
|
||||||
|
var body = (ReadyBody)env.Body;
|
||||||
|
|
||||||
|
Assert.That(body.Self.Select(p => p.Idx), Is.EqualTo(new[] { 1, 4, 3 }));
|
||||||
|
Assert.That(body.Oppo.Select(p => p.Idx), Is.EqualTo(new[] { 1, 2, 6 }),
|
||||||
|
"oppo must reflect the opponent's post-mulligan hand, not the placeholder InitialHand.");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void BuildReady_one_arg_defaults_oppo_to_InitialHand()
|
||||||
|
{
|
||||||
|
var env = ScriptedLifecycle.BuildReady(new long[] { 1, 4, 3 });
|
||||||
|
var body = (ReadyBody)env.Body;
|
||||||
|
|
||||||
|
Assert.That(body.Oppo.Select(p => p.Idx), Is.EqualTo(new[] { 1, 2, 3 }),
|
||||||
|
"single-arg overload (non-interactive opponent) keeps the placeholder hand.");
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void BuildOpponentTurnStart_HasUriTurnStartAndSpin()
|
public void BuildOpponentTurnStart_HasUriTurnStartAndSpin()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user