-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
63 lines (59 loc) · 2.4 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="./styles.css">
</head>
<body>
<div id="app">
<section class="players">
<section v-for="player in players" :key="player.id" class="player">
<h1 class="name">{{ player.name }}</h1>
<div class="health">
<div
class="currentHealth"
:style="[
{ width: (player.health < 0 ? 0 : player.health) + '%' },
{ backgroundColor: player.health < 20 ? '#F44336' : player.health < 50 ? '#FFC107' : '#4CAF50' }
]">
</div>
<span class="healthCounter">{{ player.health }}</span>
</div>
</section>
</section>
<section class="controls">
<template v-if="!isGameStarted || finalResult">
<a @click="startGame" class="btn start">Start game</a>
</template>
<template v-else>
<a @click="doAction('atack')" class="btn atack">Atack</a>
<a @click="doAction('special')" class="btn special">Special</a>
<a @click="doAction('heal')" class="btn health">Heal</a>
<a @click="giveUp" class="btn giveup">Give Up</a>
</template>
</section>
<section class="history">
<template v-if="finalResult">
<section class="result">
<template v-if="finalResult === 'win'">
You win, you're amazing!
</template>
<template v-else>
You lose, that's a shame :c
</template>
</section>
</template>
<template v-for="item in history">
<div :class="['historyItem', { you: item.player === 'you', monster: item.player === 'monster' }]">
{{ item.player }} {{ item.action }} for {{ item.amount }}
</div>
</template>
</section>
</div>
<script src="https://npmcdn.com/vue/dist/vue.js"></script>
<script src="./main.js"></script>
</body>
</html>