mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-04 23:42:18 +02:00
Fixed bug and such
This commit is contained in:
parent
25cbe6397e
commit
41f066cb4b
@ -1932,19 +1932,21 @@ export class AddSubstituteAttr extends MoveEffectAttr {
|
|||||||
* @see {@linkcode apply}
|
* @see {@linkcode apply}
|
||||||
*/
|
*/
|
||||||
export class HealAttr extends MoveEffectAttr {
|
export class HealAttr extends MoveEffectAttr {
|
||||||
/** The percentage of {@linkcode Stat.HP} to heal */
|
constructor(
|
||||||
private healRatio: number;
|
/** The percentage of {@linkcode Stat.HP} to heal; default `1` */
|
||||||
/** Should an animation be shown? */
|
protected healRatio = 1,
|
||||||
private showAnim: boolean;
|
/** Whether to display a healing animation upon healing the target; default `false` */
|
||||||
|
private showAnim = false,
|
||||||
constructor(healRatio?: number, showAnim?: boolean, selfTarget?: boolean) {
|
selfTarget = true
|
||||||
super(selfTarget === undefined || selfTarget);
|
) {
|
||||||
|
super(selfTarget);
|
||||||
this.healRatio = healRatio || 1;
|
|
||||||
this.showAnim = !!showAnim;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, args: any[]): boolean {
|
||||||
|
if (!super.apply(user, target, move, args)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
this.addHealPhase(this.selfTarget ? user : target, this.healRatio);
|
this.addHealPhase(this.selfTarget ? user : target, this.healRatio);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1998,9 +2000,8 @@ export class VariableHealAttr extends HealAttr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
apply(user: Pokemon, target: Pokemon, move: Move, _args: any[]): boolean {
|
apply(user: Pokemon, target: Pokemon, move: Move, _args: any[]): boolean {
|
||||||
const healRatio = this.healFunc(user, target, move)
|
this.healRatio = this.healFunc(user, target, move)
|
||||||
this.addHealPhase(target, healRatio);
|
return super.apply(user, target, move, args);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1601,6 +1601,7 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return this.getMaxHp() - this.hp;
|
return this.getMaxHp() - this.hp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Why does this default to `false`?
|
||||||
getHpRatio(precise = false): number {
|
getHpRatio(precise = false): number {
|
||||||
return precise ? this.hp / this.getMaxHp() : Math.round((this.hp / this.getMaxHp()) * 100) / 100;
|
return precise ? this.hp / this.getMaxHp() : Math.round((this.hp / this.getMaxHp()) * 100) / 100;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@ import { getPokemonNameWithAffix } from "#app/messages";
|
|||||||
import { getEnumValues, toReadableString } from "#app/utils/common";
|
import { getEnumValues, toReadableString } from "#app/utils/common";
|
||||||
import { AbilityId } from "#enums/ability-id";
|
import { AbilityId } from "#enums/ability-id";
|
||||||
import { MoveId } from "#enums/move-id";
|
import { MoveId } from "#enums/move-id";
|
||||||
import { MoveResult } from "#enums/move-result";
|
|
||||||
import { SpeciesId } from "#enums/species-id";
|
import { SpeciesId } from "#enums/species-id";
|
||||||
import { WeatherType } from "#enums/weather-type";
|
import { WeatherType } from "#enums/weather-type";
|
||||||
import GameManager from "#test/testUtils/gameManager";
|
import GameManager from "#test/testUtils/gameManager";
|
||||||
@ -27,7 +26,7 @@ describe("Moves - Recovery Moves - ", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
game = new GameManager(phaserGame);
|
game = new GameManager(phaserGame);
|
||||||
game.override
|
game.override
|
||||||
.ability(AbilityId.BALL_FETCH)
|
.ability(AbilityId.MAGIC_GUARD) // prevents passive weather damage
|
||||||
.battleStyle("single")
|
.battleStyle("single")
|
||||||
.criticalHits(false)
|
.criticalHits(false)
|
||||||
.enemySpecies(SpeciesId.MAGIKARP)
|
.enemySpecies(SpeciesId.MAGIKARP)
|
||||||
@ -37,7 +36,6 @@ describe("Moves - Recovery Moves - ", () => {
|
|||||||
.enemyLevel(100);
|
.enemyLevel(100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe.each<{ name: string; move: MoveId }>([
|
describe.each<{ name: string; move: MoveId }>([
|
||||||
{ name: "Recover", move: MoveId.RECOVER },
|
{ name: "Recover", move: MoveId.RECOVER },
|
||||||
{ name: "Soft-Boiled", move: MoveId.SOFT_BOILED },
|
{ name: "Soft-Boiled", move: MoveId.SOFT_BOILED },
|
||||||
|
Loading…
Reference in New Issue
Block a user