public override int GetHashCode()
        {
            int hash = 1;

            if (MaxPokemon != 0)
            {
                hash ^= MaxPokemon.GetHashCode();
            }
            if (MaxBagItems != 0)
            {
                hash ^= MaxBagItems.GetHashCode();
            }
            if (BasePokemon != 0)
            {
                hash ^= BasePokemon.GetHashCode();
            }
            if (BaseBagItems != 0)
            {
                hash ^= BaseBagItems.GetHashCode();
            }
            if (BaseEggs != 0)
            {
                hash ^= BaseEggs.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public static BasePokemon GetPokemon(int level, int pokemon_class, List <int> IDPreset)
        {
            List <int> validIDs = new List <int>();

            string[] files = Directory.GetFiles(GameController.GamePath + "\\Content\\Pokemon\\Data", "*.dat", SearchOption.TopDirectoryOnly);
            foreach (string f in files)
            {
                if (Path.GetFileNameWithoutExtension(f).IsNumeric())
                {
                    int newID = Convert.ToInt32(Path.GetFileNameWithoutExtension(f));
                    if (IDPreset == null || IDPreset.Contains(newID))
                    {
                        validIDs.Add(newID);
                    }
                }
            }

            int ID = validIDs[Core.Random.Next(0, validIDs.Count)];

            var p = GetPredeterminedPokemon(ID, level, pokemon_class);

            if (p == null)
            {
                p = BasePokemon.GetPokemonByID(ID);
                p.Generate(level, true);
                p.FullRestore();
            }

            return(p);
        }
        public float GetPokemonWeight(bool own, BaseBattleScreen BattleScreen)
        {
            BasePokemon p  = BattleScreen.OwnPokemon;
            BasePokemon op = BattleScreen.OppPokemon;

            if (own == false)
            {
                p  = BattleScreen.OppPokemon;
                op = BattleScreen.OwnPokemon;
            }

            float weigth = p.PokedexEntry.Weight;

            if (p.Ability.Name.ToLower() == "light metal" && CanUseAbility(own, BattleScreen) == true)
            {
                weigth /= 2;
            }

            if (p.Ability.Name.ToLower() == "heavy metal" && CanUseAbility(own, BattleScreen) == true)
            {
                weigth *= 2;
            }

            return(weigth);
        }
        private void GetOnlineTeam(string result)
        {
            List <API.JoltValue> list = API.HandleData(result);

            if (Convert.ToBoolean(list[0].Value) == true)
            {
                this.OnlineTeam = new List <BasePokemon>();
                string data = result.Remove(0, 22);
                data = data.Remove(data.LastIndexOf("\""));
                string[] dataArray = data.SplitAtNewline();

                foreach (string line in dataArray)
                {
                    if (line.StartsWith("{") == true && line.EndsWith("}") == true)
                    {
                        string pokemonData = line.Replace("\\\"", "\"");

                        this.OnlineTeam.Add(BasePokemon.GetPokemonByData(pokemonData));
                    }
                }
            }
            else
            {
                this.OnlineTeam = null;
            }
        }
    static BasePokemon GetPokemon(PokemonData PokemonData, PlaceData Place)
    {
        BasePokemon Pokemon = new BasePokemon
        {
            Monster   = PokemonData.GeneralInformation.Monster,
            Name      = PokemonData.GeneralInformation.Name,
            Nature    = Natures.GetRandomNature(),
            Level     = GetLevel(Place, PokemonData),
            Ability   = GetRandomAbility(PokemonData),
            isShiny   = CheckForShiny(),
            Happiness = PokemonData.Breeding.BaseHappiness,
            Gender    = GetRandomGender(PokemonData),

            TrainerInfo = new P_Trainer()
            {
                Place = Place.Place,//,
                //Time
                TrainerName = TrainerData.GetData().Name,
                TrainerID   = TrainerData.GetData().ID
            },

            EValues = new EffortValues(),
            DValues = GetGenes()
        };

        Pokemon.Moves      = GetMoveList(Pokemon);
        Pokemon.Experience = Experience.GetExperience(PokemonData.Breeding.LvlRate, Pokemon.Level);
        Pokemon.Stats      = GetStats(Pokemon);
        ResetLiveStats(Pokemon);

        return(Pokemon);
    }
Exemple #6
0
        /// <summary>
        /// Returns the Animation Name of the Pokémon, the path to its Sprite/Model files.
        /// </summary>
        public static string GetAnimationName(BasePokemon P)
        {
            foreach (var listP in PokemonList)
            {
                if (listP.IsNumber(P.Number))
                {
                    string _name = listP.GetAnimationName(P).ToLower();
                    if (_name.StartsWith("mega "))
                    {
                        _name = _name.Remove(0, 5);
                        if (_name.EndsWith(" x_mega_x") || _name.EndsWith(" y_mega_y"))
                        {
                            _name = _name.Remove(_name.Length - 9, 2);
                        }
                    }
                    else if (_name.StartsWith("primal "))
                    {
                        _name = _name.Remove(0, 7);
                    }
                    return(_name);
                }
            }

            return(P.OriginalName);
        }
Exemple #7
0
    static public void AddPokemonToParty(BasePokemon Pokemon)
    {
        if (Pokemon != null)
        {
            CheckForSpace();

            if (Count >= 6)
            {
                Debug.Log("Party is full; " + Pokemon.Name + " could not get added.");
            }

            else
            {
                for (int i = 0; i < List.Length; i++)
                {
                    if (List[i] == null)
                    {
                        List[i] = Pokemon;

                        Logger.Debug(MethodBase.GetCurrentMethod().DeclaringType, "Added " + Pokemon.Name + " to the Party");

                        break;
                    }
                }
            }
        }

        else
        {
            Logger.Error(MethodBase.GetCurrentMethod().DeclaringType, "You are trying to add a Pokemon that is = null!");
        }
    }
Exemple #8
0
 private static void NewMethod(Rarity rarity, List <BasePokemon> returnPokemon, BasePokemon Pokemon)
 {
     if (Pokemon.rarity == rarity)
     {
         returnPokemon.Add(Pokemon);
     }
 }
    public void AddMember(BasePokemon bp)
    {
        Name        = bp.Name;
        Monster     = bp.Monster;
        HeldItem    = bp.HeldItem;
        TrainerInfo = bp.TrainerInfo;
        LiveStats   = bp.LiveStats;
        isShiny     = bp.isShiny;
        Level       = bp.Level;
        Stats       = bp.Stats;

        /**/
        PokemonData Data = PokemonData.GetData(Monster);

        LiveStats.HP             = Data.BaseStats.HP;
        LiveStats.Attack         = Data.BaseStats.Attack;
        LiveStats.Defense        = Data.BaseStats.Defense;
        LiveStats.SpecialAttack  = Data.BaseStats.SpecialAttack;
        LiveStats.SpecialDefense = Data.BaseStats.SpecialDefense;
        LiveStats.Speed          = Data.BaseStats.Speed;

        /*
         * LiveStats.HP = bp.Kind.BaseStats.HPStat;
         * LiveStats.Attack = bp.Kind.BaseStats.AttackStat;
         * LiveStats.Defence = bp.Kind.BaseStats.DefenceStat;
         * LiveStats.SpecialAttack = bp.Kind.BaseStats.SpAttackStat;
         * LiveStats.SpecialDefence = bp.Kind.BaseStats.SpDefenceStat;
         * LiveStats.Speed = bp.Kind.BaseStats.SpeedStat;
         */
    }   //TODO can this be removed?
Exemple #10
0
    public void EnterBattle(Rarity rarity)
    {
        playerCamera.SetActive(false);
        battleCamera.SetActive(true);

        BasePokemon battlePokemon = GetRandomPokemonFromList(GetPokemonByRarity(rarity));

        Debug.Log(battlePokemon.name);

        player.GetComponent <PlayerMovement>().isAllowedToMove = false;

        GameObject dPoke = Instantiate(emptyPoke, defencePodium.transform.position, Quaternion.identity) as GameObject;

        Vector3 pokeLocalPos = new Vector3(0, 1, 0);

        dPoke.transform.parent        = defencePodium;
        dPoke.transform.localPosition = pokeLocalPos;
        BasePokemon tempPoke = dPoke.AddComponent <BasePokemon> () as BasePokemon;

        tempPoke.AddMember(battlePokemon);

        dPoke.GetComponent <SpriteRenderer> ().sprite = battlePokemon.image;

        bm.ChangeMenu(BattleManager.BattleMenu.Selection);
    }
Exemple #11
0
    //When you enter a battle sets camera on battle and
    //sets player unable to move
    public void EnterBattle(Rarity rarity)
    {
        playerCamera.SetActive(false);
        battleCamera.SetActive(true);
        BasePokemon battlePokemon = GetRandomPokemonFromList(GetPokemonByRarity(rarity));

        player.GetComponent <PlayerMovement>().isAllowedToMove = false;
    }
Exemple #12
0
 void Spawn2()
 {
     Pokemon = new BasePokemon
     {
         Monster = Monster.ivysaur,
         Name    = PokemonData.GetData(Monster.ivysaur).GeneralInformation.Name
     };
 }
Exemple #13
0
    public BasePokemon GetRandomPokemonFromList(List <BasePokemon> pokeList)
    {
        BasePokemon poke      = new BasePokemon();
        int         pokeIndex = Random.Range(0, pokeList.Count - 1);

        poke = pokeList[pokeIndex];
        return(poke);
    }
 private static void AddMoveset(ref BasePokemon p, int[] moveList)
 {
     p.Attacks.Clear();
     foreach (int moveID in moveList)
     {
         p.Attacks.Add(BaseAttack.GetAttackByID(moveID));
     }
 }
Exemple #15
0
    public BasePokemon GetRandomPokemonFromList(List <BasePokemon> pokeList)
    {
        BasePokemon poke      = gameObject.AddComponent <BasePokemon>();
        int         pokeIndex = Random.Range(0, pokeList.Count - 1);

        poke = pokeList[pokeIndex];
        return(poke);
    }
        private static BasePokemon GetPredeterminedPokemon(int ID, int level, int pokemon_class)
        {
            string path = GameController.GamePath + "\\Content\\Pokemon\\Data\\frontier\\" + pokemon_class.ToString(NumberFormatInfo.InvariantInfo) + ".dat";
            // TODO:
            //Security.FileValidation.CheckFileValid(path, false, "FrontierSpawner.vb");

            List <string> data = System.IO.File.ReadAllLines(path).ToList();

            foreach (string line in data)
            {
                string[] lData    = line.Split(Convert.ToChar("|"));
                string[] InputIDs = lData[0].Split(Convert.ToChar(","));
                if (InputIDs.Contains(ID.ToString(NumberFormatInfo.InvariantInfo)) == true)
                {
                    int        OutputID = Convert.ToInt32(lData[1]);
                    List <int> Moveset  = new List <int>();
                    foreach (string move in lData[2].Split(Convert.ToChar(",")))
                    {
                        if (!string.IsNullOrEmpty(move) && move.IsNumeric())
                        {
                            Moveset.Add(Convert.ToInt32(move));
                        }
                    }
                    string[] Stats  = lData[3].Split(Convert.ToChar(","));
                    string   ItemID = lData[4];

                    BasePokemon p = BasePokemon.GetPokemonByID(OutputID);
                    p.Generate(level, true);
                    p.Item = null;
                    AddMoveset(ref p, Moveset.ToArray());
                    SetStats(ref p, Stats[0], Stats[1], pokemon_class);

                    if (!string.IsNullOrEmpty(ItemID))
                    {
                        p.Item = Item.GetItemByID(Convert.ToInt32(ItemID));
                    }
                    if (p.Item == null)
                    {
                        int[] items =
                        {
                            146,
                            2009,
                            119,
                            140,
                            73,
                            74
                        };

                        p.Item = Item.GetItemByID(items[Core.Random.Next(0, items.Length)]);
                    }

                    p.FullRestore();
                    return(p);
                }
            }

            return(null);
        }
    public void EnterBattle(Rarity rarity)
    {
        //Camera into BattleMode
        playerCamera.SetActive(false);
        battleCamera.SetActive(true);

        //change State
        bm.state = BattleState.Start;
        //Get a Random Pokemon from the List
        BasePokemon  battlePokemon = GetRandomPokemonFromList(GetPokemonByRarity(rarity));
        OwnedPokemon PlayerPokemon = GetOwnedPokemon(plyr.ownedPokemon);

        //Stop Player from Moving
        player.GetComponent <PlayerMovement>().isAllowedToMove = false;
        //Initiate Pokemon
        dPoke = Instantiate(emptyPoke, defencePodium.transform.position, Quaternion.identity) as GameObject;
        aPoke = Instantiate(emptyPoke, attackPodium.transform.position, Quaternion.identity) as GameObject;
        //Set Position to to a flat Number?
        Vector3 pokeLocalPos     = new Vector3(0, 1, 0);
        Vector3 friendlyLocalPos = new Vector3(0, 0, 0);

        dPoke.transform.parent        = defencePodium;
        aPoke.transform.parent        = attackPodium;
        dPoke.transform.localPosition = pokeLocalPos;
        aPoke.transform.localPosition = friendlyLocalPos;

        dPoke.transform.parent = defencePodium;
        aPoke.transform.parent = attackPodium;
        //copy BasePokemon so it gets individuell
        tempPoke       = dPoke.AddComponent <BasePokemon>() as BasePokemon;
        playerTempPoke = aPoke.AddComponent <BasePokemon>() as BasePokemon;
        tempPoke.AddMember(battlePokemon);
        playerTempPoke.AddMember(PlayerPokemon.pokemon);

        //Random level
        int p = Random.Range(2, 5);

        tempPoke.level = p;
        //PlayerPokemon Level
        playerTempPoke.level = PlayerPokemon.level;
        //calculate HP
        tempPoke.HP              = (((2 * tempPoke.HP) * p) / 100) + p + 10;
        playerTempPoke.HP        = (((2 * playerTempPoke.HP) * playerTempPoke.level) / 100) + playerTempPoke.level + 10;
        tempPoke.currentHP       = tempPoke.HP;
        playerTempPoke.currentHP = playerTempPoke.HP;

        //Set Sprites
        dPoke.GetComponent <SpriteRenderer>().sprite = battlePokemon.image;
        aPoke.GetComponent <SpriteRenderer>().sprite = PlayerPokemon.pokemon.image;
        //User Interface Update
        bm.InfoText.text = "A wild " + battlePokemon.Name + " appeared!";
        bm.ChangeMenu(BattleMenu.Info);
        bm.GetMoves(PlayerPokemon);
        bm.GetBattlePokemon(PlayerPokemon);
        //Update
        bm.UpdatePokemonDetails(tempPoke.Name, tempPoke.level, tempPoke.currentHP, tempPoke.HP, PlayerPokemon.NickName, playerTempPoke.level, playerTempPoke.currentHP, playerTempPoke.HP);
    }
    public BasePokemon GetRandomPokemonFromList(List <BasePokemon> pokeList)
    {
        //randomly picks one pokemon from previously derived list
        BasePokemon poke      = new BasePokemon();
        int         pokeIndex = Random.Range(0, pokeList.Count - 1);

        poke = pokeList[pokeIndex];
        return(poke);
    }
Exemple #19
0
    public void ResetUI()
    {
        ActivePokemon = null;

        Icon.GetComponentInParent <GameObject>().SetActive(false);

        Name.text   = "";
        Level.text  = "";
        HPText.text = "";
    }
        public RoamingPokemon(string DataLine)
        {
            string[] data = DataLine.Split(Convert.ToChar("|"));

            PokemonReference = BasePokemon.GetPokemonByData(data[5]);

            WorldID   = Convert.ToInt32(data[2]);
            LevelFile = data[3];
            MusicLoop = data[4];
        }
        /*
         * public static void Load()
         * {
         *  Core.Player.Pokedexes.Clear();
         *
         *  string path = GameModeManager.GetContentFilePath("Data\\pokedex.dat");
         *  Security.FileValidation.CheckFileValid(path, false, "Pokedex.vb");
         *
         *  string[] lines = System.IO.File.ReadAllLines(path);
         *  foreach (string PokedexData in lines)
         *  {
         *      Core.Player.Pokedexes.Add(new Pokedex(PokedexData));
         *  }
         * }
         */

        public static string RegisterPokemon(string Data, BasePokemon Pokemon)
        {
            if (Pokemon.IsShiny == true)
            {
                return(ChangeEntry(Data, Pokemon.Number, 3));
            }
            else
            {
                return(ChangeEntry(Data, Pokemon.Number, 2));
            }
        }
Exemple #22
0
        public void Show(BasePokemon Pokemon, bool front)
        {
            var p = Pokemon;

            p.PlayCry();

            this.Delay   = 8f;
            this.Showing = true;

            this.Texture = p.GetTexture(front);
        }
Exemple #23
0
        /// <summary>
        /// Returns the path to the Pokémon's overworld sprite.
        /// </summary>
        public static string GetOverworldSpriteName(BasePokemon P)
        {
            string path = "Pokemon\\Overworld\\Normal\\";

            if (P.IsShiny)
            {
                path = "Pokemon\\Overworld\\Shiny\\";
            }
            path += P.Number + GetOverworldAddition(P);
            return(path);
        }
Exemple #24
0
    public void OnClick()
    {
        BasePokemon[] newList = new BasePokemon[1];
        newList[0] = Encounter_Manager.GetEncounter(Place.Route1);

        Pokemon_Party.AddPokemonToParty(Encounter_Manager.GetEncounter(Place.Route1));

        //Logger.Debug(GetType(), "'" + Pokemon.Name + "' got choosen.");

        BattleManager.GetComponent <Battle_Manager>().StartBattle(Pokemon_Party.List, newList);
    }
Exemple #25
0
        /// <summary>
        /// Returns the size of the Pokémon's menu sprite.
        /// </summary>
        public static Size GetMenuImageSize(BasePokemon P)
        {
            foreach (var listP in PokemonList)
            {
                if (listP.IsNumber(P.Number) == true)
                {
                    return(listP.GetMenuImageSize(P));
                }
            }

            return(new Size(32, 32));
        }
Exemple #26
0
        /// <summary>
        /// Returns the addition to the Pokémon's overworld sprite name.
        /// </summary>
        public static string GetOverworldAddition(BasePokemon P)
        {
            foreach (var listP in PokemonList)
            {
                if (listP.IsNumber(P.Number) == true)
                {
                    return(listP.GetOverworldAddition(P));
                }
            }

            return("");
        }
Exemple #27
0
        /// <summary>
        /// Returns the initial Additional Data, if it needs to be set at generation time of the Pokémon.
        /// </summary>
        public static string GetInitialAdditionalData(BasePokemon P)
        {
            foreach (var listP in PokemonList)
            {
                if (listP.IsNumber(P.Number))
                {
                    return(listP.GetInitialAdditionalData(P));
                }
            }

            return("");
        }
Exemple #28
0
    static public void RemovePokemonFromParty(BasePokemon Pokemon)
    {
        for (int i = 0; i < List.Length; i++)
        {
            if (List[i] == Pokemon)
            {
                List[i] = null;

                break;
            }
        }
    }
Exemple #29
0
        public void Show(int ID, bool shiny, bool front)
        {
            var p = BasePokemon.GetPokemonByID(ID);

            p.PlayCry();

            this.Delay   = 8f;
            this.Showing = true;

            p.IsShiny = shiny;

            this.Texture = p.GetTexture(front);
        }
    public static void ResetLiveStats(BasePokemon Pokemon, bool HP)
    {
        if (HP)
        {
            Pokemon.LiveStats.HP = Pokemon.Stats.HP;
        }

        Pokemon.LiveStats.Attack         = Pokemon.Stats.Attack;
        Pokemon.LiveStats.Defense        = Pokemon.Stats.Defense;
        Pokemon.LiveStats.SpecialAttack  = Pokemon.Stats.SpecialAttack;
        Pokemon.LiveStats.SpecialDefense = Pokemon.Stats.SpecialDefense;
        Pokemon.LiveStats.Speed          = Pokemon.Stats.Speed;
    }
Exemple #31
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;
 }