1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2025-05-12 21:11:05 +00:00

Mostly centralized layer additions, and removed previously existing content.

This commit is contained in:
Acamaeda 2020-09-24 11:54:41 -04:00
parent f5bc5580c5
commit b55185d96c
11 changed files with 1867 additions and 4651 deletions

View file

@ -39,75 +39,24 @@ var colors_theme
function drawTree() {
if (!retrieveCanvasData()) return;
ctx.clearRect(0, 0, canvas.width, canvas.height);
if (layerShown('b')) drawTreeBranch("p", "b")
if (layerShown('g')) drawTreeBranch("p", "g")
if (layerShown('e')) {
drawTreeBranch("b", "e")
drawTreeBranch("g", "e")
for (layer in layers){
if (layers[layer].layerShown() && layers[layer].branches){
for (branch in layers[layer].branches)
{
drawTreeBranch(layer, layers[layer].branches[branch])
}
}
}
if (layerShown('t')) drawTreeBranch("b", "t")
if (layerShown('sb')) drawTreeBranch("b", "sb")
if (layerShown('sg')) drawTreeBranch("g", "sg")
if (layerShown('s')) drawTreeBranch("g", "s")
if (layerShown('h')) drawTreeBranch("t", "h")
if (layerShown('q')) drawTreeBranch("e", "q")
if (layerShown('hb')) {
drawTreeBranch("sb", "hb")
drawTreeBranch("t", "hb")
}
if (layerShown('ss')) {
drawTreeBranch("e", "ss")
drawTreeBranch("s", "ss")
}
if (layerShown('hg')) {
drawTreeBranch("sg", "hg")
}
if (layerShown('m')) {
drawTreeBranch("hb", "m")
drawTreeBranch("h", "m")
drawTreeBranch("q", "m")
}
if (layerShown('ba')) {
drawTreeBranch("h", "ba", 2)
drawTreeBranch("q", "ba")
drawTreeBranch("ss", "ba")
}
if (layerShown('sp')) {
drawTreeBranch("m", "sp")
drawTreeBranch("ba", "sp")
}
if (layerShown('l')) {
drawTreeBranch("hb", "l")
drawTreeBranch("m", "l")
}
if (layerShown('ps')) {
drawTreeBranch("h", "ps", 3)
drawTreeBranch("q", "ps", 3)
}
if (layerShown('hs')) {
drawTreeBranch("ss", "hs")
drawTreeBranch("ba", "hs")
}
if (layerShown('i')) {
drawTreeBranch("ss", "i")
drawTreeBranch("sg", "i")
}
if (layerShown('mb')) {
drawTreeBranch("l", "mb")
drawTreeBranch("ps", "mb", 2)
}
if (layerShown('ge')) {
drawTreeBranch("sp", "ge")
}
if (layerShown('ma')) {
drawTreeBranch("hs", "ma")
drawTreeBranch("i", "ma")
}
needCanvasUpdate = false;
}
function drawTreeBranch(num1, num2, color_id = 1) { // taken from Antimatter Dimensions & adjusted slightly
let start = document.getElementById(num1).getBoundingClientRect();
function drawTreeBranch(num1, data) { // taken from Antimatter Dimensions & adjusted slightly
let num2 = data[0]
let color_id = data[1]
if (document.getElementById(num1) == null || document.getElementById(num2) == null)
return
let start = document.getElementById(num1).getBoundingClientRect();
let end = document.getElementById(num2).getBoundingClientRect();
let x1 = start.left + (start.width / 2) + (document.getElementById("treeTab").scrollLeft || document.body.scrollLeft);
let y1 = start.top + (start.height / 2) + (document.getElementById("treeTab").scrollTop || document.body.scrollTop);

3751
js/game.js

File diff suppressed because it is too large Load diff

123
js/layers.js Normal file
View file

@ -0,0 +1,123 @@
var layers = {
c: {
startData() { return {
unl: true,
points: new Decimal(0),
best: new Decimal(0),
upgrades: [],
}},
color: "#4BEC13",
requires() {return new Decimal(10)}, // Can be a function that takes requirement increases into account
resource: "lollipops", // Name of prestige currency
baseResource: "candies", // Name of resource prestige is based on
baseAmount() {return player.points},
type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have
exponent: 0.5, // Prestige currency exponent
base: 5, // Only needed for static layers, base of the formula (b^(x^exp))
resCeil: false, // True if the resource needs to be rounded up
canBuyMax() {}, // Only needed for static layers
gainMult() {
mult = new Decimal(1)
if (player.c.upgrades.includes(21)) mult = mult.times(2)
if (player.c.upgrades.includes(23)) mult = mult.times(LAYER_UPGS.c[23].currently())
return mult
},
gainExp() {
return new Decimal(1)
},
row: 0,
effect() {return { // Formulas for any boosts inherent to resources in the layer. Can return a single value instead of an object if there is just one effect
waffleBoost: (true == false ? 0 : Decimal.pow(player.c.points, 0.2)),
icecreamCap: (player.c.points * 10)
}},
effectDescription() {
eff = layer.c.effect();
return "which are boosting waffles by "+format(eff.waffleBoost)+" and increasing the Ice Cream cap by "+format(eff.icecreamCap)
},
upgrades: {
rows: 1,
cols: 3,
11: {
desc: "Gain 1 Candy every second.",
cost: new Decimal(1),
unl() { return player.c.unl },
},
12: {
desc: "Candy generation is faster based on your unspent Lollipops.",
cost: new Decimal(1),
unl() { return player.c.upgrades.includes(11) },
effect() {
let ret = player.c.points.add(1).pow(player.c.upgrades.includes(24)?1.1:(player.c.upgrades.includes(14)?0.75:0.5))
if (ret.gte("1e20000000")) ret = ret.sqrt().times("1e10000000")
return ret;
},
effDisp(x) { return format(x)+"x" },
},
13: {
desc: "Make this layer act like you bought it first.",
cost: new Decimal(69),
currencyDisplayName: "candies", // Use if using a nonstandard currency
currencyInternalName: "points", // Use if using a nonstandard currency
currencyLayer: "", // Leave empty if not in a layer "e.g. points"
unl() { return player.c.upgrades.includes(12) },
onPurchase() {
player.c.order = 0
}
},
},
convertToDecimal() {
// Convert any layer-specific values (besides points, total, and best) to Decimal
},
layerShown() {return true}, // Condition for when layer appears
update(diff) {
if (player.c.upgrades.includes(11)) player.points = player.points.add(tmp.pointGen.times(diff)).max(0)
}, // Do any gameloop things (e.g. resource generation) inherent to this layer
automate() {
}, // Do any automation inherent to this layer if appropriate
updateTemp() {
}, // Do any necessary temp updating
resetsNothing() {return false},
incr_order: [], // Array of layer names to have their order increased when this one is first unlocked
},
f: {
startData() { return {
unl: false,
points: new Decimal(0),
best: new Decimal(0),
}},
color: "#FE0102",
requires() {return new Decimal(200)}, // Can be a function that takes requirement increases into account
resource: "butts", // Name of prestige currency
baseResource: "points", // Name of resource prestige is based on
baseAmount() {return player.points},
type: "normal", // normal: cost to gain currency depends on amount gained. static: cost depends on how much you already have
exponent: 0.5, // Prestige currency exponent
resCeil: false, // True if the resource needs to be rounded up
gainMult() {
mult = new Decimal(1)
},
gainExp() {
return new Decimal(1)
},
row: 1,
effect() {return},
layerShown() {return true}, // Condition for when layer appears
resetsNothing() {return false},
branches: [["c", 1]] // Each pair corresponds to a line added to the tree when this node is unlocked. The letter is the other end of the line, and the number affects the color, 1 is default
},
}
function layerShown(layer){
return layers[layer].layerShown();
}
const LAYERS = Object.keys(layers);
var ROW_LAYERS = {}
for (layer in layers){
row = layers[layer].row
if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {}
ROW_LAYERS[row][layer]=layer;
}

View file

@ -1,132 +1,37 @@
function updateTemp() {
if (!tmp.challActive) {
let LAYERS_WITH_CHALLS = Object.keys(LAYER_CHALLS)
tmp.challActive = {}
for (let i = 0; i < LAYERS_WITH_CHALLS.length; i++) {
tmp.challActive[LAYERS_WITH_CHALLS[i]] = {}
updateChallTemp(LAYERS_WITH_CHALLS[i])
if (!tmp.challActive) {tmp.challActive = {}}
for (layer in layers) {
if(layers[layer].challs !== undefined){
tmp.challActive[layer] = {}
updateChallTemp(layer)
}
}
if (!tmp.layerEffs) tmp.layerEffs = {}
for (let name in LAYER_EFFS) tmp.layerEffs[name] = LAYER_EFFS[name]()
for (layer in layers) tmp.layerEffs[layer] = layers[layer].effect()
if (!tmp.layerReqs) tmp.layerReqs = {}
for (let name in LAYER_REQS) tmp.layerReqs[name] = getLayerReq(name)
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
if (!tmp.gainMults) tmp.gainMults = {}
if (!tmp.gainExp) tmp.gainExp = {}
if (!tmp.resetGain) tmp.resetGain = {}
if (!tmp.nextAt) tmp.nextAt = {}
if (!tmp.layerAmt) tmp.layerAmt = {}
for (let i in LAYERS) {
tmp.layerAmt[LAYERS[i]] = getLayerAmt(LAYERS[i])
tmp.gainMults[LAYERS[i]] = getLayerGainMult(LAYERS[i])
tmp.gainExp[LAYERS[i]] = getLayerGainExp(LAYERS[i])
tmp.resetGain[LAYERS[i]] = getResetGain(LAYERS[i])
tmp.nextAt[LAYERS[i]] = getNextAt(LAYERS[i])
for (layer in layers) {
tmp.layerAmt[layer] = layers[layer].baseAmount()
tmp.gainMults[layer] = layers[layer].gainMult()
tmp.gainExp[layer] = layers[layer].gainExp()
tmp.resetGain[layer] = getResetGain(layer)
tmp.nextAt[layer] = getNextAt(layer)
}
tmp.pointGen = getPointGen()
tmp.scaling12b = getScaling12Boosters()
tmp.atbb = addToBoosterBase()
tmp.atgb = addToGenBase()
tmp.genPowEff = getGenPowerEff()
tmp.enhPow = getEnhancerPow()
tmp.enhEff = getEnhancerEff()
tmp.enhEff2 = getEnhancerEff2()
tmp.subbedEnh = new Decimal(0)
if (tmp.challActive ? tmp.challActive.h[52] : true) {
tmp.subbedEnh = tmp.subbedEnh.add(new Decimal(player.h.time).times(40).add(1).log10().pow(10).max(10)).round()
}
tmp.freeExtCap = getFreeExtCapsules()
tmp.timeEff = getTimeEnergyEff()
tmp.attb = addToTimeBase()
tmp.mttb = multiplyToTimeBase()
if (layerUnl("s")) {
tmp.s = {
sb: {},
sbEff: {}
}
var data = tmp.s
data.sbUnl = getSpaceBuildingsUnl()
data.trueSbUnl = Decimal.min(data.sbUnl, SPACE_BUILDINGS.max).floor().toNumber()
data.sbCostMult = getSpaceBuildingCostMult()
data.sbCostMod = getSpaceBuildingCostMod()
data.sbExtra = getExtraBuildingLevels()
data.sbPow = getSpaceBuildingPow()
data.sbSum = sumValues(player.s.buildings)
for (let i=data.trueSbUnl;i>=1;i--) {
data.sb[i] = fixValue(player.s.buildings[i])
data.sbEff[i] = getSpaceBuildingEff(i)
}
}
tmp.quirkEff = getQuirkEnergyEff()
tmp.qCB = getQuirkLayerCostBase()
tmp.ssEff1 = getSubspaceEff1()
tmp.ssEff2 = getSubspaceEff2()
tmp.ssEff3 = getSubspaceEff3()
tmp.balEff = getBalancePowerEff()
tmp.balEff2 = getBalanceTypesEff()
tmp.baExp = getBalanceEnergyExp()
tmp.hexEff = getHexEff()
tmp.spellsUnl = player.sp.upgrades.includes(13)?4:3
if (!tmp.spellEffs) tmp.spellEffs = {}
for (let i=1;i<=4;i++) tmp.spellEffs[i] = getSpellEff(i)
tmp.sGenPowEff = getSGenPowEff()
if (layerUnl("l")) {
if (!tmp.l) tmp.l = {
lb: {},
lbEff: {}
}
var data = tmp.l
var data2 = LIFE_BOOSTERS
data.lpEff = data2.eff()
data.lbUnl = data2.unl()
for (let i=1;i<=data2.max;i++) {
data.lb[i] = fixValue(player.l.boosters[i])
data.lbEff[i] = data2[i].eff(data.lb[i].times(data.lpEff))
}
}
if (layerUnl("hs")) {
if (!tmp.hs) tmp.hs = {
su: {},
suEff: {}
}
var data = tmp.hs
var data2 = HYPERSPACE
data.eff = data2.eff()
for (let i=1;i<=tmp.s.trueSbUnl;i++) data.su[i] = fixValue(player.hs.superUpgrades[i])
}
if (layerUnl("i")) {
if (!tmp.i) tmp.i = {}
var data = tmp.i
data.work = new Decimal(1)
if (player.i.building) data.work = data.work.add(player.i.extraBuildings.add(1).sqrt().add(1).div(5))
data.workEff = Decimal.pow(2, data.work.sub(1))
data.collapse = {}
for (var i = 1; i <= IMPERIUM.maxCollapseRows; i++) if (data.work.gt(i + 0.5)) data.collapse[i] = data.work.sub(i + 0.5).times(2).min(1)
data.compressed = tmp.s.sbUnl.sub(SPACE_BUILDINGS.max).max(0).floor().toNumber()
for (layer in layers){
if (layers[layer].updateTemp) layers[layer].updateTemp()
}
}
@ -134,7 +39,7 @@ function updateChallTemp(layer) {
if (player[layer] === undefined) return
let data = tmp.challActive[layer]
let data2 = LAYER_CHALLS[layer]
let data2 = layers[layer].challs
let customActive = data2.active !== undefined
for (let row = 1; row <= data2.rows; row++) {
for (let col = 1; col <= data2.cols; col++) {

43
js/v.js
View file

@ -10,15 +10,18 @@ function loadVue() {
showTab(layer)
}"
v-bind:tooltip="
layerUnl(layer) ? formatWhole(player[layer].points) + ' ' + LAYER_RES[layer]
: 'Reach ' + formatWhole(tmp.layerReqs[layer]) + ' ' + LAYER_AMT_NAMES[layer] + ' to unlock (You have ' + formatWhole(tmp.layerAmt[layer]) + ' ' + LAYER_AMT_NAMES[layer] + ')'
player[layer].unl ? formatWhole(player[layer].points) + ' ' + layers[layer].resource
: 'Reach ' + formatWhole(tmp.layerReqs[layer]) + ' ' + layers[layer].baseResource + ' to unlock (You have ' + formatWhole(tmp.layerAmt[layer]) + ' ' + layers[layer].baseResource + ')'
"
v-bind:class="{
treeNode: true,
[layer]: true,
hidden: !layerShown(layer),
locked: !layerUnl(layer),
can: layerUnl(layer)
hidden: !layers[layer].layerShown(),
locked: !player[layer].unl,
can: layerUnl(layer),
}"
v-bind:style="{
'background-color': layers[layer].color,
}">
{{abb}}
</button>
@ -29,6 +32,7 @@ function loadVue() {
data: {
player,
tmp,
layers,
Decimal,
format,
formatWhole,
@ -36,41 +40,14 @@ function loadVue() {
focused,
getThemeName,
layerUnl,
getLayerEffDesc,
doReset,
buyUpg,
getEnhancerCost,
getExtCapsuleCost,
getSpace,
getSpaceBuildingsUnl,
getSpaceBuildingCost,
getSpaceBuildingEffDesc,
buyBuilding,
getQuirkLayerCost,
buyQuirkLayer,
startChall,
milestoneShown,
destroyBuilding,
getSpellDesc,
activateSpell,
spellActive,
updateToCast,
keepGoing,
VERSION,
ENDGAME,
LAYERS,
LAYER_RES,
LAYER_TYPE,
LAYER_UPGS,
LAYER_EFFS,
LAYER_AMT_NAMES,
LAYER_RES_CEIL,
LAYER_CHALLS,
SPACE_BUILDINGS,
SPELL_NAMES,
LIFE_BOOSTERS,
HYPERSPACE,
IMPERIUM
LAYERS
},
})
}