コード例 #1
0
ファイル: PokeCalc.cs プロジェクト: gemmyboy/Stuller_Backend
        }//End Instance()

        //Calculate -: takes in the name of a pokemon and calculates the type strengths/weaknesses.
        public async void Calculate(string pokemonname)
        {
            Pokemon pokemon;

            //Check Cache: if it's not there, pull data and store in cache.
            if (!Cache_PokemonNameToObj.TryGetValue(pokemonname, out pokemon))
            {
                try { pokemon = await PAC.GetResourceAsync <Pokemon>(pokemonname); }
                catch (Exception) { Console.WriteLine("Invalid Pokemon Name or Command!"); return; }
                Cache_PokemonNameToObj.Add(pokemonname, pokemon);
            }

            Output_PokemonData(pokemon.Name, pokemon.Types);

            //Pokemon can be multiple types i.e.: Flying/Normal
            for (int t_iter = 0; t_iter < pokemon.Types.Count; t_iter++)
            {
                PokemonType     t_type = pokemon.Types[t_iter];
                PokeApiNet.Type type;

                //Check Cache: if it's not there, pull data and store in cache.
                if (!Cache_PokemonTypeToTypeObj.TryGetValue(t_type.Type.Name, out type))
                {
                    type = await PAC.GetResourceAsync <PokeApiNet.Type>(t_type.Type.Name);

                    Cache_PokemonTypeToTypeObj.Add(t_type.Type.Name, type);
                }

                Output_TypeVsTypeData(type, t_iter, (t_iter == (pokemon.Types.Count - 1)));
            } //End foreach
        }     //End Calculate()
コード例 #2
0
ファイル: MoveData.cs プロジェクト: Tigidipoipoi/PokemonUnity
 public MoveData(string name, PokemonType type, Category category, int power, float accuracy, int PP,
                 Target target,
                 int priority, bool contact, bool protectable, bool magicCoatable, bool snatchable,
                 Effect[] moveEffects, float[] moveParameters,
                 Contest contest, int appeal, int jamming, string description, string fieldEffect)
 {
     this.name           = name;
     this.type           = type;
     this.category       = category;
     this.power          = power;
     this.accuracy       = accuracy;
     this.PP             = PP;
     this.target         = target;
     this.priority       = priority;
     this.contact        = contact;
     this.protectable    = protectable;
     this.magicCoatable  = magicCoatable;
     this.snatchable     = snatchable;
     this.moveEffects    = moveEffects;
     this.moveParameters = moveParameters;
     this.contest        = contest;
     this.appeal         = appeal;
     this.jamming        = jamming;
     this.description    = description;
     this.fieldEffect    = fieldEffect;
 }
コード例 #3
0
        public static float GetTypeAdvantageMultiplikator(PokemonType Attacker, PokemonType Defender)
        {
            if (Attacker == PokemonType.Normal)
            {
                switch (Defender)
                {
                case PokemonType.Rock: return(0.75f);

                case PokemonType.Ghost: return(0.75f);

                default: return(1);
                }
            }

            if (Attacker == PokemonType.Fight)
            {
                switch (Defender)
                {
                case PokemonType.Normal: return(1.25f);

                case PokemonType.Flying: return(0.75f);

                default: return(1);
                }
            }

            return(1);
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("PokemonTypeID,PokemonTypeName,LastUpdateDate")] PokemonType pokemonType)
        {
            if (id != pokemonType.PokemonTypeID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pokemonType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PokemonTypeExists(pokemonType.PokemonTypeID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pokemonType));
        }
コード例 #5
0
ファイル: PokemonUiData.cs プロジェクト: leeleonis/Cpko
 public PokemonUiData(BotWindowData ownerBot, ulong id, PokemonId pokemonid, string name, //BitmapSource img,
                      int cp, double iv, PokemonFamilyId family, int candy, ulong stamp, bool fav, bool inGym, double level,
                      PokemonMove move1, PokemonMove move2, PokemonType type1, PokemonType type2, int maxCp, BaseStats baseStats,
                      int stamina, int maxStamina, int possibleCp, int candyToEvolve)
 {
     OwnerBot  = ownerBot;
     Favoured  = fav;
     InGym     = inGym;
     Id        = id;
     PokemonId = pokemonid;
     //Image = img;
     Name          = name;
     Cp            = cp;
     Iv            = iv;
     Candy         = candy;
     Family        = family;
     Timestamp     = stamp;
     Level         = level;
     Move1         = move1;
     Move2         = move2;
     Type1         = type1;
     Type2         = type2;
     MaxCp         = maxCp;
     Stats         = baseStats;
     Stamina       = stamina;
     MaxStamina    = maxStamina;
     CandyToEvolve = candyToEvolve;
     PossibleCp    = possibleCp;
 }
コード例 #6
0
        private void DisplaySearchPrompt()
        {
            while (true)
            {
                Console.Clear();
                Console.WriteLine("See strengths and weaknesses of which type? (type below)");
                string userInput = Console.ReadLine();

                PokeTypes poke;
                if (Enum.TryParse(userInput, out poke))
                {
                    PokemonType pokeType = _pokeService.GetPokemonTypeAsync(userInput).Result;

                    Console.Clear();
                    Console.WriteLine($"The strengths and weaknesses of Type {pokeType.Name.ToString().ToUpper()}:\n");

                    DisplayAllDamageRelations(pokeType);
                    Console.ReadLine();
                }
                else
                {
                    continue;
                }
            }
        }
コード例 #7
0
ファイル: TypesManager.cs プロジェクト: teanodonuts/proshine
 public double GetMultiplier(PokemonType attacker, PokemonType defender)
 {
     if (attacker == PokemonType.None || defender == PokemonType.None)
     {
         return(1.0);
     }
     return(_typeChart[attacker][defender]);
 }
コード例 #8
0
ファイル: PokemonExtensions.cs プロジェクト: versx/WhMgr
 public static List <PokemonType> GetWeaknesses(this PokemonType type)
 {
     if (MasterFile.Instance.PokemonTypes.ContainsKey(type))
     {
         return(MasterFile.Instance.PokemonTypes[type].Weaknesses);
     }
     return(new List <PokemonType>());
 }
コード例 #9
0
 public Pokemon(Builder builder)
 {
     _name  = builder._name;
     _color = builder._color;
     _age   = builder._age;
     _type  = builder._type;
     _level = builder._level;
 }
コード例 #10
0
 public Pokemon(string name,
                string description,
                int attack,
                int defense,
                int health, PokemonType type) : base(name, description, attack, defense, health)
 {
     SetPokemonType(type);
 }
コード例 #11
0
 public PokemonAttackStats(PokemonMove move, PokemonType type, int damage, int durationMs, int energy)
 {
     Move       = move;
     Type       = type;
     Energy     = energy;
     Damage     = damage;
     DurationMs = durationMs;
     Dps        = Damage * (1000 / (float)durationMs);
 }
コード例 #12
0
    public PokedexEntry(DexID id, string speciesName, PokemonStats baseStats, PokemonType typeA, PokemonType typeB = PokemonType.none)
    {
        this.id          = id;
        this.speciesName = speciesName;
        this.baseStats   = baseStats;

        this.typeA = typeA;
        this.typeB = typeB;
    }
コード例 #13
0
 /// <summary>
 /// Get a double array of a type who is attacking.
 /// Index by <see cref="PokemonType"/>.
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 public static double[] GetAttacking(PokemonType type)
 {
     double[] attacking = new double[NumberOfTypes];
     for (int i = 0; i < NumberOfTypes; i++)
     {
         attacking[i] = Effectiveness[(int)type, i];
     }
     return(attacking);
 }
コード例 #14
0
        public static double GetMultiplier(PokemonType attack, BattlePokemon target)
        {
            var multiplier = GetMultiplier(attack, target.Pokemon.Type1);

            if (target.Pokemon.Type2 != PokemonType.None)
            {
                multiplier *= GetMultiplier(attack, target.Pokemon.Type2);
            }
            return(multiplier);
        }
コード例 #15
0
        public AnyPokemonStat(PokemonDataWrapper pokemon)
        {
            Data = pokemon;

            MainType  = GameClient.PokemonSettings.Where(f => f.PokemonId == Data.PokemonId).Select(s => s.Type).FirstOrDefault();
            ExtraType = GameClient.PokemonSettings.Where(f => f.PokemonId == Data.PokemonId).Select(s => s.Type2).FirstOrDefault();

            Attack        = GameClient.MoveSettings.Where(f => f.MovementId == Data.Move1).FirstOrDefault();
            SpecialAttack = GameClient.MoveSettings.Where(f => f.MovementId == Data.Move2).FirstOrDefault();
        }
コード例 #16
0
        protected PokeBase(int id, string name, GenerationType generationType, PokemonType firstPokemonType, PokemonType secondPokemonType = PokemonType.None)
        {
            ID   = id;
            Name = name;

            GenerationType = generationType;

            FirstPokemonType  = firstPokemonType;
            SecondPokemonType = secondPokemonType;
        }
コード例 #17
0
    static void Main()
    {
        PokemonType pokemon = new PokemonType();

        pokemon.PokemonTypeInfo();

        ElectricPokemon electricPokemon = new ElectricPokemon();

        electricPokemon.ElectricPokemonInfo();
    }
コード例 #18
0
        public async Task <IActionResult> Create([Bind("PokemonTypeID,PokemonTypeName,LastUpdateDate")] PokemonType pokemonType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pokemonType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pokemonType));
        }
コード例 #19
0
ファイル: AttackInfo.cs プロジェクト: gigawa/PStadiumVR
 //Condition Only
 public AttackInfo(string attackName, PokemonType atype, int app, int aaccuracy, StatusEffects acondition)
 {
     name       = attackName;
     category   = Category.status;
     attackType = atype;
     pp         = app;
     accuracy   = aaccuracy;
     condition  = acondition;
     stat       = Stat.none;
     stage      = 0;
 }
コード例 #20
0
 public Pokemon(string species, string name, int level, PokemonType typeOne, PokemonType typeTwo, string moveOne, string moveThree, string moveFour)
 {
     this.species = species;
     this.name    = name;
     Level        = level;
     this.typeOne = typeOne;
     this.typeTwo = typeTwo;
     MoveOne      = moveOne;
     MoveThree    = moveThree;
     MoveFour     = moveFour;
 }
コード例 #21
0
    public static float GetEffectiveness(PokemonType attackType, PokemonType defenseType)
    {
        if (attackType == PokemonType.None || defenseType == PokemonType.None)
        {
            return(1);
        }
        int row = (int)attackType - 1;
        int col = (int)defenseType - 1;

        return(chart[row][col]);
    }
コード例 #22
0
        public async Task <TypeViewModel> GetTypeInformation(string typeName)
        {
            var apiType = await _pokemonApi.GetPokemonTypeInfo(typeName);

            var pokemonType = new TypeViewModel();

            pokemonType.TypeName = apiType.name;

            foreach (var type in apiType.damage_relations.double_damage_from)
            {
                var thisType = new PokemonType();
                thisType.TypeName = type.name;
                thisType.TypeUrl  = type.url;
                pokemonType.DoubleDamageFrom.Add(thisType);
            }

            foreach (var type in apiType.damage_relations.double_damage_to)
            {
                var thisType = new PokemonType();
                thisType.TypeName = type.name;
                thisType.TypeUrl  = type.url;
                pokemonType.DoubleDamageTo.Add(thisType);
            }
            foreach (var type in apiType.damage_relations.half_damage_from)
            {
                var thisType = new PokemonType();
                thisType.TypeName = type.name;
                thisType.TypeUrl  = type.url;
                pokemonType.HalfDamageFrom.Add(thisType);
            }
            foreach (var type in apiType.damage_relations.half_damage_to)
            {
                var thisType = new PokemonType();
                thisType.TypeName = type.name;
                thisType.TypeUrl  = type.url;
                pokemonType.HalfDamageTo.Add(thisType);
            }
            foreach (var type in apiType.damage_relations.no_damage_from)
            {
                var thisType = new PokemonType();
                thisType.TypeName = type.name;
                thisType.TypeUrl  = type.url;
                pokemonType.NoDamageFrom.Add(thisType);
            }
            foreach (var type in apiType.damage_relations.no_damage_to)
            {
                var thisType = new PokemonType();
                thisType.TypeName = type.name;
                thisType.TypeUrl  = type.url;
                pokemonType.NoDamageTo.Add(thisType);
            }
            return(pokemonType);
        }
コード例 #23
0
    public static float TypeEffectiveness(Pokemon defensor, PokemonType skillType)
    {
        float effectiveness = 1f;

        foreach (PokemonType pokemonType in defensor.types)
        {
            effectiveness *= TypeChart[(int)skillType, (int)pokemonType];
        }

        Debug.Log("효과: " + effectiveness);
        return(effectiveness);
    }
コード例 #24
0
    public bool HasType(PokemonType type)
    {
        foreach (PokemonType pokemonType in types)
        {
            if (type == pokemonType)
            {
                return(true);
            }
        }

        return(false);
    }
コード例 #25
0
 public static string GetLocalisedName(PokemonType type, CultureInfo culture)
 {
     try
     {
         return(LanguageResources.ResourceManager.GetString("Type_" + type.ToString(), culture));
     }
     catch (Exception ex)
     {
         Console.WriteLine(nameof(GetLocalisedName) + ": " + ex.Message);
         return(type.ToString());
     }
 }
コード例 #26
0
ファイル: AttackInfo.cs プロジェクト: gigawa/PStadiumVR
 //Attack with condition
 public AttackInfo(string attackName, Category acategory, PokemonType atype, int app, int apower, int aaccuracy, StatusEffects acondition, Stat astat, int astage)
 {
     name       = attackName;
     category   = acategory;
     attackType = atype;
     pp         = app;
     power      = apower;
     accuracy   = aaccuracy;
     condition  = acondition;
     stat       = astat;
     stage      = astage;
 }
コード例 #27
0
 public Pokemon(string speciesName, string nickName, int level, PokemonType pokemonType, PokemonType secondaryType, string moveOne, string moveTwo, string moveThree, string moveFour)
 {
     PokemonSpeciesName = speciesName;
     PokemonNickName    = nickName;
     Level         = level;
     PokemonType   = pokemonType;
     SecondaryType = secondaryType;
     MoveOne       = moveOne;
     MoveTwo       = moveTwo;
     MoveThree     = moveThree;
     MoveFour      = moveFour;
 }
コード例 #28
0
ファイル: BadgeHelper.cs プロジェクト: nilllzz/pokemon-redux
 public static double GetBadgeTypeMultilplier(PokemonType type)
 {
     if (TYPE_BUFF_BADGES.ContainsKey(type))
     {
         var badge = TYPE_BUFF_BADGES[type];
         if (Controller.ActivePlayer.Badges.Contains(badge))
         {
             return(1.125);
         }
     }
     return(1);
 }
コード例 #29
0
    private static float Stab(Pokemon attacker, PokemonType skillType)
    {
        foreach (PokemonType pokemonType in attacker.types)
        {
            if (pokemonType == skillType)
            {
                return(1.5f);
            }
        }

        return(1f);
    }
コード例 #30
0
ファイル: AttackInfo.cs プロジェクト: gigawa/PStadiumVR
 //Attack only
 public AttackInfo(string attackName, Category acategory, PokemonType atype, int app, int apower, int aaccuracy)
 {
     name       = attackName;
     category   = acategory;
     attackType = atype;
     pp         = app;
     power      = apower;
     accuracy   = aaccuracy;
     condition  = StatusEffects.none;
     stat       = Stat.none;
     stage      = 0;
 }
コード例 #31
0
ファイル: BasePokemon.cs プロジェクト: Ricky7/Unity_Pokemon
 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;
 }
コード例 #32
0
ファイル: TypesManager.cs プロジェクト: Rympex/proshine
 public double GetMultiplier(PokemonType attacker, PokemonType defender)
 {
     if (attacker == PokemonType.None || defender == PokemonType.None)
     {
         return 1.0;
     }
     return _typeChart[attacker][defender];
 }
コード例 #33
0
ファイル: DummyTable.cs プロジェクト: Nexus87/PokeClone
 public float GetModifier(PokemonType source, PokemonType target)
 {
     return table[(int)source, (int)target];
 }
コード例 #34
0
ファイル: Data Types.cs プロジェクト: NoahSanders/Pokemon
 /// <summary>
 /// Creates an instance of a PokeType with the given PokemonType
 /// </summary>
 /// <param name="type">The type of the PokeType to instantiate</param>
 /// <returns>The created instance of the PokeType</returns>
 public static PokeType GetInstance(PokemonType type)
 {
     return GetInstance(type.ID());
 }
コード例 #35
0
ファイル: Factory.cs プロジェクト: LaudableBauble/Insipidus
        /// <summary>
        /// Create a Pokémon.
        /// </summary>
        /// <param name="name">The name of the pokémon.</param>
        /// <param name="gender">The gender of the pokémon.</param>
        /// <param name="type">The type of the pokémon.</param>
        /// <param name="hp">The max HP of the pokémon.</param>
        /// <param name="attackPhysical">The physical attack power of the pokémon.</param>
        /// <param name="defensePhysical">The physical defense power of the pokémon.</param>
        /// <param name="specialAttack">The special attack power of the pokémon.</param>
        /// <param name="specialDefense">The special defense power of the pokémon.</param>
        /// <param name="powerPhysical">The physical power of the move.</param>
        /// <param name="powerSpecial">The special power of the move.</param>
        /// <param name="speed">The speed of the pokémon.</param>
        /// <param name="level">The level of the pokémon.</param>
        /// <param name="moves">The moves that this pokémon knows.</param>
        /// <param name="maxEnergy">The max energy of the pokémon.</param>
        /// <returns>The pokémon created with the given data.</returns>
        public Creature CreatePokemon(string name, Gender gender, PokemonType type, float hp, float attackPhysical, float defensePhysical,
            float specialAttack, float specialDefense, float speed, int level, List<Move> moves, float maxEnergy)
        {
            //Create the list of types.
            List<PokemonType> types = new List<PokemonType>();
            types.Add(type);

            //Return the move.
            return CreatePokemon(name, gender, types, hp, attackPhysical, defensePhysical, specialAttack, specialDefense, speed, level, moves, maxEnergy);
        }
コード例 #36
0
ファイル: Program.cs プロジェクト: Xaphoon36/PokeWatch
 //Generate user friendly and hashtag friendly pokemon names
 //Also, this client straight up spells some of the pokemon wrong.
 private static string SpellCheckPokemon(PokemonType pokemon, bool isHashtag = false)
 {
     switch (pokemon)
     {
         case PokemonType.Charmender:
             return "Charmander";
         case PokemonType.Clefary:
             return "Clefairy";
         case PokemonType.Geoduge:
             return "Geodude";
         case PokemonType.Farfetchd:
             return isHashtag ? "Farfetchd" : "Farfetch'd";
         case PokemonType.MrMime:
             return isHashtag ? "MrMime" : "Mr. Mime";
         case PokemonType.NidoranFemale:
             return isHashtag ? "Nidoran" : "Nidoran♀";
         case PokemonType.NidoranMale:
             return isHashtag ? "Nidoran" : "Nidoran♂";
         default:
             return pokemon.ToString();
     }
 }
コード例 #37
0
ファイル: Factory.cs プロジェクト: LaudableBauble/Insipidus
        /// <summary>
        /// Create a move.
        /// </summary>
        /// <param name="name">The name of the move.</param>
        /// <param name="description">The description of the move.</param>
        /// <param name="type">The first type of the move.</param>
        /// <param name="powerPhysical">The physical power of the move.</param>
        /// <param name="powerSpecial">The special power of the move.</param>
        /// <param name="accuracy">The accuracy of the move.</param>
        /// <param name="energyConsume">The energy consumed by the move.</param>
        /// <param name="status">The status ailments that the moves afflicts victims with.</param>
        /// <param name="force">The physical force behind the move.</param>
        /// <returns>The move created with the given data.</returns>
        public Move CreateMove(string name, string description, PokemonType type, int powerPhysical, int powerSpecial, int accuracy, int energyConsume,
            Status status, float force)
        {
            //Create the list of types.
            List<PokemonType> types = new List<PokemonType>();
            types.Add(type);

            //Return the move.
            return CreateMove(name, description, types, powerPhysical, powerSpecial, accuracy, energyConsume, status, force);
        }