Beispiel #1
0
        private async Task WriteGameOver()
        {
            await Task.Delay(2000);

            var winners = Battle.GetTeam(Battle.GetWinner());
            var text    = $"{winners.FirstOrDefault().name}'s Party wins! Battle will reset shortly";
            await StatusMsg.ModifyAsync(m => { m.Content = text; m.Embed = null; });

            await Task.Delay(2000);

            await Reset();
        }
Beispiel #2
0
        internal async Task GameOver()
        {
            var winners = Battle.GetTeam(Battle.GetWinner());

            if (Battle.SizeTeamB == 0)
            {
                Console.WriteLine("Game Over with no enemies existing.");
            }
            if (winners.First() is PlayerFighter)
            {
                winsInARow++;
                var wasMimic = Battle.TeamB.Any(e => e.name.Contains("Mimic"));
                winners.ConvertAll(s => (PlayerFighter)s).ForEach(async p => await ServerGames.UserWonBattle(p.avatar, winsInARow, LureCaps, p.battleStats, Diff, TextChannel, winners, wasMimic));
                if (!IsEndless)
                {
                    _ = WriteGameOver();
                }
                else
                {
                    Battle.TeamA.ForEach(p =>
                    {
                        p.PPrecovery += (winsInARow <= 8 * 4 && winsInARow % 4 == 0) ? 1 : 0;
                        p.RemoveNearlyAllConditions();
                        p.Buffs = new List <Buff>();
                        p.Heal((uint)(p.stats.HP * 5 / 100));
                    });

                    var text = $"{winners.First().name}'s Party wins Battle {winsInARow}! Battle will reset shortly";
                    await Task.Delay(2000);

                    await StatusMsg.ModifyAsync(m => { m.Content = text; m.Embed = null; });

                    await Task.Delay(2000);

                    Diff = (BattleDifficulty)Math.Min(4, 1 + winsInARow / stageLength);
                    SetRandomEnemies(ColossoBattle.Team.B);
                    Battle.turn = 0;
                    _           = StartBattle();
                }
            }
            else
            {
                if (IsEndless)
                {
                    Diff = BattleDifficulty.Easy;
                }

                var losers = winners.First().battle.GetTeam(winners.First().enemies);
                losers.ConvertAll(s => (PlayerFighter)s).ForEach(async p => await ServerGames.UserLostBattle(p.avatar, Diff, TextChannel));
                _ = WriteGameOver();
            }
        }
Beispiel #3
0
 private async Task WriteStatus()
 {
     if (Battle.log.Count > 0 && Battle.turn > 0)
     {
         if (StatusMsg == null)
         {
             StatusMsg = await BattleChannel.SendMessageAsync(Battle.log.Aggregate("", (s, l) => s += l + "\n"));
         }
         else
         {
             await StatusMsg.ModifyAsync(c => c.Content = Battle.log.Aggregate("", (s, l) => s += l + "\n"));
         }
     }
     else
     {
         if (StatusMsg == null)
         {
             string msg = Messages.Values
                          .Where(p => p is PlayerFighter)
                          .Aggregate("", (s, v) => s += $"<@{((PlayerFighter)v).avatar.ID}>, ");
             StatusMsg = await BattleChannel.SendMessageAsync($"{msg}get in position!");
         }
     }
 }