Files
2021-04-11 14:24:13 -04:00

25 lines
631 B
JavaScript

const path = require('path');
module.exports = class TarotCard {
constructor(data) {
this.rank = data.rank;
this.suit = data.suit;
this.name = data.name;
this.meanings = data.meanings;
this.keywords = data.keywords;
this.fortunes = data.fortune_telling;
}
get imagePath() {
return path.join(__dirname, '..', '..', 'assets', 'images', 'tarot', this.suit, `${this.rank}.jpg`);
}
randomLightMeaning() {
return this.meanings.light[Math.floor(Math.random() * this.meanings.light.length)];
}
randomShadowMeaning() {
return this.meanings.shadow[Math.floor(Math.random() * this.meanings.shadow.length)];
}
};