This commit is contained in:
Bertie690 2025-08-05 00:57:37 -05:00 committed by GitHub
commit 2c921837b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 38 additions and 5 deletions

BIN
public/images/logo_fake.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -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.01%)
*/
export const FAKE_TITLE_LOGO_CHANCE = 10000;

View File

@ -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");

View File

@ -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;

View File

@ -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.scaledCanvas.width / 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";
}
}

View File

@ -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;