This commit is contained in:
NightKev 2025-08-18 20:54:39 +01:00 committed by GitHub
commit 7a86b1acef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4952,31 +4952,48 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
return true;
}
let sleepTurnsRemaining: NumberHolder;
const sleepTurnsRemaining: NumberHolder = new NumberHolder(1);
if (effect === StatusEffect.SLEEP) {
sleepTurnsRemaining = new NumberHolder(this.randBattleSeedIntRange(2, 4));
switch (effect) {
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
const invulnerableTags = [
BattlerTagType.UNDERGROUND,
BattlerTagType.UNDERWATER,
BattlerTagType.HIDDEN,
BattlerTagType.FLYING,
];
// If the user is invulnerable, lets remove their invulnerability when they fall asleep
const invulnerableTags = [
BattlerTagType.UNDERGROUND,
BattlerTagType.UNDERWATER,
BattlerTagType.HIDDEN,
BattlerTagType.FLYING,
];
const tag = invulnerableTags.find(t => this.getTag(t));
const tag = invulnerableTags.find(t => this.getTag(t));
if (tag) {
this.removeTag(tag);
this.getMoveQueue().pop();
if (tag) {
this.removeTag(tag);
this.getMoveQueue().pop();
}
break;
}
case StatusEffect.FREEZE:
this.setFrameRate(0);
break;
case StatusEffect.BURN:
this.setFrameRate(14);
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;
}
@ -5009,8 +5026,8 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
public clearStatus(confusion: boolean, reloadAssets: boolean) {
const lastStatus = this.status?.effect;
this.status = null;
this.setFrameRate(10);
if (lastStatus === StatusEffect.SLEEP) {
this.setFrameRate(10);
if (this.getTag(BattlerTagType.NIGHTMARE)) {
this.lapseTag(BattlerTagType.NIGHTMARE);
}