dice game

HTML

<div id="dice-hero1" ></div>
<div id="dice-hero2"></div>
<div>hero_lifebar<progress id="hero_lifebar" value="150" max="150"></progress></div>

<div id="dice-monster1"></div>
<div id="dice-monster2"></div>
<div>monster_lifebar<progress id="monster_lifebar" value="80" max="80"></progress></div>

CSS

#dice-hero1, #dice-hero2{
    width: 95px;
    height: 95px;
    border-radius: 20px;
    background-color: green;
    
    color: white;
    font-size: 90px;
    text-align: center;
    margin-left: 200px;
    
}

#dice-monster1, #dice-monster2{
    width: 95px;
    height: 95px;
    border-radius: 20px;
    background-color: red;
    
    color: white;
    font-size: 90px;
    text-align: center;
    margin-left: 200px;
    
}

JavaScript

rollDice2(); 
//removeHealth();
var tid
var stopped=false
document.addEventListener('click',function(){
  if(!stopped){
    clearInterval(tid)
    removeHealth()
   }else{
   	rollDice2()
   }
   stopped=!stopped
})
function rollDice2(){

    function getRandomInt(min, max) {
        return Math.floor(Math.random() * (max - min + 1)) + min;
    }
    
    var ms = 800;
    var func = function () {
        var randNum = getRandomInt(1, 6);    // Gets random number between 1 and 6
        var randNum2 = getRandomInt(1, 6);
        var randNum3 = getRandomInt(1, 6);
        var randNum4 = getRandomInt(1, 6);
        document.getElementById("dice-hero1").innerHTML = randNum;
        document.getElementById("dice-hero2").innerHTML = randNum2;
        document.getElementById("dice-monster1").innerHTML = randNum3;
        document.getElementById("dice-monster2").innerHTML = randNum4;
    };
    
    func();
    tid=setInterval(func, ms);
  
}

function removeHealth(){

	let health = document.getElementById("hero_lifebar")
  let health2 = document.getElementById("monster_lifebar")
	var vh1=parseInt(document.getElementById('dice-hero1').innerText)
  var vh2=parseInt(document.getElementById('dice-hero2').innerText)
  var vm1=parseInt(document.getElementById('dice-monster1').innerText)
  var vm2=parseInt(document.getElementById('dice-monster2').innerText)
  
  vh=vh1+vh2
  vm=vm1+vm2
  if(vh>vm){
  	health2.value -= 10;
  }else if(vh<vm){
  	health.value -= 20;
  }
  if(health.value<=0){
  	// monster win
    alert('monster win')
  }
  if(health2.value<=0){
  	// hero win
    alert('hero win')
  }
	
}