-
+
diff --git a/static/cards.js b/static/cards.js
index a19f03b..3d59298 100644
--- a/static/cards.js
+++ b/static/cards.js
@@ -1,29 +1,32 @@
-export const cards = {
- "cards": {
- "1": {
- "role": "Villager",
- "team": "village",
- "description": "During the day, find the wolves and kill them."
+export const cards = [
+ {
+ role: "Villager",
+ team: "village",
+ description: "During the day, find the wolves and kill them.",
+ powerRole: false
},
- "2": {
- "role": "Seer",
- "team": "village",
- "description": "During the night, choose one person. The moderator will tell you whether that player is evil."
+ {
+ role: "Seer",
+ team: "village",
+ description: "During the night, choose one person. The moderator will tell you whether that player is evil.",
+ powerRole: true
},
- "3": {
- "role": "Hunter",
- "team": "village",
- "description": "If you are alive with a wolf at the end of the game, the village wins."
+ {
+ role: "Hunter",
+ team: "village",
+ description: "If you are alive with a wolf at the end of the game, the village wins.",
+ powerRole: true
},
- "4": {
- "role": "Werewolf",
- "team": "wolf",
- "description": "During the night, choose a villager to kill. Don't get killed."
+ {
+ role: "Werewolf",
+ team: "wolf",
+ description: "During the night, choose a villager to kill. Don't get killed.",
+ powerRole: false
},
- "5": {
- "role": "Minion",
- "team": "wolf",
- "description": "You are villager, but you know who the wolves are - and want them to win."
+ {
+ role: "Minion",
+ team: "wolf",
+ description: "You are villager, but you know who the wolves are - and want them to win.",
+ powerRole: true
}
- }
-};
+];
diff --git a/static/setup.js b/static/setup.js
index 0123ade..767e9cc 100644
--- a/static/setup.js
+++ b/static/setup.js
@@ -1,17 +1,63 @@
import {cards} from './cards.js'
+// important declarations
class Card {
- constructor(name, team, description) {
- this.name = name;
+ constructor(role, team, description, powerRole) {
+ this.role = role;
this.team = team;
this.description = description;
+ this.quantity = 0;
+ this.powerRole = powerRole;
}
}
-console.log(cards);
+var deck = [];
-document.getElementById("card-select").onload = function() {
- let jsonCards = JSON.parse('')
+
+// register event listeners on buttons
+document.getElementById("reset-btn").addEventListener("click", resetCardQuantities);
+document.getElementById("create-btn").addEventListener("click", generateAccessCode);
+
+// render all of the available cards to the user
+window.onload = function() {
+ for (const card of cards) {
+ const newCard = new Card(card.role, card.team, card.description, card.powerRole);
+ const cardContainer = document.createElement("div");
+
+ deck.push(newCard);
+
+ cardContainer.setAttribute("class", "card");
+ cardContainer.innerHTML = "