ActorSheet, WIP

This commit is contained in:
LeRatierBretonnien 2023-01-18 21:08:32 +01:00
parent 54e397d6f0
commit d294d6aed1
5 changed files with 40 additions and 9 deletions

View File

@ -507,8 +507,12 @@ export class HeritiersActor extends Actor {
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
buildListeAdversites() { getTricherie() {
return [] return this.system.rang.tricherie.value
}
/* -------------------------------------------- */
getHeritages() {
return this.system.rang.heritage.value
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
@ -521,6 +525,10 @@ export class HeritiersActor extends Actor {
rollData.img = this.img rollData.img = this.img
rollData.caracList = this.getCarac() rollData.caracList = this.getCarac()
rollData.caracKey = "agi" rollData.caracKey = "agi"
rollData.tricherie = this.getTricherie()
rollData.heritage = this.getHeritages()
rollData.useTricherie = false
rollData.useHeritage = false
if (compId) { if (compId) {
rollData.competence = duplicate(this.items.get(compId) || {}) rollData.competence = duplicate(this.items.get(compId) || {})

View File

@ -72,6 +72,11 @@ export class HeritiersRollDialog extends Dialog {
html.find('#bonus-malus-context').change((event) => { html.find('#bonus-malus-context').change((event) => {
this.rollData.bonusMalusContext = Number(event.currentTarget.value) this.rollData.bonusMalusContext = Number(event.currentTarget.value)
}) })
html.find('#useTricherie').change((event) => {
this.rollData.useTricherie = event.currentTarget.checked
})
html.find('#useHeritage').change((event) => {
this.rollData.useHeritage = event.currentTarget.checked
})
} }
} }

View File

@ -11,10 +11,6 @@ export class HeritiersUtility {
Hooks.on('renderChatLog', (log, html, data) => HeritiersUtility.chatListeners(html)) Hooks.on('renderChatLog', (log, html, data) => HeritiersUtility.chatListeners(html))
Hooks.on("getChatLogEntryContext", (html, options) => HeritiersUtility.chatRollMenu(html, options)) Hooks.on("getChatLogEntryContext", (html, options) => HeritiersUtility.chatRollMenu(html, options))
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
HeritiersUtility.pushInitiativeOptions(html, options);
})
this.rollDataStore = {} this.rollDataStore = {}
this.defenderStore = {} this.defenderStore = {}
HeritiersCommands.init() HeritiersCommands.init()
@ -282,7 +278,10 @@ export class HeritiersUtility {
/* -------------------------------------------- */ /* -------------------------------------------- */
static computeResult(rollData) { static computeResult(rollData) {
rollData.diceResult = rollData.roll.terms[0].results[0].result rollData.diceResult = -1
for ( let res of rollData.roll.terms[0].results) {
rollData.diceResult = Math.max(res.result, rollData.diceResult)
}
if (rollData.mainDice.includes("d10")) { if (rollData.mainDice.includes("d10")) {
if ( rollData.diceResult == 1) { if ( rollData.diceResult == 1) {
rollData.finalResult -= 3 rollData.finalResult -= 3
@ -292,6 +291,9 @@ export class HeritiersUtility {
if ( rollData.diceResult == 1 || rollData.diceResult == 2) { if ( rollData.diceResult == 1 || rollData.diceResult == 2) {
rollData.finalResult -= 5 rollData.finalResult -= 5
} }
}
if (rollData.useHeritage || rollData.useTricherie) {
} }
//rollData.finalResult = Math.max(rollData.finalResult, 0) //rollData.finalResult = Math.max(rollData.finalResult, 0)
//console.log("Result : ", rollData) //console.log("Result : ", rollData)
@ -309,8 +311,9 @@ export class HeritiersUtility {
let actor = this.getActorFromRollData(rollData) let actor = this.getActorFromRollData(rollData)
//rollData.actionImg = "systems/fvtt-les-heritiers/assets/icons/" + actor.system.attributs[rollData.attrKey].labelnorm + ".webp" //rollData.actionImg = "systems/fvtt-les-heritiers/assets/icons/" + actor.system.attributs[rollData.attrKey].labelnorm + ".webp"
rollData.carac = duplicate(actor.system.caracteristiques[rollData.caracKey]) rollData.carac = duplicate(actor.system.caracteristiques[rollData.caracKey])
rollData.diceFormula = rollData.mainDice
rollData.nbDice = (rollData.useTricherie || rollData.useHeritage) ? 3 : 1
rollData.diceFormula = rollData.nbDice + rollData.mainDice + "kh1"
//console.log("BEFORE COMP", rollData) //console.log("BEFORE COMP", rollData)
if (rollData.competence) { if (rollData.competence) {
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0 let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0

View File

@ -120,6 +120,7 @@
}, },
"heritage": { "heritage": {
"value": 0, "value": 0,
"max": 0,
"scenarios": 0 "scenarios": 0
} }
}, },

View File

@ -26,6 +26,20 @@
</div> </div>
{{/if}} {{/if}}
{{#if tricherie}}
<div class="flexrow">
<span class="roll-dialog-label">Utiliser 1 point de Tricherie ({{tricherie}}) ?</span>
<input type="checkbox" class="item-field-label-short" id="useTricherie" {{checked useTricherie}}/>
</div>
{{/if}}
{{#if heritage}}
<div class="flexrow">
<span class="roll-dialog-label">Utiliser 1 point d'Heritage ? ({{heritage}})</span>
<input type="checkbox" class="item-field-label-short" id="useHeritage" {{checked useHeritage}}/>
</div>
{{/if}}
<div class="flexrow"> <div class="flexrow">
<span class="roll-dialog-label">Bonus/Malus </span> <span class="roll-dialog-label">Bonus/Malus </span>
<select class="roll-dialog-label" id="bonus-malus-context" type="text" value="{{bonusMalusContext}}" <select class="roll-dialog-label" id="bonus-malus-context" type="text" value="{{bonusMalusContext}}"