diff options
author | Daniel Weipert <code@drogueronin.de> | 2023-08-19 15:32:48 +0200 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2023-08-19 15:32:48 +0200 |
commit | c1fe94a630a88c4f7203d54f34985c109030791c (patch) | |
tree | e6e75fe468dddddcbe440cbd356ddaaaf605144f /resources/js/classes | |
parent | 218da95a4b387ee5ac25f168d1529419039f2e54 (diff) |
translations
Diffstat (limited to 'resources/js/classes')
-rw-r--r-- | resources/js/classes/InventoryItem.js | 4 | ||||
-rw-r--r-- | resources/js/classes/Item.js | 6 | ||||
-rw-r--r-- | resources/js/classes/Monster.js | 39 | ||||
-rw-r--r-- | resources/js/classes/State.js | 5 | ||||
-rw-r--r-- | resources/js/classes/Technique.js | 6 |
5 files changed, 49 insertions, 11 deletions
diff --git a/resources/js/classes/InventoryItem.js b/resources/js/classes/InventoryItem.js index 2e9b764..d6eb311 100644 --- a/resources/js/classes/InventoryItem.js +++ b/resources/js/classes/InventoryItem.js @@ -26,6 +26,10 @@ class InventoryItem { return this.item.name; } + get description () { + return this.item.description; + } + get category () { return this.item.category; } diff --git a/resources/js/classes/Item.js b/resources/js/classes/Item.js index 8a12b9a..9da6a92 100644 --- a/resources/js/classes/Item.js +++ b/resources/js/classes/Item.js @@ -4,7 +4,11 @@ class Item { } get name () { - return slugToName(this.slug); + return translate(this.slug) || slugToName(this.slug); + } + + get description () { + return translate(`${this.slug}_description`) || 'ITEM_DESCRIPTION_MISSING'; } get category () { diff --git a/resources/js/classes/Monster.js b/resources/js/classes/Monster.js index 9023f32..5c930f8 100644 --- a/resources/js/classes/Monster.js +++ b/resources/js/classes/Monster.js @@ -70,6 +70,9 @@ class Monster { return DB.monsters[this.slug].moveset; } + /** + * @returns {DB_Evolution[]} + */ get evolutions () { return DB.monsters[this.slug].evolutions; } @@ -102,7 +105,7 @@ class Monster { } get name () { - return slugToName(this.slug); + return translate(this.slug) || slugToName(this.slug); } getLearnableTechniques () { @@ -126,18 +129,36 @@ class Monster { ); } - getPossibleEvolutions () { - // return this.evolutions.filter((evolution) => this.level >= evolution.at_level && (!evolution.item || this.heldItem === evolution.item)); - return this.evolutions.filter((evolution) => evolution.path === 'standard' && this.level >= evolution.at_level); - } + /** + * @param {EvolutionPathType} path + */ + getPossibleEvolutions (path) { + return this.evolutions.filter((evolution) => { + if (evolution.path !== path) { + return false; + } + + if (evolution.path === EvolutionPathType.standard) { + return this.level >= evolution.at_level; + } - canEvolve () { - return this.getPossibleEvolutions().length > 0; + else if (evolution.path === EvolutionPathType.item) { + return true; + } + }); } - evolve () { - const evolution = this.getPossibleEvolutions()[0]; + /** + * @param {EvolutionPathType} path + */ + canEvolve (path) { + return this.getPossibleEvolutions(path).length > 0; + } + /** + * @param {DB_Evolution} evolution + */ + evolve (evolution) { const statsPreEvolve = this.stats; const hpPreEvolve = this.hp; diff --git a/resources/js/classes/State.js b/resources/js/classes/State.js index 99a642c..44afa96 100644 --- a/resources/js/classes/State.js +++ b/resources/js/classes/State.js @@ -1,5 +1,10 @@ class State { /** + * @type {string} + */ + language = 'ja'; + + /** * @type {number} */ turn = 0; diff --git a/resources/js/classes/Technique.js b/resources/js/classes/Technique.js index 74783a2..5f01e64 100644 --- a/resources/js/classes/Technique.js +++ b/resources/js/classes/Technique.js @@ -14,7 +14,11 @@ class Technique { } get name () { - return slugToName(this.slug); + return translate(this.slug) || slugToName(this.slug); + } + + get description () { + return translate(`${this.slug}_description`) || 'TECHNIQUE_DESCRIPTION_MISSING'; } get types () { |