Ajout multiples pour le combat et ameliorations des items
This commit is contained in:
@@ -11,7 +11,7 @@ export class TeDeumActorPJSheet extends ActorSheet {
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-te-deum", "sheet", "actor"],
|
||||
template: "systems/fvtt-te-deum/templates/actors/actor-sheet.hbs",
|
||||
width: 860,
|
||||
@@ -33,10 +33,10 @@ export class TeDeumActorPJSheet extends ActorSheet {
|
||||
name: this.actor.name,
|
||||
editable: this.isEditable,
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
system: duplicate(this.object.system),
|
||||
system: foundry.utils.duplicate(this.object.system),
|
||||
limited: this.object.limited,
|
||||
competences: this.actor.getCompetences(),
|
||||
config: duplicate(game.system.tedeum.config),
|
||||
config: foundry.utils.duplicate(game.system.tedeum.config),
|
||||
armes: this.actor.getArmes(),
|
||||
caracList: this.actor.prepareCaracteristiques(),
|
||||
providence: this.actor.prepareProvidence(),
|
||||
@@ -44,6 +44,11 @@ export class TeDeumActorPJSheet extends ActorSheet {
|
||||
equipements: this.actor.getEquipements(),
|
||||
armures: this.actor.getArmures(),
|
||||
graces: this.actor.getGraces(),
|
||||
blessures: this.actor.getBlessures(),
|
||||
maladies: this.actor.getMaladies(),
|
||||
poisons: this.actor.getPoisons(),
|
||||
combat: this.actor.prepareCombat(),
|
||||
santeModifier: this.actor.getSanteModifier(),
|
||||
description: await TextEditor.enrichHTML(this.object.system.description, { async: true }),
|
||||
notes: await TextEditor.enrichHTML(this.object.system.notes, { async: true }),
|
||||
options: this.options,
|
||||
|
@@ -89,48 +89,91 @@ export class TeDeumActor extends Actor {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getCompetences() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'competence') || [])
|
||||
let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'competence') || [])
|
||||
return comp;
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
getGraces() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'grace') || [])
|
||||
let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'grace') || [])
|
||||
TeDeumUtility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
getArmes() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'arme') || [])
|
||||
let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'arme') || [])
|
||||
TeDeumUtility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
getEquipements() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'equipement') || [])
|
||||
let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'equipement') || [])
|
||||
TeDeumUtility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
getArmures() {
|
||||
let comp = duplicate(this.items.filter(item => item.type == 'armure') || [])
|
||||
let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'armure') || [])
|
||||
TeDeumUtility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
getBlessures() {
|
||||
let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'blessure') || [])
|
||||
for (let c of comp) {
|
||||
let blessDef = game.system.tedeum.config.blessures[c.system.typeBlessure]
|
||||
c.malus = blessDef.modifier
|
||||
}
|
||||
TeDeumUtility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
getMaladies() {
|
||||
let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'maladie') || [])
|
||||
for (let c of comp) {
|
||||
c.malus = "N/A"
|
||||
if (c.system.appliquee) {
|
||||
let malDef = game.system.tedeum.config.virulence[c.system.virulence]
|
||||
c.malus = malDef.modifier
|
||||
}
|
||||
}
|
||||
TeDeumUtility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
getPoisons() {
|
||||
let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'poison') || [])
|
||||
for (let c of comp) {
|
||||
c.malus = "N/A"
|
||||
if (c.system.appliquee) {
|
||||
let poisDef = game.system.tedeum.config.virulencePoison[c.system.virulence]
|
||||
c.malus = poisDef.modifier
|
||||
}
|
||||
}
|
||||
TeDeumUtility.sortArrayObjectsByName(comp)
|
||||
return comp;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
calculMalusBlessures() {
|
||||
let modifierBlessures = 0
|
||||
let nbBlessures = 0
|
||||
// Cumul des malus de blessures
|
||||
for (let locKey in this.system.localisation) {
|
||||
let loc = this.system.localisation[locKey]
|
||||
let bDef = game.system.tedeum.config.blessures[loc.blessures]
|
||||
modifierBlessures += bDef.modifier
|
||||
nbBlessures += bDef.count
|
||||
getSanteModifier() {
|
||||
let comp = foundry.utils.duplicate(this.items.filter(item => item.type == 'maladie') || [])
|
||||
let modTotal = 0
|
||||
for (let c of comp) {
|
||||
if (c.system.appliquee) {
|
||||
let maladieDef = game.system.tedeum.config.virulence[c.system.virulence]
|
||||
modTotal += maladieDef.modifier
|
||||
}
|
||||
}
|
||||
let simples= foundry.utils.duplicate(this.items.filter(item => item.type == 'simple') || [])
|
||||
for (let c of simples) {
|
||||
if (c.system.appliquee) {
|
||||
let simpleDef = game.system.tedeum.config.virulencePoison[c.system.virulence]
|
||||
modTotal += simpleDef.modifier
|
||||
}
|
||||
}
|
||||
let blessures = foundry.utils.duplicate(this.items.filter(item => item.type == 'blessure') || [])
|
||||
for (let c of blessures) {
|
||||
let blessDef = game.system.tedeum.config.blessures[c.system.typeBlessure]
|
||||
modTotal += blessDef.modifier
|
||||
}
|
||||
// Si le nombre de blessures est supérieur au score d'endurance, alors malus supplémentaire
|
||||
let endurance = this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "endurance")
|
||||
if ( nbBlessures > endurance.system.score) {
|
||||
modifierBlessures += -1
|
||||
}
|
||||
return modifierBlessures
|
||||
if ( blessures.length > endurance.system.score) {
|
||||
modTotal += -1
|
||||
}
|
||||
return modTotal
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -160,7 +203,26 @@ export class TeDeumActor extends Actor {
|
||||
providence.dice = game.system.tedeum.config.providence[providence.value].diceValue
|
||||
return providence
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
prepareCombat() {
|
||||
let combatLoc = foundry.utils.deepClone(this.system.localisation)
|
||||
for (let key in combatLoc) {
|
||||
combatLoc[key] = foundry.utils.mergeObject(combatLoc[key], game.system.tedeum.config.LOCALISATION[key])
|
||||
combatLoc[key].armures = []
|
||||
combatLoc[key].protectionTotal = 0
|
||||
let armures = this.getArmures()
|
||||
for (let armure of armures) {
|
||||
if (armure.system.equipe && armure.system.localisation[key].protege) {
|
||||
combatLoc[key].armures.push(armure)
|
||||
combatLoc[key].protectionTotal += armure.system.protection
|
||||
}
|
||||
}
|
||||
let endurance = this.items.find(item => item.type == "competence" && item.name.toLowerCase() == "endurance")
|
||||
combatLoc[key].endurance = endurance.system.score + game.system.tedeum.config.LOCALISATION[key].locMod
|
||||
combatLoc[key].touche = combatLoc[key].endurance + combatLoc[key].protectionTotal
|
||||
}
|
||||
return combatLoc
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
modifyProvidence(value) {
|
||||
let providence = foundry.utils.duplicate(this.system.providence)
|
||||
@@ -202,7 +264,7 @@ export class TeDeumActor extends Actor {
|
||||
getItemById(id) {
|
||||
let item = this.items.find(item => item.id == id);
|
||||
if (item) {
|
||||
item = duplicate(item)
|
||||
item = foundry.utils.duplicate(item)
|
||||
}
|
||||
return item;
|
||||
}
|
||||
@@ -232,7 +294,7 @@ export class TeDeumActor extends Actor {
|
||||
|
||||
/* ------------------------------------------- */
|
||||
async buildContainerTree() {
|
||||
let equipments = duplicate(this.items.filter(item => item.type == "equipment") || [])
|
||||
let equipments = foundry.utils.duplicate(this.items.filter(item => item.type == "equipment") || [])
|
||||
for (let equip1 of equipments) {
|
||||
if (equip1.system.iscontainer) {
|
||||
equip1.system.contents = []
|
||||
@@ -288,10 +350,13 @@ export class TeDeumActor extends Actor {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
getInitiativeScore(combatId, combatantId) {
|
||||
let init = Math.floor((this.system.attributs.physique.value + this.system.attributs.habilite.value) / 2)
|
||||
let subValue = new Roll("1d20").roll({ async: false })
|
||||
return init + (subValue.total / 100)
|
||||
getInitiativeScore() {
|
||||
let initiative = this.items.find(it=>it.type == "competence" && it.name.toLowerCase() == "initiative")
|
||||
if ( initiative ) {
|
||||
return initiative.system.score
|
||||
}
|
||||
ui.notifications.warn("Impossible de trouver la compétence Initiative pour l'acteur " + this.name)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@@ -327,8 +392,8 @@ export class TeDeumActor extends Actor {
|
||||
rollData.actorId = this.id
|
||||
rollData.img = this.img
|
||||
rollData.providence = this.prepareProvidence()
|
||||
rollData.malusBlessures = this.calculMalusBlessures()
|
||||
|
||||
rollData.santeModifier = this.getSanteModifier()
|
||||
|
||||
return rollData
|
||||
}
|
||||
|
||||
@@ -336,7 +401,7 @@ export class TeDeumActor extends Actor {
|
||||
getCommonCompetence(compId) {
|
||||
let rollData = this.getCommonRollData()
|
||||
|
||||
let competence = duplicate(this.items.find(it => it.type =="competence" && it.id == compId))
|
||||
let competence = foundry.utils.duplicate(this.items.find(it => it.type =="competence" && it.id == compId))
|
||||
|
||||
rollData.competence = competence
|
||||
let c = foundry.utils.duplicate(this.system.caracteristiques[competence.system.caracteristique])
|
||||
@@ -357,15 +422,30 @@ export class TeDeumActor extends Actor {
|
||||
|
||||
|
||||
/* -------------------------------------------- */
|
||||
rollArme(armeId) {
|
||||
rollArme(armeId, compName = undefined) {
|
||||
let weapon = this.items.get(armeId)
|
||||
if (weapon) {
|
||||
weapon = duplicate(weapon)
|
||||
weapon = foundry.utils.duplicate(weapon)
|
||||
let rollData = this.getCommonRollData()
|
||||
rollData.mode = "arme"
|
||||
rollData.arme = weapon
|
||||
rollData.img = weapon.img
|
||||
rollData.title = weapon.name
|
||||
|
||||
// Setup competence + carac
|
||||
if (!compName) {
|
||||
compName = weapon.system.competence
|
||||
}
|
||||
let competence = this.items.find(item => item.type == "competence" && item.name.toLowerCase() == compName.toLowerCase())
|
||||
if ( competence) {
|
||||
rollData.competence = competence
|
||||
let c = foundry.utils.duplicate(this.system.caracteristiques[competence.system.caracteristique])
|
||||
this.updateCarac( c, competence.system.caracteristique)
|
||||
rollData.carac = c
|
||||
} else {
|
||||
ui.notifications.warn("Impossible de trouver la compétence " + compName)
|
||||
return
|
||||
}
|
||||
this.startRoll(rollData).catch("Error on startRoll")
|
||||
} else {
|
||||
ui.notifications.warn("Impossible de trouver l'arme concernée ")
|
||||
|
@@ -6,11 +6,10 @@ export class TeDeumCombat extends Combat {
|
||||
/* -------------------------------------------- */
|
||||
async rollInitiative(ids, formula = undefined, messageOptions = {} ) {
|
||||
ids = typeof ids === "string" ? [ids] : ids;
|
||||
for (let cId = 0; cId < ids.length; cId++) {
|
||||
const c = this.combatants.get(ids[cId]);
|
||||
let id = c._id || c.id;
|
||||
let initBonus = c.actor ? c.actor.getInitiativeScore( this.id, id ) : -1;
|
||||
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: initBonus } ]);
|
||||
for (let cId of ids) {
|
||||
const c = this.combatants.get(cId);
|
||||
let initBonus = c.actor ? c.actor.getInitiativeScore( this.id, cId ) : -1;
|
||||
await this.updateEmbeddedDocuments("Combatant", [ { _id: cId, initiative: initBonus } ]);
|
||||
}
|
||||
|
||||
return this;
|
||||
|
@@ -13,17 +13,16 @@ export const TEDEUM_CONFIG = {
|
||||
{ value: 10 }, { value: 30 }, { value: 50 }],
|
||||
|
||||
LOCALISATION: {
|
||||
"pieddroit": { label: "Pied Droit", value: 1, id: "pieddroit", nbArmure: 1 },
|
||||
"jambedroite": { label: "Jambe Droite", value: 1, id: "jambedroite", nbArmure: 1 },
|
||||
"jambegauche": { label: "Jambe Gauche", value: 1, id: "jambegauche", nbArmure: 1 },
|
||||
"piedgauche": { label: "Pied Gauche", value: 1, id: "piedgauche", nbArmure: 1 },
|
||||
"piedgauche": { label: "Pied Gauche", value: 1, id: "piedgauche", nbArmure: 1 },
|
||||
"maindroite": { label: "Main Droite", value: 1, id: "maindroite", nbArmure: 1 },
|
||||
"maingauche": { label: "Main Gauche", value: 1, id: "maingauche", nbArmure: 1 },
|
||||
"brasdroit": { label: "Bras Droit", value: 1, id: "brasdroit", nbArmure: 2 },
|
||||
"brasgauche": { label: "Bras Gauche", value: 1, id: "brasgauche", nbArmure: 2 },
|
||||
"corps": { label: "Corps", value: 1, id: "corps", nbArmure: 2 },
|
||||
"tete": { label: "Tête", value: 1, id: "tete", nbArmure: 2 },
|
||||
"pieddroit": { label: "Pied Droit", value: 1, locMod:0, id: "pieddroit", nbArmure: 1, score: {min: 1, max:1}, coord: { top: 500, left: 0 } },
|
||||
"jambedroite": { label: "Jambe Droite", value: 1, locMod:-1,id: "jambedroite", nbArmure: 1, score: {min: 3, max:4},coord: { top: 400, left: 100 } },
|
||||
"jambegauche": { label: "Jambe Gauche", value: 1, locMod:-1,id: "jambegauche", nbArmure: 1, score: {min: 5, max:6},coord: { top: 400, left: 300 } },
|
||||
"piedgauche": { label: "Pied Gauche", value: 1, locMod:0,id: "piedgauche", nbArmure: 1, score: {min: 2, max:2},coord: { top: 500, left: 400 } },
|
||||
"maindroite": { label: "Main Droite", value: 1, locMod:0,id: "maindroite", nbArmure: 1, score: {min: 7, max:7},coord: { top: 0, left: 0 } },
|
||||
"maingauche": { label: "Main Gauche", value: 1, locMod:0,id: "maingauche", nbArmure: 1, score: {min: 8, max:8},coord: { top: 0, left: 400 } },
|
||||
"brasdroit": { label: "Bras Droit", value: 1, locMod:-1,id: "brasdroit", nbArmure: 2, score: {min: 9, max:10},coord: { top: 200, left: 0 } },
|
||||
"brasgauche": { label: "Bras Gauche", value: 1, locMod:-1,id: "brasgauche", nbArmure: 2, score: {min: 11, max:12},coord: { top: 200, left: 400 } },
|
||||
"corps": { label: "Corps", value: 1, id: "corps", locMod:-2,nbArmure: 2, score: {min: 13, max:17},coord: { top: 200, left: 200 } },
|
||||
"tete": { label: "Tête", value: 1, id: "tete", locMod:-2,nbArmure: 2 , score: {min: 18, max:20},coord: { top: 0, left: 200 }},
|
||||
},
|
||||
|
||||
ARME_SPECIFICITE: {
|
||||
@@ -157,13 +156,32 @@ export const TEDEUM_CONFIG = {
|
||||
{ value: "1", label: "+1 niveau" },
|
||||
{ value: "2", label: "+2 niveaux" }
|
||||
],
|
||||
blessures: [
|
||||
{ value: 0, label: "Indemne", degatsMax: -1, count: 0, modifier: 0 },
|
||||
{ value: 1, label: "Estafilade/Contusion", degatsMax: 2, count: 1, modifier: 0 },
|
||||
{ value: 2, label: "Plaie", degatsMax: 4, count: 1, modifier: -1 },
|
||||
{ value: 3, label: "Plaie béante", degatsMax: 6, count: 1, modifier: -2 },
|
||||
{ value: 4, label: "Plaie atroce", degatsMax: 6, count: 1, horsCombat: true, modifier: -12 },
|
||||
{ value: 5, label: "Tué net", degatsMax: 100, count: 1, horsCombat: true, mort: true, modifier: -12 }
|
||||
]
|
||||
|
||||
blessures: {
|
||||
indemne: { value: 0, label: "Indemne", key: "indemne", degatsMax: -1, count: 0, modifier: 0 },
|
||||
estafilade: { value: 1, label: "Estafilade", key: "estafilade", degatsMax: 2, count: 1, modifier: 0 },
|
||||
plaie: { value: 2, label: "Plaie", key: "plaie", degatsMax: 4, count: 1, modifier: -1 },
|
||||
plaiebeante: { value: 3, label: "Plaie béante", key: "plaiebeante", degatsMax: 6, count: 1, modifier: -2 },
|
||||
plaieatroce: { value: 4, label: "Plaie atroce", key: "plaieatroce", degatsMax: 6, count: 1, horsCombat: true, modifier: -12 },
|
||||
tunenet: { value: 5, label: "Tué net", key: "tuenet", degatsMax: 100, count: 1, horsCombat: true, mort: true, modifier: -12 }
|
||||
},
|
||||
virulence: {
|
||||
fatigue: { label: "Fatigue", value: "fatigue", modifier: 0 },
|
||||
epuisement: { label: "Epuisement", value: "epuisement",modifier: -1 },
|
||||
souffrance: { label: "Souffrance", value: "souffrance", modifier: -2 },
|
||||
agonie: { label: "Agonie", value: "agonie", modifier: -3 }
|
||||
},
|
||||
fievre: {
|
||||
aucune: { label: "Aucune", value: "aucune" },
|
||||
legere: { label: "Légère", value: "legere" },
|
||||
forte: { label: "Forte", value: "forte" },
|
||||
grave: { label: "Grave", value: "grave" }
|
||||
},
|
||||
virulencePoison: {
|
||||
aucune: { label: "Aucune", value: "nausee", modifier: 0 },
|
||||
nausee: { label: "Nausées & Vertiges", value: "nausee", modifier:0 },
|
||||
inflammation: { label: "Inflammations & Vomissements", value: "inflammation", modifier: -1 },
|
||||
elancement: { label: "Elancements & Hémorragies", value: "elancement" , modifier: -2 },
|
||||
convulsion: { label: "Convulsions & Délire hallucinatoire", value: "convulsion", modifier: -3 },
|
||||
mort: { label: "Inconscience & Mort", value: "mort", modifier: -12 }
|
||||
}
|
||||
}
|
@@ -50,6 +50,10 @@ export class TeDeumUtility {
|
||||
//console.log("getConfigLabel", configName, key)
|
||||
return game.system.tedeum.config[configName][key].label
|
||||
})
|
||||
Handlebars.registerHelper('getConfigLabelArray', function (configName, key) {
|
||||
//console.log("getConfigLabel", configName, key)
|
||||
return game.system.tedeum.config[configName][key].label
|
||||
})
|
||||
Handlebars.registerHelper('isSpecArmeType', function (key, armeType) {
|
||||
return game.system.tedeum.config.ARME_SPECIFICITE[key][armeType]
|
||||
})
|
||||
@@ -360,6 +364,10 @@ export class TeDeumUtility {
|
||||
/* -------------------------------------------- */
|
||||
static modifyDice(dice, bonusMalus) {
|
||||
let newIndex = game.system.tedeum.config.diceValeur.indexOf(dice) + Number(bonusMalus)
|
||||
if (newIndex < 0) {
|
||||
ui.notifications.error("Vos blessures ou maladies vous empêchent de réaliser cette action, vous êtes trop faibles")
|
||||
return undefined
|
||||
}
|
||||
newIndex = Math.min(Math.max(newIndex, 0), game.system.tedeum.config.diceValeur.length - 1)
|
||||
return game.system.tedeum.config.diceValeur[newIndex]
|
||||
}
|
||||
@@ -368,7 +376,8 @@ export class TeDeumUtility {
|
||||
static computeRollFormula(rollData, actor, isConfrontation = false) {
|
||||
let diceFormula = ""
|
||||
if (rollData.competence) {
|
||||
let diceBase = this.modifyDice(rollData.carac.dice, rollData.bonusMalus+rollData.malusBlessures)
|
||||
let diceBase = this.modifyDice(rollData.carac.dice, Number(rollData.bonusMalus)+rollData.santeModifier)
|
||||
if (!diceBase) return;
|
||||
diceFormula = diceBase + "x + " + rollData.competence.system.score
|
||||
}
|
||||
if (rollData.enableProvidence) {
|
||||
@@ -386,8 +395,9 @@ export class TeDeumUtility {
|
||||
rollData.difficulty = 7
|
||||
}
|
||||
rollData.difficulty = game.system.tedeum.config.difficulte[rollData.difficulty].value
|
||||
|
||||
let diceFormula = this.computeRollFormula(rollData, actor)
|
||||
if (!diceFormula) return;
|
||||
console.log("RollData", rollData, diceFormula )
|
||||
|
||||
// Performs roll
|
||||
let myRoll = await new Roll(diceFormula).roll()
|
||||
@@ -501,7 +511,7 @@ export class TeDeumUtility {
|
||||
/* -------------------------------------------- */
|
||||
static getBasicRollData() {
|
||||
let rollData = {
|
||||
rollId: randomID(16),
|
||||
rollId: foundry.utils.randomID(16),
|
||||
type: "roll-data",
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
difficulty: "pardefaut",
|
||||
@@ -509,7 +519,7 @@ export class TeDeumUtility {
|
||||
isReroll : false,
|
||||
enableProvidence : false,
|
||||
malusBlessures: 0,
|
||||
config: duplicate(game.system.tedeum.config)
|
||||
config: foundry.utils.duplicate(game.system.tedeum.config)
|
||||
}
|
||||
TeDeumUtility.updateWithTarget(rollData)
|
||||
return rollData
|
||||
|
@@ -48,7 +48,9 @@ export class TeDeumArmeSchema extends foundry.abstract.TypeDataModel {
|
||||
|
||||
schema.prix = new fields.NumberField({ ...requiredDouble, initial: 0, min: 0 });
|
||||
schema.monnaie = new fields.StringField({ required: true, blank: false, initial: "denier" });
|
||||
|
||||
|
||||
schema.equipe = new fields.BooleanField({initial: false}),
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, blank: true });
|
||||
|
||||
return schema;
|
||||
|
@@ -19,6 +19,8 @@ export class TeDeumArmureSchema extends foundry.abstract.TypeDataModel {
|
||||
|
||||
schema.prix = new fields.NumberField({ ...requiredDouble, initial: 0, min: 0 });
|
||||
schema.monnaie = new fields.StringField({ required: true, blank: false, initial: "denier" });
|
||||
|
||||
schema.equipe = new fields.BooleanField({initial: false}),
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, blank: true });
|
||||
|
||||
|
14
modules/data/tedeum-schema-blessure.js
Normal file
14
modules/data/tedeum-schema-blessure.js
Normal file
@@ -0,0 +1,14 @@
|
||||
export class TeDeumBlessureSchema extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
const requiredInteger = { required: true, nullable: false, integer: true };
|
||||
const schema = {};
|
||||
|
||||
schema.typeBlessure = new fields.StringField({required: true, choices: ["indemne", "estafilade", "plaie", "plaiebeante", "plaieatroce", "tuenet"], initial: "estafilade"});
|
||||
schema.localisation = new fields.StringField({required: true, choices: ["piedgauche", "pieddroit", "jambegauche", "jambedroite", "maingauche", "maindroite", "brasgauche", "brasdroit", "tete", "corps"], initial: "corps"});
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, blank: true });
|
||||
|
||||
return schema;
|
||||
}
|
||||
}
|
18
modules/data/tedeum-schema-maladie.js
Normal file
18
modules/data/tedeum-schema-maladie.js
Normal file
@@ -0,0 +1,18 @@
|
||||
export class TeDeumMaladieSchema extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
const requiredInteger = { required: true, nullable: false, integer: true };
|
||||
const schema = {};
|
||||
|
||||
schema.transmission = new fields.HTMLField({ required: true, blank: true });
|
||||
schema.difficulteEndurance = new fields.StringField({required:true, initial:"routine"});
|
||||
schema.virulence = new fields.StringField({required: true, choices: ["fatigue", "epuisement", "souffrance", "agonie"], initial: "fatigue"});
|
||||
schema.fievre = new fields.StringField({required: true, choices: ["aucune", "legere", "forte", "grave"], initial: "aucune"});
|
||||
schema.symptomes = new fields.HTMLField({ required: true, blank: true });
|
||||
schema.appliquee = new fields.BooleanField({initial: false}),
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, blank: true });
|
||||
|
||||
return schema;
|
||||
}
|
||||
}
|
@@ -23,7 +23,9 @@ export class TeDeumPJSchema extends foundry.abstract.TypeDataModel {
|
||||
|
||||
schema.localisation = new fields.SchemaField(
|
||||
Object.values(game.system.tedeum.config.LOCALISATION).reduce((obj, loc) => {
|
||||
obj[loc.id] =new fields.SchemaField({
|
||||
obj[loc.id] = new fields.SchemaField({
|
||||
armure: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 20 }),
|
||||
touche: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 20 }),
|
||||
blessures: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0, max: 20 })
|
||||
});
|
||||
return obj;
|
||||
|
20
modules/data/tedeum-schema-simple.js
Normal file
20
modules/data/tedeum-schema-simple.js
Normal file
@@ -0,0 +1,20 @@
|
||||
export class TeDeumMaladieSchema extends foundry.abstract.TypeDataModel {
|
||||
static defineSchema() {
|
||||
const fields = foundry.data.fields;
|
||||
const requiredInteger = { required: true, nullable: false, integer: true };
|
||||
const schema = {};
|
||||
|
||||
schema.difficulteEndurance = new fields.StringField({required:true, initial:"routine"});
|
||||
schema.virulence = new fields.StringField({required: true, choices: ["aucune", "nausee", "inflammation", "elancement", "convulsion", "mort"], initial: "fatigue"});
|
||||
schema.vertus = new fields.HTMLField({ required: true, blank: true });
|
||||
schema.toxicite = new fields.HTMLField({ required: true, blank: true });
|
||||
schema.appliquee = new fields.BooleanField({initial: false}),
|
||||
|
||||
schema.prix = new fields.NumberField({ ...requiredDouble, initial: 0, min: 0 });
|
||||
schema.monnaie = new fields.StringField({ required: true, blank: false, initial: "denier" });
|
||||
|
||||
schema.description = new fields.HTMLField({ required: true, blank: true });
|
||||
|
||||
return schema;
|
||||
}
|
||||
}
|
@@ -8,7 +8,7 @@ export class TeDeumItemSheet extends ItemSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
return mergeObject(super.defaultOptions, {
|
||||
return foundry.utils.mergeObject(super.defaultOptions, {
|
||||
classes: ["fvtt-te-deum", "sheet", "item"],
|
||||
template: "systems/fvtt-te-deum/templates/item-sheet.hbs",
|
||||
dragDrop: [{ dragSelector: null, dropSelector: null }],
|
||||
|
@@ -7,6 +7,9 @@ export const defaultItemImg = {
|
||||
competence: "systems/fvtt-te-deum/images/icons/competence.webp",
|
||||
education: "systems/fvtt-te-deum/images/icons/education.webp",
|
||||
grace: "systems/fvtt-te-deum/images/icons/grace.webp",
|
||||
blessure: "systems/fvtt-te-deum/images/icons/blessure.webp",
|
||||
maladie: "systems/fvtt-te-deum/images/icons/maladie.webp",
|
||||
simple: "systems/fvtt-te-deum/images/icons/simple.webp",
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -19,6 +19,8 @@ import { TeDeumEquipementSchema } from "./data/tedeum-schema-equipement.js";
|
||||
import { TeDeumOrigineSchema } from "./data/tedeum-schema-origine.js";
|
||||
import { TeDeumEducationSchema } from "./data/tedeum-schema-education.js";
|
||||
import { TeDeumGraceSchema } from "./data/tedeum-schema-grace.js";
|
||||
import { TeDeumBlessureSchema } from "./data/tedeum-schema-blessure.js";
|
||||
import { TeDeumMaladieSchema } from "./data/tedeum-schema-maladie.js";
|
||||
|
||||
import { TeDeumItem } from "./items/tedeum-item.js";
|
||||
import { TeDeumItemSheet } from "./items/tedeum-item-sheet.js";
|
||||
@@ -71,7 +73,9 @@ Hooks.once("init", async function () {
|
||||
armure: TeDeumArmureSchema,
|
||||
origine: TeDeumOrigineSchema,
|
||||
education: TeDeumEducationSchema,
|
||||
grace: TeDeumGraceSchema
|
||||
grace: TeDeumGraceSchema,
|
||||
blessure: TeDeumBlessureSchema,
|
||||
maladie: TeDeumMaladieSchema,
|
||||
};
|
||||
|
||||
console.log("TeDeum RPG | Ready");
|
||||
|
Reference in New Issue
Block a user