Fix initiative
This commit is contained in:
parent
d776c219a8
commit
0b86c3b159
@ -10,22 +10,24 @@ export class VadentisCombat extends Combat {
|
||||
ids = typeof ids === "string" ? [ids] : ids;
|
||||
const currentId = this.combatant._id;
|
||||
for (let cId = 0; cId < ids.length; cId++) {
|
||||
const c = this.getCombatant(ids[cId]);
|
||||
const c = this.combatants.get(ids[cId]);
|
||||
let initBonus = c.actor ? c.actor.getInitiativeScore() : 0;
|
||||
console.log("Init for ", initBonus);
|
||||
const roll = super._getInitiativeRoll(c, "1d20+"+initBonus);
|
||||
|
||||
const roll = c.getInitiativeRoll("1d20+"+initBonus);
|
||||
if ( !roll.total) {
|
||||
roll.evaluate( {async: false});
|
||||
}
|
||||
if (roll.total <= 0) roll.total = 0;
|
||||
console.log("Compute init for", roll.total);
|
||||
await this.updateEmbeddedEntity("Combatant", { _id: c._id, initiative: roll.total });
|
||||
let id = c._id || c.id;
|
||||
await this.updateEmbeddedDocuments("Combatant", [ { _id: id, initiative: roll.total } ]);
|
||||
|
||||
// Send a chat message
|
||||
let rollMode = messageOptions.rollMode || game.settings.get("core", "rollMode");
|
||||
let messageData = mergeObject(
|
||||
{
|
||||
speaker: {
|
||||
scene: canvas.scene._id,
|
||||
actor: c.actor ? c.actor._id : null,
|
||||
scene: canvas.scene.id,
|
||||
actor: id,
|
||||
token: c.token._id,
|
||||
alias: c.token.name,
|
||||
sound: CONFIG.sounds.dice,
|
||||
|
@ -2,7 +2,7 @@
|
||||
"name": "foundryvtt-vadentis",
|
||||
"title": "Vadentis",
|
||||
"description": "Système Vadentis pour FoundryVTT",
|
||||
"version": "0.3.1",
|
||||
"version": "0.3.2",
|
||||
"manifestPlusVersion": "1.0.0",
|
||||
"minimumCoreVersion": "0.8.9",
|
||||
"compatibleCoreVersion": "9",
|
||||
|
Loading…
Reference in New Issue
Block a user