private void readJson() { if (!File.Exists(path)) { cwrite("Could not open movelist.txt", "error", COLOR_ERR); cwrite("Analytic mode will not work properly.", "[!]", COLOR_WARN); cwrite("Attempting to continue", COLOR_OK); return; } var settings = new JsonSerializerSettings { }; using (var reader = new StreamReader(path)) { string json; json = reader.ReadToEnd(); JObject jo = JsonConvert.DeserializeObject <JObject>(json); string allmoves = jo.First.ToString(); var current = jo.First; for (int i = 0; i < jo.Count; i++) { MoveJSONObj mv = JsonConvert.DeserializeObject <MoveJSONObj>(current.First.ToString()); Move move = new Move(mv); Global.moves.Add(move.name, move); current = current.Next; } } }
public Move(MoveJSONObj obj) { name = obj.name; type = Global.types[obj.type.ToLower()]; bp = obj.basePower; accuracy = ((float)obj.accuracy / 100f); group = obj.category.ToLower(); priority = obj.priority; boosts = obj.boosts; desc = obj.desc; statuseffect = obj.status; secondary = obj.secondary; if (obj.sideCondition != "none") { field = true; //Hazard moves } if (obj.isZ != "false") { isZ = true; bp = 100; //for now just set bp to a high value to encourage usage --otherwise endlessly switches. } if (statuseffect != "none") { status = true; } if (hasBoosts()) { isBoost = true; } if (Convert.ToBoolean(obj.flags.heal)) { heal = true; } if (!Object.Equals(obj.flags, null)) { flags = obj.flags; } }