mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2024-11-10 06:02:13 +00:00
perk functionality
This commit is contained in:
parent
45815ed43d
commit
0327a49562
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.vscode
|
@ -2958,6 +2958,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="perks" class="realitytab" style="display: none;">
|
||||
<div id="pp">You have 0 Perk points</div>
|
||||
<div class="vis-network" tabindex="900" style="position: relative; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); width: 100%; height: 100%;">
|
||||
<canvas width="800" height="800" style="position: relative; touch-action: none; user-select: none; -webkit-user-drag: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); width: 100%; height: 100%;"></canvas>
|
||||
</div>
|
||||
@ -3094,6 +3095,7 @@
|
||||
<script type="text/javascript" src="javascripts/core/canvases.js"></script>
|
||||
<script type="text/javascript" src="javascripts/core/dilation.js"></script>
|
||||
<script type="text/javascript" src="javascripts/core/wormhole.js"></script>
|
||||
<script type="text/javascript" src="javascripts/core/perks.js"></script>
|
||||
<script type="text/javascript" src="javascripts/core/devtools.js"></script>
|
||||
<script type="text/javascript" src="javascripts/core/load_functions.js"></script>
|
||||
<script type="text/javascript" src="javascripts/core/newsticker.js"></script>
|
||||
|
@ -346,8 +346,8 @@ var nodes = [{id: 0, label: "0", group: 999, title: "Remove the secondary requir
|
||||
{id: 2, label: "2", group: 0, title: "+10 Automator rows."},
|
||||
{id: 3, label: "3", group: 1, title: "Remove the unlock requirement for Time Dilation."},
|
||||
{id: 4, label: "4", group: 1, title: "The 2nd rebuyable dilation upgrade no longer resets your free galaxies or dilated time."},
|
||||
{id: 5, label: "6", group: 2, title: "+1 to base glyph level."},
|
||||
{id: 6, label: "5", group: 2, title: "+1 glyph choice on reality."},
|
||||
{id: 5, label: "5", group: 2, title: "+1 to base glyph level."},
|
||||
{id: 6, label: "6", group: 2, title: "+1 glyph choice on reality."},
|
||||
];
|
||||
var edges = [{from: 0, to: 1},
|
||||
{from: 1, to: 2},
|
||||
@ -359,7 +359,7 @@ var edges = [{from: 0, to: 1},
|
||||
{from: 3, to: 4},
|
||||
]
|
||||
|
||||
var nodeContainer = document.getElementById("perks");
|
||||
var nodeContainer = $(".vis-network")[0];
|
||||
var nodeData = {
|
||||
nodes: nodes,
|
||||
edges: edges
|
||||
@ -382,6 +382,7 @@ var nodeOptions = {
|
||||
};
|
||||
network = new vis.Network(nodeContainer, nodeData, nodeOptions);
|
||||
|
||||
// TODO: lower the cost.
|
||||
network.on("click", function(params) {
|
||||
if (isFinite(params.nodes[0])) console.log("trying to buy perk #"+params.nodes[0]);
|
||||
if (isFinite(params.nodes[0])) buyPerk(params.nodes[0], 99);
|
||||
});
|
||||
|
@ -272,4 +272,8 @@ dev.updateTestSave = function() {
|
||||
player.reality.perks = []
|
||||
player.options.testVersion = 7
|
||||
}
|
||||
if (player.options.testVersion == 7) {
|
||||
player.reality.pp = 0
|
||||
player.options.testVersion = 8
|
||||
}
|
||||
}
|
@ -151,7 +151,8 @@ function onLoad() {
|
||||
epmultbuyer: {
|
||||
on: false,
|
||||
threshhold: 1
|
||||
}
|
||||
},
|
||||
pp: 0
|
||||
};
|
||||
}
|
||||
|
||||
@ -697,6 +698,8 @@ if (player.version < 5) {
|
||||
updateWormholeUpgrades()
|
||||
updateAutomatorRows()
|
||||
|
||||
$("#pp").text("You have " + player.reality.pp + " Perk Points.")
|
||||
|
||||
if (player.reality.respec) $("#glyphRespec").addClass("rUpgBought")
|
||||
if (localStorage.getItem("automatorScript1") !== null) importAutomatorScript(localStorage.getItem("automatorScript1"));
|
||||
let diff = new Date().getTime() - player.lastUpdate
|
||||
|
27
javascripts/core/perks.js
Normal file
27
javascripts/core/perks.js
Normal file
@ -0,0 +1,27 @@
|
||||
|
||||
// Key is the perk in question, value is a list of perks that are connected to that perk
|
||||
const CONNECTED_PERKS = {
|
||||
1: [0],
|
||||
2: [1],
|
||||
3: [0],
|
||||
4: [3],
|
||||
5: [0],
|
||||
6: [5]
|
||||
}
|
||||
|
||||
function hasConnectedPerk(id) {
|
||||
if (id == 0) return true
|
||||
return CONNECTED_PERKS[id].some(hasPerk)
|
||||
}
|
||||
|
||||
function hasPerk(id) {
|
||||
return player.reality.perks.includes(id)
|
||||
}
|
||||
|
||||
function buyPerk(id, cost) {
|
||||
if (cost > player.reality.pp) return false
|
||||
if (hasPerk(id) || !hasConnectedPerk(id)) return false
|
||||
|
||||
player.reality.perks.push(id)
|
||||
player.reality.pp -= cost
|
||||
}
|
@ -307,7 +307,8 @@ var player = {
|
||||
epmultbuyer: {
|
||||
on: false,
|
||||
threshhold: 1
|
||||
}
|
||||
},
|
||||
pp: 0
|
||||
},
|
||||
wormhole: {
|
||||
speed: 60 * 60, // Seconds to fill
|
||||
@ -3729,7 +3730,8 @@ function reality(force) {
|
||||
};
|
||||
|
||||
if (player.reality.upg.includes(10)) player.eternities = 100
|
||||
|
||||
player.reality.pp++;
|
||||
$("#pp").text("You have " + player.reality.pp + " Perk Points.")
|
||||
if (player.eternities <= 30) {
|
||||
document.getElementById("secondRow").style.display = "none";
|
||||
document.getElementById("thirdRow").style.display = "none";
|
||||
|
Loading…
Reference in New Issue
Block a user