mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 16:02:20 +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?
|
||||
- [ ] Have I provided a clear explanation of the changes?
|
||||
- [ ] 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 provided screenshots/videos of the changes (if applicable)?
|
||||
- [ ] 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 ArenaData from "#app/system/arena-data";
|
||||
import { pokerogueApi } from "#app/plugins/api/pokerogue-api";
|
||||
import { MessagePhase } from "./message-phase";
|
||||
|
||||
export class GameOverPhase extends BattlePhase {
|
||||
private isVictory: boolean;
|
||||
@ -122,7 +123,7 @@ export class GameOverPhase extends BattlePhase {
|
||||
globalScene.disableMenu = true;
|
||||
globalScene.time.delayedCall(1000, () => {
|
||||
let firstClear = false;
|
||||
if (this.isVictory && newClear) {
|
||||
if (this.isVictory) {
|
||||
if (globalScene.gameMode.isClassic) {
|
||||
firstClear = globalScene.validateAchv(achvs.CLASSIC_VICTORY);
|
||||
globalScene.validateAchv(achvs.UNEVOLVED_CLASSIC_VICTORY);
|
||||
@ -226,7 +227,17 @@ export class GameOverPhase extends BattlePhase {
|
||||
isVictory: this.isVictory,
|
||||
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) {
|
||||
globalScene.gameData.offlineNewClear().then(result => {
|
||||
doGameOver(result);
|
||||
|
@ -20,17 +20,20 @@ export class PokerogueSessionSavedataApi extends ApiBase {
|
||||
* *This is **NOT** the same as {@linkcode clear | clear()}.*
|
||||
* @param params The {@linkcode NewClearSessionSavedataRequest} to send
|
||||
* @returns The raw savedata as `string`.
|
||||
* @throws Error if the request fails
|
||||
*/
|
||||
public async newclear(params: NewClearSessionSavedataRequest) {
|
||||
try {
|
||||
const urlSearchParams = this.toUrlSearchParams(params);
|
||||
const response = await this.doGet(`/savedata/session/newclear?${urlSearchParams}`);
|
||||
const json = await response.json();
|
||||
|
||||
return Boolean(json);
|
||||
if (response.ok) {
|
||||
return Boolean(json);
|
||||
}
|
||||
throw new Error("Could not newclear session!");
|
||||
} catch (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 () => {
|
||||
server.use(http.get(`${apiBase}/savedata/session/newclear`, () => HttpResponse.error()));
|
||||
|
||||
const success = await sessionSavedataApi.newclear(params);
|
||||
|
||||
expect(success).toBe(false);
|
||||
await expect(sessionSavedataApi.newclear(params)).rejects.toThrow("Could not newclear session!");
|
||||
expect(console.warn).toHaveBeenCalledWith("Could not newclear session!", expect.any(Error));
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user