@@ -39,7 +39,7 @@ public class PokemonMove {
39
39
/**
40
40
* The percent value of how likely this move is to be successful
41
41
*/
42
- private int accuracy ;
42
+ private Integer accuracy ;
43
43
44
44
/**
45
45
* 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 {
59
59
/**
60
60
* The base power of this move
61
61
*/
62
- private int power ;
62
+ private Integer power ;
63
63
64
64
/**
65
65
* The elemental type of this move
@@ -141,14 +141,16 @@ public static PokemonMove fromName(String name) throws PokedexException {
141
141
);
142
142
}
143
143
JsonObject meta = json .getAsJsonObject ("meta" );
144
+ JsonElement accuracy = json .get ("accuracy" );
145
+ JsonElement power = json .get ("power" );
144
146
return new PokemonMove (
145
147
json .get ("id" ).getAsInt (),
146
148
json .get ("name" ).getAsString (),
147
- json . get ( "accuracy" ) .getAsInt (),
149
+ accuracy . isJsonNull () ? null : accuracy .getAsInt (),
148
150
effectChance .isJsonNull () ? null : effectChance .getAsInt (),
149
151
json .get ("pp" ).getAsInt (),
150
152
json .get ("priority" ).getAsByte (),
151
- json . get ( "power" ) .getAsInt (),
153
+ power . isJsonNull () ? null : power .getAsInt (),
152
154
PokemonType .valueOf (new NamedResource (json .get ("type" )).toEnumName ()),
153
155
MoveAilment .valueOf (new NamedResource (meta .get ("ailment" )).toEnumName ()),
154
156
MoveDamageClass .valueOf (new NamedResource (json .get ("damage_class" )).toEnumName ()),
0 commit comments