Gestion/assistance aventure/eclat

This commit is contained in:
sladecraven 2022-06-05 18:49:38 +02:00
parent ea0de0e8cd
commit cd1ecf1d96
6 changed files with 38 additions and 12 deletions

View File

@ -162,8 +162,8 @@ export class MournbladeActor extends Actor {
}
/* -------------------------------------------- */
canEclatDoubleD20( ) {
return ( this.getAlignement() == "loyal" && this.data.data.eclat.value> 0)
canEclatDoubleD20() {
return (this.getAlignement() == "loyal" && this.data.data.eclat.value > 0)
}
/* -------------------------------------------- */
@ -234,11 +234,14 @@ export class MournbladeActor extends Actor {
rollData.img = this.img
rollData.canEclatDoubleD20 = this.canEclatDoubleD20()
rollData.doubleD20 = false
rollData.attributs = MournbladeUtility.getAttributs()
if (attrKey) {
rollData.attrKey = attrKey
rollData.actionImg = "systems/fvtt-mournblade/assets/icons/" + this.data.data.attributs[attrKey].labelnorm + ".webp"
rollData.attr = duplicate(this.data.data.attributs[attrKey])
if (attrKey != "tochoose") {
rollData.actionImg = "systems/fvtt-mournblade/assets/icons/" + this.data.data.attributs[attrKey].labelnorm + ".webp"
rollData.attr = duplicate(this.data.data.attributs[attrKey])
}
}
if (compId) {
rollData.competence = duplicate(this.data.items.get(compId) || {})

View File

@ -63,6 +63,9 @@ export class MournbladeRollDialog extends Dialog {
html.find('#difficulte').change(async (event) => {
this.rollData.difficulte = Number(event.currentTarget.value)
})
html.find('#attrKey').change(async (event) => {
this.rollData.attrKey = String(event.currentTarget.value)
})
html.find('#doubleD20').change(async (event) => {
this.rollData.doubleD20 = event.currentTarget.checked
})

View File

@ -288,11 +288,20 @@ export class MournbladeUtility {
/* -------------------------------------------- */
static async rollMournblade(rollData) {
let actor = game.actors.get(rollData.actorId)
if (rollData.attrKey == "tochoose") { // No attr selected, force address
rollData.attrKey = "adr"
}
if ( !rollData.attr) {
console.log("ATTR!!!", rollData.attrKey)
rollData.actionImg = "systems/fvtt-mournblade/assets/icons/" + actor.data.data.attributs[rollData.attrKey].labelnorm + ".webp"
rollData.attr = duplicate(actor.data.data.attributs[rollData.attrKey])
}
rollData.diceFormula = rollData.mainDice
if ( rollData.doubleD20) { // Multiply result !
rollData.diceFormula += "*2"
if (!rollData.isReroll) {
let actor = game.actors.get(rollData.actorId)
actor.changeEclat(-1)
}
}

View File

@ -17,7 +17,7 @@
"library": false,
"license": "LICENSE.txt",
"manifest": "https://www.uberwald.me/gitea/public/fvtt-mournblade/raw/branch/main/system.json",
"download": "https://www.uberwald.me/gitea/public/fvtt-mournblade/archive/fvtt-mournblade-0.0.10.zip",
"download": "https://www.uberwald.me/gitea/public/fvtt-mournblade/archive/fvtt-mournblade-0.0.11.zip",
"manifestPlusVersion": "1.0.0",
"media": [],
"minimumCoreVersion": "0.8.0",
@ -70,9 +70,9 @@
"styles": [
"styles/simple.css"
],
"templateVersion": 8,
"templateVersion": 9,
"title": "Mournblade",
"url": "",
"version": "0.0.10",
"version": "0.0.11",
"background": "./images/ui/mournblade_welcome.webp"
}

View File

@ -104,7 +104,7 @@
{{#each skills as |skill key|}}
<li class="item flexrow " data-item-id="{{skill._id}}" data-item-type="competence">
<img class="item-name-img" src="{{skill.img}}" />
<span class="item-name-label competence-name">{{skill.name}}</span>
<span class="item-name-label competence-name"><a class="roll-competence" data-attr-key="tochoose">{{skill.name}}</a></span>
<select class="status-small-label color-class-common edit-item-data competence-niveau" type="text" data-item-field="niveau"
value="{{skill.data.niveau}}" data-dtype="Number">
{{#select skill.data.niveau}}

View File

@ -9,8 +9,19 @@
<div class="flexcol">
<div class="flexrow">
<span class="roll-dialog-label">{{attr.label}}</span>
<span class="small-label">{{attr.value}}</span>
{{#if (eq attrKey "tochoose")}}
<span class="roll-dialog-label">Attribut</span>
<select class="status-small-label color-class-common" id ="attrKey" type="text" name="attrKey" value="attrKey" data-dtype="string" >
{{#select attrKey}}
{{#each attributs as |attrLabel attrKey|}}
<option value="{{attrKey}}">{{attrLabel}}</option>
{{/each}}
{{/select}}
</select>
{{else}}
<span class="roll-dialog-label">{{attr.label}}</span>
<span class="small-label">{{attr.value}}</span>
{{/if}}
</div>
{{#if competence}}