Example #1
0
        public BattlePokemon(Pokemon p)
        {
            this.mon = p;
            maxHealth = mon.getRealStat("hp");
            currentHealth = maxHealth;
            status = Status.STATE_HEALTHY;
            currentBoosts = new Boosts();
            type1 = mon.type1;
            type2 = mon.type2;
            item = mon.item;
            level = 100; //TODO: actually find this, for now just assume its max.
            initBoosts();

           
        }
Example #2
0
        public Pokemon(PokeJSONObj obj)
        {
            basicInit(obj);
            initRoles();
            RoleOverride ro = getRoleOverride();
            /*If the pokemon has a "personal" override, create a new pokemon data object to hold the information
            /* regarding our personal pokemon to keep it seperate from the generic "expected" pokemon
             * Otherwise, modify the role as roleoverride is intended.
            */
            if (!Object.ReferenceEquals(ro, null))
            {
                if (!Object.ReferenceEquals(ro.personal, null))
                {
                    if (ro.personal)
                    {
                        Pokemon personal = new Pokemon(obj, ro);
                        if (!Global.pokedex.ContainsKey(personal.name))
                            Global.pokedex.Add(personal.name, personal); //Only allow 1 personal version of each pkmn.
                    }
                    else
                        modifyRole();
                }
            }

            setRealStats();
        }
Example #3
0
 /// <summary>
 /// Changes the internal pokemon.
 /// Used primarily to mega evolve.
 /// </summary>
 public void changeMon(string name)
 {
     Pokemon newmega = Global.lookup(name);
         mon = newmega;
         type1 = mon.type1;
         type2 = mon.type2;
 }
Example #4
0
        private void BuildPokedex()
        {
            cwrite("Building pokedex, this may take a moment...");
            if (!File.Exists(Global.POKEBASEPATH))
            {
                cwrite("Could not find pokedex.js","[ERROR]",COLOR_ERR);
                cwrite("Analytic battle mode will not work correctly.",COLOR_WARN);
                cwrite("Continuing operation.",COLOR_OK);
                return;
            }
            string json;
            using (var reader = new StreamReader(Global.POKEBASEPATH))
            {
                while ((json = reader.ReadLine()) != null)
                {
                    string full = "{" + json + "}";
                    JObject po = JsonConvert.DeserializeObject<JObject>(full);
                    var first = po.First;
                    PokeJSONObj obj = JsonConvert.DeserializeObject<PokeJSONObj>(po.First.First.ToString());
                    Pokemon p = new Pokemon(obj);
                    Global.pokedex.Add(p.name, p);
                }
            }
            //cwrite("Pokedex built!", COLOR_OK);

        }