summaryrefslogtreecommitdiff
path: root/resources/js/classes/Technique.js
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2023-08-17 02:53:14 +0200
committerDaniel Weipert <code@drogueronin.de>2023-08-17 17:42:15 +0200
commitcc685bfe02b42b592987117fa008a4461785f53c (patch)
tree625c1c9573b178e574bb70cac042c35da4036cf1 /resources/js/classes/Technique.js
parent717fde1c48c7221da986ac02d2b806b2fee6f2d5 (diff)
refactorrefactor
Diffstat (limited to 'resources/js/classes/Technique.js')
-rw-r--r--resources/js/classes/Technique.js77
1 files changed, 77 insertions, 0 deletions
diff --git a/resources/js/classes/Technique.js b/resources/js/classes/Technique.js
new file mode 100644
index 0000000..a24e094
--- /dev/null
+++ b/resources/js/classes/Technique.js
@@ -0,0 +1,77 @@
+class Technique {
+ #accuracy = 0;
+ #potency = 0;
+ #power = 0;
+
+ constructor (slug) {
+ this.slug = slug;
+
+ this.resetStats();
+ }
+
+ get name () {
+ return slugToName(this.slug);
+ }
+
+ get types () {
+ return DB.techniques[this.slug].types;
+ }
+
+ get range () {
+ return DB.techniques[this.slug].range;
+ }
+
+ get animation () {
+ return DB.techniques[this.slug].animation;
+ }
+
+ get sfx () {
+ return DB.techniques[this.slug].sfx;
+ }
+
+ /**
+ * @returns {string[]}
+ */
+ get effects () {
+ return DB.techniques[this.slug].effects;
+ }
+
+ get accuracy () {
+ return this.#accuracy;
+ }
+ set accuracy (accuracy) {
+ this.#accuracy = accuracy;
+ }
+
+ get potency () {
+ return this.#potency;
+ }
+ set potency (potency) {
+ this.#potency = potency;
+ }
+
+ get power () {
+ return this.#power;
+ }
+ set power (power) {
+ this.#power = power;
+ }
+
+ get stats () {
+ const accuracy = DB.techniques[this.slug].accuracy;
+ const potency = DB.techniques[this.slug].potency;
+ const power = DB.techniques[this.slug].power;
+
+ return {
+ accuracy,
+ potency,
+ power,
+ };
+ }
+
+ resetStats () {
+ this.accuracy = this.stats.accuracy;
+ this.potency = this.stats.potency;
+ this.power = this.stats.power;
+ }
+}