FIX: Initiative on skip defeated

master
U~man 2020-07-19 19:42:10 +02:00
parent 83fa2f1744
commit 031168bddc
3 changed files with 16 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 69 KiB

View File

@ -34,13 +34,16 @@ export class OseCombat {
static async individualInitiative(combat, data) { static async individualInitiative(combat, data) {
let updates = []; let updates = [];
let messages = []; let messages = [];
combat.data.combatants.forEach((c, i) => { combat.data.combatants.forEach((c, i) => {
// This comes from foundry.js, had to remove the update turns thing // This comes from foundry.js, had to remove the update turns thing
// Roll initiative // Roll initiative
const cf = combat._getInitiativeFormula(c); const cf = combat._getInitiativeFormula(c);
const roll = combat._getInitiativeRoll(c, cf); const roll = combat._getInitiativeRoll(c, cf);
updates.push({_id: c._id, initiative: roll.total}); let value = roll.total;
if (combat.settings.skipDefeated && c.defeated) {
value = -790;
}
updates.push({ _id: c._id, initiative: value });
// Determine the roll mode // Determine the roll mode
let rollMode = game.settings.get("core", "rollMode"); let rollMode = game.settings.get("core", "rollMode");
@ -63,7 +66,6 @@ export class OseCombat {
}); });
await combat.updateEmbeddedEntity("Combatant", updates); await combat.updateEmbeddedEntity("Combatant", updates);
await CONFIG.ChatMessage.entityClass.create(messages); await CONFIG.ChatMessage.entityClass.create(messages);
// Take the first combatant
data.turn = 0; data.turn = 0;
} }
@ -73,6 +75,10 @@ export class OseCombat {
span.innerHTML == "-789.00" span.innerHTML == "-789.00"
? '<i class="fas fa-weight-hanging"></i>' ? '<i class="fas fa-weight-hanging"></i>'
: span.innerHTML; : span.innerHTML;
span.innerHTML =
span.innerHTML == "-790.00"
? '<i class="fas fa-dizzy"></i>'
: span.innerHTML;
}); });
let init = game.settings.get("ose", "individualInit"); let init = game.settings.get("ose", "individualInit");
if (init) { if (init) {

View File

@ -111,7 +111,7 @@ export class OseCharacterCreator extends FormApplication {
// Generate gold // Generate gold
let gold = event.target.elements.namedItem('gold').value; let gold = event.target.elements.namedItem('gold').value;
const itemData = { const itemData = {
name: "Gold pieces", name: "GP",
type: "item", type: "item",
img: "/systems/ose/assets/gold.png", img: "/systems/ose/assets/gold.png",
data: { data: {