-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
171 lines (161 loc) · 5.49 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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Random Battle Click</title>
<!-- <link
href="https://fonts.googleapis.com/css?family=Press+Start+2P&display=swap"
rel="stylesheet"
/> -->
<link rel="stylesheet" href="./css/nes.css" />
<link rel="stylesheet" href="./css/perfect-scroll.css" />
<link rel="stylesheet" href="./css/style.css" />
</head>
<body>
<div id="app">
<div class="container">
<div class="players nes-container">
<div class="player">
<div class="player__media center">
<transition name="custom-2">
<div
class="player__win-counter"
v-show="status.play || status.winner"
>
{{ stats.win.player1 }}
</div>
</transition>
<img
class="player__avatar"
:src="`./img/players/${selectedPlayer.player1.avatar}`"
alt=""
/>
</div>
<p class="player__name">{{ selectedPlayer.player1.name }}</p>
<progress
class="nes-progress player__health-bar"
:value="health.player1"
max="100"
:class="[healthBarColorStatus(health.player1), { hidden: !status.play }, { visible: status.winner }, { 'player__health-bar--xs': status.play || status.winner }]"
/>
</div>
<div class="vs">VS</div>
<div class="player">
<div class="player__media center">
<transition name="custom-2">
<div
class="player__win-counter"
v-show="status.play || status.winner"
>
{{ stats.win.player2 }}
</div>
</transition>
<img
class="player__avatar"
:src="`./img/players/${selectedPlayer.player2.avatar}`"
alt=""
/>
</div>
<p class="player__name">{{ selectedPlayer.player2.name }}</p>
<progress
class="nes-progress player__health-bar"
:value="health.player2"
max="100"
:class="[healthBarColorStatus(health.player2), { hidden: !status.play }, { visible: status.winner }, { 'player__health-bar--xs': status.play || status.winner }]"
/>
</div>
</div>
</div>
<div
v-if="!status.play && !status.winner"
class="mb-2 container no-background"
>
<button
type="button"
class="nes-btn center start-game-btn"
@click="startNewGame"
>
▶ Start Game
</button>
</div>
<div class="container">
<div class="nes-container actions actions--alt" v-if="status.winner">
<button type="button" class="nes-btn actions__btn" @click="exitGame">
🚪 Exit
</button>
<button type="button" class="nes-btn actions__btn" @click="reBattle">
⚔️ Re-Battle
</button>
</div>
</div>
<div class="container" v-if="status.play">
<div class="nes-container actions">
<button
type="button"
class="nes-btn is-error actions__btn"
@click="attack"
>
Attack
</button>
<button
type="button"
class="nes-btn is-primary actions__btn"
@click="specialAttack"
>
Special Attack
</button>
<button
type="button"
class="nes-btn is-success actions__btn"
:class="{
'is-disabled':
health.player1 >= 90 && health.player2 >= 90 ||
health.player1 >= 90 && health.player2 <= 90 ||
health.player2 >= 90 && health.player1 <= 90 ||
tracker.heal >= 3
}"
@click="heal"
:disable="health.player1 >= 90 && health.player2 >= 90 || tracker.heal >= 3"
>
Heal
</button>
<button
class="actions__btn nes-btn"
@click="showDialogGiveUp"
type="button"
>
Give Up
</button>
<dialog class="nes-dialog give-up-dialog" id="give-up-dialog">
<form method="dialog">
<p class="text-center">Are you sure, want to give up?</p>
<menu class="dialog-menu give-up-dialog-menu">
<button class="nes-btn" @click.prevent="hideDialogGiveUp">
Hell no!
</button>
<button class="nes-btn is-primary" @click="giveUp">Yes</button>
</menu>
</form>
</dialog>
</div>
</div>
<transition name="custom-1">
<div
class="container"
v-show="status.play || status.winner || status.giveUp && logs.length"
>
<div class="logs nes-container mb-2">
<template v-if="logs.length">
<p v-for="(log, index) in logs">{{ log }}</p>
</template>
<p v-else>There is no activities on the battle right now.</p>
</div>
</div>
</transition>
</div>
<script src="./js/vue.js"></script>
<script src="./js/perfect-scroll.js"></script>
<script src="./js/script.js"></script>
</body>
</html>