add a special attack

This commit is contained in:
Andreas Zweili 2021-01-21 12:28:31 +01:00
parent 7eaa708046
commit 6f3f20e1b4
2 changed files with 11 additions and 2 deletions

View File

@ -10,6 +10,7 @@ const app = Vue.createApp({
playerHealth: 100,
monsterHealth: 100,
battleLog: [],
currentRound: 0,
};
},
computed: {
@ -19,13 +20,21 @@ const app = Vue.createApp({
playerBarStyles() {
return { width: this.playerHealth + "%" };
},
specialAttackAllowed() {
return this.currentRound % 3 !== 0;
},
},
methods: {
attackMonster() {
this.currentRound++;
this.monsterHealth -= attackValue(5, 12);
this.attackPlayer();
},
specialAttackMonster() {},
specialAttackMonster() {
this.currentRound++;
this.monsterHealth -= attackValue(10, 25);
this.attackPlayer();
},
healPlayer() {},
surrender() {},
attackPlayer() {

View File

@ -30,7 +30,7 @@
</section>
<section id="controls">
<button @click="attackMonster">ATTACK</button>
<button>SPECIAL ATTACK</button>
<button :disabled="specialAttackAllowed" @click="specialAttackMonster">SPECIAL ATTACK</button>
<button>HEAL</button>
<button>SURRENDER</button>
</section>