From ed5921eb1011f491862a983b5843897bfa33e2a9 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Thu, 29 Feb 2024 12:23:49 -0500 Subject: [PATCH] Rework boss HP logic to allow unlimited bypasses for large damage --- src/data/move.ts | 2 +- src/data/pokemon-species.ts | 2 +- src/pokemon.ts | 16 +++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/data/move.ts b/src/data/move.ts index 1c05a5d4a..bd07ac672 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -2913,7 +2913,7 @@ export function initMoves() { new AttackMove(Moves.ERUPTION, "Eruption", Type.FIRE, MoveCategory.SPECIAL, 150, 100, 5, -1, "The user attacks opposing Pokémon with explosive fury. The lower the user's HP, the lower the move's power.", -1, 0, 3) .attr(HpPowerAttr) .target(MoveTarget.ALL_NEAR_ENEMIES), - new StatusMove(Moves.SKILL_SWAP, "Skill Swap (N)", Type.PSYCHIC, -1, 1, 98, "The user employs its psychic power to exchange Abilities with the target.", -1, 0, 3), + new StatusMove(Moves.SKILL_SWAP, "Skill Swap (N)", Type.PSYCHIC, -1, 10, 98, "The user employs its psychic power to exchange Abilities with the target.", -1, 0, 3), new SelfStatusMove(Moves.IMPRISON, "Imprison (N)", Type.PSYCHIC, -1, 10, 92, "If opposing Pokémon know any move also known by the user, they are prevented from using it.", -1, 0, 3), new SelfStatusMove(Moves.REFRESH, "Refresh", Type.NORMAL, -1, 20, -1, "The user rests to cure itself of poisoning, a burn, or paralysis.", -1, 0, 3) .attr(HealStatusEffectAttr, true, StatusEffect.PARALYSIS, StatusEffect.POISON, StatusEffect.TOXIC, StatusEffect.BURN) diff --git a/src/data/pokemon-species.ts b/src/data/pokemon-species.ts index ef5ec9b3e..f84b35055 100644 --- a/src/data/pokemon-species.ts +++ b/src/data/pokemon-species.ts @@ -2346,7 +2346,7 @@ export const speciesStarters = { [Species.MANKEY]: 4, [Species.GROWLITHE]: 4, [Species.POLIWAG]: 3, - [Species.ABRA]: 4, + [Species.ABRA]: 3, [Species.MACHOP]: 3, [Species.BELLSPROUT]: 3, [Species.TENTACOOL]: 3, diff --git a/src/pokemon.ts b/src/pokemon.ts index a5462979a..9cb4f4bee 100644 --- a/src/pokemon.ts +++ b/src/pokemon.ts @@ -2343,9 +2343,15 @@ export class EnemyPokemon extends Pokemon { const roundedHpThreshold = Math.round(hpThreshold); if (this.hp >= roundedHpThreshold) { if (this.hp - damage < roundedHpThreshold) { - const bypassSegment = this.canBypassBossSegments() && (this.hp - roundedHpThreshold) / damage < 0.1; - damage = this.hp - (bypassSegment ? Math.round(hpThreshold - segmentSize) : roundedHpThreshold); - this.handleBossSegmentCleared(s); + const hpRemainder = this.hp - roundedHpThreshold; + let segmentsBypassed = 0; + while (this.canBypassBossSegments(segmentsBypassed + 1) && (damage - hpRemainder) >= Math.round(segmentSize * Math.pow(2, segmentsBypassed + 1))) { + segmentsBypassed++; + //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); + this.handleBossSegmentCleared(s - segmentsBypassed); } break; } @@ -2357,9 +2363,9 @@ export class EnemyPokemon extends Pokemon { return super.damage(damage, ignoreSegments, preventEndure); } - canBypassBossSegments(): boolean { + canBypassBossSegments(segmentCount: integer = 1): boolean { if (this.scene.currentBattle.battleSpec === BattleSpec.FINAL_BOSS) { - if (!this.formIndex && (this.bossSegmentIndex - 1) <= 1) + if (!this.formIndex && (this.bossSegmentIndex - segmentCount) < 1) return false; }