@@ -39,7 +39,7 @@ public class PokemonMove {
3939 /**
4040 * The percent value of how likely this move is to be successful
4141 */
42- private int accuracy ;
42+ private Integer accuracy ;
4343
4444 /**
4545 * The percent value of how likely it is this moves effect will happen. <tt>null</tt> if no effect
@@ -59,7 +59,7 @@ public class PokemonMove {
5959 /**
6060 * The base power of this move
6161 */
62- private int power ;
62+ private Integer power ;
6363
6464 /**
6565 * The elemental type of this move
@@ -141,14 +141,16 @@ public static PokemonMove fromName(String name) throws PokedexException {
141141 );
142142 }
143143 JsonObject meta = json .getAsJsonObject ("meta" );
144+ JsonElement accuracy = json .get ("accuracy" );
145+ JsonElement power = json .get ("power" );
144146 return new PokemonMove (
145147 json .get ("id" ).getAsInt (),
146148 json .get ("name" ).getAsString (),
147- json . get ( "accuracy" ) .getAsInt (),
149+ accuracy . isJsonNull () ? null : accuracy .getAsInt (),
148150 effectChance .isJsonNull () ? null : effectChance .getAsInt (),
149151 json .get ("pp" ).getAsInt (),
150152 json .get ("priority" ).getAsByte (),
151- json . get ( "power" ) .getAsInt (),
153+ power . isJsonNull () ? null : power .getAsInt (),
152154 PokemonType .valueOf (new NamedResource (json .get ("type" )).toEnumName ()),
153155 MoveAilment .valueOf (new NamedResource (meta .get ("ailment" )).toEnumName ()),
154156 MoveDamageClass .valueOf (new NamedResource (json .get ("damage_class" )).toEnumName ()),
0 commit comments