mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-06 08:22:16 +02:00
Merge branch 'beta' into small-rock
This commit is contained in:
commit
7dda4c5d5b
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
@ -65,7 +65,7 @@ Do the reviewers need to do something special in order to test your changes?
|
|||||||
- [ ] The PR is self-contained and cannot be split into smaller PRs?
|
- [ ] The PR is self-contained and cannot be split into smaller PRs?
|
||||||
- [ ] Have I provided a clear explanation of the changes?
|
- [ ] Have I provided a clear explanation of the changes?
|
||||||
- [ ] Have I tested the changes manually?
|
- [ ] Have I tested the changes manually?
|
||||||
- [ ] Are all unit tests still passing? (`npm run test`)
|
- [ ] Are all unit tests still passing? (`npm run test:silent`)
|
||||||
- [ ] Have I created new automated tests (`npm run create-test`) or updated existing tests related to the PR's changes?
|
- [ ] Have I created new automated tests (`npm run create-test`) or updated existing tests related to the PR's changes?
|
||||||
- [ ] Have I provided screenshots/videos of the changes (if applicable)?
|
- [ ] Have I provided screenshots/videos of the changes (if applicable)?
|
||||||
- [ ] Have I made sure that any UI change works for both UI themes (default and legacy)?
|
- [ ] Have I made sure that any UI change works for both UI themes (default and legacy)?
|
||||||
|
@ -31,6 +31,7 @@ import ChallengeData from "#app/system/challenge-data";
|
|||||||
import TrainerData from "#app/system/trainer-data";
|
import TrainerData from "#app/system/trainer-data";
|
||||||
import ArenaData from "#app/system/arena-data";
|
import ArenaData from "#app/system/arena-data";
|
||||||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||||
|
import { MessagePhase } from "./message-phase";
|
||||||
|
|
||||||
export class GameOverPhase extends BattlePhase {
|
export class GameOverPhase extends BattlePhase {
|
||||||
private isVictory: boolean;
|
private isVictory: boolean;
|
||||||
@ -122,7 +123,7 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
globalScene.disableMenu = true;
|
globalScene.disableMenu = true;
|
||||||
globalScene.time.delayedCall(1000, () => {
|
globalScene.time.delayedCall(1000, () => {
|
||||||
let firstClear = false;
|
let firstClear = false;
|
||||||
if (this.isVictory && newClear) {
|
if (this.isVictory) {
|
||||||
if (globalScene.gameMode.isClassic) {
|
if (globalScene.gameMode.isClassic) {
|
||||||
firstClear = globalScene.validateAchv(achvs.CLASSIC_VICTORY);
|
firstClear = globalScene.validateAchv(achvs.CLASSIC_VICTORY);
|
||||||
globalScene.validateAchv(achvs.UNEVOLVED_CLASSIC_VICTORY);
|
globalScene.validateAchv(achvs.UNEVOLVED_CLASSIC_VICTORY);
|
||||||
@ -226,7 +227,17 @@ export class GameOverPhase extends BattlePhase {
|
|||||||
isVictory: this.isVictory,
|
isVictory: this.isVictory,
|
||||||
clientSessionId: clientSessionId,
|
clientSessionId: clientSessionId,
|
||||||
})
|
})
|
||||||
.then(success => doGameOver(!!success));
|
.then(success => doGameOver(!globalScene.gameMode.isDaily || !!success))
|
||||||
|
.catch(_err => {
|
||||||
|
globalScene.clearPhaseQueue();
|
||||||
|
globalScene.clearPhaseQueueSplice();
|
||||||
|
globalScene.unshiftPhase(new MessagePhase(i18next.t("menu:serverCommunicationFailed"), 2500));
|
||||||
|
// force the game to reload after 2 seconds.
|
||||||
|
setTimeout(() => {
|
||||||
|
window.location.reload();
|
||||||
|
}, 2000);
|
||||||
|
this.end();
|
||||||
|
});
|
||||||
} else if (this.isVictory) {
|
} else if (this.isVictory) {
|
||||||
globalScene.gameData.offlineNewClear().then(result => {
|
globalScene.gameData.offlineNewClear().then(result => {
|
||||||
doGameOver(result);
|
doGameOver(result);
|
||||||
|
@ -20,17 +20,20 @@ export class PokerogueSessionSavedataApi extends ApiBase {
|
|||||||
* *This is **NOT** the same as {@linkcode clear | clear()}.*
|
* *This is **NOT** the same as {@linkcode clear | clear()}.*
|
||||||
* @param params The {@linkcode NewClearSessionSavedataRequest} to send
|
* @param params The {@linkcode NewClearSessionSavedataRequest} to send
|
||||||
* @returns The raw savedata as `string`.
|
* @returns The raw savedata as `string`.
|
||||||
|
* @throws Error if the request fails
|
||||||
*/
|
*/
|
||||||
public async newclear(params: NewClearSessionSavedataRequest) {
|
public async newclear(params: NewClearSessionSavedataRequest) {
|
||||||
try {
|
try {
|
||||||
const urlSearchParams = this.toUrlSearchParams(params);
|
const urlSearchParams = this.toUrlSearchParams(params);
|
||||||
const response = await this.doGet(`/savedata/session/newclear?${urlSearchParams}`);
|
const response = await this.doGet(`/savedata/session/newclear?${urlSearchParams}`);
|
||||||
const json = await response.json();
|
const json = await response.json();
|
||||||
|
if (response.ok) {
|
||||||
return Boolean(json);
|
return Boolean(json);
|
||||||
|
}
|
||||||
|
throw new Error("Could not newclear session!");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn("Could not newclear session!", err);
|
console.warn("Could not newclear session!", err);
|
||||||
return false;
|
throw new Error("Could not newclear session!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,9 +57,7 @@ describe("Pokerogue Session Savedata API", () => {
|
|||||||
it("should return false and report a warning on ERROR", async () => {
|
it("should return false and report a warning on ERROR", async () => {
|
||||||
server.use(http.get(`${apiBase}/savedata/session/newclear`, () => HttpResponse.error()));
|
server.use(http.get(`${apiBase}/savedata/session/newclear`, () => HttpResponse.error()));
|
||||||
|
|
||||||
const success = await sessionSavedataApi.newclear(params);
|
await expect(sessionSavedataApi.newclear(params)).rejects.toThrow("Could not newclear session!");
|
||||||
|
|
||||||
expect(success).toBe(false);
|
|
||||||
expect(console.warn).toHaveBeenCalledWith("Could not newclear session!", expect.any(Error));
|
expect(console.warn).toHaveBeenCalledWith("Could not newclear session!", expect.any(Error));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user