Add skills

This commit is contained in:
2025-02-02 20:05:52 -08:00
parent 810edb7e3b
commit 06a7263ad9
9 changed files with 588 additions and 45 deletions

262
src/skills.ts Normal file
View File

@ -0,0 +1,262 @@
import {Skill, SkillData, SkillGoverning, Stat} from "./datatypes.ts";
class SkillsTable {
#skills: SkillData[]
constructor() {
this.#skills = [];
}
add(data: SkillData): Skill {
let id = this.#skills.length;
this.#skills.push(data);
return {id};
}
get(skill: Skill): SkillData {
return this.#skills[skill.id]
}
getAllAvailableSkills(): Skill[] {
let skills = [];
for (let i = 0; i < this.#skills.length; i++) {
skills.push({id: i});
}
return skills;
}
}
type Difficulty = 0 | 1 | 2 | 3
type GoverningTemplate = {
stats: Stat[],
note: string
}
type Track = "bat" | "stealth" | "charm" | "stare" | "party" | "lore"
let templates: Record<Track, GoverningTemplate> = {
bat: { stats: ["AGI", "AGI", "PSI"], note: "Cheaper with AGI and PSI." },
stealth: { stats: ["AGI", "AGI", "INT"], note: "Cheaper with AGI and INT." },
charm: { stats: ["CHA", "PSI", "PSI"], note: "Cheaper with CHA and PSI." },
stare: { stats: ["PSI", "PSI"], note: "Cheaper with PSI." },
party: { stats: ["CHA", "CHA", "PSI"], note: "Cheaper with CHA and PSI." },
lore: { stats: ["INT", "INT", "CHA"], note: "Cheaper with INT and CHA." },
}
function governing(track: Track, difficulty: Difficulty): SkillGoverning {
let template = templates[track];
let target: number
let cost: number
switch(difficulty) {
case 0: target = 30; cost = 50; break;
case 1: target = 100; cost = 100; break;
case 2: target = 150; cost = 250; break;
case 3: target = 250; cost = 500; break;
}
return {
stats: template.stats,
target: target,
cost: cost,
note: template.note,
}
}
let table = new SkillsTable();
export let bat0 = table.add({
governing: governing("bat", 0),
profile: {
name: "Screech",
description: "Energy fills your body. You can't help but let go. It just feels so good to let that sound rip through you."
},
prereqs: []
});
export let bat1 = table.add({
governing: governing("bat", 1),
profile: {
name: "Flap",
description: "Sailing on your cloak is pleasurable, but it's better still to shake your limbs and FIGHT the wind."
},
prereqs: [bat0]
});
export let bat2 = table.add({
governing: governing("bat", 2),
profile: {
name: "Transform",
description: "Bare your fangs and let them out further than normal. Your nose wrinkles. You have a SNOUT??"
},
prereqs: [bat1]
});
export let bat3 = table.add({
governing: governing("bat", 3),
profile: {
name: "Eat Bugs",
description: "This is the forbidden pleasure. It supersedes even blood. Go on -- have a bite -- CRUNCH!"
},
prereqs: [bat2]
});
export let stealth0 = table.add({
governing: governing("stealth", 0),
profile: {
name: "Be Quiet",
description: "There's a thing in the brain that _wants_ to be caught. Mortals have it, vampires don't."
},
prereqs: []
});
export let stealth1 = table.add({
governing: governing("stealth", 1),
profile: {
name: "Disguise",
description: "First impressions: what you want them to see, they'll see. Just meet their gaze and start talking.",
},
prereqs: [stealth0]
});
export let stealth2 = table.add({
governing: governing("stealth", 2),
profile: {
name: "Sneak",
description: "Your unnatural pallor _should_ make you bright against the shadow. But it likes you, so you fade."
},
prereqs: [stealth1]
});
export let stealth3 = table.add({
governing: governing("stealth", 3),
profile: {
name: "Turn Invisible",
description: "No one sees any more of you than you'd like. You're as ghostly as your own reflection.",
},
prereqs: [stealth2]
});
export let charm0 = table.add({
governing: governing("charm", 0),
profile: {
name: "Flatter",
description: "No matter how weird you're being, people like praise. Praise in your voice has an intoxicating quality.",
},
prereqs: []
});
export let charm1 = table.add({
governing: governing("charm", 1),
profile: {
name: "Befriend",
description: "Cute: they think they've met the real you. They're even thinking about you when you're not around."
},
prereqs: [charm0]
});
export let charm2 = table.add({
governing: governing("charm", 2),
profile: {
name: "Seduce",
description: "Transfix them long and deep enough for them to realize how much they want you. \"No\" isn't \"no\" anymore.",
},
prereqs: [charm1]
});
export let charm3 = table.add({
governing: governing("charm", 3),
profile: {
name: "Infatuate",
description: "They were into mortals once. Now they can't get off without the fangs. The eyes. The pale dead flesh."
},
prereqs: [charm2]
});
export let stare0 = table.add({
governing: governing("stare", 0),
profile: {
name: "Dazzle",
description: "Your little light show can reduce anyone to a puddle of their own fluids. Stare and they give in instantly.",
},
prereqs: []
});
export let stare1 = table.add({
governing: governing("stare", 1),
profile: {
name: "Hypnotize",
description: "Say \"sleep\" and the mortal falls asleep. That is not a person: just a machine that acts when you require it."
},
prereqs: [stare0]
});
export let stare2 = table.add({
governing: governing("stare", 2),
profile: {
name: "Enthrall",
description: "Everyone's mind has room for one master. Reach into the meek fractured exterior and mean for it to be you."
},
prereqs: [stare1]
});
export let stare3 = table.add({
governing: governing("stare", 3),
profile: {
name: "Seal Memory",
description: "There was no existence before you and will be none after. Your mortals cannot imagine another existence."
},
prereqs: [stare2]
});
export let party0 = table.add({
governing: governing("party", 0),
profile: {
name: "Chug",
description: "This undead body can hold SO MUCH whiskey. (BRAAAAP.) \"You, mortal -- fetch me another drink!\""
},
prereqs: []
});
export let party1 = table.add({
governing: governing("party", 1),
profile: {
name: "Rave",
description: "You could jam glowsticks in your hair, but your eyes are a lot brighter. And they pulse with the music."
},
prereqs: [party0]
});
export let party2 = table.add({
governing: governing("party", 2),
profile: {
name: "Peer Pressure",
description: "Partying: it gets you out of your head. Makes you do things you wouldn't normally do. Controls you."
},
prereqs: [party1]
});
export let party3 = table.add({
governing: governing("party", 3),
profile: {
name: "Sleep It Off",
description: "Feels good. Never want it to end. But sober up. These feelings aren't for you. They're for your prey."
},
prereqs: [party2]
});
export let lore0 = table.add({
governing: governing("lore", 0),
profile: {
name: "Respect Elders",
description: "You're told not to bother learning much. The test is not to believe that. Bad vampires _disappear_."
},
prereqs: []
});
export let lore1 = table.add({
governing: governing("lore", 1),
profile: {
name: "Brick by Brick",
description: "Vampire history is a mix of fact and advice. Certain tips -- \"live in a castle\" -- seem very concrete."
},
prereqs: [lore0]
});
export let lore2 = table.add({
governing: governing("lore", 2),
profile: {
name: "Make Wine",
description: "Fruit bats grow the grapes. Insectivores fertilize the soil. What do vampire bats do? Is this a metaphor?"
},
prereqs: [lore1]
});
export let lore3 = table.add({
governing: governing("lore", 3),
profile: {
name: "Third Clade",
description: "Mortals love the day. They hate the night. There's a night deeper than any night that cannot be discussed."
},
prereqs: [lore2]
});
export function getSkills(): SkillsTable {
return table;
}