swade-mb-helpers/packs/helper-macros/_source/Lethal_Poison_mMSTm47fgx77GqAO.json

34 lines
2.4 KiB
JSON

{
"name": "Lethal Poison",
"type": "script",
"author": "sVoCvBU1knmXzoYe",
"img": "icons/magic/acid/dissolve-bone-skull.webp",
"scope": "global",
"command": "const speaker = ChatMessage.implementation.getSpeaker();\ntoken = (canvas.ready ? canvas.tokens.get(speaker.token) : null);\nactor = token?.actor || game.actors.get(speaker.actor);\nif (!actor.status.isDistracted) {\n const dist = game.swade.util.getStatusEffectDataById('distracted')\n await actor.toggleActiveEffect(dist, {active: true})\n}\nif (!actor.status.isStunned) {\n const stun = game.swade.util.getStatusEffectDataById('stunned')\n await actor.toggleActiveEffect(stun, {active: true})\n}\nconst poison = await Dialog.wait({\n title: `Apply Lethal Poison to ${actor.name}`,\n content: `<p>What was the result of the vigor roll against the lethal poison? (If ${actor.name} succeeded, you can close out of this dialog to cancel)</p>`,\n buttons: {\n fail: {\n icon: '<i class=\"fa-solid fa-skull\"></i>',\n label: \"Failure\"\n },\n critFail: {\n icon: '<i class=\"fa-solid fa-skull-crossbones\"></i>',\n label: \"Critical Failure\"\n }\n }\n})\nconst wounds = actor.system.wounds\nconst p = poison === 'fail' ? 1 : 2\nconst newWounds = wounds.value + p\nactor.update({'system.wounds.value': newWounds})\nif (newWounds > wounds.max) {\n if (!actor.status.isIncapacitated) {\n const incap = game.swade.util.getStatusEffectDataById('incapacitated')\n await actor.toggleActiveEffect(incap, {active: true})\n }\n}\nconst duration = new Roll('2d6')\nawait duration.toMessage(options={flavor: `${actor.name} will perish from the lethal poison in this many rounds`});\nactor.createEmbeddedDocuments('ActiveEffect', [{\n name: 'Lethal Poison',\n duration: {\n rounds: duration.total\n },\n icon: 'icons/magic/acid/dissolve-bone-skull.webp',\n statuses: ['perish'],\n flags: {swade: {expiration: 0}}\n}])",
"folder": "DbVwJ0fIfuijv8Nu",
"ownership": {
"default": 0,
"sVoCvBU1knmXzoYe": 3
},
"flags": {
"core": {},
"exportSource": {
"world": "swade-test",
"system": "swade",
"coreVersion": "11.315",
"systemVersion": "3.2.5"
}
},
"_stats": {
"systemId": "swade",
"systemVersion": "3.2.5",
"coreVersion": "11.315",
"createdTime": 1705988835525,
"modifiedTime": 1705990319268,
"lastModifiedBy": "sVoCvBU1knmXzoYe"
},
"_id": "mMSTm47fgx77GqAO",
"sort": 300000,
"_key": "!macros!mMSTm47fgx77GqAO"
}