Replace and fix mortal field
This commit is contained in:
@@ -44,22 +44,13 @@ export const MONEY = {
|
||||
}
|
||||
|
||||
export const MORTAL_CHOICES = {
|
||||
"mankind": {label: "Mankind", value: "Mankind", defenseBonus: 0},
|
||||
"elf": {label: "Elf", value: "Elf", defenseBonus: 0},
|
||||
"dwarf": {label: "Dwarf", value: "Dwarf", defenseBonus: 0},
|
||||
"halfelf": {label: "Half-Elf", value: "Half-Elf", defenseBonus: 0},
|
||||
"halforc": {label: "Half-Orc", value: "Half-Orc", defenseBonus: 0},
|
||||
"gnome": {label: "Gnome", value: "Gnome", defenseBonus: 2},
|
||||
"shirefolk": {label: "Shire Folk", value: "Shire Folk", defenseBonus: 2},
|
||||
"Elf": {label: "Elf", value: "Elf", defenseBonus: 0},
|
||||
"Half-orc": {label: "Half-Orc", value: "Half-Orc", defenseBonus: 0},
|
||||
"Half-Orc": {label: "Half-Orc", value: "Half-Orc", defenseBonus: 0},
|
||||
"Dwarf": {label: "Dwarf", value: "Dwarf", defenseBonus: 0},
|
||||
"Half-elf": {label: "Half-Elf", value: "Half-Elf", defenseBonus: 0},
|
||||
"Gnome": {label: "Gnome", value: "Gnome", defenseBonus: 2},
|
||||
"Shire Folk": {label: "Shire Folk", value: "Shire Folk", defenseBonus: 2},
|
||||
"Shire folk": {label: "Shire Folk", value: "Shire Folk", defenseBonus: 2},
|
||||
"Mankind": {label: "Human", value: "Human", defenseBonus: 0},
|
||||
"mankind": {label: "Mankind", id: "mankind", defenseBonus: 0},
|
||||
"elf": {label: "Elf", id: "elf", defenseBonus: 0},
|
||||
"dwarf": {label: "Dwarf", id: "dwarf", defenseBonus: 0},
|
||||
"halfelf": {label: "Half-Elf", id: "halfelf", defenseBonus: 0},
|
||||
"halforc": {label: "Half-Orc", id: "halforc", defenseBonus: 0},
|
||||
"gnome": {label: "Gnome", id: "gnome", defenseBonus: 2},
|
||||
"halflings": {label: "Halflings", id: "halflings", defenseBonus: 2}
|
||||
}
|
||||
|
||||
export const FAVOR_CHOICES = {
|
||||
|
||||
@@ -174,6 +174,31 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
||||
/** @override */
|
||||
static LOCALIZATION_PREFIXES = ["LETHALFANTASY.Character"]
|
||||
|
||||
static migrateData(data) {
|
||||
if (data?.biodata?.mortal) {
|
||||
if (!SYSTEM.MORTAL_CHOICES[data.biodata.mortal]) {
|
||||
for (let key in SYSTEM.MORTAL_CHOICES) {
|
||||
let mortal = SYSTEM.MORTAL_CHOICES[key]
|
||||
if ( mortal.label.toLowerCase() === data.biodata.mortal.toLowerCase()) {
|
||||
data.biodata.mortal = mortal.id
|
||||
}
|
||||
if ( data.biodata.mortal.toLowerCase().includes("shire")) {
|
||||
data.biodata.mortal = "halflings"
|
||||
}
|
||||
if ( data.biodata.mortal.toLowerCase().includes("human")) {
|
||||
data.biodata.mortal = "mankind"
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!SYSTEM.MORTAL_CHOICES[data.biodata.mortal]) {
|
||||
console.warn("Lethal Fantasy | Migrate data: Mortal not found, forced to mankind", data.biodata.mortal)
|
||||
data.biodata.mortal = "mankind"
|
||||
}
|
||||
}
|
||||
|
||||
return super.migrateData(data)
|
||||
}
|
||||
|
||||
prepareDerivedData() {
|
||||
super.prepareDerivedData();
|
||||
let grit = 0
|
||||
@@ -275,7 +300,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
||||
actorName: this.parent.name,
|
||||
actorImage: this.parent.img,
|
||||
combatId,
|
||||
combatantId ,
|
||||
combatantId,
|
||||
actorClass,
|
||||
maxInit,
|
||||
})
|
||||
@@ -302,10 +327,10 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
|
||||
let formula = ""
|
||||
if (s.type === "spell") {
|
||||
let dice = LethalFantasyUtils.getLethargyDice(s.system.level)
|
||||
title = `${s.name} (Casting time: ${s.system.castingTime}, Lethargy: ${dice})`
|
||||
title = `${s.name} (Casting time: ${s.system.castingTime}, Lethargy: ${dice})`
|
||||
formula = `${s.system.castingTime}+${dice}`
|
||||
} else {
|
||||
title = `${s.name} (Prayer time: ${s.system.prayerTime})`
|
||||
title = `${s.name} (Prayer time: ${s.system.prayerTime})`
|
||||
formula = `${s.system.prayerTime}`
|
||||
}
|
||||
weaponsChoices.push({ id: s.id, name: title, combatProgressionDice: formula })
|
||||
|
||||
Reference in New Issue
Block a user