Use ceiling HP percentages only with the HP Percentage Mod

This commit is contained in:
André Bastos Dias 2026-05-18 17:04:45 +01:00
parent e0551883ff
commit ed6da51a1f
2 changed files with 9 additions and 9 deletions

View File

@ -1352,7 +1352,7 @@ export const Rulesets: import('../sim/dex-formats').FormatDataTable = {
hppercentagemod: {
effectType: 'Rule',
name: 'HP Percentage Mod',
desc: "Shows the HP of Pokémon in percentages",
desc: "Shows the HP of Pokémon in rounded-up percentages",
onBegin() {
this.add('rule', 'HP Percentage Mod: HP is shown in percentages');
this.reportPercentages = true;

View File

@ -2063,7 +2063,14 @@ export class Pokemon {
let shared;
if (this.battle.reportExactHP) {
shared = secret;
} else if (this.battle.dex.currentMod === 'champions') {
} else if (this.battle.reportPercentages) {
// HP Percentage Mod mechanics
let percentage = Math.ceil(100 * this.hp / this.maxhp);
if (percentage === 100 && this.hp < this.maxhp) {
percentage = 99;
}
shared = `${percentage}/100`;
} else if (this.battle.gen >= 7) {
// Pokemon Champions mechanics
const percentage = Math.floor(100 * this.hp / this.maxhp) || 1;
shared = `${percentage}/100`;
@ -2072,13 +2079,6 @@ export class Pokemon {
} else if (percentage === 50) {
shared += this.hp * 2 > this.maxhp ? 'g' : 'y';
}
} else if (this.battle.reportPercentages || this.battle.gen >= 7) {
// HP Percentage Mod mechanics
let percentage = Math.ceil(100 * this.hp / this.maxhp);
if (percentage === 100 && this.hp < this.maxhp) {
percentage = 99;
}
shared = `${percentage}/100`;
} else {
/**
* In-game accurate pixel health mechanics