Skip to content

Commit 82cd09f

Browse files
sadyeGrover-c13
authored andcommitted
Added iv calculator (#207)
* Added iv calculator * checkstyleMain fix * Fix @returns in doc of getIVRatio()
1 parent ccf1f7f commit 82cd09f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/main/java/com/pokegoapi/api/pokemon/Pokemon.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,14 @@ public int getIndividualDefense() {
267267
public int getIndividualStamina() {
268268
return proto.getIndividualStamina();
269269
}
270+
271+
/**
272+
* Calculates the pokemons IV ratio.
273+
* @return the pokemons IV ratio as a double between 0 and 1.0, 1.0 being perfect IVs
274+
*/
275+
public double getIVRatio() {
276+
return (this.getIndividualAttack() + this.getIndividualDefense() + this.getIndividualStamina()) / 45.0;
277+
}
270278

271279
public float getCpMultiplier() {
272280
return proto.getCpMultiplier();

0 commit comments

Comments
 (0)