Review sheet and headers

This commit is contained in:
2022-03-11 14:00:14 +01:00
parent e887828d53
commit 7974897c03
7 changed files with 52 additions and 29 deletions

View File

@@ -84,10 +84,17 @@ export class PegasusActorSheet extends ActorSheet {
}
/* -------------------------------------------- */
async rollIDR( diceValue) {
async rollIDR( itemId, diceValue) {
let item = this.actor.data.items.get( itemId) ?? {name: "Unknown"}
let myRoll = new Roll(diceValue+"x").roll({ async: false })
//await PegasusUtility.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
myRoll.toMessage()
await PegasusUtility.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"))
let chatData = {
user: game.user.id,
rollMode: game.settings.get("core", "rollMode"),
whisper: [game.user.id].concat(ChatMessage.getWhisperRecipients('GM')),
content: `${this.actor.name} has roll IDR for ${item.name} : ${myRoll.total}`
}
ChatMessage.create(chatData)
}
/* -------------------------------------------- */
@@ -191,12 +198,12 @@ export class PegasusActorSheet extends ActorSheet {
} );
html.find('.ammo-minus').click(event => {
const li = $(event.currentTarget).parents(".item");
const li = $(event.currentTarget).parents(".item")
this.actor.incDecAmmo( li.data("item-id"), -1 );
} );
html.find('.ammo-plus').click(event => {
const li = $(event.currentTarget).parents(".item");
this.actor.incDecAmmo( li.data("item-id"), +1 );
const li = $(event.currentTarget).parents(".item")
this.actor.incDecAmmo( li.data("item-id"), +1 )
} );
html.find('.momentum-minus').click(event => {
@@ -240,7 +247,8 @@ export class PegasusActorSheet extends ActorSheet {
});
html.find('.roll-idr').click((event) => {
const diceValue = $(event.currentTarget).data("dice-value")
this.rollIDR( diceValue)
const li = $(event.currentTarget).parents(".item")
this.rollIDR( li.data("item-id"), diceValue)
})
html.find('.roll-spec').click((event) => {

View File

@@ -20,15 +20,19 @@ export class PegasusCombat extends Combat {
_onUpdate(changed, options, userId) {
}
/* -------------------------------------------- */
static async checkTurnPosition() {
while (game.combat.turn > 0) {
await game.combat.previousTurn()
}
}
/* -------------------------------------------- */
static async decInitBy10( combatantId, value) {
const combatant = game.combat.combatants.get(combatantId)
let initValue = combatant.initiative + value
await game.combat.setInitiative(combatantId, initValue)
while (game.combat.turn > 0) {
await game.combat.previousTurn()
}
console.log("COMBAT", game.combat )
setTimeout( this.checkTurnPosition, 400) // The setInitiative is no more blocking for unknown reason
}
}

View File

@@ -499,20 +499,18 @@ export class PegasusUtility {
diceFormulaTab.push(this.getFoundryDiceFromLevel(diceGroup.level))
}
let diceFormula = '{' + diceFormulaTab.join(', ') + '}kh';
console.log(diceFormula);
// Performs roll
let myRoll = rollData.roll;
if (!myRoll) { // New rolls only of no rerolls
myRoll = new Roll(diceFormula).roll({ async: false });
console.log("ROLL : ", diceFormula);
console.log("ROLL : ", diceFormula)
await this.showDiceSoNice(myRoll, game.settings.get("core", "rollMode"));
rollData.roll = myRoll
}
// Final score and keep data
rollData.finalScore = myRoll.total + dicePool[0].statmod;
console.log("ROLLLL!!!!", rollData);
if (rollData.damages) {
let dmgFormula = this.getFoundryDiceFromLevel(rollData.damages.value)