diff --git a/src/game-lib/Events/GameEventType.cs b/src/game-lib/Events/GameEventType.cs index 67708d8b..46126adb 100644 --- a/src/game-lib/Events/GameEventType.cs +++ b/src/game-lib/Events/GameEventType.cs @@ -25,6 +25,8 @@ public class GameEventType public static bool IsValidPlayerActionEvent(string type) => PlayerActionName.IsValid(type); + public bool IsNotTimeAdvancement => ToString() != nameof(AdvanceTimePlayerAction); + public GameEventType(string type) { Contract.Assert(IsValidWorldEventType(type) || IsValidPlayerActionEvent(type)); diff --git a/src/game-lib/State/GameSessionTurn.cs b/src/game-lib/State/GameSessionTurn.cs index 932c7ea3..8832a9a5 100644 --- a/src/game-lib/State/GameSessionTurn.cs +++ b/src/game-lib/State/GameSessionTurn.cs @@ -55,9 +55,9 @@ public void AssertInvariants() "Number of events in turn must match the number of updates between the game states."); Contract.Assert(EventsUntilStartState.Last().Type.ToString() == GameEventType.ReportEvent); + Contract.Assert(EventsInTurn.SkipLast(1).All(@event => @event.Type.IsNotTimeAdvancement)); IdGen.AssertConsecutiveIds(GameEvents.ToList()); - // kja all events in turn except the last one must be not AdvanceTime player action - // Contract.Assert(EventsInTurn.SkipLast(1).All(@event => @event.Type == "a")) + StartState.AssertInvariants(); EndState.AssertInvariants(); }