diff --git a/system.json b/system.json index ef5c40d..0dada84 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "zero-engine", "title": "Zero Engine (SLA Industries)", "description": "A basic game system for SLA Industries using the Zero Engine rules.", - "version": "1.4.4", + "version": "1.4.5", "compatibility": { "minimum": 13, "verified": "14.359" diff --git a/templates/actor/character-sheet.hbs b/templates/actor/character-sheet.hbs index 222a930..26dfb8e 100644 --- a/templates/actor/character-sheet.hbs +++ b/templates/actor/character-sheet.hbs @@ -873,7 +873,7 @@
CURRENT BALANCE - c + c {{#if system.finances.debt}}⚠ DEBT {{system.finances.debt}}c{{/if}}
diff --git a/zero-engine.mjs b/zero-engine.mjs index c3d670b..24b645a 100644 --- a/zero-engine.mjs +++ b/zero-engine.mjs @@ -304,7 +304,7 @@ class ZeroEngineActorSheet extends foundry.appv1.sheets.ActorSheet { const _inc = this.actor.system.finances?.income || {}; const _exp = this.actor.system.finances?.expenses || {}; context.weeklyIncome = (_inc.salary||0) + (_inc.bpnReward||0) + (_inc.other||0); - context.weeklyExpenses = (_exp.accommodation||0) + (_exp.drugs||0) + (_exp.subscriptions||0) + (_exp.other||0); + context.weeklyExpenses = (_exp.accommodation||0) + (_exp.drugs||0) + (_exp.subscriptions||0) + (_exp.other||0) + (_exp.bulletTax||0); context.weeklyNet = context.weeklyIncome - context.weeklyExpenses; context.weeklyNetSign = context.weeklyNet >= 0 ? '+' : ''; context.weeklyNetColor = context.weeklyNet >= 0 ? '#44cc66' : '#cc1111'; @@ -6008,7 +6008,11 @@ async function _applyBulletTax(actor, weaponData, roundsFired) { // Bullet tax is DOUBLED: base cost (ammo) + tax of equal value = 2× const totalCost = costPerRound * roundsFired * 2; - const currentCredits = Number(actor.system?.details?.credits ?? 0); + // Fall back to 500 (template default) not 0 — actors created before the + // credits field existed have undefined here, not zero. + const storedCredits = actor.system?.details?.credits; + const currentCredits = (storedCredits !== undefined && storedCredits !== null) + ? Number(storedCredits) : 500; const newCredits = Math.max(0, currentCredits - totalCost); // ── Credit deduction — critical, standalone update ────────────────────── @@ -6122,7 +6126,7 @@ class ZeroEngineActorSheetMk2 extends ZeroEngineActorSheet { const inc = context.system.finances.income || {}; const exp = context.system.finances.expenses || {}; context.weeklyIncome = (inc.salary||0) + (inc.bpnReward||0) + (inc.other||0); - context.weeklyExpenses = (exp.accommodation||0) + (exp.drugs||0) + (exp.subscriptions||0) + (exp.other||0); + context.weeklyExpenses = (exp.accommodation||0) + (exp.drugs||0) + (exp.subscriptions||0) + (exp.other||0) + (exp.bulletTax||0); context.weeklyNet = context.weeklyIncome - context.weeklyExpenses; context.weeklyNetSign = context.weeklyNet >= 0 ? '+' : ''; context.weeklyNetColor = context.weeklyNet >= 0 ? '#44cc66' : '#cc1111';