add a special attack
This commit is contained in:
parent
7eaa708046
commit
6f3f20e1b4
|
@ -10,6 +10,7 @@ const app = Vue.createApp({
|
||||||
playerHealth: 100,
|
playerHealth: 100,
|
||||||
monsterHealth: 100,
|
monsterHealth: 100,
|
||||||
battleLog: [],
|
battleLog: [],
|
||||||
|
currentRound: 0,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -19,13 +20,21 @@ const app = Vue.createApp({
|
||||||
playerBarStyles() {
|
playerBarStyles() {
|
||||||
return { width: this.playerHealth + "%" };
|
return { width: this.playerHealth + "%" };
|
||||||
},
|
},
|
||||||
|
specialAttackAllowed() {
|
||||||
|
return this.currentRound % 3 !== 0;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
attackMonster() {
|
attackMonster() {
|
||||||
|
this.currentRound++;
|
||||||
this.monsterHealth -= attackValue(5, 12);
|
this.monsterHealth -= attackValue(5, 12);
|
||||||
this.attackPlayer();
|
this.attackPlayer();
|
||||||
},
|
},
|
||||||
specialAttackMonster() {},
|
specialAttackMonster() {
|
||||||
|
this.currentRound++;
|
||||||
|
this.monsterHealth -= attackValue(10, 25);
|
||||||
|
this.attackPlayer();
|
||||||
|
},
|
||||||
healPlayer() {},
|
healPlayer() {},
|
||||||
surrender() {},
|
surrender() {},
|
||||||
attackPlayer() {
|
attackPlayer() {
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
</section>
|
</section>
|
||||||
<section id="controls">
|
<section id="controls">
|
||||||
<button @click="attackMonster">ATTACK</button>
|
<button @click="attackMonster">ATTACK</button>
|
||||||
<button>SPECIAL ATTACK</button>
|
<button :disabled="specialAttackAllowed" @click="specialAttackMonster">SPECIAL ATTACK</button>
|
||||||
<button>HEAL</button>
|
<button>HEAL</button>
|
||||||
<button>SURRENDER</button>
|
<button>SURRENDER</button>
|
||||||
</section>
|
</section>
|
||||||
|
|
Reference in New Issue