-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
152 lines (132 loc) · 6.95 KB
/
index.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>SW:Destiny - Dice Simulator</title>
<link href="https://fonts.googleapis.com/css?family=Lato:400,700" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet">
<link rel="icon" href="/static/assets/images/cropped-swdestiny-favicon-32x32.png" sizes="32x32" />
<link rel="icon" href="/static/assets/images/cropped-swdestiny-favicon-192x192.png" sizes="192x192" />
<link rel="apple-touch-icon-precomposed" href="/static/assets/images/cropped-swdestiny-favicon-180x180.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
</head>
<body>
<div id="app">
<section class="controls">
<h1>SW:Destiny - Dice Simulator</h1>
<select id="cards" v-model="selected_card">
<optgroup v-for="(cards, set) in sets" :key="set" :label="set">
<option :value="card.code" v-for="card in cards" v-if="card.sides">{{ card.code }} {{card.name}}<template v-if="card.subtitle"> - {{ card.subtitle }}</template></option>
</optgroup>
</select>
<a @click.prevent="addCard">Add Card</a>
</section>
<section v-if="active_cards.length">
<div class="table-wrapper">
<table>
<thead>
<tr>
<th>Name</th>
<th>Text</th>
<th class="side" colspan="6">Sides</th>
<th class="action" colspan="2">Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="(card, slot) in active_cards">
<td class="name">{{ card.name }}<em v-if="card.subtitle"><br />{{ card.subtitle }}</em></td>
<td class="text" v-html="card.text"></td>
<td class="side" v-for="side in card.sides" v-html="niceSide(side)"></td>
<td class="action"><a @click="removeCard(card.code)">Remove</a></td>
<td class="elite" v-if="eliteOption(card.points)"><label v-bind:for="'elite-'+card.code">Elite?</label> <input v-bind:id="'elite-'+card.code" @click="toggleElite(slot)" type="checkbox" /></td>
</tr>
</tbody>
</table>
</div>
<div class="controls">
<button @click="roll(1)">Roll Dice</button>
<button @click="roll(100)">Roll Dice ×100</button>
<button @click="roll(1000)">Roll Dice ×1000</button>
<button @click="roll(10000)">Roll Dice ×10,000</button>
</div>
</section>
<section v-if="rolls.length" @click="roll(1)" class="dice">
<ol>
<li v-for="die in rolls[rolls.length - 1]" v-bind:class="getDieFaction(die)" v-html="parsedDie(die)"></li>
</ol>
</section>
<section v-if="rolls.length">
<div>
<h3>Last Roll ({{this.rolls[this.rolls.length - 1].length}} dice)</h3>
<div class="table-wrapper">
<table class="data">
<thead>
<tr>
<th>Side</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr v-for="(value, key) in last_roll">
<td><span v-html="icon(key)"></span> <template v-if="key.includes('Special')"> {{ key }}</template></td>
<td>{{ value }}</td>
</tr>
</tbody>
</table>
</div>
</div>
<div>
<h3>Average</h3>
<div class="table-wrapper">
<table class="data">
<thead>
<tr>
<th>Side</th>
<th>Mean</th>
<th>Max</th>
<th>Standard Deviation</th>
</tr>
</thead>
<tbody>
<tr v-for="(averages, key) in average_roll">
<td><span v-html="icon(key)"></span> <template v-if="key.includes('Special')"> {{ key }}</template></td>
<td>{{ averages.mean }}</td>
<td>{{ averages.max }}</td>
<td>{{ averages.sd }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<section v-if="active_cards.length">
<div>
<h3>Resolvable Permutations <a @click.prevent="togglePermutations">({{ show_permutations ? 'Hide' : 'Show' }})</a></h3>
<div class="table-wrapper" v-if="show_permutations">
<table class="data">
<thead>
<tr>
<th>Result</th>
<th>% Chance</th>
<th>Probability</th>
</tr>
</thead>
<tbody>
<tr v-for="permutation in permutations">
<td><template v-for="(value, side) in permutation.result"><span v-if="value">{{ value }}</span><span v-html="icon(side)"></span> <template v-if="side.includes('Special')"> {{ side }}</template> </template></td>
<td>{{ permutation.percentage }}</td>
<td>{{ permutation.probability }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<footer>
<p>For bugs or feedback please contact <a href="http://twitter.com/elstob">@elstob</a> or visit <a href="https://github.com/elstob/ReturnOfTheJedie">Github</a>.</p>
</footer>
</div>
<!-- built files will be auto injected -->
</body>
</html>