foundry-dsa41-game/src/module/data/miracle/liturgyData.mjs

192 lines
5.1 KiB
JavaScript

export class LiturgyData {
static ranks = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII"]
static #ranks = [
{
index: 0,
name: "O",
lkp: 3,
mod: 2,
costKaP: 2,
costKaPPermant: 0,
duration: "Augenblicklich",
castDuration: "Stoßgebet",
strength: "LkP*/2"
},
{
index: 1,
name: "I",
lkp: 3,
mod: 0,
costKaP: 5,
costKaPPermant: 0,
range: "Selbst",
castDuration: "Gebet",
duration: "LkP* KR",
strength: "LkP*/2"
},
{
index: 2,
name: "II",
lkp: 6,
mod: -2,
costKaP: 10,
costKaPPermant: 0,
range: "Berührung",
target: ["Geweihter"],
castDuration: "Andacht",
duration: "LkP*10 KR",
strength: "LkP/2+5"
},
{
index: 3,
name: "III",
lkp: 9,
mod: -4,
costKaP: 15,
costKaPPermant: 0,
range: "Sicht",
target: ["1 Person", "1 Objekt"],
castDuration: "Zeremonie",
duration: "LkP* Spielrunden",
strength: "LkP*+5"
},
{
index: 4,
name: "IV",
lkp: 12,
mod: -6,
costKaP: 20,
costKaPPermant: 0,
range: "Fern",
target: ["10 Personen", "10 Objekte"],
castDuration: "Zyklus",
duration: "LkP* Stunden",
strength: "LkP*+10"
},
{
index: 5,
name: "V",
lkp: 15,
mod: -8,
costKaP: 25,
costKaPPermant: 1,
target: ["100 Personen", "100 Objekte"],
duration: "LkP* Tage",
strength: "LkP*+15"
},
{
index: 6,
name: "VI",
lkp: 18,
mod: -10,
costKaP: 30,
costKaPPermant: 3,
target: ["1000 Personen", "1000 Objekte"],
duration: "LkP* Wochen",
strength: "LkP*+20"
},
{
index: 7,
name: "VII",
lkp: 21,
mod: -12,
costKaP: 35,
costKaPPermant: 5,
duration: "LkP* Monate",
strength: "LkP*+25"
},
{
index: 8,
name: "VIII",
lkp: 24,
mod: -14,
costKaP: 40,
costKaPPermant: 7,
duration: "LkP* Jahre oder permanent",
casttime: "",
strength: "LkP*+30"
},
];
static alverans = [
"Praios",
"Rondra",
"Efferd",
"Travia",
"Boron",
"Hesinde",
"Firun",
"Tsa",
"Phex",
"Peraine",
"Ingerimm",
"Rahja"
]
static #aliases = [
{
"originalName": "Handwerkssegen",
"aliases": ["Cereborns Handreichung", "Hauch der Leidenschaft"]
},
{
"originalName": "Heiliger Befehl",
"aliases": ["Wort der Wahrheit"],
},
{
"originalName": "Eidsegen",
"aliases": ["Lehnseid"],
}
]
static getModifiedStrength(originalString, rankIncrease) {
// TODO as "Flagge des Regenbogens" demonstrates there may be different variations of Strengths which separately needs to be adjusted
return Object.assign({}, this.#ranks[this.#ranks.findIndex(p => p.strength === originalString) + rankIncrease])
}
static getModifiedDuration(originalString, rankIncrease) {
let currentDuration = 0
let durationText = ""
let adjustedDurationText = ""
let found = false
for (let {duration} of this.#ranks) {
if (originalString.indexOf(duration) !== -1) {
durationText = duration
adjustedDurationText = this.#ranks[currentDuration + rankIncrease].duration
found = true
break
}
++currentDuration
}
if (found) {
durationText = this.#ranks[currentDuration].duration
console.log({currentDuration, durationText, adjustedDurationText})
return {currentDuration, durationText, adjustedDurationText}
}
return {currentDuration: 0, durationText: originalString, adjustedDurationText: originalString}
}
static getModifiedRank(rank) {
return Object.assign({}, LiturgyData.#ranks[rank])
}
static getRankOfLiturgy(liturgy, deity) {
const lookupData = liturgy.herkunft.find(p => p.name === deity)
const rank = lookupData?.grad
return Object.assign({}, LiturgyData.#ranks[rank])
}
static lookupAlias(alias) {
return LiturgyData.#aliases.find((entry) => {
return entry.aliases.indexOf(alias) !== -1
})?.originalName ?? alias // cant determine thus simply return the original query name
}
}