diff --git a/web/encounter.html b/web/encounter.html
index 700ce92..cbd1dde 100644
--- a/web/encounter.html
+++ b/web/encounter.html
@@ -2,7 +2,7 @@
- Gamma World Game Play
+ Gamma World Encounter Check
diff --git a/web/img/Attack Failed!.png b/web/img/Attack Failed!.png
new file mode 100644
index 0000000..29bfc08
Binary files /dev/null and b/web/img/Attack Failed!.png differ
diff --git a/web/img/Attack Successful!.png b/web/img/Attack Successful!.png
new file mode 100644
index 0000000..963226e
Binary files /dev/null and b/web/img/Attack Successful!.png differ
diff --git a/web/img/Devastating Success!.png b/web/img/Devastating Success!.png
new file mode 100644
index 0000000..04e248a
Binary files /dev/null and b/web/img/Devastating Success!.png differ
diff --git a/web/index.html b/web/index.html
index 366fdb0..01f7e06 100644
--- a/web/index.html
+++ b/web/index.html
@@ -11,8 +11,10 @@
-
+
+
+
@@ -23,13 +25,18 @@
loadContent("rolldice.html?t=" + new Date().getTime());
});
+ document.getElementById("encounter").addEventListener("click", function () {
+ loadContent("encounter.html?t=" + new Date().getTime());
+ });
+
+ document.getElementById("mentalattack").addEventListener("click", function () {
+ loadContent("mentalattack.html?t=" + new Date().getTime());
+ });
+
document.getElementById("chargen").addEventListener("click", function () {
loadContent("chargen.html?t=" + new Date().getTime());
});
- document.getElementById("encounter").addEventListener("click", function () {
- loadContent("encounter.html?t=" + new Date().getTime());
- });
});
function loadContent(pageUrl) {
diff --git a/web/mentalattack.html b/web/mentalattack.html
new file mode 100644
index 0000000..2f2b869
--- /dev/null
+++ b/web/mentalattack.html
@@ -0,0 +1,42 @@
+
+
+
+
+ Gamma World Mental Attack Roll
+
+
+
+
+
+Mental Attack Roll!
+
+Set Mental Strength Values, and Press Attack!
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/web/mentalattack.js b/web/mentalattack.js
new file mode 100644
index 0000000..368546a
--- /dev/null
+++ b/web/mentalattack.js
@@ -0,0 +1,54 @@
+window.onload = function () {
+ document.getElementById('mentalAttackForm').addEventListener('submit', function (event) {
+ event.preventDefault(); // Prevent the form from submitting the normal way
+
+ const ams = parseInt(document.getElementById('ams').value, 10);
+ const dms = parseInt(document.getElementById('dms').value, 10);
+ const modifier = parseInt(document.getElementById('modifier').value, 0);
+
+ fetch('https://gammaworld.gmgauthier.com/roll/attack/mental', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify({
+ ams: ams,
+ dms: dms,
+ modifier: modifier
+ }),
+ })
+ .then(response => response.json())
+ .then(data => {
+ const resultsDiv = document.getElementById('results');
+ let html = '';
+
+ if (data['needed']) {
+ html += `Needed: ${data['needed']} `;
+ }
+
+ if (data['original-roll']) {
+ html += `Original Roll: ${data['original-roll']}
`;
+ }
+
+ if (data['modifier']) {
+ html += `Modifier: ${data['modifier']} `;
+ }
+
+ if (data['adjusted-roll']) {
+ html += `Adjusted Roll: ${data['adjusted-roll']}
`;
+ }
+
+ html += `
`;
+
+ if (data['outcome']) {
+ let outcomeText = data['outcome'];
+ html += `${outcomeText}
`;
+ // adding img tag
+ let outcomeImage = 'img/' + outcomeText.replace(' ', '%20') + '.png';
+ html += ``
+
+ resultsDiv.innerHTML = html;
+ }
+ })
+ });
+}
\ No newline at end of file