//Called when the oppoenent is selected public void DoAttack() { Attacker.Target.currentMana -= SelectedMove.getCost(); foreach (CreatureBattleStatusController Defender in Defenders) { string message; if (SelectedMove.execute(Attacker, Defender)) { //attack hit message = Attacker.GetCreature().GetName() + " used " + SelectedMove.name + " on " + Defender.GetCreature().GetName() + "."; messageBoxActions.Enqueue(() => ShowMessage(message)); //faint? if (Defender.GetCreature().currentActiveHealth <= 0) { if (Defender.GetCreature().currentCriticalHealth <= 0) { messageBoxActions.Enqueue(() => ShowMessage(Defender.GetCreature().GetName() + " died!")); messageBoxActions.Enqueue(() => Defender.Die()); } else { messageBoxActions.Enqueue(() => ShowMessage(Defender.GetCreature().GetName() + " fainted!")); messageBoxActions.Enqueue(() => Defender.Faint()); } } } else { //attack missed message = SelectedMove.name + " missed" + Defender.GetCreature().GetName() + "."; messageBoxActions.Enqueue(() => ShowMessage(message)); } } resetSelection(); messageBoxActions.Enqueue(() => EndTurn()); }