mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-20 15:22:19 +02:00
Ensure status overriding (ie rest) works properly
This commit is contained in:
parent
a976bac19f
commit
df1bab44e2
@ -2384,12 +2384,8 @@ export class StatusEffectAttr extends MoveEffectAttr {
|
|||||||
const statusCheck = moveChance < 0 || moveChance === 100 || user.randSeedInt(100) < moveChance;
|
const statusCheck = moveChance < 0 || moveChance === 100 || user.randSeedInt(100) < moveChance;
|
||||||
if (statusCheck) {
|
if (statusCheck) {
|
||||||
const pokemon = this.selfTarget ? user : target;
|
const pokemon = this.selfTarget ? user : target;
|
||||||
if (pokemon.status) {
|
if (pokemon.status && !this.overrideStatus) {
|
||||||
if (this.overrideStatus) {
|
return false;
|
||||||
pokemon.resetStatus();
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (user !== target && target.isSafeguarded(user)) {
|
if (user !== target && target.isSafeguarded(user)) {
|
||||||
@ -2398,8 +2394,8 @@ export class StatusEffectAttr extends MoveEffectAttr {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if ((!pokemon.status || (pokemon.status.effect === this.effect && moveChance < 0))
|
if (((!pokemon. status || this.overrideStatus) || (pokemon.status.effect === this.effect && moveChance < 0))
|
||||||
&& pokemon.trySetStatus(this.effect, true, user, this.turnsRemaining)) {
|
&& pokemon.trySetStatus(this.effect, true, user, this.turnsRemaining, null, this.overrideStatus)) {
|
||||||
applyPostAttackAbAttrs(ConfusionOnStatusEffectAbAttr, user, target, move, null, false, this.effect);
|
applyPostAttackAbAttrs(ConfusionOnStatusEffectAbAttr, user, target, move, null, false, this.effect);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3744,8 +3744,8 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
trySetStatus(effect?: StatusEffect, asPhase: boolean = false, sourcePokemon: Pokemon | null = null, turnsRemaining: number = 0, sourceText: string | null = null): boolean {
|
trySetStatus(effect?: StatusEffect, asPhase: boolean = false, sourcePokemon: Pokemon | null = null, turnsRemaining: number = 0, sourceText: string | null = null, overrideStatus?: boolean): boolean {
|
||||||
if (!this.canSetStatus(effect, asPhase, false, sourcePokemon)) {
|
if (!this.canSetStatus(effect, asPhase, overrideStatus, sourcePokemon)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (this.isFainted() && effect !== StatusEffect.FAINT) {
|
if (this.isFainted() && effect !== StatusEffect.FAINT) {
|
||||||
@ -3761,6 +3761,9 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (asPhase) {
|
if (asPhase) {
|
||||||
|
if (overrideStatus) {
|
||||||
|
this.resetStatus(false);
|
||||||
|
}
|
||||||
globalScene.unshiftPhase(new ObtainStatusEffectPhase(this.getBattlerIndex(), effect, turnsRemaining, sourceText, sourcePokemon));
|
globalScene.unshiftPhase(new ObtainStatusEffectPhase(this.getBattlerIndex(), effect, turnsRemaining, sourceText, sourcePokemon));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user