Skip to content

Commit

Permalink
Add support for class-specific attack modifiers for Jaws of the Lion …
Browse files Browse the repository at this point in the history
…classes
  • Loading branch information
Andrew Brindamour committed Dec 27, 2020
1 parent 0ef16f6 commit 3bff083
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/Logic/GloomhavenDataService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
7 changes: 6 additions & 1 deletion src/UI/AttackModifierImages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

}
}

0 comments on commit 3bff083

Please sign in to comment.