Fix return statement
This commit is contained in:
parent
b0b1269afa
commit
e2301b1cfd
@ -52,7 +52,7 @@ export class RdDActor extends Actor {
|
||||
data.items.push(compItem);
|
||||
}
|
||||
|
||||
super.create(data, options);
|
||||
return super.create(data, options);
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
@ -1,62 +0,0 @@
|
||||
Combat.prototype.rollInitiative = async function (
|
||||
ids,
|
||||
formula = null,
|
||||
messageOptions = {}
|
||||
) {
|
||||
console.log(
|
||||
`${game.data.system.data.title} | Combat.rollInitiative()`,
|
||||
ids,
|
||||
formula,
|
||||
messageOptions
|
||||
);
|
||||
// Structure input data
|
||||
ids = typeof ids === "string" ? [ids] : ids;
|
||||
const currentId = this.combatant._id;
|
||||
|
||||
// calculate initiative
|
||||
if (ids.length == 1) {
|
||||
const c = this.getCombatant(ids[0]);
|
||||
if (!c) return results;
|
||||
|
||||
const cf = formula || this._getInitiativeFormula(c);
|
||||
const roll = this._getInitiativeRoll(c, cf);
|
||||
|
||||
const updates = this.combatants
|
||||
.filter(
|
||||
(combatant) =>
|
||||
!combatant.actor || combatant.actor.data.type == "character"
|
||||
)
|
||||
.map((combatant) => {
|
||||
return { _id: combatant._id, initiative: roll.total };
|
||||
});
|
||||
|
||||
if (!updates.length) return this;
|
||||
|
||||
// Update multiple combatants
|
||||
await this.updateEmbeddedEntity("Combatant", updates);
|
||||
|
||||
// Ensure the turn order remains with the same combatant
|
||||
await this.update({
|
||||
turn: this.turns.findIndex((t) => t._id === currentId),
|
||||
});
|
||||
|
||||
// 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,
|
||||
token: c.token._id,
|
||||
alias: c.token.name,
|
||||
sound: CONFIG.sounds.dice,
|
||||
},
|
||||
flavor: `${c.token.name} rolls for Party Initiative!`,
|
||||
},
|
||||
messageOptions
|
||||
);
|
||||
roll.toMessage(messageData, { rollMode, create: true });
|
||||
return this;
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user