Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Engagement #2044

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions modules/hooks/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,16 @@ export default function() {
type: Boolean
});

// Register Automatic Engagement
game.settings.register("wfrp4e", "automaticEngagement", {
name: "SETTINGS.AutomaticEngagement",
hint: "SETTINGS.AutomaticEngagementHint",
scope: "world",
config: true,
default: false,
type: Boolean
});

game.settings.register("wfrp4e", "weaponLength", {
name: "SETTINGS.WeaponLength",
hint: "SETTINGS.WeaponLengthHint",
Expand Down
5 changes: 4 additions & 1 deletion modules/system/opposed-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ export default class OpposedTest {
await Promise.all(defender.runScripts("preOpposedDefender", { attackerTest, defenderTest, opposedTest: this }))
await Promise.all(defenderTest.item?.runScripts?.("preOpposedDefender", { attackerTest, defenderTest, opposedTest: this }) ?? [])

if (game.settings.get("wfrp4e", "automaticEngagement") && attackerTest.item?.isMelee) {
defender.addCondition("engaged")
}

opposeResult.modifiers = this.checkPostModifiers(attackerTest, defenderTest);

Expand Down Expand Up @@ -454,4 +457,4 @@ export default class OpposedTest {
return string;
}

}
}
3 changes: 3 additions & 0 deletions modules/system/rolls/attack-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export default class AttackTest extends TestWFRP {

computeProperties()
{
if (game.settings.get("wfrp4e", "automaticEngagement") && this.item?.isMelee && this.targets?.length > 0) {
this.actor.addCondition("engaged")
}
if (this.failed) {
// Dangerous weapons fumble on any failed tesst including a 9
if (this.result.roll % 11 == 0 || this.result.roll == 100 || (this.item.properties.flaws.dangerous && this.result.roll.toString().includes("9"))) {
Expand Down
2 changes: 2 additions & 0 deletions static/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
"SETTINGS.UIACritsModHint" : "Change the amount Critical Hits are modified (using Up In Arms rules as described on page 81)",
"SETTINGS.UIAShields" : "Up In Arms Shield Property",
"SETTINGS.UIAShieldsHint" : "Change the Shield property as specified in Up In Arms page 90",
"SETTINGS.AutomaticEngagement" : "Automatic Engagement",
"SETTINGS.AutomaticEngagementHint" : "Automatically adds the Engaged effect to attacker and defender during a melee attack.",
"SETTINGS.WeaponLength" : "Weapon Length",
"SETTINGS.WeaponLengthHint" : "Use weapon length to apply modifiers as described by the rule on page 297.",
"SETTINGS.SoundEffects" : "Sound Effect Path",
Expand Down