private void AddCombatant(DD4ECombatant combatant) { if (Combatants.Any(c => c.Name.Equals(combatant.Name) && c.IsPlayer == false)) { int id = Combatants.Count(c => c.Name.Equals(combatant.Name) && c.IsPlayer == false); combatant.ID = id; } else { if (Combatants.Any(c => c.Name.Equals(combatant.Name))) { MessageBox.Show("You cannot add the same player character twice.", "Warning"); return; } } Combatants.Add(combatant); }
} // OrderOfBattle() public static void PrepareBattle(ApplicationDbContext ctx) { if (Status == false) { random = new Random(); OrderOfBattle(); BattleLog = new List <string>(); combatantsCount = Combatants.Count(); combatantTurn = 0; var first = Combatants.First(); AddToLog(new string($"Walka rozpoczęta, jako pierwszy uderza {first.Name}")); deadCount = 0; Status = true; } BattleTurn(ctx); } // PrepareBattle()