private EpicBossResults GetEpicBossResults(EpicBoss epicBoss, Guild guild, Player player)
        {
            EpicBossResults results = new EpicBossResults();
            results.Items = new List<EpicBossResultItem>();

            int playerHealth = GetPlayerHealth(player.Level);
            int playerStats = GetPlayerStats(player.Level);
            int followerHealth = GetFollowerHealth(player.Level);
            int followerStats = GetFollowerStats(player.Level);
            decimal baseAttack = GetBaseAttack(player.Level);
            decimal knightBonus = GetKnightBonus(player.KnightCount);

            foreach (PlayerArmor playerArmor in player.Armors)
            {
                Armor armor = ArmorTable.Instance.GetArmor(playerArmor.ArmorName);

                KeyValuePair<int, int> armorStats = GetArmorStats(armor, playerArmor.Level, playerArmor.IsPlus);
                decimal guildRankBonus = GetGuildRankBonus(guild.RankBonus);
                decimal guildElementBonus = GetGuildElementBonus(armor, guild);
                decimal playerBonus = GetPlayerBonus(epicBoss.Element1, epicBoss.Element2, armor, playerArmor.IsNemesis);
                decimal bossLevelBonus = GetBossLevelBonus(epicBoss.Level);
                decimal bossElementBonus = GetBossElementBonus(epicBoss, armor);

                int playerDamageDone = GetDamageDone(baseAttack, armorStats.Key + playerStats, epicBoss.Defense, guildRankBonus, guildElementBonus, playerBonus, knightBonus);
                int followerDamageDone = GetDamageDone(baseAttack, armorStats.Key + followerStats, epicBoss.Defense, guildRankBonus, guildElementBonus, playerBonus, knightBonus);

                int playerDamageTaken = GetDamageTaken(armorStats.Value + playerStats, epicBoss.Attack, guildRankBonus, guildElementBonus, bossLevelBonus, bossElementBonus);
                int followerDamageTaken = GetDamageTaken(armorStats.Value + followerStats, epicBoss.Attack, guildRankBonus, guildElementBonus, bossLevelBonus, bossElementBonus);

                int playerHitsTaken = (playerHealth / playerDamageTaken) + 1;
                int followerHitsTaken = (followerHealth / followerDamageTaken) + 1;

                results.Items.Add(new EpicBossResultItem(armor.Name, armor.SafeName, playerDamageDone, playerDamageTaken, playerHitsTaken, followerDamageDone, followerDamageTaken, followerHitsTaken));
            }
            results.Items.Sort((x, y) => -1 * x.PlayerTotalDamageDone.CompareTo(y.PlayerTotalDamageDone));

            return results;
        }
        private string GetPlayerDataValidationMessage(Player player)
        {
            if (player == null) return Strings.ErrorPlayerDataNotProvided;
            if (player.Level < 1 || player.Level > 100) return Strings.ErrorInvalidPlayerLevel;
            if (player.KnightCount < 1 || player.KnightCount > 5) return Strings.ErrorInvalidPlayerKnightCount;
            if (player.Armors == null || player.Armors.Count <= 0) return Strings.ErrorPlayerArmorsDataNotProvided;

            foreach (PlayerArmor playerArmor in player.Armors)
            {
                Armor armor = ArmorTable.Instance.GetArmor(playerArmor.ArmorName);
                if (armor == null) return string.Format(Strings.ErrorPlayerArmorNotFound, playerArmor.ArmorName);
                if (playerArmor.Level < 1 || playerArmor.Level > armor.MaxLevel) return string.Format(Strings.ErrorInvalidPlayerArmorLevel, playerArmor.ArmorName, armor.MaxLevel);
                if (playerArmor.IsNemesis && armor.Rarity != Rarity.Nemesis) return string.Format(Strings.ErrorInvalidIsNemesis, playerArmor.ArmorName);
                if ((playerArmor.IsPlus && armor.PlusStats == null) || (!playerArmor.IsPlus && armor.NormalStats == null)) return string.Format(Strings.ErrorArmorStatsNotAvailable, playerArmor.ArmorName);
            }

            return string.Empty;
        }
Example #3
0
 private Player GetPlayer(int knightCount, PlayerArmor armor)
 {
     Player player = new Player();
     player.Level = 100;
     player.KnightCount = knightCount;
     player.Armors = new List<PlayerArmor>();
     player.Armors.Add(armor);
     return player;
 }