diff --git a/monster_game/app.js b/monster_game/app.js index 01afe6c..04d6726 100644 --- a/monster_game/app.js +++ b/monster_game/app.js @@ -32,24 +32,24 @@ var app = new Vue({ }, playerAttack(){ console.log("player Attack"); - var dmg = this.getRandomInt(1, 10); - var log = {attacker: 'player', dmg: dmg} + var dmg = this.getRandomInt(3, 10); this.mHP -= dmg; - this.logs.unshift(log); + this.logs.unshift({isPlayer: true, text: 'Player hits monster for ' + dmg}); this.monsterAttack(); }, specialAttack(){ console.log("special Attack"); - var dmg = this.getRandomInt(1, 20); - var log = {attacker: 'player', dmg: dmg} + var dmg = this.getRandomInt(10, 20); this.mHP -= dmg; - this.logs.unshift(log); + this.logs.unshift({isPlayer: true, text: 'Player hits monster hard for ' + dmg}); this.monsterAttack(); }, heal(){ console.log("heal"); - var hp = this.getRandomInt(1, 10); - this.pHP += hp; + var hp = 10 + this.pHP = Math.min(100, this.pHP + 10 ); + var log = + this.logs.unshift({isPlayer: true, text: 'Player heals for 10'}); this.monsterAttack(); }, giveUp(){ @@ -58,8 +58,8 @@ var app = new Vue({ }, monsterAttack(){ console.log("attacked"); - var dmg = this.getRandomInt(1, 10); - var log = { attacker: 'monster', dmg: dmg} + var dmg = this.getRandomInt(5, 12); + var log = { isPlayer: false, text: 'monster hits player for ' + dmg} this.pHP -= dmg; this.logs.unshift(log); }, diff --git a/monster_game/index.html b/monster_game/index.html index 24454ce..48eb69b 100644 --- a/monster_game/index.html +++ b/monster_game/index.html @@ -42,18 +42,9 @@