polycule/index.html

186 lines
6.8 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
.box {
display: flex;
flex-direction: column;
width: 400px;
padding: 10px
}
.box > * {
padding: 3px;
}
.box > button {
padding: 3px 0;
}
p {
margin: 0;
}
</style>
</head>
<body>
<div class="box">
<h2>Polycule: <span id="cuties">0</span> cuties</h2>
<button id="inviteCutie" onClick="inviteClicked()">Invite a cutie</button>
</div>
<div class="box">
<p>Funds: $ <span id="funds">0.00</span></p>
</div>
<div class="box">
<p><span id="discordServers">0</span> Discord servers</p>
<button id="createDiscordServer" onClick="createDiscordServerClicked()">Create Discord server</button>
</div>
<div class="box">
<p><span id="twitchChannels">0</span> Twitch channels</p>
<p><span id="twitchFollowers">0</span> followers</p>
<button id="createTwitchChannel" onClick="createTwitchChannelClicked()">Create Twitch channel</button>
</div>
<div class="box">
<p><span id="catEars">0</span> cat ears</p>
<button id="buyCatEars" onClick="buyCatEarsClicked()">Buy cat ears</button>
<p>Cat ears cost: $ <span id="catEarsCost">5.00</span></p>
</div>
<div class="box">
<p><span id="minecraftServers">0</span> Minecraft servers <span id="percentRunning"></span></p>
<button id="launchMinecraftServer" onClick="launchMinecraftServerClicked()">Launch Minecraft server</button>
<button id="deployCloudOrchestration" onClick="deployCloudOrchestrationClicked()" style="display: none">Deploy cloud orchestration</button>
<p>Cloud instance cost: $ <span id="minecraftServersCost">12.00</span> / month</p>
</div>
<div class="box">
<p><span id="synthesizers">0</span> synthesizers</p>
<button id="buySynthesizer" onClick="buySynthesizerClicked()">Buy synthesizer</button>
<p>Synthesizer cost: $ <span id="synthesizersCost">100.00</span></p>
</div>
<script>
var cutieCount = 0;
var funds = 0;
var discordServers = 0;
var twitchChannels = 0;
var twitchFollowers = 0;
var catEars = 0;
var catEarsCost = 5.00;
var minecraftServers = 0;
var minecraftServersCost = 12.00;
var minecraftServersTotalCost = 0;
var cloudOrchestration = false;
var synthesizers = 0;
var synthesizersCost = 100;
var cutiesElement = document.getElementById("cuties");
var fundsElement = document.getElementById("funds");
var discordServersElement = document.getElementById("discordServers");
var twitchChannelsElement = document.getElementById("twitchChannels");
var twitchFollowersElement = document.getElementById("twitchFollowers");
var catEarsElement = document.getElementById("catEars");
var buyCatEarsElement = document.getElementById("buyCatEars");
var catEarsCostElement = document.getElementById("catEarsCost");
var minecraftServersElement = document.getElementById("minecraftServers");
var minecraftServersCostElement = document.getElementById("minecraftServersCost");
var deployCloudOrchestrationElement = document.getElementById("deployCloudOrchestration");
var percentRunningElement = document.getElementById("percentRunning");
var buySynthesizerElement = document.getElementById("buySynthesizer");
var synthesizersElement = document.getElementById("synthesizers");
var synthesizersCostElement = document.getElementById("synthesizersCost");
function inviteClicked() {
cutieCount++;
}
function createDiscordServerClicked() {
discordServers++;
}
function createTwitchChannelClicked() {
twitchChannels++;
}
function buyCatEarsClicked() {
catEars++;
funds -= catEarsCost;
catEarsCost *= 1.15;
}
function launchMinecraftServerClicked() {
minecraftServers++;
minecraftServersTotalCost += minecraftServersCost;
minecraftServersCost *= 1.15;
if (!cloudOrchestration && minecraftServers >= 100) {
deployCloudOrchestrationElement.style.display = "";
}
}
function deployCloudOrchestrationClicked() {
cloudOrchestration = true;
deployCloudOrchestrationElement.style.display = "none";
}
function buySynthesizerClicked() {
synthesizers++;
funds -= synthesizersCost;
synthesizersCost *= 1.15;
}
var fundsBaseRate = 0.00001227;
var discordRate = 0.00001;
var streamerBaseRate = 0.01;
var streamerWithCatEarsRate = 0.005;
var twitchEarningRate = 0.00001;
var synthRepRate = 0.0001;
window.setInterval(function() {
if (discordServers > 0) {
cutieCount += Math.min(discordServers, cutieCount / 100) * cutieCount * discordRate;
}
var streamers = Math.min(twitchChannels, cutieCount * (streamerBaseRate + Math.min(cutieCount, catEars) * streamerWithCatEarsRate));
if (streamers > 0) {
if (twitchFollowers < streamers * 10000) {
twitchFollowers += 0.01 * (streamers * 10000 - twitchFollowers);
} else {
twitchFollowers -= 0.01 * (twitchFollowers - streamers * 10000);
}
}
funds += cutieCount * fundsBaseRate + twitchFollowers * twitchEarningRate;
if (minecraftServers > 0) {
var cloudServerCosts = minecraftServersTotalCost / (12 * 24 * 60 * 60 * 100);
if (cloudServerCosts < funds) {
percentRunningElement.style.display = "none";
funds -= cloudServerCosts;
if (cloudOrchestration) {
minecraftServers += 0.00001 * minecraftServers;
}
} else {
percentRunningElement.style.display = "";
percentRunningElement.innerHTML = "(" + Math.floor(100 * funds / cloudServerCosts) + " % running)"
funds = 0;
}
}
synthesizers += synthesizers * synthRepRate;
cutiesElement.innerHTML = Math.floor(cutieCount);
fundsElement.innerHTML = funds.toFixed(2);
discordServersElement.innerHTML = discordServers;
twitchChannelsElement.innerHTML = twitchChannels;
twitchFollowersElement.innerHTML = Math.floor(twitchFollowers);
catEarsElement.innerHTML = catEars;
catEarsCostElement.innerHTML = catEarsCost.toFixed(2);
minecraftServersElement.innerHTML = Math.floor(minecraftServers);
minecraftServersCostElement.innerHTML = minecraftServersCost.toFixed(2);
synthesizersElement.innerHTML = Math.floor(synthesizers);
synthesizersCostElement.innerHTML = synthesizersCost.toFixed(2);
buyCatEarsElement.disabled = catEarsCost > funds;
buySynthesizerElement.disabled = synthesizersCost > funds;
}, 10);
</script>
</body>
</html>