Fix bougette sur PNJ/Creatures

This commit is contained in:
LeRatierBretonnien 2022-12-04 13:48:37 +01:00
parent 884823a1bc
commit 6d6fec99b0
4 changed files with 53 additions and 44 deletions

View File

@ -148,7 +148,7 @@ export class BoLActorSheet extends ActorSheet {
formData.options = this.options
formData.owner = this.document.isOwner
formData.editScore = this.options.editScore
formData.useBougette = BoLUtility.getUseBougette()
formData.useBougette = (this.actor.type == "character" && BoLUtility.getUseBougette()) || false
formData.bougette = this.actor.getBougette()
formData.charType = this.actor.getCharType()
formData.villainy = this.actor.getVillainy()

View File

@ -40,26 +40,35 @@ export class BoLActor extends Actor {
/* -------------------------------------------- */
getBougette() {
let b = duplicate(this.system.bougette)
b.label = game.i18n.localize( game.bol.config.bougetteState[String(this.system.bougette.value)] )
b.diceImg = "icons/dice/" + game.bol.config.bougetteDice[String(this.system.bougette.value)] + "black.svg"
return b
if ( this.type == "character") {
let b = duplicate(this.system.bougette)
b.label = game.i18n.localize( game.bol.config.bougetteState[String(this.system.bougette.value)] )
b.diceImg = "icons/dice/" + game.bol.config.bougetteDice[String(this.system.bougette.value)] + "black.svg"
return b
}
return undefined
}
/* -------------------------------------------- */
async rollBougette() {
//ui.notifications.info("Roll bougette done !")
let attribute = duplicate(this.system.attributes.vigor)
let rollData = BoLRoll.getCommonRollData(this, "bougette", attribute, undefined )
rollData.formula = game.bol.config.bougetteDice[String(this.system.bougette.value)]
let r = new BoLDefaultRoll(rollData)
r.roll()
if ( this.type == "character") {
let attribute = duplicate(this.system.attributes.vigor)
let rollData = BoLRoll.getCommonRollData(this, "bougette", attribute, undefined )
rollData.formula = game.bol.config.bougetteDice[String(this.system.bougette.value)]
let r = new BoLDefaultRoll(rollData)
r.roll()
}
}
/* -------------------------------------------- */
decBougette() {
let bougette = duplicate(this.system.bougette)
bougette.value = Math.max( Number(bougette.value) - 1, 0)
this.update( { 'system.bougette': bougette } )
if ( this.type == "character") {
let bougette = duplicate(this.system.bougette)
bougette.value = Math.max( Number(bougette.value) - 1, 0)
this.update( { 'system.bougette': bougette } )
}
}
/* -------------------------------------------- */
updateResourcesData() {
if (this.type == 'character') {

View File

@ -14,7 +14,7 @@
],
"url": "https://www.uberwald.me/gitea/public/bol",
"license": "LICENSE.txt",
"version": "10.4.10",
"version": "10.4.11",
"compatibility": {
"minimum": "10",
"verified": "10",
@ -203,7 +203,7 @@
],
"socket": true,
"manifest": "https://www.uberwald.me/gitea/public/bol/raw/v10/system.json",
"download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.4.10.zip",
"download": "https://www.uberwald.me/gitea/public/bol/archive/bol-v10.4.11.zip",
"background": "systems/images/map_lemurie.webp",
"gridDistance": 1.5,
"gridUnits": "m",

View File

@ -1,34 +1,34 @@
<!--ARMES-->
<button class="create_item">Créer un Equipement</button>
{{#if useBougette}}
<ol class="items-list">
<li class="item flexrow item-header">
<div class="item-name flex4 left">{{localize "BOL.ui.moneyTitle"}}</div>
<div class="item-name flex4 left">&nbsp;</div>
</li>
<li class="item flexrow" data-item-id="{{item._id}}">
<h4 class="item-name flex4 left">
<div class="item-image"><img src="icons/containers/bags/coinpouch-simple-leather-brown.webp" title="{{localize "BOL.ui.money"}}" /></div>
{{localize "BOL.ui.money"}}
</h4>
<div class="item-image">
<a class="bougette-roll rollable" data-roll-type="bougette"><i class="darkgreen fas fa-dice"></i></a>
</div>
{{#if isGM}}
<select class="field-value" name="system.bougette.value" data-dtype="String">
{{#select bougette.value}}
{{#each config.bougetteState as |value id|}}
<option value="{{id}}">{{localize value}}</option>
{{/each}}
{{/select}}
</select>
{{else}}
<label class="">{{localize bougette.label}}</label></a>
{{/if}}
</li>
</ol>
{{/if}}
{{#if useBougette}}
<ol class="items-list">
<li class="item flexrow item-header">
<div class="item-name flex4 left">{{localize "BOL.ui.moneyTitle"}}</div>
<div class="item-name flex4 left">&nbsp;</div>
</li>
<li class="item flexrow" data-item-id="{{item._id}}">
<h4 class="item-name flex4 left">
<div class="item-image"><img src="icons/containers/bags/coinpouch-simple-leather-brown.webp" title="{{localize "BOL.ui.money"}}" /></div>
{{localize "BOL.ui.money"}}
</h4>
<div class="item-image">
<a class="bougette-roll rollable" data-roll-type="bougette"><i class="darkgreen fas fa-dice"></i></a>
</div>
{{#if isGM}}
<select class="field-value" name="system.bougette.value" data-dtype="String">
{{#select bougette.value}}
{{#each config.bougetteState as |value id|}}
<option value="{{id}}">{{localize value}}</option>
{{/each}}
{{/select}}
</select>
{{else}}
<label class="">{{localize bougette.label}}</label></a>
{{/if}}
</li>
</ol>
{{/if}}
<ol class="items-list">
<li class="item flexrow item-header">