kipyin / pokemaster

Checkout kipyin/pokemaster2 !
https://github.com/kipyin/pokemaster2
2 stars 2 forks source link

In-battle stats and stage multipliers #26

Open kipyin opened 5 years ago

kipyin commented 5 years ago

Issue #15 suggested the implementation of in-battle stats, but none of the then-existing codes actually used it, hence there is a few things that I was missing when I wrote BattleStats:

  1. The stage multipliers needs to be tracked, because some moves (e.g. Punishment) need to use this info.

  2. The stage multipliers actually also include the critical-hit rate, which was not included when implementing BattleStats.

Hence, to implement above mechanisms, we have two choices:

  1. Make a new class, StatStages, and put the stage info into this new class.

  2. Make a _Stat class, which represent a single stat, such as hp or attack, which contains the value of its permanent stats, effective stats, stage, and stage change history. Remove BattleStats class. Access all stat-related data like Pokemon().stats.hp.permanent, Pokemon().stats.evasion.effective, Pokemon().stats.critical_hit.stage_log, etc. Of course, Pokemon().stats.critical_hit.permanent will be a non-sense, and will probably be 0.

kipyin commented 5 years ago

If we take the first choice, we would have at least 3 stat-related properties in Pokemon: Pokemon.stats, Pokemon.battle_stats, and Pokemon.stages (and even Pokemon.stage_logs).

If we take the second choice, then we will end up with deeply stored properties.


We can also set BattleStats.attack etc. as a named tuple: BattleStats.attack = Stat(value=100, stage=-2)