mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-09-24 07:23:24 +02:00
Merge branch 'beta' into arena-tag-cleanup
This commit is contained in:
commit
ac080588e9
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user