Пример #1
0
        public static float getEffectivityMultiplier(PokeType from, PokemonInfo victim)
        {
            PokeType[] types = new PokeType[2];
            if (victim == null)
            {
                Console.WriteLine("victim null");
            }
            types[0] = victim.type1;
            types[1] = victim.type2;
            float delta = 1;

            foreach (PokeType t in types)
            {
                if (t != null)
                {
                    if (t == Normal)
                    {
                        if (from == Fighting)
                        {
                            delta++;
                        }
                        if (from == Ghost)
                        {
                            return(0);
                        }
                    }
                    if (t == Grass)
                    {
                        if (from == Fire || from == Poison || from == Bug || from == Flying || from == Ice)
                        {
                            delta++;
                        }
                        if (from == Ground || from == Water || from == Electric || from == Grass)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Fire)
                    {
                        if (from == Ground || from == Rock || from == Water)
                        {
                            delta++;
                        }
                        if (from == Fire || from == Steel || from == Grass || from == Bug || from == Ice)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Water)
                    {
                        if (from == Grass || from == Electric)
                        {
                            delta++;
                        }
                        if (from == Water || from == Steel || from == Fire || from == Ice)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Flying)
                    {
                        if (from == Ice || from == Electric || from == Rock)
                        {
                            delta++;
                        }
                        if (from == Fighting || from == Bug || from == Grass)
                        {
                            delta -= 0.5f;
                        }
                        if (from == Ground)
                        {
                            return(0);
                        }
                    }
                    if (t == Electric)
                    {
                        if (from == Ground)
                        {
                            delta++;
                        }
                        if (from == Flying || from == Steel || from == Electric)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Ice)
                    {
                        if (from == Fighting || from == Fire || from == Steel || from == Rock)
                        {
                            delta++;
                        }
                        if (from == Ice)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Fighting)
                    {
                        if (from == Flying || from == Psychic)
                        {
                            delta++;
                        }
                        if (from == Rock || from == Bug || from == Dark)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Poison)
                    {
                        if (from == Psychic || from == Ground)
                        {
                            delta++;
                        }
                        if (from == Poison || from == Grass || from == Bug || from == Fighting)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Ground)
                    {
                        if (from == Grass || from == Water || from == Ice)
                        {
                            delta++;
                        }
                        if (from == Poison || from == Rock)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Steel)
                    {
                        if (from == Fire || from == Fighting || from == Ground)
                        {
                            delta++;
                        }
                        if (from == Steel || from == Normal || from == Flying || from == Rock || from == Bug || from == Ghost || from == Dark || from == Grass || from == Electric || from == Psychic || from == Ice || from == Dragon)
                        {
                            delta -= 0.5f;
                        }
                        if (from == Poison)
                        {
                            return(0);
                        }
                    }
                    if (t == Psychic)
                    {
                        if (from == Bug)
                        {
                            delta++;
                        }
                        if (from == Psychic || from == Fighting)
                        {
                            delta -= 0.5f;
                        }
                        if (from == Ghost)
                        {
                            return(0);
                        }
                    }
                    if (t == Bug)
                    {
                        if (from == Fire || from == Flying || from == Rock || from == Poison)
                        {
                            delta++;
                        }
                        if (from == Bug || from == Grass || from == Ground)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Rock)
                    {
                        if (from == Ground || from == Grass || from == Water || from == Fighting)
                        {
                            delta++;
                        }
                        if (from == Rock || from == Flying || from == Poison || from == Fire)
                        {
                            delta -= 0.5f;
                        }
                    }
                    if (t == Dark)
                    {
                        if (from == Fighting || from == Bug)
                        {
                            delta++;
                        }
                        if (from == Ghost || from == Dark)
                        {
                            delta -= 0.5f;
                        }
                        if (from == Psychic)
                        {
                            return(0);
                        }
                    }
                    if (t == Ghost)
                    {
                        if (from == Ghost || from == Dark)
                        {
                            delta++;
                        }
                        if (from == Poison || from == Bug)
                        {
                            delta -= 0.5f;
                        }
                        if (from == Normal || from == Fighting)
                        {
                            return(0);
                        }
                    }
                    if (t == Dragon)
                    {
                        if (from == Dragon || from == Ice)
                        {
                            delta++;
                        }
                        if (from == Fire || from == Grass || from == Water || from == Electric)
                        {
                            delta -= 0.5f;
                        }
                    }
                }
            }
            return(delta);
        }
Пример #2
0
		public static float getEffectivityMultiplier(PokeType from, PokemonInfo victim) {
			PokeType[] types = new PokeType[2];
			if (victim == null) Console.WriteLine("victim null");
			types[0] = victim.type1;
			types[1] = victim.type2;
			float delta = 1;
			foreach (PokeType t in types) {
				if (t != null) {
					if (t == Normal) {
						if (from == Fighting) delta++;
						if (from == Ghost) return 0;
					}
					if (t == Grass) {
						if (from == Fire || from == Poison || from == Bug || from == Flying || from == Ice) delta++;
						if (from == Ground || from == Water || from == Electric || from == Grass) delta -= 0.5f;
					}
					if (t == Fire) {
						if (from == Ground || from == Rock || from == Water) delta++;
						if (from == Fire || from == Steel || from == Grass || from == Bug || from == Ice) delta -= 0.5f;
					}
					if (t == Water) {
						if (from == Grass || from == Electric) delta++;
						if (from == Water || from == Steel || from == Fire || from == Ice) delta -= 0.5f;
					}
					if (t == Flying) {
						if (from == Ice || from == Electric || from == Rock) delta++;
						if (from == Fighting || from == Bug || from == Grass) delta -= 0.5f;
						if (from == Ground) return 0;
					}
					if (t == Electric) {
						if (from == Ground) delta++;
						if (from == Flying || from == Steel || from == Electric) delta -= 0.5f;
					}
					if (t == Ice) {
						if (from == Fighting || from == Fire || from == Steel || from == Rock) delta++;
						if (from == Ice) delta -= 0.5f;
					}
					if (t == Fighting) {
						if (from == Flying || from == Psychic) delta++;
						if (from == Rock || from == Bug || from == Dark) delta -= 0.5f;
					}
					if (t == Poison) {
						if (from == Psychic || from == Ground) delta++;
						if (from == Poison || from == Grass || from == Bug || from == Fighting) delta -= 0.5f;
					}
					if (t == Ground) {
						if (from == Grass || from == Water || from == Ice) delta++;
						if (from == Poison || from == Rock) delta -= 0.5f;
					}
					if (t == Steel) {
						if (from == Fire || from == Fighting || from == Ground) delta++;
						if (from == Steel || from == Normal || from == Flying || from == Rock || from == Bug || from == Ghost || from == Dark || from == Grass || from == Electric || from == Psychic || from == Ice || from == Dragon) delta -= 0.5f;
						if (from == Poison) return 0;
					}
					if (t == Psychic) {
						if (from == Bug) delta++;
						if (from == Psychic || from == Fighting) delta -= 0.5f;
						if (from == Ghost) return 0;
					}
					if (t == Bug) {
						if (from == Fire || from == Flying || from == Rock || from == Poison) delta++;
						if (from == Bug || from == Grass || from == Ground) delta -= 0.5f;
					}
					if (t == Rock) {
						if (from == Ground || from == Grass || from == Water || from == Fighting) delta++;
						if (from == Rock || from == Flying || from == Poison || from == Fire) delta -= 0.5f;
					}
					if (t == Dark) {
						if (from == Fighting || from == Bug) delta++;
						if (from == Ghost || from == Dark) delta -= 0.5f;
						if (from == Psychic) return 0;
					}
					if (t == Ghost) {
						if (from == Ghost || from == Dark) delta++;
						if (from == Poison || from == Bug) delta -= 0.5f;
						if (from == Normal || from == Fighting) return 0;

					} if (t == Dragon) {
						if (from == Dragon || from == Ice) delta++;
						if (from == Fire || from == Grass || from == Water || from == Electric) delta -= 0.5f;
					}
				}
			}
			return delta;

		}
Пример #3
0
        public void LoadFromIni()
        {
            string loc = Environment.CurrentDirectory + "\\Datas\\pokemons.ini";

            FileIniDataParser parser = new FileIniDataParser();
            IniData           ini    = parser.LoadFile(loc);

            for (int i = 1; i <= 649; i++)
            {
                KeyDataCollection section = ini.Sections["" + i];
                PokemonInfo       info    = new PokemonInfo(i);
                info.name         = iniValue(section, "Name");
                info.internalname = iniValue(section, "InternalName");
                info.type1        = PokeType.getTypeFromString(iniValue(section, "Type1"));
                info.type2        = PokeType.getTypeFromString(iniValue(section, "Type2"));

                //base stat parse
                string   basestats = iniValue(section, "BaseStats");
                string[] bsspl     = basestats.Split(',');
                int      _i        = 0;
                foreach (string _thres in bsspl)
                {
                    int val = Int32.Parse(_thres);
                    if (_i == 0)
                    {
                        info.hp = val;
                    }
                    else if (_i == 1)
                    {
                        info.attack = val;
                    }
                    else if (_i == 2)
                    {
                        info.spattack = val;
                    }
                    else if (_i == 3)
                    {
                        info.defence = val;
                    }
                    else if (_i == 4)
                    {
                        info.spdefence = val;
                    }
                    else if (_i == 5)
                    {
                        info.speed = val;
                    }
                    else
                    {
                        Console.WriteLine("what kind of f****d up shit is this");
                    }
                    _i++;
                }

                info.genderrate = new GenderRate();                 //todo
                info.xpcurve    = XpCurve.GetCurve(iniValue(section, "GrowthRate"));
                info.basexp     = Int32.Parse(iniValue(section, "BaseEXP"));

                //EV stat parse
                string   evyeld = iniValue(section, "BaseStats");
                string[] evspl  = evyeld.Split(',');
                int      j      = 0;
                foreach (string _thres in evspl)
                {
                    int val = Int32.Parse(_thres);
                    if (j == 0)
                    {
                        info.evhp = val;
                    }
                    else if (j == 1)
                    {
                        info.evattack = val;
                    }
                    else if (j == 2)
                    {
                        info.evspattack = val;
                    }
                    else if (j == 3)
                    {
                        info.evdefence = val;
                    }
                    else if (j == 4)
                    {
                        info.evspdefence = val;
                    }
                    else if (j == 5)
                    {
                        info.evspeed = val;
                    }
                    else
                    {
                        Console.WriteLine("what kind of f****d up shit is this");
                    }
                    j++;
                }

                info.rareness  = Int32.Parse(iniValue(section, "Rareness"));
                info.happiness = Int32.Parse(iniValue(section, "Happiness"));

                // --> ability here

                // --> hidden ability here

                string   learnset    = iniValue(section, "Moves");
                string[] learnsetspl = learnset.Split(',');
                int      k           = 0;
                int      cint        = -1;
                string   cstr        = "null";
                foreach (string _thres in learnsetspl)
                {
                    int w = k % 2;
                    if (w == 0)
                    {
                        cint = Int32.Parse(_thres);
                    }
                    else if (w == 1)
                    {
                        cstr = _thres;
                        info.learnablemoves.Add(new Tuple <int, string>(cint, cstr));
                    }

                    k++;
                }

                string   eggmoves    = iniValue(section, "EggMoves");
                string[] eggmovesspl = eggmoves.Split(',');
                info.eggmoves.AddRange(eggmovesspl);

                // --> compatibility

                info.hatch_steps = Int32.Parse(iniValue(section, "StepsToHatch"));
                info.height      = float.Parse(iniValue(section, "Height"), CultureInfo.InvariantCulture);
                info.weight      = float.Parse(iniValue(section, "Weight"), CultureInfo.InvariantCulture);
                info.color       = iniValue(section, "Color");
                info.habitat     = iniValue(section, "Habitat");
                //regional number
                info.kind             = iniValue(section, "Kind");
                info.pokedexentry     = iniValue(section, "Pokedex");
                info.battler_player_y = Int32.Parse(iniValue(section, "BattlerPlayerY"));
                info.battle_enemy_y   = Int32.Parse(iniValue(section, "BattlerEnemyY"));
                // --> altitude
                infos.Add(info);
            }
        }