-
Notifications
You must be signed in to change notification settings - Fork 1
Notes Combat
Carson Noble edited this page Jul 16, 2018
·
1 revision
var currentTurn = 0;
var currentAttackThreshold = 0;
var nextAttackThreshold = 0;
var attackSpeed = 0.5;
function attack() {
currentTurn += attackSpeed;
currentAttackThreshold = Math.floor(currentTurn);
while (currentAttackThreshold > nextAttackThreshold) {
console.log("Launching an attack!");
nextAttackThreshold++;
}
}
function combat() {
for (var i=0; i<10; i++) {
console.log("Simulating round " + i + " of combat.");
attack();
}
}