[Misc] Change framerate of Pokemon based on its status effect

This commit is contained in:
NightKev 2025-08-17 16:16:22 -07:00
parent 2ff9bd4652
commit 30b1a059c2

View File

@ -4952,12 +4952,20 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
return true; return true;
} }
let sleepTurnsRemaining: NumberHolder; const sleepTurnsRemaining: NumberHolder = new NumberHolder(1);
if (effect === StatusEffect.SLEEP) { switch (effect) {
sleepTurnsRemaining = new NumberHolder(this.randBattleSeedIntRange(2, 4)); case StatusEffect.POISON:
case StatusEffect.TOXIC:
this.setFrameRate(8);
break;
case StatusEffect.PARALYSIS:
this.setFrameRate(5);
break;
case StatusEffect.SLEEP: {
sleepTurnsRemaining.value = this.randBattleSeedIntRange(2, 4);
this.setFrameRate(4); this.setFrameRate(3);
// If the user is invulnerable, lets remove their invulnerability when they fall asleep // If the user is invulnerable, lets remove their invulnerability when they fall asleep
const invulnerableTags = [ const invulnerableTags = [
@ -4973,10 +4981,19 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
this.removeTag(tag); this.removeTag(tag);
this.getMoveQueue().pop(); this.getMoveQueue().pop();
} }
break;
}
case StatusEffect.FREEZE:
this.setFrameRate(0);
break;
case StatusEffect.BURN:
this.setFrameRate(12);
break;
case StatusEffect.FAINT:
break;
} }
sleepTurnsRemaining = sleepTurnsRemaining!; // tell TS compiler it's defined this.status = new Status(effect, 0, sleepTurnsRemaining.value);
this.status = new Status(effect, 0, sleepTurnsRemaining?.value);
return true; return true;
} }
@ -5009,8 +5026,8 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
public clearStatus(confusion: boolean, reloadAssets: boolean) { public clearStatus(confusion: boolean, reloadAssets: boolean) {
const lastStatus = this.status?.effect; const lastStatus = this.status?.effect;
this.status = null; this.status = null;
if (lastStatus === StatusEffect.SLEEP) {
this.setFrameRate(10); this.setFrameRate(10);
if (lastStatus === StatusEffect.SLEEP) {
if (this.getTag(BattlerTagType.NIGHTMARE)) { if (this.getTag(BattlerTagType.NIGHTMARE)) {
this.lapseTag(BattlerTagType.NIGHTMARE); this.lapseTag(BattlerTagType.NIGHTMARE);
} }