feat(battle-node): emit real spin per-frame on forwarded PlayActions
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -285,6 +285,97 @@ public class BattleSessionDispatchTests
|
||||
Assert.That(pb.UList[0].Skill, Is.EqualTo("37|36|0"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Pvp_PlayActions_emits_spin_for_a_hidden_fetch()
|
||||
{
|
||||
var (s, a, b) = NewPvpSession();
|
||||
DriveToAfterReady(s, a);
|
||||
DriveToAfterReady(s, b);
|
||||
|
||||
// Played card 3 (hand->field) PLUS a hidden deck->hand fetch of a non-played token idx 31.
|
||||
var body = new Dictionary<string, object?>
|
||||
{
|
||||
["playIdx"] = 3L,
|
||||
["type"] = 30L,
|
||||
["orderList"] = new List<object?>
|
||||
{
|
||||
new Dictionary<string, object?>
|
||||
{
|
||||
["move"] = new Dictionary<string, object?>
|
||||
{
|
||||
["idx"] = new List<object?> { 3L }, ["isSelf"] = 1L, ["from"] = 10L, ["to"] = 20L,
|
||||
}
|
||||
},
|
||||
new Dictionary<string, object?>
|
||||
{
|
||||
["move"] = new Dictionary<string, object?>
|
||||
{
|
||||
["idx"] = new List<object?> { 31L }, ["isSelf"] = 1L, ["from"] = 0L, ["to"] = 10L,
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
var routes = s.ComputeFrames(a, EnvWith(NetworkBattleUri.PlayActions, body));
|
||||
var pb = (PlayActionsBroadcastBody)routes[0].Frame.Body;
|
||||
Assert.That(pb.Spin, Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Pvp_PlayActions_emits_null_spin_for_a_vanilla_play()
|
||||
{
|
||||
var (s, a, b) = NewPvpSession();
|
||||
DriveToAfterReady(s, a);
|
||||
DriveToAfterReady(s, b);
|
||||
|
||||
var body = MoveOrderList(idx: 3, from: 10, to: 20); // played card only, no fetch
|
||||
body["playIdx"] = 3L;
|
||||
body["type"] = 30L;
|
||||
|
||||
var routes = s.ComputeFrames(a, EnvWith(NetworkBattleUri.PlayActions, body));
|
||||
var pb = (PlayActionsBroadcastBody)routes[0].Frame.Body;
|
||||
Assert.That(pb.Spin, Is.Null, "spin omitted (client assumes 0) when there are no hidden draws.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Pvp_PlayActions_emits_null_spin_for_a_revealed_uList_fetch()
|
||||
{
|
||||
// A fetch whose identity is revealed via the uList (cardId present) is NOT counted — the
|
||||
// receiver knows it, so its stream doesn't need a crank.
|
||||
var (s, a, b) = NewPvpSession();
|
||||
DriveToAfterReady(s, a);
|
||||
DriveToAfterReady(s, b);
|
||||
|
||||
var body = new Dictionary<string, object?>
|
||||
{
|
||||
["playIdx"] = 3L,
|
||||
["type"] = 30L,
|
||||
["orderList"] = new List<object?>
|
||||
{
|
||||
new Dictionary<string, object?>
|
||||
{
|
||||
["move"] = new Dictionary<string, object?>
|
||||
{
|
||||
["idx"] = new List<object?> { 31L }, ["isSelf"] = 1L, ["from"] = 0L, ["to"] = 10L,
|
||||
}
|
||||
},
|
||||
},
|
||||
["uList"] = new List<object?>
|
||||
{
|
||||
new Dictionary<string, object?>
|
||||
{
|
||||
["idxList"] = new List<object?> { 31L },
|
||||
["from"] = 0L, ["to"] = 10L, ["isSelf"] = 1L, ["skill"] = "37|36|0",
|
||||
["cardId"] = 100_011_010L, // revealed identity
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
var routes = s.ComputeFrames(a, EnvWith(NetworkBattleUri.PlayActions, body));
|
||||
var pb = (PlayActionsBroadcastBody)routes[0].Frame.Body;
|
||||
Assert.That(pb.Spin, Is.Null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Pvp_PlayActions_without_uList_leaves_it_null()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user