From 6f3f20e1b48deca7c7fb587a46b7d83db7ee0ee1 Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Thu, 21 Jan 2021 12:28:31 +0100 Subject: [PATCH] add a special attack --- prj-monster-01-starting-setup/app.js | 11 ++++++++++- prj-monster-01-starting-setup/index.html | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/prj-monster-01-starting-setup/app.js b/prj-monster-01-starting-setup/app.js index 82a1084..4cfad6a 100644 --- a/prj-monster-01-starting-setup/app.js +++ b/prj-monster-01-starting-setup/app.js @@ -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() { diff --git a/prj-monster-01-starting-setup/index.html b/prj-monster-01-starting-setup/index.html index dc5f167..33faed4 100644 --- a/prj-monster-01-starting-setup/index.html +++ b/prj-monster-01-starting-setup/index.html @@ -30,7 +30,7 @@
- +