2021-07-25 22:48:37 -04:00
|
|
|
import { random, replace, sample, sampleSize } from "lodash";
|
|
|
|
|
|
2021-08-21 16:02:35 -04:00
|
|
|
// This is the general implemenetation of details.
|
|
|
|
|
// We are not doing strict class inheritance because that way leads to pain
|
|
|
|
|
export class Detail {
|
|
|
|
|
constructor(public type: string, public roll: number, public description: string) { }
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-25 22:48:37 -04:00
|
|
|
export class Ability {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "ability";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollAbility(roll: number = random(1, 12)): Ability {
|
|
|
|
|
let ability = new Ability(roll);
|
|
|
|
|
ability.description = [
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["bless", "curse"]),
|
|
|
|
|
sample(["entangle", "trap", "snare"]),
|
|
|
|
|
sample(["poison", "disease"]),
|
|
|
|
|
sample(["paralyze", "petrify"]),
|
|
|
|
|
sample(["mimic", "camouflage"]),
|
|
|
|
|
sample(["seduce", "hypnotize"]),
|
|
|
|
|
sample(["dissolve", "disintegrate"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
rollMagicType().description,
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["drain life", "drain magic"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
`immunity to ${rollElement().description}`,
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["read minds", "control minds"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
"[ABILITY] and [ABILITY]"
|
|
|
|
|
][roll - 1];
|
|
|
|
|
ability.description = replace(ability.description, /\[ABILITY\]/g, () => rollAbility(random(1, 11)).description);
|
|
|
|
|
|
|
|
|
|
return ability;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Activity {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "activity";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollActivity(roll: number = random(1, 12)): Activity {
|
|
|
|
|
let activity = new Activity(roll);
|
|
|
|
|
activity.description = [
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["laying trap", "ambush"]),
|
|
|
|
|
sample(["fighting", "at war"]),
|
|
|
|
|
sample(["prowling", "on patrol"]),
|
|
|
|
|
sample(["hunting", "foraging"]),
|
|
|
|
|
sample(["eating", "resting"]),
|
|
|
|
|
sample(["crafting", "praying"]),
|
|
|
|
|
sample(["traveling", "relocating"]),
|
|
|
|
|
sample(["exploring", "lost"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
"returning home",
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["building", "excavating"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
"sleeping",
|
|
|
|
|
"dying",
|
|
|
|
|
][roll - 1];
|
|
|
|
|
|
|
|
|
|
return activity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Adjective {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "adjective";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollAdjective(roll: number = random(1, 12)): Adjective {
|
|
|
|
|
let adjective = new Adjective(roll);
|
|
|
|
|
adjective.description = [
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["slick", "slimy"]),
|
|
|
|
|
sample(["rough", "hard", "sharp"]),
|
|
|
|
|
sample(["smooth", "soft", "dull"]),
|
|
|
|
|
sample(["corroded", "rusty"]),
|
|
|
|
|
sample(["rotten", "decaying"]),
|
|
|
|
|
sample(["broken", "brittle"]),
|
|
|
|
|
sample(["stinking", "smelly"]),
|
|
|
|
|
sample(["weak", "thin", "drained"]),
|
|
|
|
|
sample(["strong", "fat", "full"]),
|
|
|
|
|
sample(["pale", "poor", "shallow"]),
|
|
|
|
|
sample(["dark", "rich", "deep"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
"colorful",
|
|
|
|
|
][roll - 1];
|
|
|
|
|
|
|
|
|
|
return adjective;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Age {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "age";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollAge(roll: number = random(1, 12)): Age {
|
|
|
|
|
let age = new Age(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 1) {
|
|
|
|
|
age.description = "being born/built";
|
|
|
|
|
} else if (roll <= 4) {
|
|
|
|
|
age.description = "young/recent";
|
|
|
|
|
} else if (roll <= 7) {
|
|
|
|
|
age.description = "middle-aged";
|
|
|
|
|
} else if (roll <= 9) {
|
|
|
|
|
age.description = "old";
|
|
|
|
|
} else if (roll <= 11) {
|
|
|
|
|
age.description = "ancient";
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
age.description = "pre-historic";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return age;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Alignment {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "alignment";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollAlignment(roll: number = random(1, 12)): Alignment {
|
|
|
|
|
let alignment = new Alignment(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 2) {
|
|
|
|
|
alignment.description = "chaotic";
|
|
|
|
|
} else if (roll <= 4) {
|
|
|
|
|
alignment.description = "evil";
|
|
|
|
|
} else if (roll <= 8) {
|
|
|
|
|
alignment.description = "neutral";
|
|
|
|
|
} else if (roll <= 10) {
|
|
|
|
|
alignment.description = "good";
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
alignment.description = "lawful";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return alignment;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Aspect {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "aspect";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollAspect(roll: number = random(1, 12)): Aspect {
|
|
|
|
|
let aspect = new Aspect(roll);
|
|
|
|
|
aspect.description = [
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["power", "strength"]),
|
|
|
|
|
sample(["trickery", "dexterity"]),
|
|
|
|
|
sample(["time", "constitution"]),
|
|
|
|
|
sample(["knowledge", "intelligence"]),
|
|
|
|
|
sample(["nature", "wisdom"]),
|
|
|
|
|
sample(["culture", "charisma"]),
|
|
|
|
|
sample(["war", "lies", "discord"]),
|
|
|
|
|
sample(["peace", "truth", "balance"]),
|
|
|
|
|
sample(["hate", "envy"]),
|
|
|
|
|
sample(["love", "admiration"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
rollElement().description,
|
|
|
|
|
"[ASPECT] and [ASPECT]"
|
|
|
|
|
][roll - 1];
|
|
|
|
|
aspect.description = replace(aspect.description, /\[ASPECT\]/g, () => rollAspect(random(1, 11)).description);
|
|
|
|
|
|
|
|
|
|
return aspect;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Condition {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "condition";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollCondition(roll: number = random(1, 12)): Condition {
|
|
|
|
|
let condition = new Condition(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 1) {
|
2021-07-30 19:19:03 -04:00
|
|
|
condition.description = sample(["being built", "being born"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 4) {
|
2021-07-30 19:19:03 -04:00
|
|
|
condition.description = sample(["intact", "healthy", "stable"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 7) {
|
2021-07-30 19:19:03 -04:00
|
|
|
condition.description = sample(["occupied", "active", "alert"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 9) {
|
2021-07-30 19:19:03 -04:00
|
|
|
condition.description = sample(["worn", "tired", "weak"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 10) {
|
2021-07-30 19:19:03 -04:00
|
|
|
condition.description = sample(["vacant", "lost"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 11) {
|
2021-07-30 19:19:03 -04:00
|
|
|
condition.description = sample(["ruined", "defiled", "dying"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 12) {
|
2021-07-30 19:19:03 -04:00
|
|
|
condition.description = sample(["disappeared", "dead"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return condition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Disposition {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "disposition";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollDisposition(roll: number = random(1, 12)): Disposition {
|
|
|
|
|
let disposition = new Disposition(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 1) {
|
|
|
|
|
disposition.description = "attacking";
|
|
|
|
|
} else if (roll <= 4) {
|
2021-07-30 19:19:03 -04:00
|
|
|
disposition.description = sample(["hostile", "aggressive"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 6) {
|
2021-07-30 19:19:03 -04:00
|
|
|
disposition.description = sample(["cautious", "doubtful"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 7) {
|
2021-07-30 19:19:03 -04:00
|
|
|
disposition.description = sample(["fearful", "fleeing"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 10) {
|
|
|
|
|
disposition.description = "neutral";
|
|
|
|
|
} else if (roll <= 11) {
|
2021-07-30 19:19:03 -04:00
|
|
|
disposition.description = sample(["curious", "hopeful"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
disposition.description = "friendly";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return disposition;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Element {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "element";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollElement(roll: number = random(1, 12)): Element {
|
|
|
|
|
let element = new Element(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 2) {
|
|
|
|
|
element.description = "air";
|
|
|
|
|
} else if (roll <= 4) {
|
|
|
|
|
element.description = "earth";
|
|
|
|
|
} else if (roll <= 6) {
|
|
|
|
|
element.description = "fire";
|
|
|
|
|
} else if (roll <= 8) {
|
|
|
|
|
element.description = "water";
|
|
|
|
|
} else if (roll <= 10) {
|
|
|
|
|
element.description = "life";
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
element.description = "death";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return element;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Feature {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "feature";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollFeature(roll: number = random(1, 12)): Feature {
|
|
|
|
|
let feature = new Feature(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 1) {
|
|
|
|
|
feature.description = "heavily armored";
|
|
|
|
|
} else if (roll <= 3) {
|
|
|
|
|
feature.description = "winged/flying";
|
|
|
|
|
} else if (roll <= 4) {
|
2021-07-30 19:19:03 -04:00
|
|
|
feature.description = sample(["multiple heads", "headless"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 5) {
|
2021-07-30 19:19:03 -04:00
|
|
|
feature.description = sample(["many eyes", "one eye"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 6) {
|
2021-07-30 19:19:03 -04:00
|
|
|
feature.description = sample(["many limbs", "tails"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 7) {
|
2021-07-30 19:19:03 -04:00
|
|
|
feature.description = sample(["tentacles", "tendrils"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 8) {
|
|
|
|
|
feature.description = rollAspect().description;
|
|
|
|
|
} else if (roll <= 9) {
|
|
|
|
|
feature.description = rollElement().description;
|
|
|
|
|
} else if (roll <= 10) {
|
|
|
|
|
feature.description = rollMagicType().description;
|
|
|
|
|
} else if (roll <= 11) {
|
|
|
|
|
feature.description = rollOddity().description;
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
feature.description = `${rollFeature(random(1, 11)).description} and ${rollFeature(random(1, 11)).description}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return feature;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class MagicType {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "magic type";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollMagicType(roll: number = random(1, 12)): MagicType {
|
|
|
|
|
let magicType = new MagicType(roll);
|
|
|
|
|
if (roll <= 2) {
|
|
|
|
|
magicType.description = "divination";
|
|
|
|
|
} else if (roll <= 4) {
|
|
|
|
|
magicType.description = "enchantment";
|
|
|
|
|
} else if (roll <= 6) {
|
|
|
|
|
magicType.description = "evocation";
|
|
|
|
|
} else if (roll <= 8) {
|
|
|
|
|
magicType.description = "illusion";
|
|
|
|
|
} else if (roll <= 10) {
|
|
|
|
|
magicType.description = "necromancy";
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
magicType.description = "summoning";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return magicType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class NumAppearing {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "num appearing";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "", public count: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollNumAppearing(roll: number = random(1, 12)): NumAppearing {
|
|
|
|
|
let numAppearing = new NumAppearing(roll);
|
|
|
|
|
if (roll <= 4) {
|
|
|
|
|
numAppearing.description = "solitary";
|
|
|
|
|
numAppearing.count = "1";
|
|
|
|
|
} else if (roll <= 9) {
|
|
|
|
|
numAppearing.description = "group";
|
|
|
|
|
numAppearing.count = "1d6+2";
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
numAppearing.description = "horde";
|
|
|
|
|
numAppearing.count = "4d6 per wave";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return numAppearing;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Oddity {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "oddity";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollOddity(roll: number = random(1, 12)): Oddity {
|
|
|
|
|
let oddity = new Oddity(roll);
|
|
|
|
|
oddity.description = [
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["weird color", "smell", "sound"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
"geometric",
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["web", "network", "system"]),
|
|
|
|
|
sample(["crystalline", "glass-like"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
"fungal",
|
2021-07-30 19:19:03 -04:00
|
|
|
sample(["gaseous", "smokey"]),
|
|
|
|
|
sample(["mirage", "illusion"]),
|
|
|
|
|
sample(["volcanic", "explosive"]),
|
|
|
|
|
sample(["magnetic", "repellant"]),
|
2021-07-25 22:48:37 -04:00
|
|
|
"devoid of life",
|
|
|
|
|
"unexpectedly alive",
|
|
|
|
|
"[ODDITY] and [ODDITY]",
|
|
|
|
|
][roll - 1];
|
|
|
|
|
oddity.description = replace(oddity.description, /\[ODDITY\]/g, () => rollOddity(random(1, 11)).description);
|
|
|
|
|
|
|
|
|
|
return oddity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Orientation {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "orientation";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollOrientation(roll: number = random(1, 12)): Orientation {
|
|
|
|
|
let orientation = new Orientation(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 2) {
|
|
|
|
|
orientation.description = "down/earthward";
|
|
|
|
|
} else if (roll <= 3) {
|
|
|
|
|
orientation.description = "north";
|
|
|
|
|
} else if (roll <= 4) {
|
|
|
|
|
orientation.description = "northeast";
|
|
|
|
|
} else if (roll <= 5) {
|
|
|
|
|
orientation.description = "east";
|
|
|
|
|
} else if (roll <= 6) {
|
|
|
|
|
orientation.description = "southeast";
|
|
|
|
|
} else if (roll <= 7) {
|
|
|
|
|
orientation.description = "south";
|
|
|
|
|
} else if (roll <= 8) {
|
|
|
|
|
orientation.description = "southwest";
|
|
|
|
|
} else if (roll <= 9) {
|
|
|
|
|
orientation.description = "west";
|
|
|
|
|
} else if (roll <= 10) {
|
|
|
|
|
orientation.description = "northwest";
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
orientation.description = "up/skyward ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return orientation;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Ruination {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "ruination";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollRuination(roll: number = random(1, 12)): Ruination {
|
|
|
|
|
let ruination = new Ruination(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 1) {
|
|
|
|
|
ruination.description = "arcane disaster";
|
|
|
|
|
} else if (roll <= 2) {
|
2021-07-30 19:19:03 -04:00
|
|
|
ruination.description = sample(["damnation", "curse"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 4) {
|
2021-07-30 19:19:03 -04:00
|
|
|
ruination.description = sample(["earthquake", "fire", "flood"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 6) {
|
2021-07-30 19:19:03 -04:00
|
|
|
ruination.description = sample(["plague", "famine", "drought"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 8) {
|
|
|
|
|
ruination.description = "overrun by monsters";
|
|
|
|
|
} else if (roll <= 10) {
|
2021-07-30 19:19:03 -04:00
|
|
|
ruination.description = sample(["war", "invasion"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 11) {
|
|
|
|
|
ruination.description = "depleted resources";
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
ruination.description = "better prospects elsewhere";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ruination;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Size {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "size";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollSize(roll: number = random(1, 12)): Size {
|
|
|
|
|
let size = new Size(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 1) {
|
|
|
|
|
size.description = "tiny";
|
|
|
|
|
} else if (roll <= 3) {
|
|
|
|
|
size.description = "small";
|
|
|
|
|
} else if (roll <= 9) {
|
|
|
|
|
size.description = "medium-sized";
|
|
|
|
|
} else if (roll <= 11) {
|
|
|
|
|
size.description = "large";
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
size.description = "huge";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Tag {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "tag";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollTag(roll: number = random(1, 12)) {
|
|
|
|
|
let tag = new Tag(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 1) {
|
|
|
|
|
tag.description = "amorphous";
|
|
|
|
|
} else if (roll <= 2) {
|
|
|
|
|
tag.description = "cautious";
|
|
|
|
|
} else if (roll <= 3) {
|
|
|
|
|
tag.description = "construct";
|
|
|
|
|
} else if (roll <= 4) {
|
|
|
|
|
tag.description = "devious";
|
|
|
|
|
} else if (roll <= 5) {
|
|
|
|
|
tag.description = "intelligent";
|
|
|
|
|
} else if (roll <= 6) {
|
|
|
|
|
tag.description = "magical";
|
|
|
|
|
} else if (roll <= 8) {
|
|
|
|
|
tag.description = "organized";
|
|
|
|
|
} else if (roll <= 9) {
|
|
|
|
|
tag.description = "planar";
|
|
|
|
|
} else if (roll <= 10) {
|
|
|
|
|
tag.description = "stealthy";
|
|
|
|
|
} else if (roll <= 11) {
|
|
|
|
|
tag.description = "terrifying";
|
|
|
|
|
} else if (roll <= 12) {
|
|
|
|
|
tag.description = `${rollTag(random(1, 11)).description} and ${rollTag(random(1, 11)).description}`;
|
|
|
|
|
}
|
|
|
|
|
return tag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Terrain {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "terrain";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollTerrain(roll: number = random(1, 12)): Terrain {
|
|
|
|
|
let terrain = new Terrain(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 1) {
|
2021-07-30 19:19:03 -04:00
|
|
|
terrain.description = sample(["wasteland", "desert"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 3) {
|
2021-07-30 19:19:03 -04:00
|
|
|
terrain.description = sample(["flatland", "plain"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 4) {
|
2021-07-30 19:19:03 -04:00
|
|
|
terrain.description = sample(["wetland", "marsh", "swamp"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 7) {
|
2021-07-30 19:19:03 -04:00
|
|
|
terrain.description = sample(["woodland", "forest", "jungle"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 9) {
|
2021-07-30 19:19:03 -04:00
|
|
|
terrain.description = sample(["highland", "hills"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 11) {
|
|
|
|
|
terrain.description = "mountains";
|
|
|
|
|
} else if (roll <= 12) {
|
2021-07-30 19:19:03 -04:00
|
|
|
terrain.description = `${rollOddity().description} oddity`;
|
2021-07-25 22:48:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return terrain;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export class Visibility {
|
2021-07-30 00:17:49 -04:00
|
|
|
type: string = "visibility";
|
2021-07-25 22:48:37 -04:00
|
|
|
constructor(public roll: number = 0, public description: string = "") { };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function rollVisibility(roll: number = random(1, 12)): Visibility {
|
|
|
|
|
let visibility = new Visibility(roll);
|
|
|
|
|
|
|
|
|
|
if (roll <= 2) {
|
2021-07-30 19:19:03 -04:00
|
|
|
visibility.description = sample(["buried", "camouflaged", "nigh invisible"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 6) {
|
2021-07-30 19:19:03 -04:00
|
|
|
visibility.description = sample(["partly covered", "partly overgrown", "partly hidden"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 9) {
|
2021-07-30 19:19:03 -04:00
|
|
|
visibility.description = sample(["obvious", "in plain sight"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
} else if (roll <= 11) {
|
|
|
|
|
visibility.description = "visible at near distance";
|
|
|
|
|
} else if (roll <= 12) {
|
2021-07-30 19:19:03 -04:00
|
|
|
visibility.description = sample(["visible at great distance", "focal point"]);
|
2021-07-25 22:48:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return visibility;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|