alaah 6 years ago
parent
commit
161b922d6a
2 changed files with 10 additions and 3 deletions
  1. 1 1
      public/index.html
  2. 9 2
      public/script.js

+ 1 - 1
public/index.html

@@ -99,7 +99,7 @@
             </select>
         </form>
 
-        <button style="margin-top: 5px;" onclick="document.getElementById('frm').reset();">Reset</button>
+        <button style="margin-top: 5px;" onclick="reset();">Reset</button>
 
         <div class="yay">HP: <span id="result">-</span></div>
         <div class="yay" id="capdiv" style="display: none;">Damage cap: <span id="hardcap">-</span></div>

+ 9 - 2
public/script.js

@@ -80,8 +80,6 @@ let diff = 0;
 let mob = -1;
 let level = -1;
 
-let counter = 0;
-
 function separator_gen(val) {
   return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, " ");
 }
@@ -161,7 +159,16 @@ function update_level(val) {
 }
 
 function init() {
+    reset();
     stats[0] = document.getElementById('brut').value;
     stats[1] = document.getElementById('tact').value;
     stats[2] = document.getElementById('surv').value;
 }
+
+function reset() {
+    document.getElementById('frm').reset();
+    stats = [1, 1, 1];
+    diff = 0;
+    mob = -1;
+    level = -1;
+}