if (!this.actor.flags.holed) return; if (this.actor.flags.holed.applied === true) return; if (this.actor.hasCondition("dead")) return; const currentHoled = this.actor.flags.holed.holed || 0; const openGunPorts = this.actor.itemTypes.vehicleMod.reduce((acc, m) => { if (!m.name.toLowerCase().includes("gun port")) return acc; let closed = m.getFlag("wfrp4e-soc", "gunport"); if (!closed) acc++; return acc; }, 0); const totalHoled = currentHoled + openGunPorts; const toughness = this.actor.system.characteristics.t.value; this.actor.flags.holed.total = totalHoled; if (totalHoled >= toughness) { const speaker = ChatMessage.getSpeaker({actor: this.actor}); this.script.scriptMessage(`
${speaker.alias} sank due to having Holed (${totalHoled}) rating equal to, or exceeding its Toughness (${toughness })
Holed due to Critical Damage: ${currentHoled}
Holed due to opened Gun Ports: ${openGunPorts}