Scenario generator for vore roleplay and story ideas. https://scenario-generator.deliciousreya.net/responses
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

43 lines
1.1 KiB

export enum RollTable {
Setting = 0,
Theme = 1,
Start = 2,
Challenge = 3,
Twist = 4,
Focus = 5,
Word = 6,
}
export enum ValueAccess {
Global = 0,
Server = 1,
CreatorDM = 2,
}
export const RollTableOrder =
[RollTable.Setting, RollTable.Theme, RollTable.Start, RollTable.Challenge, RollTable.Twist, RollTable.Focus, RollTable.Word] as const satisfies RollTable[]
export const RollTableOrdinals =
{
[RollTable.Setting]: 0,
[RollTable.Theme]: 1,
[RollTable.Start]: 2,
[RollTable.Challenge]: 3,
[RollTable.Twist]: 4,
[RollTable.Focus]: 5,
[RollTable.Word]: 6,
} as const satisfies {[key in RollTable]: number} & {[key in Extract<keyof typeof RollTableOrder, number> as typeof RollTableOrder[key]]: key}
export type RollableTables = {readonly [key in RollTable]: readonly string[]}
export function isTable(val: number): val is RollTable {
return RollTableOrdinals.hasOwnProperty(val)
}
export function rollOn(table: RollTable, tables: RollableTables): string {
const values = tables[table]
if (values.length === 0) {
throw Error(`no possible options for table ${table}`)
}
return values[Math.floor(values.length * Math.random())]
}