add a method to surrender the game

This commit is contained in:
Andreas Zweili 2021-01-22 20:05:29 +01:00
parent a31d971291
commit f61cd7af9f
2 changed files with 4 additions and 2 deletions

View File

@ -95,7 +95,9 @@ const app = Vue.createApp({
}
this.attackPlayer();
},
surrender() {},
surrender() {
this.winner = "monster";
},
attackPlayer() {
this.playerHealth -= getRandomValue(8, 15);
},

View File

@ -39,7 +39,7 @@
<button @click="attackMonster">ATTACK</button>
<button :disabled="specialAttackAllowed" @click="specialAttackMonster">SPECIAL ATTACK</button>
<button @click="healPlayer">HEAL</button>
<button>SURRENDER</button>
<button @click="surrender">SURRENDER</button>
</section>
<section id="log" class="container">
<h2>Battle Log</h2>