public override void When()
        {
            base.When();

            var action = new RegularAttackAction(1).SetTarget(_monster);
            var message = new PlayerActionMessage(_player, action);

            _combatEncounter.OnPlayerAction(message);
        }
Пример #2
0
        public override void When()
        {
            base.When();

            _player = _players[0];
            var action = new RegularAttackAction(30);
            _message = new PlayerActionMessage(_player, action);

            _combatEncounter.OnPlayerAction(_message);
        }
Пример #3
0
        private static void OnPlayerReadyForAction(PlayerReadyForActionEvent e)
        {
            Console.WriteLine("Player Ready");
            string input = Console.ReadLine();

            int index = Convert.ToInt16(input);

            ICombatAction action = new RegularAttackAction(10).SetTarget(_monsters[index]);

            var message = new PlayerActionMessage(e.Player, action);
            MessageBroker.Send(message);
        }
        public override void OnWhen()
        {
            base.OnWhen();

            _player = _players[0];

            var action1 = new RegularAttackAction(30);
            _message1 = new PlayerActionMessage(_player, action1);

            var action2 = new RegularAttackAction(30);
            _message2 = new PlayerActionMessage(_player, action2);

            _combatEncounter.OnPlayerAction(_message1);
            _combatEncounter.OnPlayerAction(_message2);
        }
Пример #5
0
        /// <summary>
        /// Called when [player action].
        /// </summary>
        /// <param name="m">The message.</param>
        public void OnPlayerAction(PlayerActionMessage m)
        {
            PlayerActionMessage foundAction = _playerActions.FirstOrDefault(a => a.Player == m.Player);

            if (foundAction != null)
            {
                _playerActions.Remove(foundAction);
            }

            _playerActions.Add(m);

            bool allPlayersHaveAnAction = true;
            foreach (var player in _players)
            {
                if (!_playerActions.Exists(a => a.Player == player))
                {
                    allPlayersHaveAnAction = false;
                    break;
                }
            }

            if (allPlayersHaveAnAction)
                ExecuteRound();
        }
Пример #6
0
 public void Round2()
 {
     ICombatAction action = new RegularAttackAction(5).SetTarget(_monster);
     var message = new PlayerActionMessage(_player, action);
     _combatEncounter.OnPlayerAction(message);
 }