Fix dividing by 0 when calculating party member scores

This commit is contained in:
Flashfyre 2024-03-26 16:07:59 -04:00
parent 0fbf21f19b
commit 8bdab3d3bc
1 changed files with 1 additions and 1 deletions

View File

@ -748,7 +748,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
if (types.length > 1)
atkScore *= pokemon.getAttackTypeEffectiveness(types[1]);
if (enemyTypes.length > 1)
defScore *= (1 / this.getAttackTypeEffectiveness(enemyTypes[1]));
defScore *= (1 / Math.max(this.getAttackTypeEffectiveness(enemyTypes[1]), 0.25));
let hpDiffRatio = this.getHpRatio() + (1 - pokemon.getHpRatio());
if (outspeed)
hpDiffRatio = Math.min(hpDiffRatio * 1.5, 1);