コード例 #1
0
 internal void AdvanceTurn()
 {
     foreach (Monster monster in monsters)
     {
         monster.IsDown = false;
         monster.UpdateColor();
     }
     player.IsDown = false;
     if (Turn == Turns.Player)
     {
         DoBlast(Constants.MAX_ENEMIES, player);
     }
     else
     {
         DoBlast((int)Turn - 1, monsters[(int)Turn - 1]);
     }
     HideOneMore();
     turnCounters.Clear();
     turnCounters.Add(new KeyValuePair <Turns, int>(Turns.Player, player.TurnCounter));
     for (int i = 0; i < monsters.Length; i++)
     {
         if (monsters[i].enabled)
         {
             turnCounters.Add(new KeyValuePair <Turns, int>((Turns)i + 1, monsters[i].TurnCounter));
         }
     }
     turnCounters.Sort((x, y) => x.Value.CompareTo(y.Value));
     Turn = turnCounters.First().Key;
     if (Turn == Turns.Player)
     {
         log.Add("Your Turn");
         player.ApplyDuration();
         player.TurnCounter += player.Stats.Speed;
         DoStatus(Constants.MAX_ENEMIES, player);
     }
     else
     {
         log.Add("Enemy Turn");
         monsters[(int)Turn - 1].ApplyDuration();
         monsters[(int)Turn - 1].TurnCounter += monsters[(int)Turn - 1].Stats.Speed;
         DoStatus((int)Turn - 1, monsters[(int)Turn - 1]);
     }
 }