new rpg mode
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import type { AetherShipKind } from "../game/aetherAssault";
|
||||
|
||||
export const AETHER_STANDARD_SHIP_COLORS = [
|
||||
"#20c8e8",
|
||||
"#8a5cff",
|
||||
"#f044b5",
|
||||
"#31cf74",
|
||||
"#f06b3c",
|
||||
"#d6b91c",
|
||||
] as const;
|
||||
|
||||
export const AETHER_ARMORED_SHIP_COLORS = [
|
||||
"#9ef5ff",
|
||||
"#d0b8ff",
|
||||
"#ff9bdc",
|
||||
"#9af0b8",
|
||||
"#ffb088",
|
||||
"#ffe976",
|
||||
] as const;
|
||||
|
||||
export function aetherShipColorIndex(seed: number, wave: number, shipIndex: number) {
|
||||
const normalizedSeed = Math.floor(Number.isFinite(seed) ? seed : 0) >>> 0;
|
||||
const mixedSeed = (normalizedSeed ^ (normalizedSeed >>> 16)) >>> 0;
|
||||
const normalizedWave = Math.max(1, Math.floor(Number.isFinite(wave) ? wave : 1));
|
||||
const normalizedIndex = Math.max(0, Math.floor(Number.isFinite(shipIndex) ? shipIndex : 0));
|
||||
return (mixedSeed + (normalizedWave - 1) * 3 + normalizedIndex * 5) % AETHER_STANDARD_SHIP_COLORS.length;
|
||||
}
|
||||
|
||||
export function aetherShipColor(seed: number, wave: number, shipIndex: number, kind: AetherShipKind) {
|
||||
const palette = kind === "armored" ? AETHER_ARMORED_SHIP_COLORS : AETHER_STANDARD_SHIP_COLORS;
|
||||
return palette[aetherShipColorIndex(seed, wave, shipIndex)];
|
||||
}
|
||||
Reference in New Issue
Block a user