Fix being unable to clear boss segment without bypass

pull/16/head
Flashfyre 2024-03-01 12:41:47 -05:00
parent fd5a7985ce
commit 0e0fe95d4c
2 changed files with 14 additions and 9 deletions

View File

@ -2343,7 +2343,9 @@ export class EnemyPokemon extends Pokemon {
if (this.isFainted())
return 0;
let bossSegmentIndex = this.bossSegmentIndex;
let clearedBossSegmentIndex = this.isBoss()
? this.bossSegmentIndex + 1
: 0;
if (this.isBoss() && !ignoreSegments) {
const segmentSize = this.getMaxHp() / this.bossSegments;
@ -2360,7 +2362,7 @@ export class EnemyPokemon extends Pokemon {
}
damage = hpRemainder + Math.round(segmentSize * segmentsBypassed);
bossSegmentIndex = s - segmentsBypassed;
clearedBossSegmentIndex = s - segmentsBypassed;
}
break;
}
@ -2370,8 +2372,8 @@ export class EnemyPokemon extends Pokemon {
const ret = super.damage(damage, ignoreSegments, preventEndure);
if (this.isBoss()) {
if (bossSegmentIndex < this.bossSegmentIndex)
this.handleBossSegmentCleared(bossSegmentIndex);
if (clearedBossSegmentIndex <= this.bossSegmentIndex)
this.handleBossSegmentCleared(clearedBossSegmentIndex);
this.battleInfo.updateBossSegments(this);
}

View File

@ -289,11 +289,14 @@ export class GameData {
this.starterMoveData = systemData.starterMoveData || {};
if (systemData.starterEggMoveData)
this.starterEggMoveData = systemData.starterEggMoveData;
else {
this.starterEggMoveData = {};
this.initEggMoveData();
if (systemData.starterEggMoveData) {
for (let key of Object.keys(systemData.starterEggMoveData)) {
if (this.starterEggMoveData.hasOwnProperty(key))
this.starterEggMoveData[key] = systemData.starterEggMoveData[key];
}
}
if (systemData.gameStats)