落地无头规则引擎与局内内容,便于命令行复现对战。
规则、卡包与测试放在同一套核心里,避免表现层自行结算。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using CardGame.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace Game.Core.Tests;
|
||||
|
||||
public sealed class PhaseCTests
|
||||
{
|
||||
[Fact]
|
||||
public void Lantern_supplies_on_turn_start()
|
||||
{
|
||||
var state = MatchSetup.Create(
|
||||
9,
|
||||
Cards.Repeat(Cards.Lantern, 10),
|
||||
Cards.Repeat(Cards.Wisp, 10),
|
||||
Cards.Catalog,
|
||||
shuffle: false);
|
||||
var lantern = state.Players[0].Hand[0];
|
||||
Assert.Equal(1, state.Players[0].Energy);
|
||||
state = RulesEngine.Execute(state, new PlayCardAction(0, lantern.Id));
|
||||
Assert.Equal(0, state.Players[0].Energy);
|
||||
state = RulesEngine.Execute(state, new EndTurnAction(0));
|
||||
state = RulesEngine.Execute(state, new EndTurnAction(1));
|
||||
// base field +1, lantern +1
|
||||
Assert.Equal(2, state.Players[0].Energy);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Fuse_expires_and_damages()
|
||||
{
|
||||
var state = MatchSetup.Create(
|
||||
4,
|
||||
Cards.Repeat(Cards.Fuse, 10),
|
||||
Cards.Repeat(Cards.Wisp, 10),
|
||||
Cards.Catalog,
|
||||
shuffle: false);
|
||||
var fuse = state.Players[0].Hand[0];
|
||||
state = RulesEngine.Execute(state, new PlayCardAction(0, fuse.Id));
|
||||
state = RulesEngine.Execute(state, new EndTurnAction(0));
|
||||
Assert.DoesNotContain(state.Board, e => e.Definition.Id == Cards.Fuse.Id);
|
||||
Assert.Equal(18, state.Players[1].Life);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user