Utiliser les fenêtres de jets pour les jets
This commit is contained in:
parent
551438f514
commit
1b75decb18
@ -222,7 +222,7 @@ export class RdDActorSheet extends RdDBaseActorSangSheet {
|
||||
}
|
||||
|
||||
// Points de reve actuel
|
||||
this.html.find('.roll-reve-actuel').click(async event => this.actor.rollCarac('reve-actuel', true))
|
||||
this.html.find('.roll-reve-actuel').click(async event => this.actor.rollCarac('reve-actuel', {resistance:true}))
|
||||
this.html.find('.empoignade-label a').click(async event => RdDEmpoignade.onAttaqueEmpoignadeFromItem(RdDSheetUtility.getItem(event, this.actor)))
|
||||
|
||||
this.html.find('.roll-arme').click(async event => this.actor.rollArme(foundry.utils.duplicate(this._getEventArmeCombat(event)), 'competence'))
|
||||
|
@ -28,7 +28,7 @@ export class RdDBaseActorReveSheet extends RdDBaseActorSheet {
|
||||
|
||||
this.html.find('.button-encaissement').click(async event => this.actor.encaisser())
|
||||
this.html.find('.roll-carac').click(async event => {
|
||||
this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes['data-carac-name'].value))});
|
||||
this.actor.rollCarac(Grammar.toLowerCaseNoAccent(event.currentTarget.attributes['data-carac-name'].value))})
|
||||
this.html.find('.roll-competence').click(async event => this.actor.rollCompetence(RdDSheetUtility.getItemId(event)));
|
||||
this.html.find('.endurance-plus').click(async event => this.actor.santeIncDec("endurance", 1));
|
||||
this.html.find('.endurance-moins').click(async event => this.actor.santeIncDec("endurance", -1));
|
||||
|
@ -344,14 +344,15 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
competences: this.itemTypes['competence']
|
||||
},
|
||||
callbackAction: r => this.$onRollCaracResult(r)
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async rollCarac(caracName, jetResistance = undefined) {
|
||||
async rollCarac(caracName, options = {}) {
|
||||
if (Grammar.equalsInsensitive(caracName, 'taille')) {
|
||||
return
|
||||
}
|
||||
foundry.utils.mergeObject(options, { resistance: false, diff: 0 }, { overwrite: false })
|
||||
RdDEmpoignade.checkEmpoignadeEnCours(this)
|
||||
let selectedCarac = this.getCaracByName(caracName)
|
||||
console.log("selectedCarac", selectedCarac)
|
||||
@ -362,7 +363,8 @@ export class RdDBaseActorReve extends RdDBaseActor {
|
||||
rollData: {
|
||||
selectedCarac: selectedCarac,
|
||||
competences: this.itemTypes['competence'],
|
||||
jetResistance: jetResistance ? caracName : undefined
|
||||
diffLibre: options.diff ?? 0,
|
||||
jetResistance: options.resistance ? caracName : undefined
|
||||
},
|
||||
callbackAction: r => this.$onRollCaracResult(r)
|
||||
});
|
||||
|
@ -32,12 +32,26 @@ class TextRollCaracCompetence {
|
||||
const path = RdDCarac.caracDetails(caracCode)?.path
|
||||
const actors = TextRollCaracCompetence.getSelectedActors(actor)
|
||||
actors.filter(it => foundry.utils.getProperty(it, path) != undefined)
|
||||
.forEach(it => it.doRollCaracCompetence(caracCode, competence, diff))
|
||||
.forEach(it => TextRollCaracCompetence.doRoll(it, caracCode, competence, diff))
|
||||
}
|
||||
}
|
||||
static async doRoll(actor, caracCode, competence, diff) {
|
||||
if (competence) {
|
||||
if (actor.type == ACTOR_TYPES.personnage) {
|
||||
actor.rollCaracCompetence(caracCode, competence, diff)
|
||||
}
|
||||
else {
|
||||
actor.doRollCaracCompetence(caracCode, competence, diff)
|
||||
}
|
||||
}
|
||||
else {
|
||||
actor.rollCarac(caracCode, { diff })
|
||||
}
|
||||
}
|
||||
|
||||
static getSelectedActors(actor) {
|
||||
const selected = canvas.tokens.controlled.map(it => it.actor).filter(it => it)
|
||||
if (selected.length > 0){
|
||||
if (selected.length > 0) {
|
||||
return selected
|
||||
}
|
||||
actor = actor ?? RdDUtility.getSelectedActor()
|
||||
|
Loading…
x
Reference in New Issue
Block a user