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

View File

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