FIX: Combat ordering
parent
2490986d54
commit
e20c4bc98e
|
@ -36,6 +36,8 @@
|
||||||
"OSE.roll.exploration": "{exploration} test",
|
"OSE.roll.exploration": "{exploration} test",
|
||||||
"OSE.roll.details.exploration": "Roll 1d6 <= {expl} for success",
|
"OSE.roll.details.exploration": "Roll 1d6 <= {expl} for success",
|
||||||
"OSE.roll.reaction": "Reaction roll",
|
"OSE.roll.reaction": "Reaction roll",
|
||||||
|
"OSE.roll.initiative": "Group {group} rolls for Initiative!",
|
||||||
|
"OSE.roll.individualInit": "{name} rolls for Initiative!",
|
||||||
|
|
||||||
"OSE.table.treasure.roll": "Roll Treasure",
|
"OSE.table.treasure.roll": "Roll Treasure",
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@
|
||||||
"OSE.roll.exploration": "Test de {exploration}",
|
"OSE.roll.exploration": "Test de {exploration}",
|
||||||
"OSE.roll.details.exploration": "Lancez 1d6 <= {expl} pour réussir",
|
"OSE.roll.details.exploration": "Lancez 1d6 <= {expl} pour réussir",
|
||||||
"OSE.roll.reaction": "Jet de Réaction",
|
"OSE.roll.reaction": "Jet de Réaction",
|
||||||
|
"OSE.roll.initiative": "Le groupe {group} tire son Initiative !",
|
||||||
|
"OSE.roll.individualInit": "{name} tire son Initiative!",
|
||||||
|
|
||||||
"OSE.table.treasure.roll": "Trésor Aléatoire",
|
"OSE.table.treasure.roll": "Trésor Aléatoire",
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ export class OseCombat {
|
||||||
Object.keys(groups).forEach((group) => {
|
Object.keys(groups).forEach((group) => {
|
||||||
let roll = new Roll("1d6").roll();
|
let roll = new Roll("1d6").roll();
|
||||||
roll.toMessage({
|
roll.toMessage({
|
||||||
flavor: `${CONFIG.OSE.colors[group]} group rolls initiative`,
|
flavor: game.i18n.format('OSE.roll.initiative', {group: CONFIG[OSE].colors[group]}),
|
||||||
});
|
});
|
||||||
groups[group].initiative = roll.total;
|
groups[group].initiative = roll.total;
|
||||||
});
|
});
|
||||||
|
@ -31,12 +31,40 @@ export class OseCombat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static individualInitiative(combat, data) {
|
static async individualInitiative(combat, data) {
|
||||||
let ids = [];
|
let updates = [];
|
||||||
combat.data.combatants.forEach((cbt) => {
|
let messages = [];
|
||||||
ids.push(cbt._id);
|
|
||||||
|
combat.data.combatants.forEach((c, i) => {
|
||||||
|
// This comes from foundry.js, had to remove the update turns thing
|
||||||
|
// Roll initiative
|
||||||
|
const cf = combat._getInitiativeFormula(c);
|
||||||
|
const roll = combat._getInitiativeRoll(c, cf);
|
||||||
|
updates.push({_id: c._id, initiative: roll.total});
|
||||||
|
|
||||||
|
// Determine the roll mode
|
||||||
|
let rollMode = game.settings.get("core", "rollMode");
|
||||||
|
if (( c.token.hidden || c.hidden ) && (rollMode === "roll") ) rollMode = "gmroll";
|
||||||
|
|
||||||
|
// Construct chat message data
|
||||||
|
let messageData = mergeObject({
|
||||||
|
speaker: {
|
||||||
|
scene: canvas.scene._id,
|
||||||
|
actor: c.actor ? c.actor._id : null,
|
||||||
|
token: c.token._id,
|
||||||
|
alias: c.token.name
|
||||||
|
},
|
||||||
|
flavor: game.i18n.format('OSE.roll.individualInit', {name: c.token.name})
|
||||||
|
}, {});
|
||||||
|
const chatData = roll.toMessage(messageData, {rollMode, create:false});
|
||||||
|
|
||||||
|
if ( i > 0 ) chatData.sound = null; // Only play 1 sound for the whole set
|
||||||
|
messages.push(chatData);
|
||||||
});
|
});
|
||||||
combat.rollInitiative(ids);
|
await combat.updateEmbeddedEntity("Combatant", updates);
|
||||||
|
await CONFIG.ChatMessage.entityClass.create(messages);
|
||||||
|
// Take the first combatant
|
||||||
|
data.turn = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static format(object, html, user) {
|
static format(object, html, user) {
|
||||||
|
|
Loading…
Reference in New Issue