Beispiel #1
0
 public _MoveSet(PokemonTranslator pokemonTranslator, MoveTranslator fastMove, bool fastMoveLegacy, bool fastMoveStab, MoveTranslator chargedMove, bool chargedMoveLegacy, bool chargedMoveStab)
 {
     base_dps      = PokeFormulas.GetMoveSetDPS(pokemonTranslator, fastMove, chargedMove);
     true_dps      = PokeFormulas.GetTrueDPS(pokemonTranslator, fastMove, fastMoveStab, chargedMove, chargedMoveStab);
     FastAttack    = new Attack(fastMove.Name, fastMoveStab, fastMoveLegacy);
     ChargedAttack = new Attack(chargedMove.Name, chargedMoveStab, chargedMoveLegacy);
 }
Beispiel #2
0
        public static double GetMoveSetDPS(PokemonTranslator pokemonTranslator, MoveTranslator fastMove, MoveTranslator chargedMove)
        {
            if (fastMove.Energy == 0)
            {
                return(0);
            }

            double fastMovesToCharge = Math.Ceiling((double)-chargedMove.Energy / (double)fastMove.Energy);
            double damage            = (fastMove.Power * fastMovesToCharge) + chargedMove.Power;
            double time = (fastMove.Duration * fastMovesToCharge) + chargedMove.Duration;

            return(damage / time);
        }
Beispiel #3
0
        public static double GetTrueDPS(PokemonTranslator pokemonTranslator, MoveTranslator fastMove, bool fastMoveStab, MoveTranslator chargedMove, bool chargedMoveStab)
        {
            if (fastMove.Energy == 0)
            {
                return(0);
            }

            double fastSTAB          = fastMoveStab ? STAB_BONUS : 1;
            double chargedSTAB       = chargedMoveStab ? STAB_BONUS : 1;
            double fastMovesToCharge = Math.Ceiling((double)-chargedMove.Energy / (double)fastMove.Energy);
            double fastPower         = (Math.Floor((pokemonTranslator.PokemonSettings.stats.base_attack + PokeConstants.Evaluation.Attribute.Max) * fastMove.Power * fastSTAB / 200) + 1) * fastMovesToCharge;
            double chargedPower      = (Math.Floor((pokemonTranslator.PokemonSettings.stats.base_attack + PokeConstants.Evaluation.Attribute.Max) * chargedMove.Power * chargedSTAB / 200) + 1);
            double time = (fastMove.Duration * fastMovesToCharge) + chargedMove.Duration;

            return((fastPower + chargedPower) / time);
        }
Beispiel #4
0
        /// <summary>
        /// Goes through the GAME_MASTERs and collects the data we want to leverage for the PokeRef site.
        /// </summary>
        /// <param name="gameMaster"></param>
        /// <param name="legacyGameMasters"></param>
        private void CollectData(GameMasterTemplate gameMasterTemplate, IEnumerable <GameMasterTemplate> legacyGameMasterTemplates)
        {
            // Get a list of all of the GAME_MASTER files.
            CurrentGameMaster = gameMasterTemplate;
            GameMasters.Add(gameMasterTemplate.FileName, gameMasterTemplate.HaveRawGameMaster);
            foreach (var legacyGameMasterTemplate in legacyGameMasterTemplates)
            {
                GameMasters.Add(legacyGameMasterTemplate.FileName, legacyGameMasterTemplate.HaveRawGameMaster);
            }

            // Process the current GameMaster
            foreach (var itemTemplate in gameMasterTemplate.GameMaster.item_templates)
            {
                try
                {
                    if (itemTemplate.pokemon_settings != null)
                    {
                        PokemonTranslator pokemon = new PokemonTranslator(itemTemplate);
                        Pokemon.Add(pokemon.Key, pokemon);
                    }
                    else if (itemTemplate.move_settings != null)
                    {
                        MoveTranslator move = new MoveTranslator(itemTemplate);
                        PokeMoves.Add(move.Key, move);
                    }
                    else if (itemTemplate.gender_settings != null)
                    {
                        GenderRatioTranslator genderRatio = new GenderRatioTranslator(itemTemplate);

                        // Some Pokemon are duplicated and should be ignored. (E.G. Castform for each of the weathers.)
                        if (GenderRatios.ContainsKey(genderRatio.Key))
                        {
                            continue;
                        }

                        GenderRatios.Add(genderRatio.Key, genderRatio);
                    }
                    else if (itemTemplate.player_level != null)
                    {
                        PlayerLevel = new PlayerLevelTranslator(itemTemplate);
                    }
                    else if (itemTemplate.form_settings != null)
                    {
                        if (itemTemplate.form_settings.forms != null)
                        {
                            FormSettingsTranslator formSettings = new FormSettingsTranslator(itemTemplate);
                            Forms.Add(formSettings.Key, formSettings);
                        }
                    }
                    else if (itemTemplate.friendship_milestone_settings != null)
                    {
                        Friendships.Add(new FriendshipTranslator(itemTemplate));
                    }

                    #region Data I am currently not using.

                    //else if (itemTemplate.avatarCustomization != null)
                    //{
                    //}
                    //else if (itemTemplate.badgeSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.battleSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.camera != null)
                    //{
                    //}
                    //else if (itemTemplate.encounterSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.gymBadgeSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.gymLevel != null)
                    //{
                    //}
                    //else if (itemTemplate.iapItemDisplay != null)
                    //{
                    //}
                    //else if (itemTemplate.iapSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.itemSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.moveSequenceSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.pokemonUpgrades != null)
                    //{
                    //}
                    //else if (itemTemplate.questSettings != null)
                    //{
                    //}
                    //else if (itemTemplate.typeEffective != null)
                    //{
                    //}

                    #endregion Data I am currently not using.
                }
                catch (Exception ex)
                {
                    ConsoleOutput.OutputException(ex, $"Error processing {itemTemplate.template_id} ({gameMasterTemplate.FileName})");
                }
            }

            Legacy.Initialize(gameMasterTemplate, legacyGameMasterTemplates, ManualDataSettings.PokemonAvailability, ManualDataSettings.SpecialMoves);
            foreach (var pokemon in Pokemon.Values)
            {
                pokemon.AssignProperties(Pokemon,
                                         GenderRatios.ContainsKey(pokemon.PokemonSettings.pokemon_id) ? GenderRatios[pokemon.PokemonSettings.pokemon_id] : null,
                                         Legacy.FastMoves.ContainsKey(pokemon.TemplateId) ? Legacy.FastMoves[pokemon.TemplateId] : null,
                                         Legacy.ChargedMoves.ContainsKey(pokemon.TemplateId) ? Legacy.ChargedMoves[pokemon.TemplateId] : null);
            }
        }
Beispiel #5
0
 public static bool HasStab(PokemonTranslator pokemonTranslator, MoveTranslator move)
 {
     return(string.Equals(pokemonTranslator.Type1, move.Type, StringComparison.OrdinalIgnoreCase) ||
            string.Equals(pokemonTranslator.Type2, move.Type, StringComparison.OrdinalIgnoreCase));
 }
Beispiel #6
0
 public static double GetTrueDPS(PokemonTranslator pokemonTranslator, MoveTranslator fastMove, MoveTranslator chargedMove)
 {
     return(GetTrueDPS(pokemonTranslator, fastMove, HasStab(pokemonTranslator, fastMove), chargedMove, HasStab(pokemonTranslator, chargedMove)));
 }
Beispiel #7
0
 public _MoveSet(PokemonTranslator pokemonTranslator, MoveTranslator fastMove, bool fastMoveLegacy, MoveTranslator chargedMove, bool chargedMoveLegacy, bool chargedMoveStab) :
     this(pokemonTranslator, fastMove, fastMoveLegacy, PokeFormulas.HasStab(pokemonTranslator, fastMove), chargedMove, chargedMoveLegacy, chargedMoveStab)
 {
 }