alfalfascout / pokemon-daycare

A web page that calculates the chance of hatching the pokemon with the stats you want.
GNU General Public License v3.0
6 stars 1 forks source link

IV calculation should include Power Items #4

Closed alfalfascout closed 8 years ago

alfalfascout commented 8 years ago

Add a case in the IV calculation process that will account for power items.

Power items work like this: (pseudocode) if (parents[x].item === "power_hp") { egg_iv[0] = parents[x].ivs[0]; } Where the "hp" iv is the 0th iv. Likewise, atk = 1, def = 2, satk = 3, sdef = 4, spe = 5.

alfalfascout commented 8 years ago

If someone could double-check my code that would be dandy because probability is not my strong suit.

How each spread SHOULD be generated with power items:

If one parent has a power item... the egg always inherits that stat from that parent. (as far as I can tell, this works)

If both parents have the same power item... the egg either inherits the stat from one parent or the other. It never randomly rolls the stat.

if both parents have different power items... the egg inherits the first stat and random rolls the second stat, XOR it inherits the second stat and random rolls the first. It should never random roll both stats, and it should never inherit both stats.

alfalfascout commented 8 years ago

(Oops: commit d5a7c07 has nothing to do with power items. Help is issue #3 and gender is issue #5.)

alfalfascout commented 8 years ago

Bulbapedia is not very clear on what happens to stats when both parents have power items for different stats, but I think I've come as close as I can.