Compare commits

..

6 Commits

Author SHA1 Message Date
d74f7784bb Fix bougette sur PNJ/Creatures 2022-12-04 13:49:00 +01:00
6d6fec99b0 Fix bougette sur PNJ/Creatures 2022-12-04 13:48:37 +01:00
884823a1bc Init again !!!! 2022-12-02 13:16:42 +01:00
399c22d623 Init again !!!! 2022-12-02 13:15:48 +01:00
085265df5d initiative bugfix 2022-12-01 23:57:33 +01:00
593db9ba5b initiative bugfix 2022-12-01 23:46:27 +01:00
7 changed files with 85 additions and 70 deletions

View File

@ -182,7 +182,8 @@
"BOL.ui.armornoformula": "L'armure {protect.name} n'a pas de formule pour la protection !", "BOL.ui.armornoformula": "L'armure {protect.name} n'a pas de formule pour la protection !",
"BOL.ui.selectactor": "Selectionnez votre personnage pour utiliser la macro", "BOL.ui.selectactor": "Selectionnez votre personnage pour utiliser la macro",
"BOL.ui.itemnotfound": "Impossible de trouver l'objet de cette macro", "BOL.ui.itemnotfound": "Impossible de trouver l'objet de cette macro",
"BOL.ui.noinit": "Pas d'initiative trouvée, veuillez en enregistrer une.",
"BOL.featureCategory.origins": "Origines", "BOL.featureCategory.origins": "Origines",
"BOL.featureCategory.races": "Races", "BOL.featureCategory.races": "Races",
"BOL.featureCategory.careers": "Carrières", "BOL.featureCategory.careers": "Carrières",

View File

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

View File

@ -40,26 +40,35 @@ export class BoLActor extends Actor {
/* -------------------------------------------- */ /* -------------------------------------------- */
getBougette() { getBougette() {
let b = duplicate(this.system.bougette) if ( this.type == "character") {
b.label = game.i18n.localize( game.bol.config.bougetteState[String(this.system.bougette.value)] ) let b = duplicate(this.system.bougette)
b.diceImg = "icons/dice/" + game.bol.config.bougetteDice[String(this.system.bougette.value)] + "black.svg" b.label = game.i18n.localize( game.bol.config.bougetteState[String(this.system.bougette.value)] )
return b b.diceImg = "icons/dice/" + game.bol.config.bougetteDice[String(this.system.bougette.value)] + "black.svg"
return b
}
return undefined
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollBougette() { async rollBougette() {
//ui.notifications.info("Roll bougette done !") if ( this.type == "character") {
let attribute = duplicate(this.system.attributes.vigor) let attribute = duplicate(this.system.attributes.vigor)
let rollData = BoLRoll.getCommonRollData(this, "bougette", attribute, undefined ) let rollData = BoLRoll.getCommonRollData(this, "bougette", attribute, undefined )
rollData.formula = game.bol.config.bougetteDice[String(this.system.bougette.value)] rollData.formula = game.bol.config.bougetteDice[String(this.system.bougette.value)]
let r = new BoLDefaultRoll(rollData) let r = new BoLDefaultRoll(rollData)
r.roll() r.roll()
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
decBougette() { decBougette() {
let bougette = duplicate(this.system.bougette) if ( this.type == "character") {
bougette.value = Math.max( Number(bougette.value) - 1, 0) let bougette = duplicate(this.system.bougette)
this.update( { 'system.bougette': bougette } ) bougette.value = Math.max( Number(bougette.value) - 1, 0)
this.update( { 'system.bougette': bougette } )
}
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
updateResourcesData() { updateResourcesData() {
if (this.type == 'character') { if (this.type == 'character') {
@ -648,33 +657,38 @@ export class BoLActor extends Actor {
} }
/*-------------------------------------------- */ /*-------------------------------------------- */
registerInit(rollData) { async registerInit(rollData) {
rollData.actor = undefined // Cleanup if present rollData.actor = undefined // Cleanup if present
this.setFlag("world", "last-initiative", rollData) await this.setFlag("world", "last-initiative", rollData)
} }
/*-------------------------------------------- */ /*-------------------------------------------- */
getInitiativeRank() { getInitiativeRank(rollData = undefined) {
let rollData = this.getFlag("world", "last-initiative") if (!rollData) {
let fvttInit = 5 rollData = this.getFlag("world", "last-initiative")
if (this.type == 'character') { }
if (rollData.isLegendary) { let fvttInit = 4 // Pietaille par defaut
fvttInit = 10 if (this.type == 'character' ) {
} else if (rollData.isCritical) { fvttInit = 5
fvttInit = 9 if (!rollData) {
} else if (rollData.isSuccess ) { fvttInit = -1
fvttInit = 8 } else {
} else if (rollData.isFumble) { if (rollData.isLegendary) {
fvttInit = 3 fvttInit = 10
} else if (rollData.isCritical) {
fvttInit = 9
} else if (rollData.isSuccess ) {
fvttInit = 8
} else if (rollData.isFumble) {
fvttInit = 3
}
} }
} else { }
fvttInit = 4 // Pietaille par defautco if ( this.getCharType() == 'adversary') {
if ( this.getCharType() == 'adversary') { fvttInit = 7
fvttInit = 7 }
} if ( this.getCharType() == 'tough') {
if ( this.getCharType() == 'tough') { fvttInit = 6
fvttInit = 6
}
} }
return fvttInit return fvttInit
} }

View File

@ -548,7 +548,7 @@ export class BoLDefaultRoll {
async roll() { async roll() {
const r = new Roll(this.rollData.formula) const r = new Roll(this.rollData.formula)
// console.log("Roll formula", this.rollData.formula) //console.log("Roll formula", this.rollData.formula)
await r.roll({ "async": false }) await r.roll({ "async": false })
const activeDice = r.terms[0].results.filter(r => r.active) const activeDice = r.terms[0].results.filter(r => r.active)
const diceTotal = activeDice.map(r => r.result).reduce((a, b) => a + b) const diceTotal = activeDice.map(r => r.result).reduce((a, b) => a + b)
@ -571,7 +571,7 @@ export class BoLDefaultRoll {
if (this.rollData.registerInit) { if (this.rollData.registerInit) {
actor.registerInit(this.rollData) actor.registerInit(this.rollData)
this.rollData.initiativeRank = actor.getInitiativeRank() this.rollData.initiativeRank = actor.getInitiativeRank(this.rollData)
} }
if (this.rollData.isSuccess && this.rollData.mode == "spell") { // PP cost management if (this.rollData.isSuccess && this.rollData.mode == "spell") { // PP cost management
this.rollData.remainingPP = actor.spendPowerPoint(this.rollData.ppCost + this.rollData.ppCostArmor) this.rollData.remainingPP = actor.spendPowerPoint(this.rollData.ppCost + this.rollData.ppCostArmor)

View File

@ -20,7 +20,7 @@ export class BoLCombatManager extends Combat {
console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions); console.log(`${game.system.title} | Combat.rollInitiative()`, ids, formula, messageOptions);
// Structure input data // Structure input data
ids = typeof ids === "string" ? [ids] : ids; ids = typeof ids === "string" ? [ids] : ids;
const currentId = this.combatant.id; //const currentId = this.combatant.id;
// calculate initiative // calculate initiative
for (let cId = 0; cId < ids.length; cId++) { for (let cId = 0; cId < ids.length; cId++) {

View File

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

View File

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