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

4.7.0 #223

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

4.7.0 #223

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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"*.(json|scss)": "prettier --write"
},
"dependencies": {
"deepmerge": "^4.3.1",
"dotenv-cli": "^4.1.1",
"jszip-cli": "^1.4.24",
"rollup-plugin-import-css": "^3.5.0",
Expand Down
12 changes: 7 additions & 5 deletions src/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,8 @@
"DL.RollFormula": "Roll formula",
"DL.SettingAttackReverseDamage": "Reverse Damage/Health",
"DL.SettingAttackReverseDamageHint": "Substract damage from Health insted of adding damage.",
"DL.SettingOptinalRuleExceedsByFive": "20+ rule more than 5",
"DL.SettingOptinalRuleExceedsByFiveHint": "Rules of effects of 20+ will require that you exceed the target by more than 5.",
"DL.SettingOptionalRuleExceedsByFive": "20+ rule more than 5",
"DL.SettingOptionalRuleExceedsByFiveHint": "Rules of effects of 20+ will require that you exceed the target by more than 5.",
"DL.SettingAttackShowEnemyAttribute": "Show Creature target number",
"DL.SettingAttackShowEnemyAttributeAtt": "Show the Creatures attack number",
"DL.SettingAttackShowEnemyAttributeAttHint": "Show the Creatures attack number you are rolling against in the chat.",
Expand All @@ -582,7 +582,7 @@
"DL.SettingOptionalRuleInitiativeStd": "SotDL Standard (Slow turns & fast turns)",
"DL.SettingOptionalRuleInitiativeInduvidual": "Induvidual Rolls (d20)",
"DL.SettingOptionalRuleInitiativeGroup": "Group Rolls (d6) - PCs, NPCs, Creatures",
"DL.SettingOptinalRuleRollInitEachRound": "Roll initiative each round",
"DL.SettingOptionalRuleRollInitEachRound": "Roll initiative each round",
"DL.SettingOptionalRuleStaticBoonsAndBanes": "Static Boons and Banes",
"DL.SettingOptionalRules": "Optional Rules",
"DL.SettingOptionalRulesHint": "Enable/Disable Optional Rules.",
Expand Down Expand Up @@ -613,8 +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.SettingOptionalRuleLevelDependentBane": "Character level dependent horrifying bane",
"DL.SettingOptionalRuleLevelDependentBaneHint": "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 All @@ -633,6 +633,8 @@
"DL.SettingTemplateAutoTargetingHint": "Automatically targets the tokens inside of your placed Measured Template.",
"DL.SettingUsingHomebrewMode": "Use Homebrew mode",
"DL.SettingUsingHomebrewModeHint": "Attributes are not calculated based on Ancestry or Path choices; they must be manually entered on the character sheets. Characteristics are still calculated as normal.",
"DL.SettingIgnoreEncumbrance": "Ignore encumbrance",
"DL.SettingIgnoreEncumbranceHint": "Ignore encumbrance rules when required attribute is not met.",
"DL.slowed": "Slowed",
"DL.SpecialDurationNone": "None",
"DL.SpecialDurationLabel": "Special Duration",
Expand Down
2 changes: 2 additions & 0 deletions src/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,8 @@
"DL.SettingConvertIntoBadgeHint": "Rodear los icono de linaje y senda con un fondo de insignia.",
"DL.SettingConfirmAncestryPathRemoval": "Confirmar eliminación de linaje/senda",
"DL.SettingConfirmAncestryPathRemovalHint": "Muestra un diálogo de confirmación al intentar borrar un linaje o una senda de un personaje de nivel 1 o mayor.",
"DL.SettingIgnoreEncumbrance": "Ignorar Sobrecarga",
"DL.SettingIgnoreEncumbranceHint": "Ignorar reglas de sobrecarga cuando los requisitos de un objeto no se cumplen.",
"DL.DialogInitiative": "Iniciativa",
"DL.DialogInitiativeTurn": "Ha elegido hacer un turno ",
"DL.DialogInitiativeTurnEnd": ".",
Expand Down
6 changes: 6 additions & 0 deletions src/module/active-effects/sheets/active-effect-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ export class DLActiveEffectConfig extends ActiveEffectConfig {
'system.attributes.intellect.immune': i18n('DL.ImmuneAttribute') + ' - ' + i18n('DL.AttributeIntellect'),
'system.attributes.will.immune': i18n('DL.ImmuneAttribute') + ' - ' + i18n('DL.AttributeWill'),
'system.attributes.perception.immune': i18n('DL.ImmuneAttribute') + ' - ' + i18n('DL.AttributePerception'),
// Attribute requirement modifier
'system.attributes.strength.requirementModifier': i18n('DL.Requirements') + ' - ' + i18n('DL.AttributeStrength'),
'system.attributes.agility.requirementModifier': i18n('DL.Requirements') + ' - ' + i18n('DL.AttributeAgility'),
'system.attributes.intellect.requirementModifier': i18n('DL.Requirements') + ' - ' + i18n('DL.AttributeIntellect'),
'system.attributes.will.requirementModifier': i18n('DL.Requirements') + ' - ' + i18n('DL.AttributeWill'),
'system.attributes.perception.requirementModifier': i18n('DL.Requirements') + ' - ' + i18n('DL.AttributePerception'),
// Immune
'system.bonuses.immune.affliction': i18n('DL.ImmuneAffliction'),
// Characteristics
Expand Down
11 changes: 6 additions & 5 deletions src/module/actor/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ 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
const ignoreLevelDependentBane = (game.settings.get('demonlord', 'optionalRuleLevelDependentBane') && ((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 -=
Expand Down Expand Up @@ -604,7 +604,7 @@ 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
const ignoreLevelDependentBane = (game.settings.get('demonlord', 'optionalRuleLevelDependentBane') && ((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 -= (
Expand Down Expand Up @@ -691,7 +691,7 @@ 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
const ignoreLevelDependentBane = (game.settings.get('demonlord', 'optionalRuleLevelDependentBane') && ((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 -=
Expand Down Expand Up @@ -810,7 +810,7 @@ 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
const ignoreLevelDependentBane = (game.settings.get('demonlord', 'optionalRuleLevelDependentBane') && ((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 -= (
Expand Down Expand Up @@ -1045,10 +1045,11 @@ export class DemonlordActor extends Actor {
}

async setEncumbrance() {
if (game.settings.get('demonlord', 'ignoreEncumbrance')) return
const armors = this.items.filter(i => i.type === 'armor')
const notMetItemNames = armors
.map(a => a.system)
.filter(a => a.requirement?.minvalue > this.getAttribute(a.requirement?.attribute)?.value && a.wear)
.filter(a => a.requirement?.minvalue > (this.getAttribute(a.requirement?.attribute)?.value + this.getAttribute(a.requirement?.attribute)?.requirementModifier) && a.wear)
.map(a => a.name)
return await DLActiveEffects.addEncumbrance(this, notMetItemNames)
}
Expand Down
2 changes: 1 addition & 1 deletion src/module/actor/sheets/base-actor-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export default class DLBaseActorSheet extends ActorSheet {
item.system.wear &&
item.system.requirement?.minvalue != '' &&
item.system.requirement?.attribute != '' &&
+item.system.requirement?.minvalue > +this.actor.getAttribute(item.system.requirement?.attribute)?.value
+item.system.requirement?.minvalue > (+this.actor.getAttribute(item.system.requirement?.attribute)?.value + +this.actor.getAttribute(item.system.requirement?.attribute)?.requirementModifier)
) {
$(el).addClass('dl-text-red')
}
Expand Down
2 changes: 1 addition & 1 deletion src/module/chat/chat-listeners.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ async function _onChatRollDamage(event) {
const selected = tokenManager.targets
const itemId = item.dataset.itemId || li.closest('.demonlord').dataset.itemId

if (game.settings.get('demonlord', 'optinalRuleConsistentDamage')) {
if (game.settings.get('demonlord', 'optionalRuleConsistentDamage')) {
var flattenTree = function(root) {
const list = []

Expand Down
8 changes: 4 additions & 4 deletions src/module/chat/roll-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function postAttackToChat(attacker, defender, item, attackRoll, attackAtt
? defender?.system.characteristics.defense
: defender?.getAttribute(defenseAttribute)?.value || ''

const plus20 = attackRoll?.total >= 20 && (targetNumber ? attackRoll?.total > targetNumber + (game.settings.get('demonlord', 'optinalRuleExceedsByFive') ? 5 : 4) : true)
const plus20 = attackRoll?.total >= 20 && (targetNumber ? attackRoll?.total > targetNumber + (game.settings.get('demonlord', 'optionalRuleExceedsByFive') ? 5 : 4) : true)
const didHit = voidRoll ? false : attackRoll?.total >= targetNumber

let diceTotalGM = attackRoll?.total ?? ''
Expand Down Expand Up @@ -223,7 +223,7 @@ export function postTalentToChat(actor, talent, attackRoll, target, inputBoons)
}

const targetNumber = talentData?.action?.attack ? actor.getTargetNumber(talent) : ''
const plus20 = attackRoll?.total >= 20 && (targetNumber ? attackRoll?.total > targetNumber + (game.settings.get('demonlord', 'optinalRuleExceedsByFive') ? 5 : 4) : true)
const plus20 = attackRoll?.total >= 20 && (targetNumber ? attackRoll?.total > targetNumber + (game.settings.get('demonlord', 'optionalRuleExceedsByFive') ? 5 : 4) : true)

let resultText =
!voidRoll && attackRoll != null && targetNumber !== undefined && attackRoll.total >= parseInt(targetNumber)
Expand Down Expand Up @@ -339,7 +339,7 @@ export async function postSpellToChat(actor, spell, attackRoll, target, inputBoo
if (uses >= 0 && usesMax > 0) usesText = game.i18n.localize('DL.SpellCastingsUses') + ': ' + uses + ' / ' + usesMax

const targetNumber = actor.getTargetNumber(spell)
const plus20 = attackRoll?.total >= 20 && (targetNumber ? attackRoll?.total > targetNumber + (game.settings.get('demonlord', 'optinalRuleExceedsByFive') ? 5 : 4) : true)
const plus20 = attackRoll?.total >= 20 && (targetNumber ? attackRoll?.total > targetNumber + (game.settings.get('demonlord', 'optionalRuleExceedsByFive') ? 5 : 4) : true)

let resultText =
!voidRoll && targetNumber && attackRoll?.total >= parseInt(targetNumber)
Expand Down Expand Up @@ -511,7 +511,7 @@ export const postItemToChat = (actor, item, attackRoll, target, inputBoons) => {
}*/

const targetNumber = itemData?.action?.attack ? actor.getTargetNumber(item) : ''
const plus20 = attackRoll?.total >= 20 && (targetNumber ? attackRoll?.total > targetNumber + (game.settings.get('demonlord', 'optinalRuleExceedsByFive') ? 5 : 4) : true)
const plus20 = attackRoll?.total >= 20 && (targetNumber ? attackRoll?.total > targetNumber + (game.settings.get('demonlord', 'optionalRuleExceedsByFive') ? 5 : 4) : true)

let resultText =
!voidRoll && attackRoll != null && targetNumber !== undefined && attackRoll.total >= parseInt(targetNumber)
Expand Down
2 changes: 1 addition & 1 deletion src/module/combat/combat.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ async rollInitiativeGroup(ids, { formula = null, updateTurn = true, messageOptio
/** @override */
async nextRound() {
let initiativeMethod = game.settings.get('demonlord', 'optionalRuleInitiativeMode')
if (initiativeMethod !== 's' && game.settings.get('demonlord', 'optinalRuleRollInitEachRound')) {
if (initiativeMethod !== 's' && game.settings.get('demonlord', 'optionalRuleRollInitEachRound')) {
await game.combat.resetAll({
messageOptions: {
rollMode: CONST.DICE_ROLL_MODES.PRIVATE
Expand Down
1 change: 1 addition & 0 deletions src/module/data/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function makeAttribute(attribute, max = 20) {
label: makeStringField(game.i18n.localize(`DL.Attribute${capitalize(attribute)}`)),
value: makeIntField(10, max, 1),
modifier: makeIntField(),
requirementModifier: makeIntField(),
min: makeIntField(),
max: makeIntField(max),
immune: makeBoolField()
Expand Down
2 changes: 1 addition & 1 deletion src/module/item/item.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class DemonlordItem extends Item {

async _rollAncestryFormulae(ancestry) {
// If no system data exists, we're creating it anew, don't roll anything
if (!ancestry.system) {
if (!ancestry.system?.levels) {
return ancestry
}
// Before adding the item, roll any formulas and apply the values
Expand Down
2 changes: 1 addition & 1 deletion src/module/item/sheets/base-item-sheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ export default class DLBaseItemSheet extends HandlebarsApplicationMixin(ItemShee

async _onDrag(ev){
const itemIndex = ev.currentTarget.closest('[data-item-index]').dataset.itemIndex
const data = await this.getData({})
const data = this.document
if (ev.type == 'dragend') {
if (data.system.contents[itemIndex].system.quantity <= 1) {
await this.deleteContentsItem(itemIndex)
Expand Down
39 changes: 24 additions & 15 deletions src/module/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export class OptionalRulesSettings extends FormApplication {

getData() {
return {
optinalRuleConsistentDamage: game.settings.get('demonlord', 'optinalRuleConsistentDamage'),
optionalRuleConsistentDamage: game.settings.get('demonlord', 'optionalRuleConsistentDamage'),
optionalRuleDieRollsMode: game.settings.get('demonlord', 'optionalRuleDieRollsMode'),
selectedDieRollsDropDrown: game.settings.get('demonlord', 'optionalRuleDieRollsMode'),
dieRollsDropDrown: {
Expand All @@ -84,10 +84,10 @@ export class OptionalRulesSettings extends FormApplication {
i: game.i18n.localize('DL.SettingOptionalRuleInitiativeInduvidual'),
h: game.i18n.localize('DL.SettingOptionalRuleInitiativeGroup'),
},
optinalRuleRollInitEachRound: game.settings.get('demonlord', 'optinalRuleRollInitEachRound'),
optinalRuleExceedsByFive: game.settings.get('demonlord', 'optinalRuleExceedsByFive'),
optionalRuleRollInitEachRound: game.settings.get('demonlord', 'optionalRuleRollInitEachRound'),
optionalRuleExceedsByFive: game.settings.get('demonlord', 'optionalRuleExceedsByFive'),
horrifyingBane: game.settings.get("demonlord", "horrifyingBane"),
optinalRuleLevelDependentBane: game.settings.get('demonlord', 'optinalRuleLevelDependentBane')
optionalRuleLevelDependentBane: game.settings.get('demonlord', 'optionalRuleLevelDependentBane')
}
}

Expand All @@ -109,7 +109,7 @@ export class OptionalRulesSettings extends FormApplication {
super.activateListeners(html)
html.find('button').on('click', async event => {
if (event.currentTarget?.dataset?.action === 'reset') {
const keys = ['optinalRuleConsistentDamage', 'optionalRuleDieRollsMode','optionalRuleInitiativeMode','optinalRuleRollInitEachRound']
const keys = ['optionalRuleConsistentDamage', 'optionalRuleDieRollsMode','optionalRuleInitiativeMode','optionalRuleRollInitEachRound']
await Promise.all(
keys.map(async key => {
await this.resetToDefault(key)
Expand Down Expand Up @@ -163,7 +163,7 @@ export const registerSettings = function () {
})


game.settings.registerMenu('demonlord', 'optinalRulesSettings', {
game.settings.registerMenu('demonlord', 'optionalRulesSettings', {
name: game.i18n.localize('DL.SettingOptionalRules'),
label: game.i18n.localize('Configure'),
hint: game.i18n.localize('DL.SettingOptionalRulesHint'),
Expand All @@ -172,7 +172,7 @@ export const registerSettings = function () {
restricted: true
})

game.settings.register('demonlord', 'optinalRuleConsistentDamage', {
game.settings.register('demonlord', 'optionalRuleConsistentDamage', {
name: game.i18n.localize('DL.SettingOptionalRuleConsistentDamage'),
hint: game.i18n.localize('DL.SettingOptionalRuleConsistentDamageHint'),
default: false,
Expand All @@ -181,18 +181,18 @@ export const registerSettings = function () {
config: false,
})

game.settings.register('demonlord', 'optinalRuleExceedsByFive', {
name: game.i18n.localize('DL.SettingOptinalRuleExceedsByFive'),
hint: game.i18n.localize('DL.SettingOptinalRuleExceedsByFiveDamageHint'),
game.settings.register('demonlord', 'optionalRuleExceedsByFive', {
name: game.i18n.localize('DL.SettingOptionalRuleExceedsByFive'),
hint: game.i18n.localize('DL.SettingOptionalRuleExceedsByFiveDamageHint'),
default: false,
scope: 'world',
type: Boolean,
config: false,
})

game.settings.register('demonlord', 'optinalRuleLevelDependentBane', {
name: game.i18n.localize('DL.SettingOptinalRuleLevelDependentBane'),
hint: game.i18n.localize('DL.SettingOptinalRuleLevelDependentBaneHint'),
game.settings.register('demonlord', 'optionalRuleLevelDependentBane', {
name: game.i18n.localize('DL.SettingOptionalRuleLevelDependentBane'),
hint: game.i18n.localize('DL.SettingOptionalRuleLevelDependentBaneHint'),
default: false,
scope: 'world',
type: Boolean,
Expand Down Expand Up @@ -226,14 +226,23 @@ export const registerSettings = function () {
onChange: foundry.utils.debouncedReload
})

game.settings.register('demonlord', 'optinalRuleRollInitEachRound', {
name: game.i18n.localize('DL.SettingOptinalRuleRollInitEachRound'),
game.settings.register('demonlord', 'optionalRuleRollInitEachRound', {
name: game.i18n.localize('DL.SettingOptionalRuleRollInitEachRound'),
default: false,
scope: 'world',
type: Boolean,
config: false,
})

game.settings.register('demonlord', 'ignoreEncumbrance', {
name: game.i18n.localize('DL.SettingIgnoreEncumbrance'),
hint: game.i18n.localize('DL.SettingIgnoreEncumbranceHint'),
default: false,
scope: 'world',
type: Boolean,
config: true
})

game.settings.register('demonlord', 'systemMigrationVersion', {
name: 'System Migration Version',
scope: 'world',
Expand Down
4 changes: 4 additions & 0 deletions src/styles/components/actor-sheets/_aside-creature.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ form {
left: -7px;
width: 0px;
height: 0px;

// Fix for frightening/horrifying checkbox tick not appearing in Firefox
appearance: initial;
-moz-appearance: initial;
}

input:checked::before {
Expand Down
Loading