Fix async rolls

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

View File

@ -557,7 +557,7 @@
"effectApplication": "actor",
"effectTrigger": "oneTime",
"preventDuplicateEffects": false,
"script": "fromUuid(\"Compendium.wfrp4e-core.injuries.fBcZhOBn8IpoVqQ1\").then(injury => {\n let teeth = new Roll(\"1d10\").roll().total\n ChatMessage.create({content : `<b>${this.actor.data.token.name}</b> a perdu ${teeth} dents`, speaker : {alias: this.effect.label}})\ninjury.location.value = `${teeth} ${injury.location.value}`\n args.actor.createEmbeddedEntity(\"OwnedItem\", injury.data)\n})"
"script": "fromUuid(\"Compendium.wfrp4e-core.injuries.fBcZhOBn8IpoVqQ1\").then(injury => {\n let teeth = new Roll(\"1d10\").roll({async: false}).total\n ChatMessage.create({content : `<b>${this.actor.data.token.name}</b> a perdu ${teeth} dents`, speaker : {alias: this.effect.label}})\ninjury.location.value = `${teeth} ${injury.location.value}`\n args.actor.createEmbeddedEntity(\"OwnedItem\", injury.data)\n})"
}
},
"icon": "modules/wfrp4e-core/icons/injuries/head.png",
@ -930,7 +930,7 @@
"wfrp4e": {
"effectApplication": "actor",
"effectTrigger": "oneTime",
"script": "args.actor.addCondition(\"stunned\", new Roll(\"1d10\").roll().total)"
"script": "args.actor.addCondition(\"stunned\", new Roll(\"1d10\").roll({async: false}).total)"
}
},
"icon": "modules/wfrp4e-core/icons/injuries/head.png",
@ -2640,7 +2640,7 @@
"effectApplication": "actor",
"effectTrigger": "oneTime",
"preventDuplicateEffects": false,
"script": "fromUuid(\"Compendium.wfrp4e-core.injuries.fBcZhOBn8IpoVqQ1\").then(injury => {\n let teeth = new Roll(\"1d10\").roll().total\n ChatMessage.create({content : `<b>${this.actor.data.token.name}</b> loses ${teeth} teeth`, speaker : {alias: this.effect.label}})\ninjury.location.value = `${teeth} ${injury.location.value}`\n args.actor.createEmbeddedEntity(\"OwnedItem\", injury.data)\n})\n\nfromUuid(\"Compendium.wfrp4e-core.injuries.rkJA1DlK51QuRlJy\").then(injury => {\n args.actor.createEmbeddedEntity(\"OwnedItem\", injury)\n})\n\nfromUuid(\"Compendium.wfrp4e-core.injuries.hCadFsTRvLN9faaY\").then(injury => {\n args.actor.createEmbeddedEntity(\"OwnedItem\", injury)\n})\n\n\nif (args.actor.isOwner)\n args.actor.setupSkill(\"Résistance\").then(setupData => {\n args.actor.basicTest(setupData).then(test => \n {\n if (test.result.outcome == \"failure\")\n args.actor.addCondition(\"unconscious\")\n })\n })"
"script": "fromUuid(\"Compendium.wfrp4e-core.injuries.fBcZhOBn8IpoVqQ1\").then(injury => {\n let teeth = new Roll(\"1d10\").roll({async: false}).total\n ChatMessage.create({content : `<b>${this.actor.data.token.name}</b> loses ${teeth} teeth`, speaker : {alias: this.effect.label}})\ninjury.location.value = `${teeth} ${injury.location.value}`\n args.actor.createEmbeddedEntity(\"OwnedItem\", injury.data)\n})\n\nfromUuid(\"Compendium.wfrp4e-core.injuries.rkJA1DlK51QuRlJy\").then(injury => {\n args.actor.createEmbeddedEntity(\"OwnedItem\", injury)\n})\n\nfromUuid(\"Compendium.wfrp4e-core.injuries.hCadFsTRvLN9faaY\").then(injury => {\n args.actor.createEmbeddedEntity(\"OwnedItem\", injury)\n})\n\n\nif (args.actor.isOwner)\n args.actor.setupSkill(\"Résistance\").then(setupData => {\n args.actor.basicTest(setupData).then(test => \n {\n if (test.result.outcome == \"failure\")\n args.actor.addCondition(\"unconscious\")\n })\n })"
}
},
"icon": "modules/wfrp4e-core/icons/injuries/head.png",

View File

@ -698,7 +698,7 @@
"wfrp4e": {
"effectApplication": "apply",
"effectTrigger": "oneTime",
"script": "if (args.actor.has(\"Mort-vivant\"))\n{\n let damage = (await new Roll(\"1d10\")).roll().total\n args.actor.applyBasicDamage(damage, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_ALL})\n}"
"script": "if (args.actor.has(\"Mort-vivant\"))\n{\n let damage = (await new Roll(\"1d10\")).roll({async: false}).total\n args.actor.applyBasicDamage(damage, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_ALL})\n}"
}
},
"icon": "modules/wfrp4e-core/icons/prayers/miracles.png",
@ -1142,7 +1142,7 @@
"wfrp4e": {
"effectApplication": "apply",
"effectTrigger": "oneTime",
"script": "let damage = (await new Roll(\"1d10\")).roll().total\n args.actor.applyBasicDamage(damage, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_ALL})\n\nif (args.actor.has(\"Mort-vivant\") || args.actor.data.has(\"Démoniaque\"))\n{\n args.actor.addCondition(\"ablaze\")\n}"
"script": "let damage = (await new Roll(\"1d10\")).roll({async: false}).total\n args.actor.applyBasicDamage(damage, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_ALL})\n\nif (args.actor.has(\"Mort-vivant\") || args.actor.data.has(\"Démoniaque\"))\n{\n args.actor.addCondition(\"ablaze\")\n}"
}
},
"icon": "modules/wfrp4e-core/icons/prayers/miracles.png",

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",

View File

@ -416,7 +416,7 @@
"effectTrigger": "oneTime",
"preventDuplicateEffects": false,
"effectApplication": "apply",
"script": "let damage = new Roll(\"1d10\").roll().total\n args.actor.applyBasicDamage(damage, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_ALL})\n\nargs.actor.addCondition(\"deafened\", 3)\n\nargs.actor.setupSkill(\"Résistance\", {absolute : {difficulty: \"average\" }, context : {failure: \"Subit un Etat Brisé\", success : \"Evite un Etat Brisé\"}}).then(setupData => {\n args.actor.basicTest(setupData).then(test => {\n if (test.result.outcome == \"failure\")\n args.actor.addCondition(\"broken\")\n })\n})"
"script": "let damage = new Roll(\"1d10\").roll({async: false}).total\n args.actor.applyBasicDamage(damage, {damageType : game.wfrp4e.config.DAMAGE_TYPE.IGNORE_ALL})\n\nargs.actor.addCondition(\"deafened\", 3)\n\nargs.actor.setupSkill(\"Résistance\", {absolute : {difficulty: \"average\" }, context : {failure: \"Subit un Etat Brisé\", success : \"Evite un Etat Brisé\"}}).then(setupData => {\n args.actor.basicTest(setupData).then(test => {\n if (test.result.outcome == \"failure\")\n args.actor.addCondition(\"broken\")\n })\n})"
}
},
"transfer": true,
@ -641,7 +641,7 @@
"wfrp4e": {
"effectTrigger": "endRound",
"preventDuplicateEffects": true,
"script": "let chatData = {content: \"\", whisper: ChatMessage.getWhisperRecipients(\"GM\")}\n\nlet wounds = duplicate(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> récupère ${regen} Blessures.`\n \n if (regen == 10)\n chatData.content += `<br>De plus, il récupère d'une Blessure Critique.`\n}\nelse if (regen >= 8)\n{\n chatData.content += `<b>${this.actor.name}<\/b> a réussi un ${regen} et récupère 1 Blessure.`\n wounds.value += 1\n if (regen == 10)\n chatData.content += `<br>De plus, il récupère d'une Blessure Critique.`\n}\nelse\n{\n chatData.content += `<b>${this.actor.name}<\/b> Jet de Régénration de ${regen} - Aucun effet.`\n}\n\nthis.actor.update({\"data.status.wounds\" : wounds})\nChatMessage.create(chatData)",
"script": "let chatData = {content: \"\", whisper: ChatMessage.getWhisperRecipients(\"GM\")}\n\nlet wounds = duplicate(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> récupère ${regen} Blessures.`\n \n if (regen == 10)\n chatData.content += `<br>De plus, il récupère d'une Blessure Critique.`\n}\nelse if (regen >= 8)\n{\n chatData.content += `<b>${this.actor.name}<\/b> a réussi un ${regen} et récupère 1 Blessure.`\n wounds.value += 1\n if (regen == 10)\n chatData.content += `<br>De plus, il récupère d'une Blessure Critique.`\n}\nelse\n{\n chatData.content += `<b>${this.actor.name}<\/b> Jet de Régénration de ${regen} - Aucun effet.`\n}\n\nthis.actor.update({\"data.status.wounds\" : wounds})\nChatMessage.create(chatData)",
"effectApplication": "actor"
}
},

View File

@ -5,7 +5,7 @@
"authors": [ {"name":"LeRatierBretonnien" }],
"url": "https://gitlab.com/LeRatierBretonnien/foundryvtt-wh4-lang-fr-fr",
"flags": {},
"version": "5.2.3",
"version": "5.2.4",
"minimumCoreVersion": "0.8.0",
"compatibleCoreVersion": "9",
"scripts": [],