add an unlock to wormhole

This commit is contained in:
IvarK 2018-07-27 09:46:27 +03:00
parent 36209e5b89
commit 9f018cd4dd
4 changed files with 39 additions and 26 deletions

View File

@ -2803,7 +2803,8 @@
</table>
</div>
<div id="wormhole" class="realitytab" style="display: none;">
<div>
<button class="realityUpgrade" onclick="unlockWormhole">Unleash the Wormhole<br>Costs 50 RM</button>
<div id="wormholecontainer" style="display: none">
<h1>Here will be some fancy animation made with canvas (probably by Omsi)</h1>
<div class="radial-progress" data-progress="0">
<div class="circle">

View File

@ -124,7 +124,7 @@ function onLoad() {
if (player.thisReality === undefined) player.thisReality = player.totalTimePlayed;
if (player.bestReality === undefined) player.bestReality = 9999999999;
if (player.lastTenRealities === undefined) player.lastTenRealities = [[600*60*24*31, 1, 0], [600*60*24*31, 1, 0], [600*60*24*31, 1, 0], [600*60*24*31, 1, 0], [600*60*24*31, 1, 0], [600*60*24*31, 1, 0], [600*60*24*31, 1, 0], [600*60*24*31, 1, 0], [600*60*24*31, 1, 0], [600*60*24*31, 1, 0]];
if (player.wormhole === undefined) player.wormhole = { speed: 60 * 60, power: 5, duration: 10, phase: 0, active: false }
if (player.wormhole === undefined) player.wormhole = { speed: 60 * 60, power: 5, duration: 10, phase: 0, active: false, unlocked: false }
if (player.reality === undefined) player.reality = { realityMachines: new Decimal(0), glyphs: {active: [], inventory: [], slots: 3}, seed: Math.floor(Date.now() * Math.random()+1), upg: [], upgReqs: [null, true, true, true, true, true, false, false, false, false, false], upgReqChecks: [false], automatorRows: 0, automatorCommands: [] };
setTheme(player.options.theme);
@ -607,7 +607,8 @@ if (player.version < 5) {
document.getElementById("sixthRow").style.display = "none";
document.getElementById("seventhRow").style.display = "none";
document.getElementById("eightRow").style.display = "none";
}
}
if (player.wormhole.unlocked) $("#wormholecontainer").show()
if (!player.options.hotkeys) document.getElementById("hotkeys").textContent = "Enable hotkeys"
updateAutobuyers();

View File

@ -19,6 +19,14 @@
else $("#wormholeduration").removeClass("rUpgUn")
}
function unlockWormhole() {
if (player.reality.realityMachines.lt(50)) return false
if (player.wormhole.unlocked) return false
player.wormhole.unlocked = true
player.reality.realityMachines = player.reality.realityMachines.minus(50)
$("#wormholecontainer").show()
}
function getWormholeIntervalCost() {
var amountOfPurchases = Math.round(Math.log(player.wormhole.speed / 3600) / Math.log(0.8))
return Math.pow(2.5, amountOfPurchases) * 15
@ -36,24 +44,24 @@ function getWormholeDurationCost() {
function upgradeWormholeInterval() {
var cost = getWormholeIntervalCost()
if (cost > player.reality.realityMachines) return false
player.reality.realityMachines -= cost
if (player.reality.realityMachines.lt(cost)) return false
player.reality.realityMachines = player.reality.realityMachines.minus(cost)
player.wormhole.speed *= 0.8
updateWormholeUpgrades()
}
function upgradeWormholePower() {
var cost = getWormholePowerCost()
if (cost > player.reality.realityMachines) return false
player.reality.realityMachines -= cost
if (player.reality.realityMachines.lt(cost)) return false
player.reality.realityMachines = player.reality.realityMachines.minus(cost)
player.wormhole.speed *= 1.35
updateWormholeUpgrades()
}
function upgradeWormholeDuration() {
var cost = getWormholeDurationCost()
if (cost > player.reality.realityMachines) return false
player.reality.realityMachines -= cost
if (player.reality.realityMachines.lt(cost)) return false
player.reality.realityMachines = player.reality.realityMachines.minus(cost)
player.wormhole.speed *= 1.5
updateWormholeUpgrades()
}
@ -73,4 +81,19 @@ function wormHoleLoop(diff) {
player.wormhole.active = true
}
}
}
var rotation = player.wormhole.phase / player.wormhole.speed * 180
if (player.wormhole.active ) {
$('.radial-progress .inset').css("background-color", "red")
var rotation = player.wormhole.phase / player.wormhole.duration * 180
$('.circle .fill').css("background-color", 'red');
}
else {
$('.radial-progress .inset').css("background-color", "#fbfbfb")
$('.circle .fill').css("background-color", "#97a71d")
}
$('.circle .fill').css("transform", 'rotate(' + rotation + 'deg)');
$('.circle .full').css("transform", 'rotate(' + rotation + 'deg)');
$('.circle .fill .fix').css("transform", 'rotate(' + (rotation * 2) + 'deg)');
}

View File

@ -292,7 +292,8 @@ var player = {
power: 5, // Multiplier from the wormhole
duration: 10, // How long it lasts.
phase: 0,
active: false
active: false,
unlocked: false
},
options: {
newsHidden: false,
@ -4964,6 +4965,7 @@ function gameLoop(diff) {
speedmod = glyph.effects.speed
}
}
if (player.wormhole.active) speedmod *= player.wormhole.power
if (player.thisInfinityTime < -10) player.thisInfinityTime = Infinity
if (player.bestInfinityTime < -10) player.bestInfinityTime = Infinity
if (diff > player.autoTime && !player.break) player.infinityPoints = player.infinityPoints.plus(player.autoIP.times(diff/player.autoTime))
@ -5570,21 +5572,7 @@ function gameLoop(diff) {
document.getElementById("infinityPoints2").innerHTML = "You have <span class=\"IPAmount2\">"+shortenDimensions(player.infinityPoints)+"</span> Infinity points."
document.getElementById("realitymachine").innerHTML = "Make a new reality<br>Machines gained: "+shortenDimensions(gainedRealityMachines())+" ("+percentToNextRealityMachine()+"%)<br>Glyph level: "+shortenDimensions(gainedGlyphLevel())+" ("+percentToNextGlyphLevel()+"%)"
document.getElementById("realitymachines").innerHTML = "You have <span class=\"IPAmount1\">"+shortenDimensions(player.reality.realityMachines)+"</span> Reality Machines."
var rotation = player.wormhole.phase / player.wormhole.speed * 180
if (player.wormhole.active ) {
$('.radial-progress .inset').css("background-color", "red")
var rotation = player.wormhole.phase / player.wormhole.duration * 180
$('.circle .fill').css("background-color", 'red');
}
else {
$('.radial-progress .inset').css("background-color", "#fbfbfb")
$('.circle .fill').css("background-color", "#97a71d")
}
$('.circle .fill').css("transform", 'rotate(' + rotation + 'deg)');
$('.circle .full').css("transform", 'rotate(' + rotation + 'deg)');
$('.circle .fill .fix').css("transform", 'rotate(' + (rotation * 2) + 'deg)');
wormHoleLoop(diff)
if (player.wormhole.unlocked) wormHoleLoop(diff)
player.lastUpdate = thisUpdate;
}