Пример #1
0
        private async Task AddPlayer(SocketReaction reaction)
        {
            if (Battle.isActive)
            {
                return;
            }

            if (Messages.Values.Where(v => v is PlayerFighter).Where(s => ((PlayerFighter)s).avatar.ID == reaction.UserId).Any())
            {
                return;
            }

            SocketGuildUser player       = (SocketGuildUser)reaction.User.Value;
            var             playerAvatar = UserAccounts.GetAccount(player);

            var p = new PlayerFighter(player);

            Battle.AddPlayer(p, ColossoBattle.Team.A);

            if (playerAvatar.Inv.GetGear(AdeptClassSeriesManager.GetClassSeries(playerAvatar).Archtype).Any(i => i.Name == "Lure Cap"))
            {
                LureCaps++;
                SetRandomEnemies(ColossoBattle.Team.B);
            }

            if (Name == "Bronze")
            {
                if (playerAvatar.LevelNumber < 10 && Messages.Count == 0)
                {
                    Diff = BattleDifficulty.Tutorial;
                    SetRandomEnemies(ColossoBattle.Team.B);
                }
                else
                {
                    if (Diff != BattleDifficulty.Easy)
                    {
                        Diff = BattleDifficulty.Easy;
                        SetRandomEnemies(ColossoBattle.Team.B);
                    }
                }
            }

            var playerMsg = await BattleChannel.SendMessageAsync($"{player.DisplayName()} wants to battle!");

            Messages.Add(playerMsg, p);
            resetIfNotActive.Start();

            if (Messages.Count == PlayersToStart)
            {
                await StartBattle();
            }
        }
Пример #2
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!");
         }
     }
 }