Merge branch 'beta' into arena-tag-cleanup

This commit is contained in:
Lugiad 2025-08-21 00:52:21 +02:00 committed by GitHub
commit ac080588e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 51 additions and 15 deletions

View File

@ -5001,22 +5001,43 @@ export abstract class Pokemon extends Phaser.GameObjects.Container {
effect: StatusEffect,
sleepTurnsRemaining = effect !== StatusEffect.SLEEP ? 0 : this.randBattleSeedIntRange(2, 4),
): void {
if (effect === StatusEffect.SLEEP) {
this.setFrameRate(4);
switch (effect) {
case StatusEffect.POISON:
case StatusEffect.TOXIC:
this.setFrameRate(8);
break;
case StatusEffect.PARALYSIS:
this.setFrameRate(5);
break;
case StatusEffect.SLEEP: {
this.setFrameRate(3);
// If the user is semi-invulnerable when put asleep (such as due to Yawm),
// remove their invulnerability and cancel the upcoming move from the queue
const invulnTagTypes = [
BattlerTagType.FLYING,
BattlerTagType.UNDERGROUND,
BattlerTagType.UNDERWATER,
BattlerTagType.HIDDEN,
];
// If the user is semi-invulnerable when put asleep (such as due to Yawm),
// remove their invulnerability and cancel the upcoming move from the queue
const invulnTagTypes = [
BattlerTagType.FLYING,
BattlerTagType.UNDERGROUND,
BattlerTagType.UNDERWATER,
BattlerTagType.HIDDEN,
];
if (this.findTag(t => invulnTagTypes.includes(t.tagType))) {
this.findAndRemoveTags(t => invulnTagTypes.includes(t.tagType));
this.getMoveQueue().shift();
if (this.findTag(t => invulnTagTypes.includes(t.tagType))) {
this.findAndRemoveTags(t => invulnTagTypes.includes(t.tagType));
this.getMoveQueue().shift();
}
break;
}
case StatusEffect.FREEZE:
this.setFrameRate(0);
break;
case StatusEffect.BURN:
this.setFrameRate(14);
break;
case StatusEffect.FAINT:
break;
default:
effect satisfies StatusEffect.NONE;
break;
}
this.status = new Status(effect, 0, sleepTurnsRemaining);
@ -5050,8 +5071,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);
}

View File

@ -401,6 +401,12 @@ export class StarterSelectUiHandler extends MessageUiHandler {
private starterPreferences: StarterPreferences;
/**
* Used to check whether any moves were swapped using the reorder menu, to decide
* whether a save should be performed or not.
*/
private hasSwappedMoves = false;
protected blockInput = false;
constructor() {
@ -1957,6 +1963,14 @@ export class StarterSelectUiHandler extends MessageUiHandler {
handler: () => {
this.moveInfoOverlay.clear();
this.clearText();
// Only saved if moves were actually swapped
if (this.hasSwappedMoves) {
globalScene.gameData.saveSystem().then(success => {
if (!success) {
return globalScene.reset(true);
}
});
}
ui.setMode(UiMode.STARTER_SELECT);
return true;
},
@ -1975,6 +1989,7 @@ export class StarterSelectUiHandler extends MessageUiHandler {
options.push({
label: i18next.t("starterSelectUiHandler:manageMoves"),
handler: () => {
this.hasSwappedMoves = false;
showSwapOptions(this.starterMoveset!); // TODO: is this bang correct?
return true;
},
@ -2724,8 +2739,8 @@ export class StarterSelectUiHandler extends MessageUiHandler {
} else {
starterData.moveset = updatedMoveset;
}
this.hasSwappedMoves = true;
this.setSpeciesDetails(this.lastSpecies, { forSeen: false });
this.updateSelectedStarterMoveset(speciesId);
}