Skip to content

Commit

Permalink
Merge pull request #222 from sasquach45932/master
Browse files Browse the repository at this point in the history
Creatures lose their frightening or horrifying traits for characters of a certain level or higher, according to the creature’s difficulty.
  • Loading branch information
ClipplerBlood authored Dec 18, 2024
2 parents 3af87bf + bb929b3 commit 1ecd9df
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,8 @@
"DL.SettingInitMessageHint": "Show if player chooses Fast or Slow turn in Chat Log.",
"DL.SettingInitRandomize": "Initiative Randomize",
"DL.SettingInitRandomizeHint": "Makes your initiative more random and adds a d6 to your initiative value.",
"DL.SettingOptinalRuleLevelDependentBane":"Character level dependent horrifying bane",
"DL.SettingOptinalRuleLevelDependentBaneHint":"Creatures lose their frightening or horrifying traits for characters of a certain level or higher, according to the creature’s difficulty.",
"DL.SettingLockAncestrHint": "Remove players access to change modifers, Speed, Insanity, Corruption and Health.",
"DL.SettingLockAncestry": "Lock fields on Ancestry",
"DL.SettingReplaceIcons": "Replace default icons",
Expand Down
13 changes: 8 additions & 5 deletions src/module/actor/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,14 +423,14 @@ export class DemonlordActor extends Actor {
(attacker.system.bonuses.attack.boons.weapon || 0)

const horrifyingBane = game.settings.get('demonlord', 'horrifyingBane')

const ignoreLevelDependentBane = (game.settings.get('demonlord', 'optinalRuleLevelDependentBane') && ((attacker.system?.level >=3 && attacker.system?.level <=6 && defender?.system?.difficulty <= 25) || (attacker.system?.level >=7 && defender?.system?.difficulty <= 50))) ? false : true
// The defender banes apply only if the defender is one target
if (defendersTokens.length === 1)
boons -=
(defender?.system.bonuses.defense.boons[defenseAttribute] || 0) +
(defender?.system.bonuses.defense.boons.all || 0) +
(defender?.system.bonuses.defense.boons.weapon || 0) +
(horrifyingBane && !attacker.system.horrifying && !attacker.system.frightening && defender?.system.horrifying && 1 || 0)
(horrifyingBane && ignoreLevelDependentBane && !attacker.system.horrifying && !attacker.system.frightening && defender?.system.horrifying && 1 || 0)

// Check if requirements met
if (item.system.wear && parseInt(item.system.requirement?.minvalue) > attacker.getAttribute(item.system.requirement?.attribute)?.value)
Expand Down Expand Up @@ -604,12 +604,13 @@ export class DemonlordActor extends Actor {
parseInt(talentData.action?.boonsbanes || 0)

const horrifyingBane = game.settings.get('demonlord', 'horrifyingBane')
const ignoreLevelDependentBane = (game.settings.get('demonlord', 'optinalRuleLevelDependentBane') && ((this.system?.level >=3 && this.system?.level <=6 && target?.actor?.system?.difficulty <= 25) || (this.system?.level >=7 && target?.actor?.system?.difficulty <= 50))) ? false : true

if (targets.length === 1)
boons -= (
(target?.actor?.system.bonuses.defense.boons[defenseAttribute] || 0) +
(target?.actor?.system.bonuses.defense.boons.all || 0) +
(horrifyingBane && !this.system.horrifying && !this.system.frightening && target?.actor?.system.horrifying && 1 || 0))
(horrifyingBane && ignoreLevelDependentBane && !this.system.horrifying && !this.system.frightening && target?.actor?.system.horrifying && 1 || 0))
const boonsReroll = parseInt(this.system.bonuses.rerollBoon1Dice)

attackRoll = new Roll(this.rollFormula(modifiers, boons, boonsReroll), this.system)
Expand Down Expand Up @@ -690,13 +691,14 @@ export class DemonlordActor extends Actor {
(this.system.bonuses.attack.boons.spell || 0)

const horrifyingBane = game.settings.get('demonlord', 'horrifyingBane')
const ignoreLevelDependentBane = (game.settings.get('demonlord', 'optinalRuleLevelDependentBane') && ((this.system?.level >=3 && this.system?.level <=6 && target?.actor?.system?.difficulty <= 25) || (this.system?.level >=7 && target?.actor?.system?.difficulty <= 50))) ? false : true

if (targets.length > 0)
boons -=
(target?.actor?.system.bonuses.defense.boons[defenseAttribute] || 0) +
(target?.actor?.system.bonuses.defense.boons.all || 0) +
(target?.actor?.system.bonuses.defense.boons.spell || 0) +
(horrifyingBane && !this.system.horrifying && !this.system.frightening && target?.actor?.system.horrifying && 1 || 0)
(horrifyingBane && ignoreLevelDependentBane && !this.system.horrifying && !this.system.frightening && target?.actor?.system.horrifying && 1 || 0)

const modifiers = [parseInt(inputModifier) || 0, this.getAttribute(attackAttribute).modifier || 0]
const boonsReroll = parseInt(this.system.bonuses.rerollBoon1Dice)
Expand Down Expand Up @@ -808,12 +810,13 @@ export class DemonlordActor extends Actor {
parseInt(itemData.action?.boonsbanes || 0)

const horrifyingBane = game.settings.get('demonlord', 'horrifyingBane')
const ignoreLevelDependentBane = (game.settings.get('demonlord', 'optinalRuleLevelDependentBane') && ((this.system?.level >=3 && this.system?.level <=6 && target?.actor?.system?.difficulty <= 25) || (this.system?.level >=7 && target?.actor?.system?.difficulty <= 50))) ? false : true

if (targets.length === 1)
boons -= (
(target?.actor?.system.bonuses.defense.boons[defenseAttribute] || 0) +
(target?.actor?.system.bonuses.defense.boons.all || 0) +
(horrifyingBane && !this.system.horrifying && !this.system.frightening && target?.actor?.system.horrifying && 1 || 0))
(horrifyingBane && ignoreLevelDependentBane && !this.system.horrifying && !this.system.frightening && target?.actor?.system.horrifying && 1 || 0))
const boonsReroll = parseInt(this.system.bonuses.rerollBoon1Dice)

attackRoll = new Roll(this.rollFormula(modifiers, boons, boonsReroll), this.system)
Expand Down
15 changes: 13 additions & 2 deletions src/module/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export class OptionalRulesSettings extends FormApplication {
h: game.i18n.localize('DL.SettingOptionalRuleInitiativeGroup'),
},
optinalRuleRollInitEachRound: game.settings.get('demonlord', 'optinalRuleRollInitEachRound'),
optinalRuleExceedsByFive: game.settings.get('demonlord', 'optinalRuleExceedsByFive')
optinalRuleExceedsByFive: game.settings.get('demonlord', 'optinalRuleExceedsByFive'),
horrifyingBane: game.settings.get("demonlord", "horrifyingBane"),
optinalRuleLevelDependentBane: game.settings.get('demonlord', 'optinalRuleLevelDependentBane')
}
}

Expand Down Expand Up @@ -188,6 +190,15 @@ export const registerSettings = function () {
config: false,
})

game.settings.register('demonlord', 'optinalRuleLevelDependentBane', {
name: game.i18n.localize('DL.SettingOptinalRuleLevelDependentBane'),
hint: game.i18n.localize('DL.SettingOptinalRuleLevelDependentBaneHint'),
default: false,
scope: 'world',
type: Boolean,
config: false,
})

game.settings.register('demonlord', 'optionalRuleDieRollsMode', {
name: game.i18n.localize('DL.SettingOptionalRuleDieRollsMode'),
scope: 'world',
Expand Down Expand Up @@ -372,7 +383,7 @@ export const registerSettings = function () {
default: true,
scope: 'world',
type: Boolean,
config: true,
config: false,
})
game.settings.register("demonlord", "concentrationEffect", {
name: game.i18n.localize('DL.SettingConcentrationEffect'),
Expand Down
14 changes: 14 additions & 0 deletions src/templates/setting/optionalrules.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,23 @@
<label>{{localize "DL.SettingOptinalRuleRollInitEachRound"}}</label>
<input type="checkbox" name="optinalRuleRollInitEachRound" {{checked optinalRuleRollInitEachRound}} data-dtype="Boolean" />
</div>
<hr>
<div class="form-group">
<label>{{localize "DL.SettingOptinalRuleExceedsByFive"}}</label>
<input type="checkbox" name="optinalRuleExceedsByFive" {{checked optinalRuleExceedsByFive}} data-dtype="Boolean" />
<p class="notes">{{localize "DL.SettingOptinalRuleExceedsByFiveHint"}}</p>
</div>
<hr>
<div class="form-group">
<label>{{localize "DL.SettingHorrifyingBane"}}</label>
<input type="checkbox" name="horrifyingBane" {{checked horrifyingBane}} data-dtype="Boolean" />
<p class="notes">{{localize "DL.SettingHorrifyingBaneHint"}}</p>
</div>
<div class="form-group">
<label>{{localize "DL.SettingOptinalRuleLevelDependentBane"}}</label>
<input type="checkbox" name="optinalRuleLevelDependentBane" {{checked optinalRuleLevelDependentBane}} data-dtype="Boolean" />
<p class="notes">{{localize "DL.SettingOptinalRuleLevelDependentBaneHint"}}</p>
<a style="font-size: var(--font-size-12); color: var(--color-text-dark-secondary)" href='https://somniacdelusions.wordpress.com/2019/04/17/sotdl-house-rules/'>https://somniacdelusions.wordpress.com/2019/04/17/sotdl-house-rules</a>
</div>
<footer class="sheet-footer flexrow">
<button type="submit" name="submit">
Expand Down

0 comments on commit 1ecd9df

Please sign in to comment.