From 90c3a7ed896465f55fbbc63a40f8b891e55864ed Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Thu, 31 Jul 2025 14:32:58 -0400 Subject: [PATCH 1/4] [Misc] Added 0.1% chance for fake login screen --- src/constants.ts | 7 +++++++ src/loading-scene.ts | 1 + src/timed-event-manager.ts | 10 ++++++++++ src/ui/title-ui-handler.ts | 13 ++++++++++++- src/utils/common.ts | 12 ++++++++---- 5 files changed, 38 insertions(+), 5 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index f3b37563d11..ae803ba6e92 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -94,3 +94,10 @@ export const AVERAGE_ENCOUNTERS_PER_RUN_TARGET = 12; * So anti-variance adds -15/256 to the spawn weight check for ME spawn. */ export const ANTI_VARIANCE_WEIGHT_MODIFIER = 15; + +/** + * The chance (out of 1) that a different title logo will show when the title screen is drawn. + * Inverted during April Fools (such that this becomes the chance for the _normal_ title logo is displayed). + * Default: `10000` (0.1%) + */ +export const FAKE_TITLE_LOGO_CHANCE = 10000; diff --git a/src/loading-scene.ts b/src/loading-scene.ts index 706ea01a16a..8e3987dad1e 100644 --- a/src/loading-scene.ts +++ b/src/loading-scene.ts @@ -29,6 +29,7 @@ export class LoadingScene extends SceneBase { this.loadImage("loading_bg", "arenas"); this.loadImage("logo", ""); + this.loadImage("logo_fake", ""); // Load menu images this.loadAtlas("bg", "ui"); diff --git a/src/timed-event-manager.ts b/src/timed-event-manager.ts index 9877f298404..136467ad826 100644 --- a/src/timed-event-manager.ts +++ b/src/timed-event-manager.ts @@ -397,6 +397,16 @@ export class TimedEventManager { return timedEvents.some((te: TimedEvent) => this.isActive(te)); } + /** + * Check whether the current event is active and for April Fools. + * @returns Whether the April Fools event is currently active. + */ + isAprilFoolsActive(): boolean { + return timedEvents.some( + te => this.isActive(te) && te.hasOwnProperty("bannerKey") && te.bannerKey!.startsWith("aprf"), + ); + } + activeEventHasBanner(): boolean { const activeEvents = timedEvents.filter(te => this.isActive(te) && te.hasOwnProperty("bannerKey")); return activeEvents.length > 0; diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index 66cb69f6a26..f01c8cffb8d 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -1,4 +1,5 @@ import { pokerogueApi } from "#api/pokerogue-api"; +import { FAKE_TITLE_LOGO_CHANCE } from "#app/constants"; import { timedEventManager } from "#app/global-event-manager"; import { globalScene } from "#app/global-scene"; import { TimedEventDisplay } from "#app/timed-event-manager"; @@ -41,7 +42,7 @@ export class TitleUiHandler extends OptionSelectUiHandler { this.titleContainer.setAlpha(0); ui.add(this.titleContainer); - const logo = globalScene.add.image(globalScene.game.canvas.width / 6 / 2, 8, "logo"); + const logo = globalScene.add.image(globalScene.game.canvas.width / 6 / 2, 8, this.getLogo()); logo.setOrigin(0.5, 0); this.titleContainer.add(logo); @@ -186,4 +187,14 @@ export class TitleUiHandler extends OptionSelectUiHandler { ease: "Sine.easeInOut", }); } + + /** + * Get the logo file path to load, with a 0.1% chance to use the fake logo instead. + * @returns The path to the image. + */ + private getLogo(): string { + // Invert spawn chances on april fools + const aprilFools = timedEventManager.isAprilFoolsActive(); + return aprilFools === !!randInt(FAKE_TITLE_LOGO_CHANCE) ? "logo_fake" : "logo"; + } } diff --git a/src/utils/common.ts b/src/utils/common.ts index 66a74ed2c33..64e6d6fed1c 100644 --- a/src/utils/common.ts +++ b/src/utils/common.ts @@ -70,12 +70,16 @@ export function padInt(value: number, length: number, padWith?: string): string } /** - * Returns a random integer between min and min + range - * @param range The amount of possible numbers - * @param min The starting number + * Returns a **completely unseeded** random integer between `min` and `min + range`. + * @param range - The amount of possible numbers to pick + * @param min - The minimum number to pick; default `0` + * @returns A psuedo-random, unseeded integer within the interval [min, min+range]. + * @remarks + * This should not be used for battles or other outwards-facing randomness; + * battles are intended to be seeded and deterministic. */ export function randInt(range: number, min = 0): number { - if (range === 1) { + if (range <= 1) { return min; } return Math.floor(Math.random() * range) + min; From 740ce787f91cc48b00e068ce422576a1428609ce Mon Sep 17 00:00:00 2001 From: Bertie690 Date: Thu, 31 Jul 2025 14:33:23 -0400 Subject: [PATCH 2/4] Actually added logo file --- public/images/logo_fake.png | Bin 0 -> 1628 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 public/images/logo_fake.png diff --git a/public/images/logo_fake.png b/public/images/logo_fake.png new file mode 100755 index 0000000000000000000000000000000000000000..9fdb87240252709715af48d90f62b7a313d6dde3 GIT binary patch literal 1628 zcmV-i2BZ0jP)Px){7FPXRCr$Pn>%h5K@dgljF5yCARz)0GB!a*#0FRZ>tF$FfQXDukdY7|1Q{6# zAtC{_MOjzHz4httv7aqo@~k&A-Ss*3>7Mra+27CSCr^Ic-!tD2-oHPec@Ce6WLO>l z6!crQ&&=~o?^Rn?RdbSGoX|`SACVqcnOxlHNIB?n}J{euHaq)%L3=R^~)Tw>v{x~pX112xhP*~ z{2dPHf{QT}H$bVt7+?^;9Ra2cO0SlQ}H8QrAL_EI`vp)px` ziyCsjypFaw(Bf67R`-t3aoFpy-?QzRN=8<2d9Y^mS_UhEDg$yjZ#dhGknLkdPz^^^ z`VE^Cvs)ym(r?K8`unF#`*r7LSNM2u2sN7`P8C}Wi142R<9+nR-rQE8e9=r z*m$Z;RRP(r45K#=yP-mTeMUmr5iAB!#a=4oRm*TEP?=uSV6mnzDt$^JbhKKv3`4SJ z6ZfM!P?;>_`N~QOWoKogGPjN4w_;dEz^pW$W2@3gc9!u}KgIkKja~8MfN}~f+w;Il zD&@?B=QEFTvUiFt3_5eFl+Wfw{boxATjH~2eFvvIC{>8)x)o8LJ|@FG=iGT?H=X2MiXQOUc#BSlK2c zbFzoZ1Y#=^rBJjFm7U69eUdM2S()vCwL{-sU=2NI;EDnqZKrHIo-c!?oNFtOX#dFX z8(9>ydaYg$`Fkt9C@&WjtH8X7j5I?-u|lXS9cfHc|c5_&u_1 z8LX_&i1wj;BZ>F=aebs@!rO~vX50!?X2kK$WWgS;T8dWmRi!N2Z(=>7Io^6D4=K}E zWpM^qX4@+P3nS1{b7Ux0mOAB#EiP2_8JxSon$_3Khy6^nL(ag8R_wcbES0fKrLdZ@ zEN!!LX3?Xf1y>@7cSwrxecWt1@nu5iHZPRdMCnsKj9wpVh0pDqI1p zs;Ge#Wu`1^Rp&CpM)1snRh2>Yh~4K+m#lBfVDhEVXTpwLC9qWUh#Q4$<)L2OG6m7d zQD#vqNmb4wVC>TB0#?d8XgPWwi7P$hI# zue20;SkSNxtOza!18%Oe>qq>CM@b^M#x=FkiRH3#?#bq1b9at_E7`ktXLj|zUDYei zSSn%_SXCvnvqGr6Djn#sii0|i@%OUK&B~<;hR)nk5N5&FwZl<*wZOu99Dx<3`fk)_ zSxo`p!OR@u10ovNqPx;(MnF|cTIYF{fvXvFr(PwnSk|h5RdMF2-D43P1%PtEsp(Rc z$7ih_zHNhLSqpoRsscCtKHucu78@L)R~f9VRNQoEs`8@~X3JD{uB*Inw_g9jYI<+C z1DewxcKdFTF0000 Date: Thu, 31 Jul 2025 15:01:03 -0400 Subject: [PATCH 3/4] fix comment --- src/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index ae803ba6e92..6f9f4a6d2fb 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -98,6 +98,6 @@ export const ANTI_VARIANCE_WEIGHT_MODIFIER = 15; /** * The chance (out of 1) that a different title logo will show when the title screen is drawn. * Inverted during April Fools (such that this becomes the chance for the _normal_ title logo is displayed). - * Default: `10000` (0.1%) + * Default: `10000` (0.01%) */ export const FAKE_TITLE_LOGO_CHANCE = 10000; From 92c42694cd03817a319bff461472f9f5139ad815 Mon Sep 17 00:00:00 2001 From: Bertie690 <136088738+Bertie690@users.noreply.github.com> Date: Thu, 31 Jul 2025 19:16:42 -0400 Subject: [PATCH 4/4] Update title-ui-handler.ts Co-authored-by: Wlowscha <54003515+Wlowscha@users.noreply.github.com> --- src/ui/title-ui-handler.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/title-ui-handler.ts b/src/ui/title-ui-handler.ts index f01c8cffb8d..bd49c6dd430 100644 --- a/src/ui/title-ui-handler.ts +++ b/src/ui/title-ui-handler.ts @@ -42,7 +42,7 @@ export class TitleUiHandler extends OptionSelectUiHandler { this.titleContainer.setAlpha(0); ui.add(this.titleContainer); - const logo = globalScene.add.image(globalScene.game.canvas.width / 6 / 2, 8, this.getLogo()); + const logo = globalScene.add.image(globalScene.scaledCanvas.width / 2, 8, this.getLogo()); logo.setOrigin(0.5, 0); this.titleContainer.add(logo);