Culture Generator
Generates a random Dwarf Fortress Culture.
Installation
npm install --save culture-generator
Usage
Generate Random Culture
import {
Culture,
ethics,
beliefs
} from "culture-generator"
const culture = new Culture(
{ seed: "seed" }
)
console.log(culture.name)
console.log(culture.getEthicDescription(ethics.ASSAULT))
console.log(culture.getBeliefDescription(beliefs.LAW))
console.log(culture.getEthicsDescription())
console.log(culture.getBeliefsDescription())
console.log(culture.toString())
Generate Culture With Particular Ethics & Beliefs
import {
Culture,
ethics,
beliefs,
ethicValues,
beliefValues
} from "culture-generator"
const culture = new Culture(
{
seed: "seed",
ethics: {
[ethics.ASSAULT]: ethicValues.ACCEPTABLE
},
beliefs: {
[beliefs.LAW]: beliefValues.LOWEST
}
}
)
console.log(culture.getEthicDescription(ethics.ASSAULT))
console.log(culture.getBeliefDescription(beliefs.LAW))
Branch Culture
import {
Culture
} from "culture-generator"
const cultureOne = new Culture(
{ seed: "culture-one" }
)
const branchCulture = cultureOne.branch(1)
const otherCulture = new Culture(
{ seed: "culture-two" }
)
console.log(cultureOne.getOpinion(branchCulture))
console.log(branchCulture.getOpinion(cultureOne))
console.log(cultureOne.getOpinion(otherCulture))
console.log(otherCulture.getOpinion(cultureOne))
console.log(branchCulture.getOpinion(otherCulture))
console.log(otherCulture.getOpinion(branchCulture))
Global API
new Culture(props) => Culture
Used to create a new Culture.
Property | Type | Description |
---|
seed | string | Seed used for the randomization of the culture. |
ethics | object | Used to specify the ethics of the culture. |
beliefs | object | Used to specify the beliefs of the culture. |
.name => string
Used to get the Culture's name.
.ethics => Object
Used to get the Culture's configured ethics.
.beliefs => Object
Used to get the Culture's configured beliefs.
.getEthicDescription(ethic:string
) => string
Used to get a user friendly description of how an ethic is viewed.
.getEthicsDescription() => string
Used to get a user friendly description of how all the ethics are viewed.
.getBeliefDescription(belief:string
) => string
Used to get a user friendly description of how a belief is viewed.
.getBeliefsDescription() => string
Used to get a user friendly description of how all the beliefs are viewed.
.branch([difference:number
]) => Culture
Used to create a similar culture.
.getOpinion(otherCulture:Culture
)
Used to get the opinion of another culture.
References