IV Calculator
Find the possible IVs of a Pokémon.
Installation
You can install this package via composer using:
$ composer require kostaspt/ivcalculator
Usage
<?php
require_once 'vendor/autoload.php';
$ivCalculator = new IVCalculator\IVCalculator();
// Pokemon, CP, HP, Stardust needed for power up, Was powered up before?
$results = $ivCalculator->evaluate('Dragonite', 3280, 149, 9000, false);
var_dump($results->toArray());
/*
Outputs:
array:4 [
"id" => 149
"name" => "Dragonite"
"perfection" => array:3 [
"max" => 0.62
"min" => 0.8
"average" => 0.73
]
"ivs" => array:5 [
4 => IVCalculator\Entities\IV {#56
+attackIV: 13
+defenseIV: 6
+staminaIV: 9
+level: 76
+perfection: 0.62
}
1 => IVCalculator\Entities\IV {#59
+attackIV: 15
+defenseIV: 8
+staminaIV: 10
+level: 74
+perfection: 0.73
}
3 => IVCalculator\Entities\IV {#57
+attackIV: 9
+defenseIV: 15
+staminaIV: 10
+level: 75
+perfection: 0.75
}
2 => IVCalculator\Entities\IV {#58
+attackIV: 12
+defenseIV: 12
+staminaIV: 11
+level: 74
+perfection: 0.77
}
0 => IVCalculator\Entities\IV {#60
+attackIV: 15
+defenseIV: 9
+staminaIV: 12
+level: 73
+perfection: 0.8
}
]
]
*/
The $results
variable is a Collection, so you can use it like this:
echo $results->get('name');
// Outputs: Dragonite
or
echo $results->get('perfection')->get('average');
// Outputs: 0.73
or
$highestIV = $results->get('ivs')->last();
echo $highestIV->perfection;
// Outputs: 0.8
Usage (Command Line)
You can install this package via composer globally using:
$ composer require global kostaspt/ivcalculator
Then, just run:
$ ivcalculator analyze 'Dragonite' 3280 149 9000
Credit
Heavily inspired by andromedado/pokemon-go-iv-calculator