diff --git a/src/data/dialogue.ts b/src/data/dialogue.ts index 8fd9fc125..ec9fde7eb 100644 --- a/src/data/dialogue.ts +++ b/src/data/dialogue.ts @@ -1639,7 +1639,8 @@ export const trainerTypeDialogue = { }, [TrainerType.HAU]: { encounter: [ - `I wonder if a Trainer battles differently depending on whether they're from a warm region or a cold region. Let's test it out!`, + `I wonder if a Trainer battles differently depending on whether they're from a warm region or a cold region. + $Let's test it out!`, ], victory: [ `That was awesome! I think I kinda understand your vibe a little better now!`, diff --git a/src/data/move.ts b/src/data/move.ts index dec6427a7..cd83fb114 100644 --- a/src/data/move.ts +++ b/src/data/move.ts @@ -5985,7 +5985,8 @@ export function initMoves() { .attr(FriendshipPowerAttr), new AttackMove(Moves.BOUNCY_BUBBLE, Type.WATER, MoveCategory.SPECIAL, 60, 100, 20, -1, 0, 7) .attr(HitHealAttr, 1.0) - .triageMove(), + .triageMove() + .target(MoveTarget.ALL_NEAR_ENEMIES), new AttackMove(Moves.BUZZY_BUZZ, Type.ELECTRIC, MoveCategory.SPECIAL, 60, 100, 20, 100, 0, 7) .attr(StatusEffectAttr, StatusEffect.PARALYSIS), new AttackMove(Moves.SIZZLY_SLIDE, Type.FIRE, MoveCategory.PHYSICAL, 60, 100, 20, 100, 0, 7) diff --git a/src/utils.ts b/src/utils.ts index 822f02f05..ef277630d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -222,7 +222,8 @@ export function executeIf(condition: boolean, promiseFunc: () => Promise): export const sessionIdKey = 'pokerogue_sessionId'; export const isLocal = window.location.hostname === 'localhost'; export const serverUrl = isLocal ? 'http://localhost:8001' : ''; -export const apiUrl = isLocal ? serverUrl : 'api'; +export const apiUrl = isLocal ? serverUrl : 'https://api.pokerogue.net'; +export const fallbackApiUrl = isLocal ? serverUrl : 'api'; export function setCookie(cName: string, cValue: string): void { const expiration = new Date(); @@ -243,7 +244,7 @@ export function getCookie(cName: string): string { return ''; } -export function apiFetch(path: string, authed: boolean = false): Promise { +export function apiFetch(path: string, authed: boolean = false, fallback: boolean = false): Promise { return new Promise((resolve, reject) => { const request = {}; if (authed) { @@ -251,13 +252,22 @@ export function apiFetch(path: string, authed: boolean = false): Promise resolve(response)) - .catch(err => reject(err)); + fetch(`${!fallback ? apiUrl : fallbackApiUrl}/${path}`, request) + .then(response => { + if (!response.ok && response.status === 404 && !fallback) + return apiFetch(path, authed, true).then(res => resolve(res)); + resolve(response); + }) + .catch(err => { + if (fallback) + reject(err); + else + apiFetch(path, authed, true).then(res => resolve(res)); + }); }); } -export function apiPost(path: string, data?: any, contentType: string = 'application/json', authed: boolean = false): Promise { +export function apiPost(path: string, data?: any, contentType: string = 'application/json', authed: boolean = false, fallback: boolean = false): Promise { return new Promise((resolve, reject) => { const headers = { 'Accept': contentType, @@ -268,9 +278,14 @@ export function apiPost(path: string, data?: any, contentType: string = 'applica if (sId) headers['Authorization'] = sId; } - fetch(`${apiUrl}/${path}`, { method: 'POST', headers: headers, body: data }) + fetch(`${!fallback ? apiUrl : fallbackApiUrl}/${path}`, { method: 'POST', headers: headers, body: data }) .then(response => resolve(response)) - .catch(err => reject(err)); + .catch(err => { + if (fallback) + reject(err); + else + apiPost(path, data, contentType, authed, true).then(res => resolve(res)); + }); }); }