public static async Task Attack(CombatInstance main) { var other = GetOppositeInstance(main); var user = GetUserOfInstance(main); switch (main.CombatPhase) { case 1 when other.CombatPhase == 1: main.CombatPhase++; await MessageHandler.AttackEnteredText(main.Location, user); break; case 2 when other.CombatPhase == 1: await MessageHandler.AttackAlreadyEntered(main.Location, user); break; case 1 when other.CombatPhase == 2: { main.CombatPhase += 2; other.CombatPhase++; //3- Pre-Attack phase (activate any abilities that trigger before attacks) main.CombatPhase++; other.CombatPhase++; //4- Attacks register. Calculate whether it hit, damage, bonus effects of attacks if (main.ActiveMon.CurStats[4] > main.EnemyMon.CurStats[4]) { await ApplyMoves(main, true); } else if (main.ActiveMon.CurStats[4] < main.EnemyMon.CurStats[4]) { await ApplyMoves(other, true); } else { var rand = RandomGen.Gen.Next(2); if (rand == 0) { await ApplyMoves(main, true); } else if (rand == 1) { await ApplyMoves(other, true); } } break; } default: await MessageHandler.AttackInvalid(main.Location, GetUserOfInstance(main)); break; } }