Esempio n. 1
0
        protected override async Task GameOver()
        {
            var winners = Battle.GetTeam(Battle.GetWinner());

            if (Battle.GetWinner() == Team.A)
            {
                if (Battle.GetWinner() == Team.A)
                {
                    winners.OfType <PlayerFighter>().ToList().ForEach(async p => await ServerGames.UserWonBattle(UserAccountProvider.GetById(p.Id), matchup.RewardTables.GetRewards(), p.battleStats, lobbyChannel, BattleChannel));
                }

                Battle.TeamA.ForEach(p =>
                {
                    p.RemoveNearlyAllConditions();
                    p.Buffs = new List <Buff>();
                    p.Heal((uint)(p.Stats.HP * 5 / 100));
                });

                SetNextEnemy();

                if (!EndOfDungeon)
                {
                    await SummonsMessage.ModifyAsync(m => m.Content = matchup.FlavourText);

                    var text = $"{winners.First().Name}'s Party wins Battle!";
                    await Task.Delay(2000);

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

                    await Task.Delay(2000);

                    Battle.turn = 0;
                    _           = StartBattle();
                }
                else
                {
                    winners.OfType <PlayerFighter>().ToList().ForEach(async p => await ServerGames.UserWonDungeon(UserAccountProvider.GetById(p.Id), Dungeon, lobbyChannel));

                    if (DateTime.Now <= new DateTime(2020, 11, 8) && Global.Random.Next(4) == 0)
                    {
                        var r = new List <Rewardable>()
                        {
                            new DefaultReward()
                            {
                                Dungeon = "Halloween Special"
                            }
                        };
                        winners.OfType <PlayerFighter>().ToList().ForEach(async p => await ServerGames.UserWonBattle(UserAccountProvider.GetById(p.Id), r, new BattleStats(), lobbyChannel, BattleChannel));
                    }

                    _ = WriteGameOver();
                }
            }
            else
            {
                var losers = winners.First().battle.GetTeam(winners.First().enemies);


                losers.ConvertAll(s => (PlayerFighter)s).ForEach(async p => await ServerGames.UserLostBattle(UserAccountProvider.GetById(p.Id), lobbyChannel));

                _ = WriteGameOver();
            }
        }
        protected override async Task GameOver()
        {
            var winners = Battle.GetTeam(Battle.GetWinner());

            if (Battle.GetWinner() == Team.A)
            {
                if (Battle.GetWinner() == Team.A)
                {
                    winners.OfType <PlayerFighter>().ToList().ForEach(async p => await ServerGames.UserWonBattle(p.avatar, matchup.RewardTables.GetRewards(), p.battleStats, lobbyChannel, BattleChannel));
                }

                Battle.TeamA.ForEach(p =>
                {
                    p.RemoveNearlyAllConditions();
                    p.Buffs = new List <Buff>();
                    p.Heal((uint)(p.Stats.HP * 5 / 100));
                });

                SetNextEnemy();

                if (!EndOfDungeon)
                {
                    await SummonsMessage.ModifyAsync(m => m.Content = matchup.FlavourText);

                    var text = $"{winners.First().Name}'s Party wins Battle!";
                    await Task.Delay(2000);

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

                    await Task.Delay(2000);

                    Battle.turn = 0;
                    _           = StartBattle();
                }
                else
                {
                    winners.OfType <PlayerFighter>().ToList().ForEach(async p => await ServerGames.UserWonDungeon(p.avatar, Dungeon, lobbyChannel));
                    _ = WriteGameOver();
                }
            }
            else
            {
                var losers = winners.First().battle.GetTeam(winners.First().enemies);

                losers.ConvertAll(s => (PlayerFighter)s).ForEach(async p => await ServerGames.UserLostBattle(p.avatar, lobbyChannel));

                _ = WriteGameOver();
            }
        }