Пример #1
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();
        }
Пример #2
0
        public void modifyRole()
        {
            RoleOverride ro = getRoleOverride();

            if (ro != null)
            {
                if (!Object.ReferenceEquals(ro.role, null))
                {
                    this.role = ro.role;
                }
                if (!Object.ReferenceEquals(ro.deftype, null))
                {
                    this.deftype = ro.deftype;
                }
                if (!Object.ReferenceEquals(ro.statspread, null))
                {
                    this.statSpread = ro.statspread;
                }
                if (!Object.ReferenceEquals(ro.item, null))
                {
                    this.item = ro.item;
                }
                this.certainAbility = ro.certainAbility;
            }
        }
Пример #3
0
 public Pokemon(PokeJSONObj baseMon, RoleOverride newStats)
 {
     basicInit(baseMon);
     initRoles();
     modifyRole();
     setRealStats();
     name = GlobalConstants.PERSONAL_PRE + name;
 }
Пример #4
0
        private RoleOverride getRoleOverride()
        {
            string path = Global.ROLEPATH;

            using (var reader = new StreamReader(path))
            {
                string json;
                json = reader.ReadToEnd();
                JObject jo       = JsonConvert.DeserializeObject <JObject>(json);
                string  allroles = jo.First.ToString();
                var     current  = jo.First;
                for (int i = 0; i < jo.Count; i++)
                {
                    RoleOverride ro = JsonConvert.DeserializeObject <RoleOverride>(current.First.ToString());
                    if (ro.name == this.name)
                    {
                        return(ro);
                    }
                    current = current.Next;
                }
            }
            return(null);
        }
Пример #5
0
 public Pokemon(PokeJSONObj baseMon, RoleOverride newStats)
 {
     basicInit(baseMon);
     initRoles();
     modifyRole();
     setRealStats();
     name = GlobalConstants.PERSONAL_PRE + name;
 }