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

Creatures lose their frightening or horrifying traits for characters of a certain level or higher, according to the creature’s difficulty. #222

Merged
merged 2 commits into from
Dec 18, 2024
Merged
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
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
Loading