HUD + liste de talents
This commit is contained in:
@ -96,7 +96,7 @@ export class HawkmoonUtility {
|
||||
static async ready() {
|
||||
const skills = await HawkmoonUtility.loadCompendium("fvtt-hawkmoon-cyd.skills")
|
||||
this.skills = skills.map(i => i.toObject())
|
||||
|
||||
|
||||
// Setup pause logo
|
||||
let logoPause = "systems/fvtt-hawkmoon-cyd/assets/logos/" + game.settings.get("fvtt-hawkmoon-cyd", "hawkmoon-pause-logo") + ".webp"
|
||||
let logoImg = document.querySelector('#pause').children[0]
|
||||
@ -154,6 +154,7 @@ export class HawkmoonUtility {
|
||||
'systems/fvtt-hawkmoon-cyd/templates/partial-item-prix.html',
|
||||
'systems/fvtt-hawkmoon-cyd/templates/partial-sante-etat.html',
|
||||
'systems/fvtt-hawkmoon-cyd/templates/partial-automation.html',
|
||||
'systems/fvtt-hawkmoon-cyd/templates/hud-adversites.html',
|
||||
]
|
||||
return loadTemplates(templatePaths);
|
||||
}
|
||||
@ -216,8 +217,8 @@ export class HawkmoonUtility {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getActorFromRollData(rollData) {
|
||||
let actor = game.actors.get( rollData.actorId)
|
||||
static getActorFromRollData(rollData) {
|
||||
let actor = game.actors.get(rollData.actorId)
|
||||
if (rollData.tokenId) {
|
||||
let token = canvas.tokens.placeables.find(t => t.id == rollData.tokenId)
|
||||
if (token) {
|
||||
@ -307,7 +308,7 @@ export class HawkmoonUtility {
|
||||
/* -------------------------------------------- */
|
||||
static computeResult(rollData) {
|
||||
rollData.diceResult = rollData.roll.terms[0].results[0].result
|
||||
if (rollData.mainDice.includes("d20") ) {
|
||||
if (rollData.mainDice.includes("d20")) {
|
||||
let diceValue = rollData.roll.terms[0].results[0].result
|
||||
if (diceValue % 2 == 1) {
|
||||
//console.log("PAIR/IMP2", diceValue)
|
||||
@ -325,7 +326,7 @@ export class HawkmoonUtility {
|
||||
rollData.isHeroique = ((rollData.finalResult - rollData.difficulte) >= 10)
|
||||
rollData.isDramatique = ((rollData.finalResult - rollData.difficulte) <= -10)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -340,8 +341,8 @@ export class HawkmoonUtility {
|
||||
rollData.attr = duplicate(actor.system.attributs[rollData.attrKey])
|
||||
}
|
||||
|
||||
if ( rollData.maitriseId != "none") {
|
||||
rollData.selectedMaitrise = rollData.maitrises.find(p => p.id == rollData.maitriseId )
|
||||
if (rollData.maitriseId != "none") {
|
||||
rollData.selectedMaitrise = rollData.maitrises.find(p => p.id == rollData.maitriseId)
|
||||
rollData.diceFormula = "2" + rollData.mainDice + "kh"
|
||||
} else {
|
||||
rollData.diceFormula = "1" + rollData.mainDice
|
||||
@ -352,15 +353,15 @@ export class HawkmoonUtility {
|
||||
rollData.predilections = duplicate(rollData.competence.system.predilections.filter(pred => pred.acquise && !pred.maitrise && !pred.used) || [])
|
||||
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0
|
||||
rollData.diceFormula += `+${rollData.attr.value}+${rollData.competence.system.niveau}+${rollData.modificateur}+${compmod}`
|
||||
|
||||
if ( rollData.selectedTalents && rollData.selectedTalents.length > 0) {
|
||||
|
||||
if (rollData.selectedTalents && rollData.selectedTalents.length > 0) {
|
||||
for (let id of rollData.selectedTalents) {
|
||||
let talent = rollData.talents.find(t => t._id == id)
|
||||
let bonusOK = true
|
||||
if ( talent.system.baCost ) {
|
||||
bonusOK = actor.checkBonneAventure( talent.system.baCost)
|
||||
if ( bonusOK ) {
|
||||
actor.changeBonneAventure( -talent.system.baCost )
|
||||
if (talent.system.baCost) {
|
||||
bonusOK = actor.checkBonneAventure(talent.system.baCost)
|
||||
if (bonusOK) {
|
||||
actor.changeBonneAventure(-talent.system.baCost)
|
||||
} else {
|
||||
ui.notifications.warn("Vous n'avez pas assez de points de Bonne Aventure !")
|
||||
}
|
||||
@ -369,7 +370,7 @@ export class HawkmoonUtility {
|
||||
rollData.diceFormula += `+${talent.system.bonus}`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
rollData.diceFormula += `+${rollData.bonusMalusContext}`
|
||||
} else {
|
||||
rollData.diceFormula += `+${rollData.attr.value}*${rollData.multiplier}+${rollData.modificateur}+${rollData.bonusMalusContext}`
|
||||
@ -522,7 +523,7 @@ export class HawkmoonUtility {
|
||||
let defender = game.canvas.tokens.get(rollData.defenderTokenId).actor
|
||||
rollData.armeDefense = defender.getBestDefenseValue()
|
||||
rollData.targetVigueur = defender.getVigueur()
|
||||
if ( rollData.armeDefense) {
|
||||
if (rollData.armeDefense) {
|
||||
rollData.difficulte = rollData.armeDefense.system.totalDefensif
|
||||
} else {
|
||||
ui.notifications.warn("Aucune arme de défense équipée, difficulté manuelle à positionner.")
|
||||
@ -580,13 +581,13 @@ export class HawkmoonUtility {
|
||||
let message = game.messages.get(li.attr("data-message-id"))
|
||||
let rollData = message.getFlag("world", "hawkmoon-roll")
|
||||
let actor = this.getActorFromRollData(rollData)
|
||||
return (!rollData.isReroll && actor.getBonneAventure() > 0 )
|
||||
return (!rollData.isReroll && actor.getBonneAventure() > 0)
|
||||
}
|
||||
let canApplyPE = function (li) {
|
||||
let message = game.messages.get(li.attr("data-message-id"))
|
||||
let rollData = message.getFlag("world", "hawkmoon-roll")
|
||||
let actor = this.getActorFromRollData(rollData)
|
||||
return (!rollData.isReroll && actor.getEclat() > 0 )
|
||||
return (!rollData.isReroll && actor.getEclat() > 0)
|
||||
}
|
||||
options.push(
|
||||
{
|
||||
@ -643,4 +644,21 @@ export class HawkmoonUtility {
|
||||
d.render(true);
|
||||
}
|
||||
|
||||
}
|
||||
/************************************************************************************/
|
||||
static async __create_talents_table() {
|
||||
let compName = "fvtt-hawkmoon-cyd.talents-cellule"
|
||||
const compData = await HawkmoonUtility.loadCompendium(compName)
|
||||
let talents = compData.map(i => i.toObject())
|
||||
|
||||
let htmlTab = "<table border='1'><tbody>";
|
||||
for (let entryData of talents) {
|
||||
console.log(entryData)
|
||||
htmlTab += `<tr><td>@UUID[Compendium.${compName}.${entryData._id}]{${entryData.name}}</td>`
|
||||
htmlTab += `<td>${entryData.system.description}</td>`;
|
||||
//htmlTab += `<td>${entryData.system.resumebonus}</td>`;
|
||||
htmlTab += "</tr>\n";
|
||||
}
|
||||
htmlTab += "</table>";
|
||||
await JournalEntry.create({ name: 'Liste des Talents de Cellule', content: htmlTab });
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user