-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.html
202 lines (192 loc) · 7.43 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Matador de Monstros</title>
<link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,600" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="https://unpkg.com/vue"></script>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
</head>
<body onload="playBg()">
<div id="app" :class="(mode==='dark')? 'dark' :'light' ">
<div class="section no-pad-bot" :class="(mode==='dark')? 'dark' :'light' ">
<div class="row">
<span class="col s2 offset-s10" v-if="mode=='dark'" @click="mode='light'">Modo Claro</span>
<span class="col s2 offset-s10" v-if="mode=='light'" @click="mode='dark'">Modo Escuro</span>
</div>
<div class="container" v-if="!running">
<br><br>
<div class="row center">
<img src="./logo/mdm.png" alt="Matador de Monstros" width="300px" class="responsive-img">
</div>
<div class="row center" style="max-width: 250px">
<div class="row center">
<div class="input-field">
<input id="player_name" placeholder="Nome do Personagem" type="text" required v-model="player.name">
</div>
<div class="input-field">
<p>
<label>
<input class="with-gap" name="difficulty" type="radio" v-model="difficulty" value="1"/>
<span>Fácil</span>
</label>
<label>
<input class="with-gap" name="difficulty" type="radio" v-model="difficulty" value="2"/>
<span>Normal</span>
</label>
<label>
<input class="with-gap" name="difficulty" type="radio" v-model="difficulty" value="3"/>
<span>Difícil</span>
</label>
</p>
</div>
</div>
</div>
<div class="row center">
<a class="waves-effect btn blue-grey darken-3" @click="startGame" :disabled="!player.name">Iniciar Jogo</a>
<a class="waves-effect btn blue-grey darken-3" @click="isOpen = !isOpen;">Como Jogar</a>
</div>
<transition name="modal">
<div v-if="isOpen">
<div class="overlay" @click.self="isOpen = false;">
<div class="modal">
<div class="text-center">
<img src="./logo/mdm.png" alt="Matador de Monstros" width="300px" class="responsive-img">
<h1>Como Jogar</h1>
</div>
<h5>Menu Inicial</h5>
<ul>
<li>
1 - Escolha o nome do seu jogador
</li>
<li>
2 - Escolha o nível do seu jogo
</li>
<li>
3 - Clique em "Iniciar Jogo"
</li>
</ul>
<h5>Batalha</h5>
<ul class="instructions">
<li>
<strong class="instructions-attack">Ataque ⇢</strong> Você ataca o seu adversário e recebe um dano de volta
</li>
<li>
<strong class="instructions-special-attack">Ataque Especial ⇢</strong> Você tem um poder de ataque maior e recebe um dano de volta. Você tem apenas 4 ataques especiais.
</li>
<li>
<strong class="instructions-heal">Curar ⇢</strong> Você ganha uma quantidade x de vida e recebe um ataque do seu adversário. Você pode usar 10 poções de cura.
</li>
<li>
<strong class="instructions-giveup">Desistir ⇢</strong> Desiste do jogo e volta para a tela inicial
</li>
</ul>
<div class="text-center">
<button @click="isOpen = false" class="btn btn-success">Fechar</button>
</div>
</div>
</div>
</div>
</transition>
</div>
<div class="container" v-if="running">
<div class="row">
<div class="col s6">
<div class="card" :class="!isMonsterTurn ? 'playerTurn' : ''">
<div class="score p">
<p :class="{'animate__animated animate__fadeInUp': hurtAnimation.player }" class="hurtDamagePopup">
<span v-if="showDamagePopup.player">-{{ hurtDamage }}</span>
</p>
<p><img :src="'./characters/' + player.image + '.gif'" alt="" :class="{'animate__animated animate__shakeX': hurtAnimation.player }"></p>
<h1>{{ player.name }}</h1>
<div class="life-bar">
<div class="life" :class="{danger: player.life < 20}" :style="{width: player.life + '%'}"></div>
</div>
<div class="life-percent">{{ player.life }}%</div>
</div>
</div>
</div>
<div class="col s6">
<div class="card" :class="isMonsterTurn ? 'playerTurn' : ''">
<div class="score">
<p :class="{'animate__animated animate__fadeInUp': hurtAnimation.monster }" class="hurtDamagePopup">
<span v-if="showDamagePopup.monster">-{{ hurtDamage }}</span>
</p>
<p><img :src="'./characters/' + monster.type[(difficulty-1)] + '.gif'" alt="" class="monster-img" :class="{'animate__animated animate__shakeX': hurtAnimation.monster }" :style="'filter: hue-rotate(' + monster.color + 'deg);'"></p>
<h1>{{ monster.type[(difficulty-1)] }} <span>nível {{ difficulty }}</span></h1>
<div class="life-bar">
<div class="life" :class="{danger: monster.life < 20}" :style="{width: monster.life + '%'}"></div>
</div>
<div>{{ monster.life }}%</div>
</div>
</div>
</div>
</div>
</div>
<div class="container" v-if="running">
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content buttons">
<button @click="attack()" class="btn attack" :disabled="isMonsterTurn">Ataque</button>
<button @click="attack(true)" class="btn special-attack" :class="{canUseSpecial: !canUseSpecial}" :disabled="!canUseSpecial || isMonsterTurn">Ataque especial ({{ player.special.available-player.special.used }})</button>
<button @click="healAndHurt" class="btn heal" :class="{canUseHeal: !canUseHeal}" :disabled="!canUseHeal || isMonsterTurn">Curar ({{ player.heal.available-player.heal.used }})</button>
<button @click="running = false" class="btn give-up" :disabled="isMonsterTurn">Desistir</button>
</div>
</div>
</div>
</div>
</div>
<div class="container" v-if="logs.length && running">
<div class="row">
<div class="col s12">
<div class="card">
<div class="card-content logs">
<ul>
<li class="log" :class="log.cls" v-for="log in logs">
{{ log.text }}
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="container" v-if="hasResult">
<div class="row">
<div class="col s12">
<div class="result">
<div v-if="monster.life == 0" class="win">Você ganhou!</div>
<div v-else class="lose">Você perdeu!</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/howler/2.2.0/howler.min.js"></script>
<script type="text/javascript" src="app.js"></script>
<script>
function playBg() {
var sound = new Howl({
src: ['audio/bg1.wav'],
autoplay: true,
loop: true,
volume: 0.4,
onplayerror: function() {
sound.once('unlock', function() {
sound.play();
});
}
});
sound.play();
}
</script>
</body>
</html>