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(); }
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(); }
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; } using (var reader = new StreamReader(Global.POKEBASEPATH)) { string json; json = reader.ReadToEnd(); JObject jo = JsonConvert.DeserializeObject <JObject>(json); string allmons = jo.First.ToString(); var current = jo.First; for (int i = 0; i < jo.Count; i++) { PokeJSONObj pk = JsonConvert.DeserializeObject <PokeJSONObj>(current.First.ToString()); Pokemon mon = new Pokemon(pk); Global.pokedex.Add(mon.name, mon); current = current.Next; } } //cwrite("Pokedex built!", COLOR_OK); }
public Pokemon(PokeJSONObj baseMon, RoleOverride newStats) { basicInit(baseMon); initRoles(); modifyRole(); setRealStats(); name = GlobalConstants.PERSONAL_PRE + name; }
private void basicInit(PokeJSONObj obj) { types = Global.types; name = obj.species.ToLower(); type1 = types[obj.types[0].ToLower()]; if (obj.types.Count < 2) { type2 = type1; } else { type2 = types[obj.types[1].ToLower()]; } stats = obj.baseStats; setAbilities(obj.abilities); weight = (float)obj.weightkg; deftype = new DefenseType(); role = new Role(); realStats = new Dictionary <string, int>(); }
private void basicInit(PokeJSONObj obj) { types = Global.types; name = obj.species.ToLower(); type1 = types[obj.types[0].ToLower()]; if (obj.types.Count < 2) type2 = type1; else type2 = types[obj.types[1].ToLower()]; stats = obj.baseStats; abilities = obj.abilities; weight = (float)obj.weightkg; deftype = new DefenseType(); role = new Role(); realStats = new Dictionary<string, int>(); }