Skip to content

Commit

Permalink
new shadowdarklings bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
PrototypeESBU committed Sep 4, 2024
1 parent 1e94d33 commit 8aa6958
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion system/assets/mappings/map-shadowdarkling.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"Longbow": "Compendium.shadowdark.gear.Item.GzA5T0aewhouRsa3",
"Longsword": "Compendium.shadowdark.gear.Item.ZPUhNMmwXXrtbCXi",
"Mace": "Compendium.shadowdark.gear.Item.jGZyVuFJnW7QcBFX",
"Morningstar": "Compendium.shadowdark.gear.Item.BThyJ1NC6JcRXxeX",
"Morning Star": "Compendium.shadowdark.gear.Item.BThyJ1NC6JcRXxeX",
"Pike": "Compendium.shadowdark.gear.Item.4nmzFv43ua8nZDS7",
"Razor chain": "Compendium.shadowdark.gear.Item.LW3MgxeOaEPPaiY2",
"Scimitar": "Compendium.shadowdark.gear.Item.DKBDkJ3LcRv8scLv",
Expand Down
25 changes: 25 additions & 0 deletions system/src/apps/ShadowdarklingImporterSD.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ export default class ShadowdarklingImporterSD extends FormApplication {
},
};

// calculate modifiers
CONFIG.SHADOWDARK.ABILITY_KEYS.forEach(x => {
let baseInt = this.importedActor.system.abilities[x].base;
this.importedActor.system.abilities[x].mod = Math.floor((baseInt - 10)/2);
});

// Load the mapping file
this.itemMapping = await foundry.utils.fetchJsonWithTimeout(
"systems/shadowdark/assets/mappings/map-shadowdarkling.json"
Expand Down Expand Up @@ -413,6 +419,25 @@ export default class ShadowdarklingImporterSD extends FormApplication {
bonus.bonusTo = bonus.bonusTo.split(":")[0];
}

// select the correct FarSight
if (bonus.name === "FarSight") {
let talentToRemove = "";
if (bonus.bonusName === "Plus1ToCastingSpells") talentToRemove = "Farsight (Ranged)";
if (bonus.bonusName === "AttackBonus") talentToRemove = "Farsight (Spell)";
let index = this.talents.find(x => x.name === talentToRemove);
if (index) this.talents.splice(this.talents.indexOf(index), 1);
continue;
}
// select the correct Knack
if (bonus.name === "Knack") {
let talentToRemove = "";
if (bonus.bonusName === "LuckTokenAtStartOfSession") talentToRemove = "Knack (Spellcasting)";
if (bonus.bonusName === "Plus1ToCastingSpells") talentToRemove = "Knack (Luck)";
let index = this.talents.find(x => x.name === talentToRemove);
if (index) this.talents.splice(this.talents.indexOf(index), 1);
continue;
}

// find matching spell and load
if (/^Spell:/.test(bonus.name)) {
const spell = await this._findSpell(bonus);
Expand Down

0 comments on commit 8aa6958

Please sign in to comment.