Example #1
0
        public static void AssertValidAction(GameInstance game, UctAction action)
        {
            switch (action.Type)
            {
            case UctActionType.Null:
                break;

            case UctActionType.EndTurn:
                break;

            case UctActionType.Move:
            case UctActionType.DefensiveMove:
                AssertValidMoveAction(game, action);
                break;

            case UctActionType.AbilityUse:
                AssertValidAbilityUseAction(game, action);
                break;

            case UctActionType.AttackMove:
                AssertValidMoveAction(game, action);
                var afterMove = ActionEvaluator.F(game, action.ToPureMove());
                AssertValidAbilityUseAction(afterMove, action.ToPureAbilityUse());
                break;
            }
        }
Example #2
0
        /// <summary>
        /// Asnychronously run a given action, notifying all of the subscribers.
        /// </summary>
        public async Task SlowPlayAction(GameInstance game, UctAction action)
        {
            Debug.Assert(game == _gameInstance, "instance == _gameInstance");

            foreach (var subscriber in _subscribers)
            {
                subscriber.ActionApplied(action);
            }

            switch (action.Type)
            {
            case UctActionType.AbilityUse:
                await SlowBroadcastAction(action);

                break;

            case UctActionType.EndTurn:
                break;

            case UctActionType.AttackMove:
                GameInvariants.AssertValidMoveAction(_gameInstance, action);

                await SlowBroadcastAction(action.ToPureMove());
                await SlowBroadcastAction(action.ToPureAbilityUse());

                break;

            case UctActionType.DefensiveMove:
            case UctActionType.Move:
                GameInvariants.AssertValidMoveAction(_gameInstance, action);

                await SlowBroadcastAction(action.ToPureMove());

                break;

            case UctActionType.Null:
                break;
            }
        }