Fix async rolls

This commit is contained in:
2022-04-12 00:17:26 +02:00
parent 283712e15a
commit 41b09b956b
5 changed files with 10 additions and 10 deletions

View File

@ -2148,7 +2148,7 @@
"effectApplication": "apply",
"effectTrigger": "oneTime",
"preventDuplicateEffects": false,
"script": "let roll = new Roll(\"1d10\").roll()\nroll.toMessage({flavor: \"Wounds Healed\", speaker : {alias : args.actor.name}})\n\nlet wounds = duplicate(args.actor.status.wounds);\n\nwounds.value += roll.total;\n\nif (wounds.value > wounds.max)\n wounds.value = wounds.max;\n\nargs.actor.update({\"data.status.wounds\" : wounds})\n\nlet bleeding = args.actor.hasCondition(\"bleeding\")\nif (bleeding)\n args.actor.removeCondition(\"bleeding\", bleeding.flags.wfrp4e.value)"
"script": "let roll = new Roll(\"1d10\").roll({async: false})\nroll.toMessage({flavor: \"Wounds Healed\", speaker : {alias : args.actor.name}})\n\nlet wounds = duplicate(args.actor.status.wounds);\n\nwounds.value += roll.total;\n\nif (wounds.value > wounds.max)\n wounds.value = wounds.max;\n\nargs.actor.update({\"data.status.wounds\" : wounds})\n\nlet bleeding = args.actor.hasCondition(\"bleeding\")\nif (bleeding)\n args.actor.removeCondition(\"bleeding\", bleeding.flags.wfrp4e.value)"
}
},
"icon": "modules/wfrp4e-core/icons/spells/cauterise.png",
@ -8058,7 +8058,7 @@
"effectApplication": "apply",
"effectTrigger": "endRound",
"preventDuplicateEffects": false,
"script": "let chatData = {content: \"\", whisper: ChatMessage.getWhisperRecipients(\"GM\")}\n\nlet wounds = this.actor.status.wounds\nlet regen = new Roll(\"1d10\").roll().total\n\nif (wounds.value >= wounds.max)\n return\n\nif (wounds.value > 0)\n{\n wounds.value += regen\n if (wounds.value > wounds.max) \n wounds.value = wounds.max\n chatData.content += `<b>${this.actor.name}</b> regains ${regen} Wounds.`\n \n if (regen == 10)\n chatData.content += `<br>Additionally, they regenerate a Critical Wound.`\n}\nelse if (regen >= 8)\n{\n chatData.content += `<b>${this.actor.name}</b> rolled a ${regen} and regains 1 Wound.`\n wounds.value += 1\n if (regen == 10)\n chatData.content += `<br>Additionally, they regenerate a Critical Wound.`\n}\nelse\n{\n chatData.content += `<b>${this.actor.name}</b> Regenerate roll of ${regen} - No effect.`\n}\n\nthis.actor.update({\"data.status.wounds\" : wounds})\nChatMessage.create(chatData)"
"script": "let chatData = {content: \"\", whisper: ChatMessage.getWhisperRecipients(\"GM\")}\n\nlet wounds = this.actor.status.wounds\nlet regen = new Roll(\"1d10\").roll({async: false}).total\n\nif (wounds.value >= wounds.max)\n return\n\nif (wounds.value > 0)\n{\n wounds.value += regen\n if (wounds.value > wounds.max) \n wounds.value = wounds.max\n chatData.content += `<b>${this.actor.name}</b> regains ${regen} Wounds.`\n \n if (regen == 10)\n chatData.content += `<br>Additionally, they regenerate a Critical Wound.`\n}\nelse if (regen >= 8)\n{\n chatData.content += `<b>${this.actor.name}</b> rolled a ${regen} and regains 1 Wound.`\n wounds.value += 1\n if (regen == 10)\n chatData.content += `<br>Additionally, they regenerate a Critical Wound.`\n}\nelse\n{\n chatData.content += `<b>${this.actor.name}</b> Regenerate roll of ${regen} - No effect.`\n}\n\nthis.actor.update({\"data.status.wounds\" : wounds})\nChatMessage.create(chatData)"
}
},
"icon": "modules/wfrp4e-core/icons/spells/regenerate.png",