-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
128 lines (90 loc) · 3.43 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<html>
<head>
<style>
#cardsOutput {
border: 1px solid black;
padding: 5px;
width: 80%;
}
.theDeck{
background-color: gainsboro;
width: 50%;
float: left;
}
.singleCard{
background-color: white;
padding: 10px;
width: 50%;
}
.playerInfo{
background-color: olive;
float: right;
width: 50%;
}
.playerInner {
padding: 10px;
}
</style>
<script type="text/javascript" src="./src/cardframe.js"></script>
<script>
let config = new setupGame('Greek', 2, 1, 4, 'All the Greek Peoples')
console.log(config)
let colors = createColors(['red', 'white', 'blue'])
// Creating sets of cards from our options.
// Amoung of cards, name, value, color / faction, powers, more stuff
let zeus = createCardSet(2, "Zeus", 50, colors[1], ['thunderbolt'], 'Zeus is the king of the gods')
let cassandra = createCardSet(4, "Cassandra", 5, colors[1], ['predict'], 'Cassandra predicts the future')
let hera = createCardSet(4, "Hera", 15, colors[1], ['Mean'], 'Hera is so mean')
let hades = createCardSet(4, "Hades", 25, colors[1], ['what does he do?'], 'of the underworld')
let dionysius = createCardSet(4, "Dionysius", 69, colors[1], ['what does he do?'], 'God of the party')
// We merge all the generated
let deck = mergeSets(zeus, cassandra, hera, hades, dionysius)
console.log(deck)
console.log('====================================')
// then we shuffled the cards
let shuffled = shuffle(deck);
// console.log(shuffled)
// dealing cards from deck shuffled to 4 players and two cards each
let cardsDealt = deal(shuffled, 4, 2)
// console.log("dealt cards: " + JSON.stringify(cardsDealt))
console.log(cardsDealt)
// assignes a playername to a playerID
let players = assignPlayers('Steffen', 'Mike', 'A cat', 'a dog')
let player1 = players[0]
let player2 = players[1].name
// console.log(players)
console.log(player1)
console.log(player1.name + ' card 2: ' + JSON.stringify(cardsDealt[players[1].id][1]))
console.log(player1.name + ' cards: ' + JSON.stringify(cardsDealt[players[1].id] ))
let playerCardsPlayer1 = playerCards(player1.id, cardsDealt)
console.log(playerCardsPlayer1)
</script>
</head>
<h1 id='title'>title</h1>
<h2 id='desc'>desc</h2>
<div class="theDeck"><p>The entire Shuffled Deck</p>
<table id='cardsOutput'></table>
</div>
<div class="playerInfo">
<div class="playerInner">
Player: <span id="playerInfo"></span><br>
Cards: <span id="playerCardsList"></span><br>
</div>
</div>
<script>
let h1Title = document.getElementById('title')
h1Title.innerHTML = config.nameOfGame;
let h2Desc = document.getElementById('desc')
h2Desc.innerHTML = config.description;
let cardsOutputted = document.getElementById('cardsOutput')
let playerInfo = document.getElementById('playerInfo')
playerInfo.innerHTML = player1.name
let playerCardsList = document.getElementById('playerCardsList')
for (let i = 0; i < playerCardsPlayer1.length; i++){
playerCardsList.innerHTML += '<br/>Card Number: ' + i + ' CardName: ' + playerCardsPlayer1[i].cardName + ' '
}
for (let i = 0; i < deck.length; i++){
cardsOutputted.innerHTML += '<td class="singleCard">Name: <br/>' + deck[i].cardName + "<br/> Value:" + JSON.stringify(deck[i].value) + '</td>'
}
</script>
</html>