示例#1
0
 public void AddMember(BasePokemon bp)
 {
     this.PName        = bp.PName;
     this.image        = bp.image;
     this.type         = bp.type;
     this.rarity       = bp.rarity;
     this.HP           = bp.HP;
     this.maxHP        = bp.maxHP;
     this.AttackStat   = bp.AttackStat;
     this.DefenceStat  = bp.DefenceStat;
     this.pokemonStats = bp.pokemonStats;
     this.canEvolve    = bp.canEvolve;
     this.evolveTo     = bp.evolveTo;
     this.level        = bp.level;
 }
示例#2
0
 public void AddMember(BasePokemon bp)
 {
     this.PName = bp.PName;
     this.image = bp.image;
     this.biomeFound = bp.biomeFound;
     this.type = bp.type;
     this.rarity = bp.rarity;
     this.HP = bp.HP;
     this.maxHP = bp.maxHP;
     this.AttackStat = bp.AttackStat;
     this.DefenceStat = bp.DefenceStat;
     this.pokemonStats = bp.pokemonStats;
     this.canEvolve = bp.canEvolve;
     this.evolveTo = bp.evolveTo;
     this.level = bp.level;
 }
示例#3
0
        private static string CreateEvolutionConditionString(PokemonEvolution pokemonEvolution)
        {
            var minimumHappiness = pokemonEvolution.MinimumHappiness != null ? "with High Happiness " : "";
            var dayTime          = pokemonEvolution.TimeOfDay != null ? $"during {pokemonEvolution.TimeOfDay}time " : "";
            var minimumLevel     = pokemonEvolution.MinimumLevel != null
                ? $"at level {pokemonEvolution.MinimumLevel} "
                : "";
            var minimumBeauty    = pokemonEvolution.MinimumBeauty != null ? "with max beauty " : "";
            var minimumAffection = pokemonEvolution.MinimumAffection != null
                ? $"with minimum affection of {pokemonEvolution.MinimumAffection} "
                : "";
            var triggerItem  = pokemonEvolution.TriggerItemId != null ? $"{pokemonEvolution.TriggerItem.Name} " : "";
            var knowMove     = pokemonEvolution.KnownMoveId != null ? $"knowing {pokemonEvolution.KnownMove.Name} " : "";
            var knowMoveType = pokemonEvolution.KnownMoveTypeId != null
                ? $"knowing a {pokemonEvolution.KnownMoveType.Name} type "
                : "";
            var location      = pokemonEvolution.LocationId != null ? $"in {pokemonEvolution.Location.Name} " : "";
            var heldItem      = pokemonEvolution.HeldItemId != null ? $"holding {pokemonEvolution.HeldItem.Name} " : "";
            var gender        = pokemonEvolution.Gender == 1 ? "(Female) " : pokemonEvolution.Gender == 2 ? "(Male) " : "";
            var physicalStats = pokemonEvolution.RelativePhysicalStats == 1 ? "(Attack > Defense)"
                : pokemonEvolution.RelativePhysicalStats == -1 ? "(Attack < Defense)"
                : pokemonEvolution.RelativePhysicalStats == 0 ? "(Attack = Defense)"
                : "";
            var speciesInParty = pokemonEvolution.PartySpeciesId != null
                ? $"with {pokemonEvolution.PartySpecies.Pokemon.Name} on party "
                : "";

            var evolutionCondition =
                $"({pokemonEvolution.EvolutionTrigger.Name.FirstCharToUpper().Replace("-", " ")} " +
                minimumHappiness +
                minimumLevel +
                triggerItem +
                knowMove +
                location +
                heldItem +
                dayTime +
                gender +
                physicalStats +
                speciesInParty +
                minimumBeauty +
                minimumAffection +
                knowMoveType;

            return(evolutionCondition.Remove(evolutionCondition.LastIndexOf(" ", StringComparison.Ordinal)) + ")");
        }
示例#4
0
 public void AddMember(BasePokemon bp)
 {
     this.Name         = bp.Name;
     this.image        = bp.image;
     this.biomeFound   = bp.biomeFound;
     this.type1        = bp.type1;
     this.type2        = bp.type2;
     this.rarity       = bp.rarity;
     this.HP           = bp.HP;
     this.currentHP    = bp.currentHP;
     this.attStat      = bp.attStat;
     this.defStat      = bp.defStat;
     this.spAttStat    = bp.spAttStat;
     this.spDefStat    = bp.spDefStat;
     this.speedStat    = bp.speedStat;
     this.pokemonStats = bp.pokemonStats;
     this.level        = bp.level;
     this.canEvolve    = bp.canEvolve;
     this.evolveTo     = bp.evolveTo;
 }
示例#5
0
        public async Task <ObservableCollection <PokemonEvolution> > LoadPossibleEvolutionsAsync(int speciesId, GameVersion version, int displayLanguage, CancellationToken token)
        {
            try
            {
                string query = "SELECT ps.id, psn.name, pe.min_level, etn.name AS evolution_trigger, pe.evolution_item_id FROM pokemon_v2_pokemonspecies ps\n" +
                               "LEFT JOIN\n(SELECT def.pokemon_species_id AS id, IFNULL(curr.name, def.name) AS name FROM pokemon_v2_pokemonspeciesname def\n" +
                               "LEFT JOIN pokemon_v2_pokemonspeciesname curr ON def.pokemon_species_id = curr.pokemon_species_id AND def.language_id = 9 AND curr.language_id = ?\n" +
                               "GROUP BY def.pokemon_species_id)\nAS psn ON ps.id = psn.id\n" +
                               "LEFT JOIN pokemon_v2_pokemonevolution pe ON pe.evolved_species_id = ps.id\n" +
                               "LEFT JOIN pokemon_v2_evolutiontrigger et ON pe.evolution_trigger_id = et.id\n" +
                               "LEFT JOIN\n(SELECT e.evolution_trigger_id AS id, COALESCE(o.name, e.name) AS name FROM pokemon_v2_evolutiontriggername e\n" +
                               "LEFT OUTER JOIN pokemon_v2_evolutiontriggername o ON e.evolution_trigger_id = o.evolution_trigger_id and o.language_id = ?\n" +
                               "WHERE e.language_id = 9\nGROUP BY e.evolution_trigger_id)\nAS etn ON et.id = etn.id\n" +
                               "WHERE ps.evolves_from_species_id = ? AND ps.generation_id <= ?";
                IEnumerable <DbPokemonEvolution> evolutions = await _connection.QueryAsync <DbPokemonEvolution>(token, query, new object[] { displayLanguage, displayLanguage, speciesId, version.Generation });

                var result = new ObservableCollection <PokemonEvolution>();
                foreach (DbPokemonEvolution dbEvolution in evolutions)
                {
                    var evolution = new PokemonEvolution
                    {
                        EvolvesTo = new SpeciesName {
                            Id = dbEvolution.Id, Name = dbEvolution.Name
                        },
                        MinLevel         = dbEvolution.MinLevel,
                        EvolutionTrigger = dbEvolution.EvolutionTrigger
                    };
                    if (dbEvolution.EvolutionItemId != null)
                    {
                        evolution.EvolutionItem = await LoadItemAsync((int)dbEvolution.EvolutionItemId, displayLanguage, token);
                    }
                    result.Add(evolution);
                }
                return(result);
            }
            catch (Exception)
            {
                return(new ObservableCollection <PokemonEvolution>());
            }
        }
 public void AddMember(BasePokemon bp)
 {
     //inherits all values of parent into a clone of the manually serialized prefab
     this.PName          = bp.PName;
     this.image          = bp.image;
     this.biomeFound     = bp.biomeFound;
     this.type           = bp.type;
     this.rarity         = bp.rarity;
     this.HP             = bp.HP;
     this.maxHP          = bp.maxHP;
     this.AttackStat     = bp.AttackStat;
     this.DefenceStat    = bp.DefenceStat;
     this.SpeedStat      = bp.SpeedStat;
     this.SpAttackStat   = bp.SpAttackStat;
     this.SpDefenceStat  = bp.SpDefenceStat;
     this.EvasionStat    = bp.EvasionStat;
     this.HPGain         = bp.HPGain;
     this.AttackGain     = bp.AttackGain;
     this.DefenceGain    = bp.DefenceGain;
     this.SpeedGain      = bp.SpeedGain;
     this.SpAttackGain   = bp.SpAttackGain;
     this.SpDefenceGain  = bp.SpDefenceGain;
     this.XP             = bp.XP;
     this.XPtoLvl        = bp.XPtoLvl;
     this.canEvolve      = bp.canEvolve;
     this.evolveTo       = bp.evolveTo;
     this.level          = bp.level;
     this.learnableMoves = bp.learnableMoves;
     this.Move1C         = bp.Move1C;
     this.Move2C         = bp.Move2C;
     this.Move3C         = bp.Move3C;
     this.Move4C         = bp.Move4C;
     this.Move1PP        = bp.Move1PP;
     this.Move2PP        = bp.Move2PP;
     this.Move3PP        = bp.Move3PP;
     this.Move4PP        = bp.Move4PP;
 }
示例#7
0
        }                                               //manually

        ///<summary>Int value doesnt matter, ex `.ToString(1);`</summary>
        public override string ToString()
        {
            return(string.Format("new PokemonData({0} {1} {2} {3} {4} {5} {6} {7} {8} {9} " +
                                 "{10} {11} {12} {13} {14} {15} {16} {17} {18} {19} " +
                                 "{20} {21} {22} {23} {24} {25} {26} {27} {28} {29} " +
                                 "{30} {31}),",
                                 NAME == null ? ""                   : "\nId: Pokemons." + System.Text.RegularExpressions.Regex.Replace(NAME.ToUpper().Replace('-', '_'), @"[\.']", ""),
                                 RegionalDex == null ? ""            : ",\n//regionalDex: new int[]{" + RegionalDex + "}",
                                 Type1 == null || Type1 == "NONE" ? "" : ",\ntype1: Types." + Type1,
                                 Type2 == null || Type2 == "NONE" ? "" : ",\ntype2: Types." + Type2,
                                 Ability1 == null || Ability1 == "NONE" ? "" : ",\nability1: Abilities." + Ability1,
                                 Ability2 == null || Ability2 == "NONE" ? "" : ",\nability2: Abilities." + Ability2,
                                 HiddenAbility == null || HiddenAbility == "NONE" ? "" : ",\nhiddenAbility: Abilities." + HiddenAbility,
                                 MaleRatio == null ? ""              : ",\nmaleRatio: " + MaleRatio,
                                 CatchRate == null ? ""              : ",\ncatchRate: " + CatchRate,
                                 EggGroup1 == null || EggGroup1 == "NONE" ? "" : ",\neggGroup1: EggGroups." + EggGroup1,
                                 EggGroup2 == null || EggGroup2 == "NONE" ? "" : ",\neggGroup2: EggGroups." + EggGroup2,
                                 HatchTime == null ? ""              : ",\nhatchTime: " + HatchTime,
                                 Height == null ? ""                 : ",\nheight: " + Height,
                                 Weight == null ? ""                 : ",\nweight: " + Weight,
                                 LevelingRate == null ? ""           : ",\nlevelingRate: LevelingRate." + LevelingRate,//\n" +
                                 PokedexColor == null ? ""           : ",\npokedexColor: Color." + PokedexColor,
                                 BaseFriendship == null ? ""         : ",\nbaseFriendship: " + BaseFriendship,
                                 EXPYield == null ? ""               : ",\nbaseExpYield: " + EXPYield,
                                 BSHP == null ? ""                   : ",\nbaseStatsHP: " + BSHP,
                                 BSATK == null ? ""                  : ",baseStatsATK: " + BSATK,
                                 BSDEF == null ? ""                  : ",baseStatsDEF: " + BSDEF,
                                 BSSPA == null ? ""                  : ",baseStatsSPA: " + BSSPA,
                                 BSSPD == null ? ""                  : ",baseStatsSPD: " + BSSPD,
                                 BSSPE == null ? ""                  : ",baseStatsSPE: " + BSSPE,//\n" +
                                 EYHP == null || EYHP == "0" ? ""    : ",\nevHP: " + EYHP,
                                 EYATK == null || EYATK == "0" ? ""  : ",\nevATK: " + EYATK,
                                 EYDEF == null || EYDEF == "0" ? ""  : ",\nevDEF: " + EYDEF,
                                 EYSPA == null || EYSPA == "0" ? ""  : ",\nevSPA: " + EYSPA,
                                 EYSPD == null || EYSPD == "0" ? ""  : ",\nevSPD: " + EYSPD,
                                 EYSPE == null || EYSPE == "0" ? ""  : ",\nevSPE: " + EYSPE, //\n" +
                                                                                             //NAME == null? "" : "$"luminance: "+Luminance,\n" +
                                 ",\nmovesetmoves: new PokemonMoveset[] " +
                                                                                             //$"\n" +
                                 "{\n" +
                                                                                             //trimend goes on last value, but there's also a comma before every value so it's fine
                                                                                             //it balances out the extra, and also if the value is null, you're not left with additional
                                                                                             //or dangling commas to trigger any errors.
                                 Moves.Replace("'", "").TrimEnd(',') + "\n" +
                                 "}",
                                 //$"\n" +
                                 PokemonEvolution == null ? "" : ",\nevolution: new IPokemonEvolution[] {" + PokemonEvolution.TrimEnd(',') + "\n}"
                                 //,HeldItem == null? "" : "heldItem: "+HeldItem +","
                                 ));
        }
示例#8
0
        public async Task <ObservableCollection <PokemonEvolution> > LoadEvolutionGroupAsync(int speciesId, GameVersion version, int displayLanguage, CancellationToken token)
        {
            try
            {
                string query = "SELECT ps.id, psn.name, pe.min_level, etn.name AS evolution_trigger, pe.evolution_item_id, pe.location_id, ec.baby_trigger_item_id,\n" +
                               "pe.min_happiness, pe.time_of_day, pe.held_item_id, ps.is_baby FROM pokemon_v2_pokemonspecies ps\n" +
                               "LEFT JOIN\n(SELECT def.pokemon_species_id AS id, IFNULL(curr.name, def.name) AS name FROM pokemon_v2_pokemonspeciesname def\n" +
                               "LEFT JOIN pokemon_v2_pokemonspeciesname curr ON def.pokemon_species_id = curr.pokemon_species_id AND def.language_id = 9 AND curr.language_id = ?\n" +
                               "GROUP BY def.pokemon_species_id)\nAS psn ON ps.id = psn.id\n" +
                               "LEFT JOIN pokemon_v2_pokemonevolution pe ON pe.evolved_species_id = ps.id\n" +
                               "LEFT JOIN pokemon_v2_evolutiontrigger et ON pe.evolution_trigger_id = et.id\n" +
                               "LEFT JOIN\n(SELECT e.evolution_trigger_id AS id, COALESCE(o.name, e.name) AS name FROM pokemon_v2_evolutiontriggername e\n" +
                               "LEFT OUTER JOIN pokemon_v2_evolutiontriggername o ON e.evolution_trigger_id = o.evolution_trigger_id and o.language_id = ?\n" +
                               "WHERE e.language_id = 9\n\nGROUP BY e.evolution_trigger_id)\nAS etn ON et.id = etn.id\n" +
                               "LEFT JOIN pokemon_v2_evolutionchain ec ON ec.id = ps.evolution_chain_id\n" +
                               "WHERE ps.evolution_chain_id = (SELECT evolution_chain_id FROM pokemon_v2_pokemonspecies WHERE id = ?) AND ps.generation_id <= ?\n" +
                               "ORDER BY ps.'order'";
                IEnumerable <DbPokemonEvolution> evolutions = await _connection.QueryAsync <DbPokemonEvolution>(token, query, new object[]
                {
                    displayLanguage,
                    displayLanguage,
                    speciesId,
                    version.Generation
                });

                var result = new ObservableCollection <PokemonEvolution>();
                foreach (DbPokemonEvolution evolution in evolutions)
                {
                    var evo = new PokemonEvolution
                    {
                        DayTime          = evolution.TimeOfDay,
                        EvolutionTrigger = evolution.EvolutionTrigger,
                        EvolvesTo        = new SpeciesName {
                            Id = evolution.Id, Name = evolution.Name
                        },
                        MinLevel     = evolution.MinLevel,
                        MinHappiness = evolution.MinHappiness
                    };

                    if (evolution.IsBaby)
                    {
                        evo.EvolutionTrigger = "Zucht";
                    }

                    if (evolution.LocationId != null)
                    {
                        Location loc = await LoadLocationFromIdAsync((int)evolution.LocationId, version, displayLanguage, token);

                        if (loc == null)
                        {
                            continue;
                        }
                        evo.EvolutionLocation = loc;
                    }
                    if (evolution.EvolutionItemId != null)
                    {
                        evo.EvolutionItem = await LoadItemAsync((int)evolution.EvolutionItemId, displayLanguage, token);
                    }
                    else if (evolution.HeldItemId != null)
                    {
                        evo.EvolutionItem = await LoadItemAsync((int)evolution.HeldItemId, displayLanguage, token);
                    }
                    else if (evolution.IsBaby && evolution.BabyTriggerItemId != null)
                    {
                        evo.EvolutionItem = await LoadItemAsync((int)evolution.BabyTriggerItemId, displayLanguage, token);
                    }
                    result.Add(evo);
                }
                return(result);
            }
            catch (Exception)
            {
                return(new ObservableCollection <PokemonEvolution>());
            }
        }