Change upgrade names

This commit is contained in:
thepaperpilot 2023-05-08 22:39:05 -05:00
parent 204b6788b0
commit de1f37d732
3 changed files with 120 additions and 17 deletions

View file

@ -48,7 +48,6 @@
"jsdom": "^20.0.0",
"prettier": "^2.5.1",
"typescript": "^5.0.2",
"unique-names-generator": "^4.7.1",
"vitest": "^0.29.3",
"vue-tsc": "^0.38.1"
},

View file

@ -28,7 +28,6 @@ import {
} from "game/modifiers";
import { State, noPersist, persistent } from "game/persistence";
import { createCostRequirement } from "game/requirements";
import { adjectives, colors, uniqueNamesGenerator } from "unique-names-generator";
import Decimal, { DecimalSource } from "util/bignum";
import { format, formatWhole } from "util/break_eternity";
import { Direction, WithRequired, camelToTitle } from "util/common";
@ -37,7 +36,7 @@ import { VueFeature, render, renderRow, trackHover } from "util/vue";
import { ComputedRef, Ref, computed, ref, unref } from "vue";
import { useToast } from "vue-toastification";
import { createCollapsibleModifierSections, createFormulaPreview, estimateTime } from "./common";
import { getColor, getName, sfc32 } from "./utils";
import { getColor, getName, getPowerName, sfc32 } from "./utils";
import {
Resources,
InfluenceState,
@ -218,7 +217,7 @@ export function createPlane(
};
const upgradeType = pickRandom(upgradeTypeWeights, random);
const cost = nextCost.value;
const title = getRandomUpgrade(random);
const title = getPowerName(random);
let description = "";
let modifier: WithRequired<Modifier, "description" | "invert">;
let previewModifier: WithRequired<Modifier, "invert">;
@ -309,7 +308,7 @@ export function createPlane(
// This will become less accurate the further n gets from when the repeatable showed up, but at that time it should be having an increasingly smaller effect on the overall gain
const currentN = n.value;
const initialCost = nextCost.value;
const title = getRandomUpgrade(random);
const title = getPowerName(random);
let description = "";
let effect: ComputedRef<string>;
let modifier: WithRequired<Modifier, "description" | "invert">;
@ -431,7 +430,7 @@ export function createPlane(
cachedGain[n.value] = costFormula.evaluate();
n.value += 2;
const clickableVisibility = visibility;
const title = getRandomUpgrade(random);
const title = getPowerName(random);
const formula = Formula.variable(prestigeResource).pow(effectExponent).add(1);
const modifier = createMultiplicativeModifier(() => ({
multiplier: () => formula.evaluate(),
@ -527,7 +526,7 @@ export function createPlane(
const xp = createResource<DecimalSource>(0);
const barVisibility = visibility;
const currentN = n.value;
const title = getRandomUpgrade(random);
const title = getPowerName(random);
const cost = Decimal.add(difficulty, random() - 0.5)
.pow_base(2)
.times(10);
@ -1080,14 +1079,4 @@ function pickRandom<T extends string>(items: Record<T, number>, random: () => nu
return result;
}
function getRandomUpgrade(random: () => number) {
return camelToTitle(
uniqueNamesGenerator({
dictionaries: [colors, adjectives],
seed: random() * 4294967296,
separator: " "
}) + "ity"
);
}
export type GenericPlane = ReturnType<typeof createPlane>;

View file

@ -212,6 +212,121 @@ export function getName(random: () => number) {
return camelToTitle(name);
}
const powerMorphemes = {
1: ["a", "e", "i", "o", "u"],
2: [
"ph",
"th",
"ch",
"sh",
"br",
"cr",
"dr",
"fr",
"gr",
"pr",
"tr",
"str",
"sc",
"sk",
"sm",
"sn",
"sp",
"st",
"sw"
],
3: [
"ae",
"ai",
"ao",
"au",
"ay",
"ea",
"ei",
"eo",
"eu",
"ey",
"ua",
"ue",
"ui",
"uo",
"uy",
"ia",
"ie",
"iu",
"io",
"iy",
"oa",
"oe",
"ou",
"oi",
"oy"
],
4: [
"morp",
"flux",
"syn",
"void",
"rift",
"dyn",
"nov",
"chron",
"lum",
"par",
"ter",
"psy",
"phan",
"man",
"grav",
"pyr",
"cry",
"hydr",
"elec",
"kin",
"nan",
"omni"
],
5: [
"ance",
"ation",
"esis",
"ergy",
"tide",
"al",
"ism",
"ity",
"mancy",
"urgy",
"pathy",
"port",
"shift",
"burst",
"pulse",
"wave",
"field",
"storm",
"force",
"blade"
]
};
const powerTemplates = [
[1, 2, 1, 4, 5],
[1, 4, 5],
[2, 1, 4, 5],
[1, 2, 3, 4, 5],
[3, 4, 5]
] as const;
export function getPowerName(random: () => number) {
const template = powerTemplates[Math.floor(random() * powerTemplates.length)];
let name = "";
for (let i = 0; i < template.length; i++) {
const morphemeSet = powerMorphemes[template[i]];
name += morphemeSet[Math.floor(random() * morphemeSet.length)];
}
return camelToTitle(name);
}
export function getColor(base: [number, number, number], random: () => number) {
const [h, s, v] = rgb2hsv(...base);
const [r, g, b] = hsv2rgb(Math.floor(random() * 360), s, v);