From 0d808c5e241e685f6a1cca429af1716281645080 Mon Sep 17 00:00:00 2001 From: Youness Alaoui Date: Mon, 20 May 2024 14:07:01 -0400 Subject: [PATCH] Handle blood hunter class name changing to archived Fixes #1122 --- src/dndbeyond/base/character.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/dndbeyond/base/character.js b/src/dndbeyond/base/character.js index 4ce496ef..86ca2c0a 100644 --- a/src/dndbeyond/base/character.js +++ b/src/dndbeyond/base/character.js @@ -365,10 +365,22 @@ class Character extends CharacterBase { if (substring) return this._actions.some(f => f.includes(name)); else return this._actions.includes(name); } + /** + * Blood Hunter was renamed to "Blood Hunter (archived)" + * Try to find the blood h + */ + fixBloodHunterClassName(name) { + if (name !== "Blood Hunter") return name; + const new_name = Object.keys(this._classes).find(c => c.includes("Blood Hunter")); + if (new_name) return new_name; + return "Blood Hunter (archived)"; + } getClassLevel(name) { + name = this.fixBloodHunterClassName(name); return this._classes[name] || 0; } hasClass(name) { + name = this.fixBloodHunterClassName(name); return this._classes[name] !== undefined; } getAbility(abbr) {