From 0e0fe95d4c8e6a7bdb768ea36f5e274e7495eb42 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Fri, 1 Mar 2024 12:41:47 -0500 Subject: [PATCH] Fix being unable to clear boss segment without bypass --- src/field/pokemon.ts | 10 ++++++---- src/system/game-data.ts | 13 ++++++++----- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/field/pokemon.ts b/src/field/pokemon.ts index 3a5e0c489b2..c65b6a04d97 100644 --- a/src/field/pokemon.ts +++ b/src/field/pokemon.ts @@ -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); } diff --git a/src/system/game-data.ts b/src/system/game-data.ts index 3a571ef0ca7..a09c65d8083 100644 --- a/src/system/game-data.ts +++ b/src/system/game-data.ts @@ -289,11 +289,14 @@ export class GameData { this.starterMoveData = systemData.starterMoveData || {}; - if (systemData.starterEggMoveData) - this.starterEggMoveData = systemData.starterEggMoveData; - else { - this.starterEggMoveData = {}; - this.initEggMoveData(); + 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)