feat: Body Blocker armor + drug credit deduction on use (v1.4.1)
- Add Body Blocker armor (AR 1, Dice 1, 120c) with custom SVG icon Concealable civilian vest, sits between Street Clothes and Downtown Jacket - _activateDrug now automatically deducts drug cost from actor credits Shows notification: drug name, cost charged, old and new credit total Credits cannot go below 0 - Set costs on 7 drugs that were missing them (cost was 0): Painkillers 30c, Stimulant 40c, Sedative 35c, Redline 110c, Calm-Line 65c, Rush 85c, UV 200c - Rebuild: sla-armors (18), sla-drugs (16)
This commit is contained in:
@@ -827,6 +827,17 @@ class ZeroEngineActorSheet extends foundry.appv1.sheets.ActorSheet {
|
||||
"system.withdrawalActive": false
|
||||
});
|
||||
|
||||
// ── Deduct drug cost from credits ────────────────────────────────────────
|
||||
const drugCost = Math.max(0, Number(item.system?.cost) || 0);
|
||||
if (drugCost > 0) {
|
||||
const currentCredits = Number(this.actor.system?.details?.credits ?? 0);
|
||||
const newCredits = Math.max(0, currentCredits - drugCost);
|
||||
await this.actor.update({ "system.details.credits": newCredits });
|
||||
ui.notifications.info(
|
||||
`${item.name}: ${drugCost}¢ charged to ${this.actor.name}. Credits: ${currentCredits} → ${newCredits}`
|
||||
);
|
||||
}
|
||||
|
||||
const stressBonus = Math.max(0, Number(item.system?.stressRecoveryBonus) || 0);
|
||||
if (stressBonus > 0) {
|
||||
const currentStress = this._getStressValue(this.actor);
|
||||
|
||||
Reference in New Issue
Block a user