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/Monster.js | |
parent | 218da95a4b387ee5ac25f168d1529419039f2e54 (diff) |
translations
Diffstat (limited to 'resources/js/classes/Monster.js')
-rw-r--r-- | resources/js/classes/Monster.js | 39 |
1 files changed, 30 insertions, 9 deletions
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; |