Exemplo n.º 1
0
        internal static List <ColossoFighter> GetEnemies(BattleDifficulty diff, string enemy)
        {
            List <List <ColossoFighter> > selectedDifficulty;

            switch (diff)
            {
            case BattleDifficulty.Easy:
                selectedDifficulty = BronzeFighters;
                break;

            case BattleDifficulty.Medium:
                selectedDifficulty = SilverFighters;
                break;

            case BattleDifficulty.Hard:
                selectedDifficulty = GoldFighters;
                break;

            default:
                selectedDifficulty = BronzeFighters;
                Console.WriteLine("enemies from default!!!");
                break;
            }

            var enemies = selectedDifficulty
                          .FirstOrDefault(enemyLists => enemyLists.Any(e =>
                                                                       e.Name.Equals(enemy, StringComparison.CurrentCultureIgnoreCase)))
                          ?? GetRandomEnemies(diff);

            return(enemies.Select(f => (ColossoFighter)f.Clone()).ToList());
        }
Exemplo n.º 2
0
        protected override async Task AddPlayer(SocketReaction reaction)
        {
            if (PlayerMessages.Values.Any(s => (s.avatar.ID == reaction.UserId)))
            {
                return;
            }
            SocketGuildUser player       = (SocketGuildUser)reaction.User.Value;
            var             playerAvatar = UserAccounts.GetAccount(player);
            var             factory      = new PlayerFighterFactory();
            var             p            = factory.CreatePlayerFighter(player);

            if (Difficulty == BattleDifficulty.Tutorial || Difficulty == BattleDifficulty.Easy)
            {
                if (playerAvatar.LevelNumber < 10 && Battle.SizeTeamA == 0)
                {
                    internalDiff = BattleDifficulty.Tutorial;
                    SetNextEnemy();
                }
                else if (Difficulty == BattleDifficulty.Tutorial)
                {
                    internalDiff = BattleDifficulty.Easy;
                    SetNextEnemy();
                }
            }

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

            await AddPlayer(p);
        }
Exemplo n.º 3
0
        protected override async Task AddPlayer(SocketReaction reaction)
        {
            if (PlayerMessages.Values.Any(s => (s.Id == reaction.UserId)))
            {
                return;
            }
            SocketGuildUser player       = (SocketGuildUser)reaction.User.Value;
            var             playerAvatar = EntityConverter.ConvertUser(player);
            var             p            = Factory.CreatePlayerFighter(playerAvatar);

            if (Battle.SizeTeamA == 0 && Difficulty == BattleDifficulty.Easy && playerAvatar.LevelNumber < 10)
            {
                internalDiff = BattleDifficulty.Tutorial;
                SetNextEnemy();
            }
            else if (Difficulty == BattleDifficulty.Tutorial && playerAvatar.LevelNumber >= 10)
            {
                internalDiff = BattleDifficulty.Easy;
                SetNextEnemy();
            }

            if (playerAvatar.LevelNumber < limits[Difficulty])
            {
                return;
            }

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

            await AddPlayer(p);
        }
Exemplo n.º 4
0
        internal static async Task UserWonSingleBattle(UserAccount avatar, BattleDifficulty difficulty)
        {
            var csvline = $"{DateTime.Now:s},Single,{difficulty},{avatar.Name}{Environment.NewLine}";

            File.AppendAllText(BattleFile, csvline);
            await Task.CompletedTask;
        }
Exemplo n.º 5
0
        private static ChestQuality GetRandomChest(BattleDifficulty diff)
        {
            ChestQuality[] chests;
            switch (diff)
            {
            case BattleDifficulty.Tutorial:
                chests = new ChestQuality[] { ChestQuality.Wooden };
                return(chests.Random());

            case BattleDifficulty.Easy:
            default:
                chests = new ChestQuality[] { ChestQuality.Wooden, ChestQuality.Wooden, ChestQuality.Normal, ChestQuality.Normal, ChestQuality.Normal, ChestQuality.Normal, ChestQuality.Normal, ChestQuality.Silver };
                break;

            case BattleDifficulty.Medium:
                chests = new ChestQuality[] { ChestQuality.Normal, ChestQuality.Normal, ChestQuality.Normal, ChestQuality.Normal, ChestQuality.Normal, ChestQuality.Silver, ChestQuality.Silver, ChestQuality.Gold };
                break;

            case BattleDifficulty.MediumRare:
                chests = new ChestQuality[] { ChestQuality.Silver, ChestQuality.Silver, ChestQuality.Silver, ChestQuality.Gold, ChestQuality.Gold };
                break;

            case BattleDifficulty.Hard:
                chests = new ChestQuality[] { ChestQuality.Silver, ChestQuality.Gold, ChestQuality.Gold, ChestQuality.Gold, ChestQuality.Gold, ChestQuality.Adept };
                break;
            }
            return(chests.Random());
        }
Exemplo n.º 6
0
        internal static List <ColossoFighter> GetEnemies(BattleDifficulty diff, string enemy)
        {
            List <List <ColossoFighter> > selectedDifficulty;

            switch (diff)
            {
            case (BattleDifficulty.Easy):
                selectedDifficulty = bronzeFighters;
                break;

            case (BattleDifficulty.Medium):
                selectedDifficulty = silverFighters;
                break;

            case (BattleDifficulty.Hard):
                selectedDifficulty = goldFighters;
                break;

            default:
                selectedDifficulty = bronzeFighters;
                Console.WriteLine("Enemies from default!!!");
                break;
            }
            var enemies = selectedDifficulty.Where(l => l.Any(e => e.Name.ToUpper().Contains(enemy.ToUpper()))).FirstOrDefault();

            if (enemies == null)
            {
                enemies = GetRandomEnemies(diff);
            }

            return(enemies.Select(f => (ColossoFighter)f.Clone()).ToList());
        }
Exemplo n.º 7
0
        internal static List <ColossoFighter> GetRandomEnemies(BattleDifficulty diff, double boost = 1)
        {
            List <List <ColossoFighter> > selectedDifficulty;

            switch (diff)
            {
            case BattleDifficulty.Tutorial:
                selectedDifficulty = TutorialFighters;
                break;

            case BattleDifficulty.Easy:
                selectedDifficulty = BronzeFighters;
                break;

            case BattleDifficulty.Medium:
            case BattleDifficulty.MediumRare:
                selectedDifficulty = SilverFighters;
                break;

            case BattleDifficulty.Hard:
                selectedDifficulty = GoldFighters;
                break;

            default:
                selectedDifficulty = BronzeFighters;
                Console.WriteLine("enemies from default!!!");
                break;
            }

            var enemies = selectedDifficulty.Random().Select(f => (ColossoFighter)f.Clone()).ToList();

            if (diff == BattleDifficulty.MediumRare)
            {
                enemies.ForEach(e => e.Stats *= 1.5);
            }
            enemies.ForEach(e => e.Stats *= boost);
            if (enemies.Count == 0)
            {
                Console.WriteLine($"{diff}: enemies were empty");
                enemies = GetRandomEnemies(diff);
            }

            return(enemies);
        }
Exemplo n.º 8
0
        internal static async Task UserLostBattle(UserAccount userAccount, BattleDifficulty diff, ITextChannel battleChannel)
        {
            uint oldLevel = userAccount.LevelNumber;

            userAccount.XP += (uint)(new Random()).Next(0, 10);
            uint newLevel = userAccount.LevelNumber;

            userAccount.ServerStats.ColossoStreak = 0;

            UserAccounts.SaveAccounts();
            if (oldLevel != newLevel)
            {
                var user = (SocketGuildUser)await battleChannel.GetUserAsync(userAccount.ID); // Where(s => s. == userAccount.ID).First();

                Leveling.LevelUp(userAccount, user, (SocketTextChannel)battleChannel);
            }

            await Task.CompletedTask;
        }
Exemplo n.º 9
0
 public SingleBattleEnvironment(string Name, ITextChannel lobbyChannel, ITextChannel BattleChannel, BattleDifficulty diff) : base(Name, lobbyChannel, BattleChannel)
 {
     internalDiff = diff;
     _            = Reset();
 }
Exemplo n.º 10
0
        internal static async Task UserWonBattle(UserAccount userAccount, int winsInARow, int LureCaps, BattleStats battleStats, BattleDifficulty diff, ITextChannel lobbyChannel, IEnumerable <ColossoFighter> winners, bool wasMimic)
        {
            uint oldLevel  = userAccount.LevelNumber;
            var  baseXP    = 20 + 5 * LureCaps + winsInARow / 4;
            var  xpawarded = (uint)new Random().Next(baseXP, baseXP * 2) * Math.Max(3, (uint)Math.Pow((int)diff + 1, 2));

            userAccount.XP += xpawarded;
            userAccount.Inv.AddBalance(xpawarded / 2);
            uint newLevel = userAccount.LevelNumber;

            userAccount.ServerStats.ColossoWins++;
            userAccount.ServerStats.ColossoStreak++;
            userAccount.ServerStats.ColossoHighestStreak = Math.Max(userAccount.ServerStats.ColossoHighestStreak, userAccount.ServerStats.ColossoStreak);
            switch (battleStats.TotalTeamMates)
            {
            case 0:
                userAccount.ServerStats.ColossoHighestRoundEndlessSolo = Math.Max(userAccount.ServerStats.ColossoHighestRoundEndlessSolo, winsInARow);
                break;

            case 1:
                if (winsInARow > userAccount.ServerStats.ColossoHighestRoundEndlessDuo)
                {
                    userAccount.ServerStats.ColossoHighestRoundEndlessDuo      = winsInARow;
                    userAccount.ServerStats.ColossoHighestRoundEndlessDuoNames = string.Join(", ", winners.Select(p => p.Name));
                }
                break;

            case 2:
                if (winsInARow > userAccount.ServerStats.ColossoHighestRoundEndlessTrio)
                {
                    userAccount.ServerStats.ColossoHighestRoundEndlessTrio      = winsInARow;
                    userAccount.ServerStats.ColossoHighestRoundEndlessTrioNames = string.Join(", ", winners.Select(p => p.Name));
                }
                break;

            case 3:
                if (winsInARow > userAccount.ServerStats.ColossoHighestRoundEndlessQuad)
                {
                    userAccount.ServerStats.ColossoHighestRoundEndlessQuad      = winsInARow;
                    userAccount.ServerStats.ColossoHighestRoundEndlessQuadNames = string.Join(", ", winners.Select(p => p.Name));
                }
                break;
            }

            userAccount.BattleStats += battleStats;
            _ = UnlockClasses(userAccount, lobbyChannel);

            if (wasMimic || Global.Random.Next(0, 100) <= 7 + battleStats.TotalTeamMates * 2 + 4 * LureCaps + winsInARow / 10 - 1)
            {
                ChestQuality awardedChest = GetRandomChest(diff);
                userAccount.Inv.AwardChest(awardedChest);
                var embed = new EmbedBuilder();
                embed.WithColor(Colors.Get("Iodem"));
                embed.WithDescription($"{((SocketTextChannel)lobbyChannel).Users.Where(u => u.Id == userAccount.ID).FirstOrDefault().Mention} found a {Inventory.ChestIcons[awardedChest]} {awardedChest} Chest!");
                await lobbyChannel.SendMessageAsync("", false, embed.Build());
            }

            UserAccounts.SaveAccounts();
            if (oldLevel != newLevel)
            {
                var user = (SocketGuildUser)await lobbyChannel.GetUserAsync(userAccount.ID); // Where(s => s. == userAccount.ID).First();

                Leveling.LevelUp(userAccount, user, (SocketTextChannel)lobbyChannel);
            }

            await Task.CompletedTask;
        }
Exemplo n.º 11
0
 private double GetDefaultItemDamageKoef(int level)
 => BattleDifficulty.GetCurrent().ItemDamageKoef *GetBaseItemDamageKoef(level);
Exemplo n.º 12
0
        private async Task <BattleCollector> GetBattleCollector(SocketCommandContext Context, string Name, BattleDifficulty diff)
        {
            var channel = await Context.Guild.GetOrCreateTextChannelAsync("colosso-" + Name);

            await channel.ModifyAsync(c =>
            {
                c.CategoryId = ((ITextChannel)Context.Channel).CategoryId;
                c.Position   = ((ITextChannel)Context.Channel).Position + battles.Count + 1;
            });

            await channel.SyncPermissionsAsync();

            var messages = await channel.GetMessagesAsync(100).FlattenAsync();

            await channel.DeleteMessagesAsync(messages);

            var b = new BattleCollector()
            {
                Name          = Name,
                Diff          = diff,
                BattleChannel = channel,
                EnemyMsg      = await channel.SendMessageAsync($"Welcome to {Name} Battle!\n\nReact with <:Fight:536919792813211648> to join the {Name} Battle and press <:Battle:536954571256365096> when you are ready to battle!")
            };
            await b.Reset();

            return(b);
        }
Exemplo n.º 13
0
 public double GetItemsKoef()
 => BattleDifficulty.GetCurrent().DropMultiplier;
Exemplo n.º 14
0
 public double GetGoldKoef()
 => BattleDifficulty.GetCurrent().GoldMultiplier;
Exemplo n.º 15
0
 public double GetExpKoef()
 => BattleDifficulty.GetCurrent().ExpMultiplier;
Exemplo n.º 16
0
 public SingleBattleEnvironment(string Name, ITextChannel lobbyChannel, bool isPersistent, ITextChannel BattleChannel, BattleDifficulty diff) : base(Name, lobbyChannel, isPersistent, BattleChannel)
 {
     internalDiff = diff;
     _            = Reset("init");
 }
Exemplo n.º 17
0
 public void SetBattleDifficulty(int battleDifficultyIndex)
 => BattleDifficulty.SetBattleDifficulty(battleDifficultyIndex);