Fix boss stat boosts not being applied on revive
parent
b62892e42d
commit
0dc53bfeb8
|
@ -2343,6 +2343,8 @@ export class EnemyPokemon extends Pokemon {
|
||||||
if (this.isFainted())
|
if (this.isFainted())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
let bossSegmentIndex = this.bossSegmentIndex;
|
||||||
|
|
||||||
if (this.isBoss()) {
|
if (this.isBoss()) {
|
||||||
if (!ignoreSegments) {
|
if (!ignoreSegments) {
|
||||||
const segmentSize = this.getMaxHp() / this.bossSegments;
|
const segmentSize = this.getMaxHp() / this.bossSegments;
|
||||||
|
@ -2353,13 +2355,13 @@ export class EnemyPokemon extends Pokemon {
|
||||||
if (this.hp - damage <= roundedHpThreshold) {
|
if (this.hp - damage <= roundedHpThreshold) {
|
||||||
const hpRemainder = this.hp - roundedHpThreshold;
|
const hpRemainder = this.hp - roundedHpThreshold;
|
||||||
let segmentsBypassed = 0;
|
let segmentsBypassed = 0;
|
||||||
while (this.canBypassBossSegments(segmentsBypassed + 1) && (damage - hpRemainder) >= Math.round(segmentSize * Math.pow(2, segmentsBypassed + 1))) {
|
while (segmentsBypassed < this.bossSegmentIndex && this.canBypassBossSegments(segmentsBypassed + 1) && (damage - hpRemainder) >= Math.round(segmentSize * Math.pow(2, segmentsBypassed + 1))) {
|
||||||
segmentsBypassed++;
|
segmentsBypassed++;
|
||||||
//console.log('damage', damage, 'segment', segmentsBypassed + 1, 'segment size', segmentSize, 'damage needed', Math.round(segmentSize * Math.pow(2, segmentsBypassed + 1)));
|
//console.log('damage', damage, 'segment', segmentsBypassed + 1, 'segment size', segmentSize, 'damage needed', Math.round(segmentSize * Math.pow(2, segmentsBypassed + 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
damage = hpRemainder + Math.round(segmentSize * segmentsBypassed);
|
damage = hpRemainder + Math.round(segmentSize * segmentsBypassed);
|
||||||
this.handleBossSegmentCleared(s - segmentsBypassed);
|
bossSegmentIndex = s - segmentsBypassed;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2368,7 +2370,12 @@ export class EnemyPokemon extends Pokemon {
|
||||||
this.battleInfo.updateBossSegments(this);
|
this.battleInfo.updateBossSegments(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.damage(damage, ignoreSegments, preventEndure);
|
const ret = super.damage(damage, ignoreSegments, preventEndure);
|
||||||
|
|
||||||
|
if (this.isBoss() && bossSegmentIndex < this.bossSegmentIndex)
|
||||||
|
this.handleBossSegmentCleared(bossSegmentIndex);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
canBypassBossSegments(segmentCount: integer = 1): boolean {
|
canBypassBossSegments(segmentCount: integer = 1): boolean {
|
||||||
|
|
Loading…
Reference in New Issue