From 3ffbadeb3a9cca40b5adf7ed53f1bfad7e09cc9c Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Fri, 22 Jan 2021 19:49:46 +0100 Subject: [PATCH] rename the attackValue function --- prj-monster-01-starting-setup/app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/prj-monster-01-starting-setup/app.js b/prj-monster-01-starting-setup/app.js index 4cfad6a..8aba836 100644 --- a/prj-monster-01-starting-setup/app.js +++ b/prj-monster-01-starting-setup/app.js @@ -1,6 +1,6 @@ "use strict"; -function attackValue(min, max) { +function getRandomValue(min, max) { return Math.floor(Math.random() * (max - min)) + min; } @@ -27,12 +27,14 @@ const app = Vue.createApp({ methods: { attackMonster() { this.currentRound++; - this.monsterHealth -= attackValue(5, 12); + this.monsterHealth -= getRandomValue(5, 12); this.attackPlayer(); }, specialAttackMonster() { this.currentRound++; - this.monsterHealth -= attackValue(10, 25); + this.monsterHealth -= getRandomValue(10, 25); + this.attackPlayer(); + }, this.attackPlayer(); }, healPlayer() {},