mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-12-14 22:05:34 +01:00
[Bug]]Beta] Boss segments not fully clearing (#6609)
fix: boss segments with 1 hp remaining
This commit is contained in:
parent
5745213257
commit
4a719e48c7
@ -6835,6 +6835,7 @@ export class EnemyPokemon extends Pokemon {
|
||||
this.hp,
|
||||
segmentSize,
|
||||
this.getMinimumSegmentIndex(),
|
||||
this.bossSegmentIndex,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ import { toDmgValue } from "#utils/common";
|
||||
* @param currentHp - The target's current HP
|
||||
* @param segmentHp - The HP in each segment (total HP / number of segments)
|
||||
* @param minSegmentIndex - The minimum segment index that can be cleared; default `0` (all segments). Used for the final boss
|
||||
* @param currentSegmentIndex - The current segment index of the target; if not provided, it will be calculated from `currentHp` and `segmentHp`.
|
||||
* @returns A tuple consisting of the adjusted damage and index of the boss segment the target is in after damage is applied.
|
||||
*/
|
||||
export function calculateBossSegmentDamage(
|
||||
@ -23,8 +24,9 @@ export function calculateBossSegmentDamage(
|
||||
currentHp: number,
|
||||
segmentHp: number,
|
||||
minSegmentIndex = 0,
|
||||
currentSegmentIndex?: number,
|
||||
): [adjustedDamage: number, clearedBossSegmentIndex: number] {
|
||||
const segmentIndex = Math.ceil(currentHp / segmentHp) - 1;
|
||||
const segmentIndex = currentSegmentIndex ?? Math.ceil(currentHp / segmentHp) - 1;
|
||||
if (segmentIndex <= 0) {
|
||||
return [damage, 1];
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user