From 5582c3c07069f7766aabd81f3a4a3f97def134e9 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 27 Aug 2023 14:35:50 +0200 Subject: more areas! --- resources/js/classes/Area.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'resources/js/classes') diff --git a/resources/js/classes/Area.js b/resources/js/classes/Area.js index f518f22..5a3a062 100644 --- a/resources/js/classes/Area.js +++ b/resources/js/classes/Area.js @@ -3,7 +3,6 @@ class Area { monsterProgress = 0; trainerProgress = 0; - isCompleted = false; constructor (slug) { this.slug = slug; @@ -15,14 +14,25 @@ class Area { return translate(this.alternateSlug) || slugToName(this.slug); } + get isCompleted () { + return this.monsterProgress >= this.requiredEncounters && this.trainerProgress >= this.trainers.length; + } + get alternateSlug () { return DB.areas[this.slug]['modules/tuxemon.slug']; } + /** + * @returns {Object[]} + */ get encounters () { return DB.areas[this.slug].encounters; } + get encounterPercentTotal () { + return DB.areas[this.slug].encounter_percent_total; + } + get requiredEncounters () { return DB.areas[this.slug].requiredEncounters; } -- cgit v1.2.3