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.message(`
${speaker.alias} coule en raison d'un score Percé (${totalHoled}) égal ou supérieur à sa Robustesse (${toughness })
Percé en raison de dégâts critiques : ${currentHoled}
Percé en raison de sabords ouverts : ${openGunPorts}