ENH: Individual Init
parent
8760b08dcc
commit
e3f9afe297
|
@ -1,5 +1,3 @@
|
||||||
import { OseDice } from "./dice.js";
|
|
||||||
|
|
||||||
export class OseCombat {
|
export class OseCombat {
|
||||||
static rollInitiative(combat, data) {
|
static rollInitiative(combat, data) {
|
||||||
// Check groups
|
// Check groups
|
||||||
|
@ -27,6 +25,14 @@ export class OseCombat {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static individualInitiative(combat, data) {
|
||||||
|
let ids = [];
|
||||||
|
combat.data.combatants.forEach(cbt => {
|
||||||
|
ids.push(cbt._id);
|
||||||
|
})
|
||||||
|
combat.rollInitiative(ids);
|
||||||
|
}
|
||||||
|
|
||||||
static format(object, html, user) {
|
static format(object, html, user) {
|
||||||
html.find('.combat-control[data-control="rollNPC"]').remove();
|
html.find('.combat-control[data-control="rollNPC"]').remove();
|
||||||
html.find('.combat-control[data-control="rollAll"]').remove();
|
html.find('.combat-control[data-control="rollAll"]').remove();
|
||||||
|
|
13
src/ose.js
13
src/ose.js
|
@ -77,6 +77,7 @@ Hooks.once("ready", async () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// License and KOFI infos
|
||||||
Hooks.on("renderSidebarTab", async (object, html) => {
|
Hooks.on("renderSidebarTab", async (object, html) => {
|
||||||
if (object instanceof Settings) {
|
if (object instanceof Settings) {
|
||||||
const template = "systems/ose/templates/chat/license.html";
|
const template = "systems/ose/templates/chat/license.html";
|
||||||
|
@ -106,6 +107,10 @@ Hooks.on("preUpdateCombatant", (combat, combatant, data, diff, id) => {
|
||||||
data.initiative = parseInt(groupInit);
|
data.initiative = parseInt(groupInit);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (data.initiative && init) {
|
||||||
|
if (combatant.actor.data.data.isSlow) {
|
||||||
|
data.initiative = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -118,10 +123,14 @@ Hooks.on("renderCombatTracker", (object, html, data) => {
|
||||||
|
|
||||||
Hooks.on("preUpdateCombat", async (combat, data, diff, id) => {
|
Hooks.on("preUpdateCombat", async (combat, data, diff, id) => {
|
||||||
let init = game.settings.get("ose", "individualInit");
|
let init = game.settings.get("ose", "individualInit");
|
||||||
if (!data.round || init) {
|
if (!data.round) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
OseCombat.rollInitiative(combat, data, diff, id);
|
if (!init) {
|
||||||
|
OseCombat.rollInitiative(combat, data, diff, id);
|
||||||
|
} else {
|
||||||
|
OseCombat.individualInitiative(combat, data, diff, id);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on("renderChatLog", (app, html, data) => OseItem.chatListeners(html));
|
Hooks.on("renderChatLog", (app, html, data) => OseItem.chatListeners(html));
|
||||||
|
|
Loading…
Reference in New Issue