From 3bff083a0a8d4d7ed56238d57ad07af9b15d5357 Mon Sep 17 00:00:00 2001 From: Andrew Brindamour Date: Sat, 26 Dec 2020 18:30:00 -0800 Subject: [PATCH] Add support for class-specific attack modifiers for Jaws of the Lion classes --- src/Logic/GloomhavenDataService.ts | 9 ++++++++- src/UI/AttackModifierImages.ts | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Logic/GloomhavenDataService.ts b/src/Logic/GloomhavenDataService.ts index cbfbc98..049a37e 100644 --- a/src/Logic/GloomhavenDataService.ts +++ b/src/Logic/GloomhavenDataService.ts @@ -59,7 +59,14 @@ export class GloomhavenDataService { }) this.characterAbilityCards = baseCharacterAbilityCards.concat(jotlCharacterAbilityCards) .concat() - this.attackModifiers = require("json-loader!gloomhaven/data/attack-modifiers.js") + + const baseAttackModifiers = require("json-loader!gloomhaven/data/attack-modifiers.js") + const jotlAttackModifiers = require("json-loader!jotl/data/attack-modifiers.js").filter((rawCard: any) => { + return !rawCard.image.includes(`/base/player`) && // exclude duplicative base player cards, only want the per-character ones + !rawCard.image.endsWith("-back.png") // per-character backs are included, unlike main game + }) + this.attackModifiers = baseAttackModifiers.concat(jotlAttackModifiers) + this.attackModifierAdditionals = require("../Data/attack-modifiers-additional.json") } diff --git a/src/UI/AttackModifierImages.ts b/src/UI/AttackModifierImages.ts index e6c32c6..119eab9 100644 --- a/src/UI/AttackModifierImages.ts +++ b/src/UI/AttackModifierImages.ts @@ -3,6 +3,11 @@ import { AttackModifier } from "../Logic/AttackModifier"; export class AttackModifierImages { static get(attackModifier: AttackModifier) : string { - return require(`gloomhaven/images/attack-modifiers/${attackModifier.imageBasename}.png`).default + try { + return require(`gloomhaven/images/attack-modifiers/${attackModifier.imageBasename}.png`).default + } catch(e) { + return require(`jotl/images/attack-modifiers/${attackModifier.imageBasename}.png`).default + } + } } \ No newline at end of file