generated from Nathaniel633/student1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjavascript.js
39 lines (34 loc) · 1.58 KB
/
javascript.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Declare a counter for difficulty skills
let difficultyCount = 0;
let currentTotalDifficulty = 0;
let currentExecutionScore = 10;
function addDifficulty(value) {
if (difficultyCount < 10) { // Check if less than 10 inputs have been made
currentTotalDifficulty += value;
document.getElementById("totalDifficulty").textContent = currentTotalDifficulty.toFixed(1);
difficultyCount++; // Increment the counter
} else {
alert('Maximum of 10 difficulty skills reached.'); // Alert user no more inputs allowed
}
}
function resetDifficulty() {
currentTotalDifficulty = 0;
document.getElementById("totalDifficulty").textContent = currentTotalDifficulty.toFixed(1);
difficultyCount = 0; // Reset the counter
}
function subtractDeduction(value) {
if (currentExecutionScore > 0) {
currentExecutionScore -= value;
currentExecutionScore = Math.max(currentExecutionScore, 0);
document.getElementById("executionScore").textContent = currentExecutionScore.toFixed(1);
}
}
function resetExecution() {
currentExecutionScore = 10;
document.getElementById("executionScore").textContent = currentExecutionScore.toFixed(1);
}
function displayText() {
var extraDeductions = parseFloat(document.getElementById("extra").value);
var finalScore = currentTotalDifficulty + currentExecutionScore + extraDeductions + 2;
document.getElementById("finalScore").textContent = finalScore.toFixed(1);
}