예제 #1
0
 public void Battle(IPlayer player)
 {
     if (enemyList.Count > 0)
     {
         BattleHandler battle = new BattleHandler(player, enemyList.First());
         battle.HandleBattle();
         if (enemyList.First().Health <= 0)
             enemyList.RemoveAt(0);
     }
 }
        public static bool ParseBattle(BattleHandler battle, string input)
        {
            bool validCommand = true;
            if (input.Equals(BattleCommandList.MELEE, StringComparison.CurrentCultureIgnoreCase) || input.Equals("a"))
            {
                battle.Melee();
            }
            else if (input.Equals(BattleCommandList.MAGIC, StringComparison.CurrentCultureIgnoreCase) || input.Equals("s"))
            {
                battle.Magic();
            }
            else if (input.Equals(BattleCommandList.HEAL, StringComparison.CurrentCultureIgnoreCase) || input.Equals("d"))
            {
                battle.Heal();
            }
            else
            {
                validCommand = false;
                Writer.OutputInvalidCommand();
            }

            return validCommand;
        }