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() {
return []
getTricherie() {
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.caracList = this.getCarac()
rollData.caracKey = "agi"
rollData.tricherie = this.getTricherie()
rollData.heritage = this.getHeritages()
rollData.useTricherie = false
rollData.useHeritage = false
if (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) => {
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("getChatLogEntryContext", (html, options) => HeritiersUtility.chatRollMenu(html, options))
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
HeritiersUtility.pushInitiativeOptions(html, options);
})
this.rollDataStore = {}
this.defenderStore = {}
HeritiersCommands.init()
@ -282,7 +278,10 @@ export class HeritiersUtility {
/* -------------------------------------------- */
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.diceResult == 1) {
rollData.finalResult -= 3
@ -292,6 +291,9 @@ export class HeritiersUtility {
if ( rollData.diceResult == 1 || rollData.diceResult == 2) {
rollData.finalResult -= 5
}
}
if (rollData.useHeritage || rollData.useTricherie) {
}
//rollData.finalResult = Math.max(rollData.finalResult, 0)
//console.log("Result : ", rollData)
@ -309,8 +311,9 @@ export class HeritiersUtility {
let actor = this.getActorFromRollData(rollData)
//rollData.actionImg = "systems/fvtt-les-heritiers/assets/icons/" + actor.system.attributs[rollData.attrKey].labelnorm + ".webp"
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)
if (rollData.competence) {
let compmod = (rollData.competence.system.niveau == 0) ? -3 : 0

View File

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

View File

@ -25,6 +25,20 @@
<span class="small-label roll-dialog-label">{{competence.system.niveau}}</span>
</div>
{{/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">
<span class="roll-dialog-label">Bonus/Malus </span>