Titan Selector: Engage Parameters, Choose Weapons, and Fire!
Apr 3, 2025
v.0
Engage in epic battles with your Titans! Select weapons, determine strategies, and track damage using our sophisticated app.

Versions  

Bugs  
None!

Get This App On Your Website

1. Copy the code above with the iframe and link.
2. Paste the code into your website.
3. Resize the iframe to fit your website.

Javascript, HTML, CSS Code

                
<html>
<head>
<script type="text/javascript"> window.addEventListener('error', function(event) { var message = JSON.parse(JSON.stringify(event.message)); var source = event.filename; var lineno = event.lineno; var colno = event.colno; var error = event.error; window.parent.postMessage({ type: 'iframeError', details: { message: message, source: source, lineno: lineno, colno: colno, error: error ? error.stack : '' } }, '*'); }); window.addEventListener('unhandledrejection', function(event) { window.parent.postMessage({ type: 'iframePromiseRejection', details: { reason: event.reason } }, '*'); }); </script>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Titan Selector: Engage Parameters, Choose Weapons, and Fire!</title>
<meta name="description" content="Engage in epic battles with your Titans! Select weapons, determine strategies, and track damage using our sophisticated app."/>
<meta name="keywords" content="Titan, Board Game, Battle, Strategy, Weapons, Adaptive Games, Game Stats, Turn Based Games"/>

<!-- Libraries -->
<!-- jQuery (3.6.0) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js" crossorigin="anonymous"></script>
<!-- Bootstrap CSS (5.3.3) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
<!-- Bootstrap JS (5.3.3) -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" crossorigin="anonymous"></script>
<!-- Font Awesome (6.6.0) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/fontawesome.min.css" crossorigin="anonymous">

<script type="text/javascript">
try {
const titans = {
warlord: [
{
name: "Eclipse Variant",
speed: "7/14",
vsg: 6,
br: 930,
weapons: {
left_arm: "Macro-cannon (1)",
right_arm: "Chain fist",
left_carapace: "Plasma gun (4)",
right_carapace: "Las-cannon (4)"
}
}
]
};

const weaponStats = {
"Macro-cannon": { short: 72, long: 0, toHitShort: 3, toHitLong: null, damage: 2 },
"Chain fist": { cc: true, toHit: 3, damage: 2 },
"Plasma gun": { short: 36, long: 72, toHitShort: 4, toHitLong: 6, damage: 1 },
"Las-cannon": { short: 30, long: 60, toHitShort: 4, toHitLong: 6, damage: 1 }
};

const hitLocations = {
1: "Left Arm",
2: "Right Arm",
3: "Carapace",
4: "Body",
5: "Body",
6: "Reactor"
};

function determineOrder(distance) {
if (distance <= 12) return "CHARGE";
if (distance <= 24) return "ADVANCE";
return "FIRST FIRE";
}

function rollDice(num) {
return Array.from({ length: num }, () => Math.ceil(Math.random() * 6));
}

document.addEventListener("DOMContentLoaded", function() {
const appElement = document.createElement('div');
appElement.className = "p-4 max-w-4xl mx-auto grid gap-6";

let numTitans = 1;
const titanList = [];

const createTitanUI = () => {
const maxTitansContainer = document.createElement('div');

const title = document.createElement('h2');
title.className = "text-xl font-bold mb-2";
title.textContent = "How Many Titans?";
maxTitansContainer.appendChild(title);

const titanInput = document.createElement('input');
titanInput.type = "number";
titanInput.min = 1;
titanInput.value = numTitans;
titanInput.className = "form-control mb-2";
titanInput.addEventListener('input', (e) => {
numTitans = parseInt(e.target.value);
});
maxTitansContainer.appendChild(titanInput);

const createButton = document.createElement('button');
createButton.className = "btn btn-primary";
createButton.textContent = "Create Titans";
createButton.onclick = initializeTitans;
maxTitansContainer.appendChild(createButton);

appElement.appendChild(maxTitansContainer);
};

const initializeTitans = () => {
while (titanList.length > 0) { titanList.pop(); }
const newTitans = Array.from({ length: numTitans }, (_, index) => ({
id: index,
variant: titans.warlord[0],
distance: 0,
order: "",
selectedWeapon: "",
rollResult: [],
hits: 0,
damage: 0,
status: "Operational",
criticalHits: []
}));
titanList.push(...newTitans);
renderTitans();
};

const updateTitan = (index, changes) => {
titanList[index] = { ...titanList[index], ...changes };
renderTitans();
};

const renderTitans = () => {
titanList.forEach((titan, i) => {
const titanCard = document.createElement('div');
titanCard.className = "card";
titanCard.innerHTML = `
<div class="card-body">
<h2 class="text-xl font-bold mb-2">Titan #${i + 1}</h2>
<p><strong>Status:</strong> ${titan.status}</p>
<p><strong>Damage:</strong> ${titan.damage}</p>
<p><strong>Speed:</strong> ${titan.variant.speed}</p>
<p><strong>Void Shields:</strong> ${titan.variant.vsg}</p>
<p><strong>Battle Rating:</strong> ${titan.variant.br}</p>
<h3 class="text-lg font-semibold mt-4">Weapons</h3>
${Object.entries(titan.variant.weapons).map(([slot, weapon]) => `<p><strong>${slot.replace("_", " ")}:</strong> ${weapon}</p>`).join('')}

<input type="number" placeholder="Distance in cm" value="${titan.distance}" class="form-control mt-4" oninput="updateTitan(${i}, {distance: parseInt(this.value), order: determineOrder(parseInt(this.value))})"/>
${titan.order ? `<p><strong>Suggested Order:</strong> ${titan.order}</p>` : ''}

<select class="form-control" onchange="updateTitan(${i}, { selectedWeapon: this.value })">
<option value="">Select weapon</option>
${Object.keys(titan.variant.weapons).map(slot => `<option value="${slot}">${slot.replace("_", " ")}</option>`).join('')}
</select>

<button class="btn btn-warning mt-2" onclick="handleFire(${i})">Fire at Titan</button>
${titan.rollResult.length > 0 ? `
<div class="mt-2">
<p><strong>Rolls:</strong> ${titan.rollResult.join(", ")}</p>
<p><strong>Hits:</strong> ${titan.hits}</p>
<p><strong>Critical Results:</strong></p>
<ul class="list-disc list-inside">
${titan.criticalHits.map((hit, idx) => `<li>${hit}</li>`).join('')}
</ul>
</div>` : ''}
</div>`;
appElement.appendChild(titanCard);
});
};

const handleFire = (index) => {
const titan = titanList[index];
const weaponName = titan.variant.weapons[titan.selectedWeapon];
if (!weaponName || titan.status === "Titan Death") return;

const baseName = weaponName.split(" (")[0];
const match = weaponName.match(/\((\d+)\)/);
const diceCount = match ? parseInt(match[1]) : 1;
const rolls = rollDice(diceCount);
const stats = weaponStats[baseName];

let requiredToHit = stats?.cc ? stats.toHit : (titan.distance <= stats.short ? stats.toHitShort : stats.toHitLong ?? 6);
if (titan.order === "FIRST FIRE") requiredToHit--;
if (titan.order === "CHARGE") requiredToHit++;

const validHits = rolls.filter((roll) => roll >= requiredToHit);
let newCrits = [...titan.criticalHits];

validHits.forEach(() => {
const locationRoll = rollDice(1)[0];
const critCheck = rollDice(1)[0];
const location = hitLocations[locationRoll];
const severity = critCheck >= 4 ? "CRITICAL" : "SUPERFICIAL";
newCrits.push(`${severity} hit to ${location}`);
});

const totalDamage = validHits.length * (stats.damage || 1);
const newDamage = titan.damage + totalDamage;

updateTitan(index, {
rollResult: rolls,
hits: validHits.length,
damage: newDamage,
status: newDamage >= 10 ? "Titan Death" : "Operational",
criticalHits: newCrits
});
};

createTitanUI();
document.getElementById('main-container').appendChild(appElement);
});

} catch (error) {
throw error;
}
</script>

<style>
body {
background: linear-gradient(to right, #FFEFBA, #FFFFFF);
color: #2D3748;
font-family: 'Arial', sans-serif;
}
.card {
background: #F3F4F6;
border-radius: 10px;
margin-bottom: 20px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}
.btn-primary {
background-color: #007BFF;
color: white;
border: none;
}
.btn-warning {
background-color: #FFC107;
color: #212529;
}
</style>

<link rel="canonical" href="https://calculator.tools/app/titan-selector-engage-parameters-choose-weapons-and-fire-1485/">
<meta charset="utf-8">

</head>
<body>
<div id="main-container" class="container">
<!-- App HTML Goes Here -->
</div>
<script type="text/javascript"> var localStoragePrefix = "ct-1485"; var lastSave = 0; function saveLocal(data) { if (Date.now() - lastSave < 1000) { return; } let cookie = localStoragePrefix + "=" + JSON.stringify(data) + "; path=" + window.location.pathname + "'; SameSite=Strict"; cookie += "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 365 * 1000).toUTCString(); document.cookie = cookie; lastSave = Date.now(); } function loadLocal() { var cookiePrefix = localStoragePrefix + "="; var cookieStart = document.cookie.indexOf(cookiePrefix); if (cookieStart > -1) { let cookieEnd = document.cookie.indexOf(";", cookieStart); if (cookieEnd == -1) { cookieEnd = document.cookie.length; } var cookieData = document.cookie.substring(cookieStart + cookiePrefix.length, cookieEnd); return JSON.parse(cookieData); } } </script>
<script type="text/javascript"> window.addEventListener('load', function() { var observer = new MutationObserver(function() { window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); observer.observe(document.body, {attributes: true, childList: true, subtree: true}); window.parent.postMessage({height: document.documentElement.scrollHeight || document.body.scrollHeight},"*"); }); </script>
</body>
</html>

NEW APPS

These are apps made by the community!

FAQ

What is Calculator Tools?

Calculator Tools allows you to instantly create and generate any simple one page web app for free and immediately have it online to use and share. This means anything! Mini apps, calculators, trackers, tools, games, puzzles, screensavers... anything you can think of that the AI can handle.

The AI uses Javacript, HTML, and CSS programming to code your app up in moments. This currently uses GPT-4 the latest and most powerful version of the OpenAI GPT language model.

What Do You Mean Make An App?

Have you ever just wanted a simple app but didn't want to learn programming or pay someone to make it for you? Calculator Tools is the solution! Just type in your prompt and the AI will generate a simple app for you in seconds. You can then customize it to your liking and share it with your friends.

AI has become so powerful it is that simple these days.

Does This Use ChatGPT?

It uses GPT-4 which is the most powerful model for ChatGPT.

Calculator Tools does not remember things from prompt to prompt, each image is a unique image that does not reference any of the images or prompts previously supplied.