Skip to content

Commit

Permalink
Effect cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MrPrimate committed Mar 30, 2024
1 parent c3f343f commit 4f83645
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Handle some odd formating or Humblewood Monsters.
- Some Fey Ancestry traits don't grant sleep immunity, but it was applied by the importer. @babywashbear
- Some effects would not be auto generated for features when they should be.


# 5.1.3
Expand Down
3 changes: 2 additions & 1 deletion src/effects/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ function generateGenericEffects(ddb, character, ddbItem, foundryItem, isCompendi
let effect = baseItemEffect(foundryItem, label);

if (!ddbItem.definition?.grantedModifiers || ddbItem.definition.grantedModifiers.length === 0) return [foundryItem, effect];
logger.debug(`Generating Effects for ${foundryItem.name}`, ddbItem);
logger.debug(`Generating Generic Effects for ${foundryItem.name}`, ddbItem);

const globalSaveBonus = addGlobalSavingBonusEffect(ddbItem.definition.grantedModifiers, foundryItem.name);
const globalAbilityBonus = addAddBonusEffect(
Expand Down Expand Up @@ -1580,6 +1580,7 @@ function addACEffect(ddb, character, ddbItem, foundryItem, isCompendiumItem, eff
}

export function generateEffects(ddb, character, ddbItem, foundryItem, isCompendiumItem, type) {
logger.debug(`Checking ${foundryItem.name} for auto generated effects`, ddbItem);
// set flags if using effects
foundryItem = applyDefaultMidiFlags(foundryItem);
let label;
Expand Down
6 changes: 2 additions & 4 deletions src/lib/DDBHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,9 @@ const DDBHelper = {
},

getModifiers: (ddb, type, includeExcludedEffects = false, effectOnly = false, useUnfilteredModifiers = false) => {
// are we adding effects to items?
const featureEffects = game.settings.get("ddb-importer", "character-update-policy-add-character-effects")
&& game.modules.get("dae")?.active;
// are we adding effects to documents?
const excludedModifiers = (!includeExcludedEffects || (includeExcludedEffects && effectOnly))
? getEffectExcludedModifiers(type, featureEffects, true)
? getEffectExcludedModifiers(type, true, true)
: getEffectExcludedModifiers(type, false, false);
// get items we are going to interact on
let modifiers = [];
Expand Down
13 changes: 2 additions & 11 deletions src/parser/features/DDBBaseFeature.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import utils from "../../lib/utils.js";
import logger from "../../logger.js";
import parseTemplateString from "../../lib/DDBTemplateStrings.js";
import { generateEffects } from "../../effects/effects.js";
import { generateBaseACItemEffect } from "../../effects/acEffects.js";


export default class DDBBaseFeature {
Expand Down Expand Up @@ -380,18 +379,10 @@ export default class DDBBaseFeature {
}

_addEffects(choice, type) {
// can we apply any effects to this feature
// can we apply any auto-generated effects to this feature
const compendiumItem = this.rawCharacter.flags.ddbimporter.compendium;
const addCharacterEffects = compendiumItem
? game.settings.get("ddb-importer", "munching-policy-add-effects")
: game.settings.get("ddb-importer", "character-update-policy-add-character-effects");
const modifierItem = this._getFeatModifierItem(choice, type);
if (addCharacterEffects) {
this.data = generateEffects(this.ddbData, this.rawCharacter, modifierItem, this.data, compendiumItem, "feat");
// console.log(item);
} else {
this.data = generateBaseACItemEffect(this.ddbData, this.rawCharacter, modifierItem, this.data, compendiumItem);
}
this.data = generateEffects(this.ddbData, this.rawCharacter, modifierItem, this.data, compendiumItem, "feat");
}


Expand Down

0 comments on commit 4f83645

Please sign in to comment.