Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
moo-man committed May 22, 2024
2 parents 37d313d + e26d7e0 commit bdd6b6d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 14 deletions.
8 changes: 7 additions & 1 deletion modules/actor/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ const WFRP4eDocumentMixin = (cls) => class extends cls {
*
* @returns Array of executed script return values
*/
runScripts(trigger, args) {
runScripts(trigger, args, ownerOnly=false) {

if (ownerOnly && WFRP_Utility.getActiveDocumentOwner(this).id != game.user.id)
{
return [];
}

let scripts = this.getScripts(trigger);

let promises = [];
Expand Down
4 changes: 2 additions & 2 deletions modules/apps/roll-dialog/tooltips.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ export class DialogTooltips
let typeLabel = ({
"modifier" : "",
"difficulty" : "",
"slBonus" : "SL Bonus",
"successBonus" : "Success Bonus",
"slBonus" : game.i18n.localize("DIALOG.SLBonus"),
"successBonus" : game.i18n.localize("DIALOG.SuccessBonus"),
})[type]

if (this[`_${type}`].length == 0)
Expand Down
10 changes: 5 additions & 5 deletions modules/system/combat.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class CombatHelpers {
await script(combat);
}
for (let turn of combat.turns) {
await Promise.all(turn.actor.runScripts("startCombat", combat));
await Promise.all(turn.actor.runScripts("startCombat", {combat}, true));
Hooks.callAll("wfrp4e:startCombat", combat);
}
}
Expand Down Expand Up @@ -66,7 +66,7 @@ export default class CombatHelpers {
}

for (let turn of combat.turns) {
await Promise.all(turn.actor.runScripts("endRound", combat));
await Promise.all(turn.actor.runScripts("endRound", {combat}, true));
Hooks.callAll("wfrp4e:endRound", combat);
}
}
Expand All @@ -76,14 +76,14 @@ export default class CombatHelpers {
for (let script of CombatHelpers.scripts.endTurn) {
await script(combat, previousCombatant);
}
await Promise.all(previousCombatant.actor.runScripts("endTurn", combat, previousCombatant));
await Promise.all(previousCombatant.actor.runScripts("endTurn", {combat, previousCombatant}, true));
Hooks.callAll("wfrp4e:endTurn", combat, previousCombatant);
}
if (currentCombatant) {
for (let script of CombatHelpers.scripts.startTurn) {
await script(combat, currentCombatant);
}
await Promise.all(currentCombatant.actor.runScripts("startTurn", combat, currentCombatant));
await Promise.all(currentCombatant.actor.runScripts("startTurn", {combat, currentCombatant}, true));
Hooks.callAll("wfrp4e:startTurn", combat, currentCombatant);
}
}
Expand Down Expand Up @@ -159,7 +159,7 @@ export default class CombatHelpers {
ChatMessage.create({ content, whisper: ChatMessage.getWhisperRecipients("GM") })
}
for (let turn of combat.turns) {
await Promise.all(turn.actor.runScripts("endCombat", combat));
await Promise.all(turn.actor.runScripts("endCombat", {combat}, true));
Hooks.callAll("wfrp4e:endCombat", combat);
}
}
Expand Down
4 changes: 3 additions & 1 deletion modules/system/opposed-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ export default class OpposedTest {
this.findHitLocation();
}

opposeResult.breakdown.formatted = this.formatBreakdown();
if (opposeResult.breakdown) {
opposeResult.breakdown.formatted = this.formatBreakdown();
}

try // SOUND
{
Expand Down
2 changes: 1 addition & 1 deletion modules/system/rolls/trait-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class TraitTest extends AttackTest {
let roll = await new Roll(this.item.rollable.dice).roll()
this.result.diceDamage = { value: roll.total, formula: roll.formula };
this.preData.diceDamage = this.result.diceDamage
damageBreakdown.other.push({label : game.i18n.localize("Dice"), value : roll.total});
damageBreakdown.other.push({label : game.i18n.localize("BREAKDOWN.Dice"), value : roll.total});
this.result.additionalDamage += roll.total;
this.preData.additionalDamage = this.result.additionalDamage;
}
Expand Down
2 changes: 1 addition & 1 deletion modules/system/rolls/wom-cast-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class WomCastTest extends CastTest {
this.result.diceDamage = { value: roll.total, formula: roll.formula };
this.preData.diceDamage = this.result.diceDamage
this.result.additionalDamage += roll.total;
damageBreakdown.other.push({label : game.i18n.localize("Dice"), value : roll.total});
damageBreakdown.other.push({label : game.i18n.localize("BREAKDOWN.Dice"), value : roll.total});
this.preData.additionalDamage = this.result.additionalDamage;
}
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/IukS0clr1yAleacc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
this.actor.system.characteristics.ag.modifier -= parseInt(this.item.system.location.value || 1)
this.actor.system.characteristics.ag.modifier -= parseInt(this.item.system.location.value) || 1

this.actor.system.characteristics.ws.modifier -= parseInt(this.item.system.location.value || 1)
this.actor.system.characteristics.ws.modifier -= parseInt(this.item.system.location.value) || 1
2 changes: 1 addition & 1 deletion scripts/eAtqyBd1HsDWuBuI.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
this.actor.system.characteristics.fel.modifier -= parseInt(this.item.system.location.value || 1)
this.actor.system.characteristics.fel.modifier -= parseInt(this.item.system.location.value) || 1

0 comments on commit bdd6b6d

Please sign in to comment.