rename the attackValue function

This commit is contained in:
Andreas Zweili 2021-01-22 19:49:46 +01:00
parent 6f3f20e1b4
commit 3ffbadeb3a
1 changed files with 5 additions and 3 deletions

View File

@ -1,6 +1,6 @@
"use strict"; "use strict";
function attackValue(min, max) { function getRandomValue(min, max) {
return Math.floor(Math.random() * (max - min)) + min; return Math.floor(Math.random() * (max - min)) + min;
} }
@ -27,12 +27,14 @@ const app = Vue.createApp({
methods: { methods: {
attackMonster() { attackMonster() {
this.currentRound++; this.currentRound++;
this.monsterHealth -= attackValue(5, 12); this.monsterHealth -= getRandomValue(5, 12);
this.attackPlayer(); this.attackPlayer();
}, },
specialAttackMonster() { specialAttackMonster() {
this.currentRound++; this.currentRound++;
this.monsterHealth -= attackValue(10, 25); this.monsterHealth -= getRandomValue(10, 25);
this.attackPlayer();
},
this.attackPlayer(); this.attackPlayer();
}, },
healPlayer() {}, healPlayer() {},