[Balance/Bug] Boss segments properly heal (#4819)

This commit is contained in:
Daniel Pochert 2024-11-08 05:09:25 +01:00 committed by GitHub
parent 2b91d9d259
commit aa2c794910
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5079,26 +5079,6 @@ export class EnemyPokemon extends Pokemon {
}
}
heal(amount: integer): integer {
if (this.isBoss()) {
const amountRatio = amount / this.getMaxHp();
const segmentBypassCount = Math.floor(amountRatio / (1 / this.bossSegments));
const segmentSize = this.getMaxHp() / this.bossSegments;
for (let s = 1; s < this.bossSegments; s++) {
const hpThreshold = segmentSize * s;
if (this.hp <= Math.round(hpThreshold)) {
const healAmount = Math.min(amount, this.getMaxHp() - this.hp, Math.round(hpThreshold + (segmentSize * segmentBypassCount) - this.hp));
this.hp += healAmount;
return healAmount;
} else if (s >= this.bossSegmentIndex) {
return super.heal(amount);
}
}
}
return super.heal(amount);
}
getFieldIndex(): integer {
return this.scene.getEnemyField().indexOf(this);
}