Skip to content

Commit

Permalink
stars!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
circle-gon committed May 14, 2024
1 parent 8d369ad commit c10b45c
Show file tree
Hide file tree
Showing 24 changed files with 196 additions and 46 deletions.
1 change: 0 additions & 1 deletion STUFF.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
- add offline progress
- fix grammar?
- rewrite `formatGain` because it seems to be inaccurate as hell
- reorganize html elements

# Balance

Expand Down
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
<title>Incremental Mass Rewritten</title>
</head>
<body>
<div id="app"></div>
<div id="tooltips"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
27 changes: 27 additions & 0 deletions src/atom/Stars.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
You have collapsed <h4>{{ format(player.stars.collapsed, 2) }} / {{ format(Infinity) }} {{ formatGain(player.stars.collapsed, STARS.gain.value) }}</h4> stars, and based on all Rank types,<br />
<span class="green">it boosts Mass gain by <h4>{{ formatMult(STARS.effect.value) }}</h4>.</span><br /><br />
<button v-if="player.stars.unlocked < STARS.count" class="btn" :class="player.atom.quark.lt(STARS.nextAt.value) ? 'locked' : null" @click="STARS.unlock()">Unlock a new type of Star.<br />Cost: {{ formatInteger(STARS.nextAt.value) }} Quark.</button><br /><br />
<div class="table-center">
<template v-for="i in player.stars.unlocked">
<div v-if="i > 1" style="width: 30px; font-size: 30px;"><br>&larr;</div>
<div style="width: 250px">
<img :src="getSrc(i - 1)" /><br /><br />
<div>
{{ format(player.stars.stars[i - 1], 2) }}<br />
{{ formatGain(player.stars.stars[i - 1], STARS.starGain(player.stars.stars[i]))}}
</div>
</div>
</template>
</div><br /><br />
</template>
<script setup>
import { format, formatMult, formatInteger, formatGain } from "../core/format"
import { player } from "../core/save"
import { STARS } from "./stars"
// i love vite guys
function getSrc(icon) {
return new URL(`../images/stars/${icon}.png`, import.meta.url).href;
}
</script>
9 changes: 5 additions & 4 deletions src/atom/atom.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const quarkGain = computed(() => {
if (hasRankReward(0, 13)) base = base.mul(rankReward(0, 13));
if (hasElement(5)) base = base.mul(elementEffect(5));
if (player.md.upgrades[6].gte(1)) base = base.mul(MASS_DILATION.effect(6))
base = base.mul(MASS_DILATION.effect(9))
return base.floor();
});

Expand Down Expand Up @@ -88,7 +89,7 @@ export function assignParticles() {
}

export function powerGain(i) {
let base = player.atom.particles[i].pow(2);
let base = player.atom.particles[i].sqr();
if (hasUpgrade("atom", 6)) base = base.mul(upgradeEffect("atom", 6));
if (hasElement(11))
base = base.pow(
Expand Down Expand Up @@ -123,7 +124,7 @@ export const PARTICLES = [
const amt = player.atom.powers[0];

let mass = amt.add(1).pow(3)
if (hasElement(28)) mass = mass.pow(2)
if (hasElement(28)) mass = mass.sqr()

return [mass, amt.add(1).log10().mul(0.2)];
}),
Expand All @@ -138,8 +139,8 @@ export const PARTICLES = [
effect: computed(() => {
const amt = player.atom.powers[1];

let massboost = amt.add(1).pow(2)
if (hasElement(29)) massboost = massboost.pow(2)
let massboost = amt.add(1).sqr()
if (hasElement(29)) massboost = massboost.sqr()

const mass = player.mass.add(1).log10().add(1).pow(1.25);
const rage = player.rage.power
Expand Down
29 changes: 27 additions & 2 deletions src/atom/elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export const ELEMENT_UPGRADES = [
{
desc: "Dilated Mass gain is boosted by Tickspeed",
cost: 1e98,
eff: computed(() => player.buildings.tickspeed.pow(2).div(4e4).add(1)),
eff: computed(() => player.buildings.tickspeed.sqr().div(4e4).add(1)),
effDesc: x => formatMult(x)
},
{
Expand Down Expand Up @@ -335,6 +335,30 @@ export const ELEMENT_UPGRADES = [
cost: 1e233,
eff: computed(() => dilate(player.md.mass.add(1), 1 / 3).sqrt()),
effDesc: x => formatMult(x)
},
{
desc: computed(() => `Raise Dilated Mass gain by ${format(1.02, 2)}`),
cost: 1e240
},
{
desc: computed(() => `Increase C${formatInteger(7)}'s cap by ${formatInteger(200)}, and its reward is ${formatPercent(0.5, 0)} more effective`),
cost: 1e250
},
{
desc: "Relativistic Particle gain is boosted by Rage Power",
cost: 1e285,
eff: computed(() => player.rage.power.add(1).log10().add(1).pow(1.25)),
effDesc: x => formatMult(x)
},
{
desc: "Dilated Mass gain is boosted by Black Hole's mass",
cost: 1e291,
eff: computed(() => player.dm.mass.add(1).log10().add(1).pow(2.25)),
effDesc: x => formatMult(x)
},
{
desc: "Unlock Stars and more Mass Dilation upgrades",
cost: 1e300
}
];

Expand All @@ -350,7 +374,8 @@ export const elementsUnlocked = computed(() => {
if (player.challenge.comps[6].gte(16)) unl += 4;
if (player.challenge.comps[7].gte(1)) unl += 14;
if (hasElement(17)) unl += 3;
if (MASS_DILATION.unlocked.value) unl += 15;
if (hasElement(20)) unl += 15;
if (hasElement(35)) unl += 18
return unl;
});

Expand Down
43 changes: 29 additions & 14 deletions src/atom/md.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { costScaling } from "../core/cost";
import { format, formatInteger, formatMult, formatReduction } from "../core/format";
import { dilate, uni } from "../core/utils";

const unlocked = computed(() => hasElement(20));
const penalty = computed(() => 0.8);
function run() {
if (player.md.active) player.md.particle = player.md.particle.add(rpGain.value)
Expand All @@ -33,14 +32,15 @@ function createUpgrades(base) {
return base
}

function single(cost) {
function single(cost, obj) {
return {
max: 1,
cost: {
base: cost,
linear: Infinity,
quad: Infinity
}
},
...obj
}
}

Expand Down Expand Up @@ -89,12 +89,11 @@ const UPGRADES = createUpgrades([
}),
effDesc: x => formatMult(x)
},
{
...single(1.619e21),
single(1.69e21, {
desc: "Stronger's power is boosted by dilated mass",
eff: computed(() => dilate(player.md.mass.add(1).log10(), 1 / 3).div(140).add(1).pow(2)),
eff: computed(() => dilate(player.md.mass.add(1).log10(), 1 / 3).div(140).add(1).sqr()),
effDesc: x => formatMult(x)
},
}),
{
desc: computed(() => `Mass Dilation upgrade ${formatInteger(3)} scales slower`),
max: 3,
Expand All @@ -117,15 +116,29 @@ const UPGRADES = createUpgrades([
eff: computed(() => player.md.upgrades[5].mul(0.25)),
effDesc: x => `+^${format(x)}`
},
{
...single(uni(1e100)),
single(uni(1e100), {
desc: "Quark gain is boosted by Dilated Mass",
eff: computed(() => dilate(player.md.mass.add(1), 1 / 2)),
effDesc: x => formatMult(x)
},
{
...single(uni(1e267)),
}),
single(uni(1e267), {
desc: computed(() => `Mass Dilation upgrade ${formatInteger(2)} is stronger`),
}),
single(Infinity, {
desc: "All-star resources are boosted by Tickspeed",
eff: computed(() => 1),
effDesc: x => formatMult(x)
}),
{
desc: "Double Quark gain",
max: Infinity,
cost: {
base: Infinity,
linear: Infinity,
quad: Infinity
},
eff: computed(() => 1),
effDesc: x => formatMult(x)
}
]);

Expand All @@ -150,6 +163,7 @@ const rpMult = computed(() => {
let mult = effect(2)
if (hasElement(23)) mult = mult.mul(elementEffect(23))
if (hasElement(30)) mult = mult.mul(elementEffect(30))
if (hasElement(33)) mult = mult.mul(elementEffect(33))
return mult
});
const rpGain = computed(() => {
Expand All @@ -159,15 +173,16 @@ const rpGain = computed(() => {
const rpNextAt = computed(() => player.md.particle.add(1).div(rpMult.value).root(rpExp.value).add(9).mul(50).pow10());

const dilatedMassGain = computed(() => {
let gain = player.md.particle.pow(2)
let gain = player.md.particle.sqr()
gain = gain.mul(effect(0))
if (hasElement(21)) gain = gain.mul(elementEffect(21))
if (hasElement(34)) gain = gain.mul(elementEffect(34))
if (hasElement(31)) gain = gain.pow(1.03)
return gain
});
const dilatedMassEffect = computed(() => player.md.mass.add(1).log10().div(5).add(1).sqrt().pow(effect(1)));

export const MASS_DILATION = {
unlocked,
penalty,
run,
rpMult,
Expand Down
40 changes: 40 additions & 0 deletions src/atom/stars.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { computed } from "vue"
import { player } from "../core/save"
import Decimal from "break_eternity.js"
import { MASS_DILATION } from "./md"

const REQUIREMENTS = [Infinity]

const nextAt = computed(() => {
const unl = player.stars.unlocked
if (unl >= REQUIREMENTS.length) return Infinity
return REQUIREMENTS[unl]
})
function unlock() {
if (player.atom.quark.lt(nextAt.value)) return
player.atom.quark = player.atom.quark.sub(nextAt.value)
player.stars.unlocked++
}

function starGain(i) {
let gain = Decimal.dOne.add(i);
if (player.md.upgrades[8].gte(1)) gain = gain.mul(MASS_DILATION.effect(8))
return gain
}

const gain = computed(() => {
return player.stars.stars[0]
})

const effect = computed(() => {
return 1
})

export const STARS = {
count: REQUIREMENTS.length,
nextAt,
unlock,
starGain,
gain,
effect
}
2 changes: 1 addition & 1 deletion src/core/Tooltip.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<slot name="content" />
<Teleport to="body">
<Teleport to="#tooltips">
<div v-if="hovered" ref="tooltip" class="tooltip-div" :style="style">
<slot name="tooltip" />
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/core/cost.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function costScaling(data) {
cost: (amt) =>
costScale(
amtScale(amt)
.pow(2)
.sqr()
.pow_base(unref(data.quad))
.mul(amtScale(amt).pow_base(unref(data.linear)))
.mul(unref(data.base)),
Expand Down
6 changes: 6 additions & 0 deletions src/core/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { notify } from "./popups";
import { CHALLENGES } from "../main/challenges";
import { PARTICLES } from "../atom/atom";
import { MASS_DILATION } from "../atom/md";
import { STARS } from "../atom/stars";

function defaultStart() {
return {
Expand Down Expand Up @@ -41,6 +42,11 @@ function defaultStart() {
mass: Decimal.dZero,
upgrades: Array(MASS_DILATION.upgrades.length).fill(Decimal.dZero)
},
stars: {
unlocked: 0,
collapsed: Decimal.dZero,
stars: Array(STARS.count).fill(Decimal.dZero)
},
quotes: [],
options: {
notation: "sc",
Expand Down
7 changes: 7 additions & 0 deletions src/core/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import AtomicGenerator from "../atom/AtomicGenerator.vue";
import Particles from "../atom/Particles.vue";
import Elements from "../atom/Elements.vue";
import MD from "../atom/MD.vue";
import Stars from "../atom/Stars.vue"
import { player } from "./save";
import { hasElement } from "../atom/elements";

Expand All @@ -33,6 +34,12 @@ const tabs = [
class: "atom",
unlocked: computed(() => player.atom.unlocked),
},
{
name: "Stars",
comp: Stars,
class: "supernova",
unlocked: computed(() => hasElement(35))
}
],
},
{
Expand Down
Binary file added src/images/stars/0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/stars/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/stars/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/stars/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/stars/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ragePowerGain } from "./main/rage";
import { PARTICLES, atomGain, atomicPowerGain, powerGain, quarkGain } from "./atom/atom";
import { elementEffect, hasElement } from "./atom/elements";
import { MASS_DILATION } from "./atom/md";
import { STARS } from "./atom/stars";

function loop() {
const now = Date.now();
Expand Down Expand Up @@ -57,6 +58,16 @@ function loop() {
player.atom.particles[i] = player.atom.quark
.mul(0.1 * diff)
.add(player.atom.particles[i]);
if (hasElement(35))
// give the gain for each of the previous ones
// this makes the gain slightly more smoother
for (let i = player.stars.unlocked - 1; i >= 0; i--)
player.stars.stars[i] = STARS.starGain(player.stars.stars[i + 1] ?? 0)
.mul(diff)
.add(player.stars.stars[i])
player.stars.collapsed = STARS.gain.value
.mul(diff)
.add(player.stars.collapsed)
}

upgradeAuto();
Expand All @@ -73,7 +84,7 @@ function updateCss() {
}

function init() {
createApp(App).mount("body");
createApp(App).mount("#app");
loadStorage();
startAutoSave();
updateCss();
Expand Down
2 changes: 1 addition & 1 deletion src/main/Challenges.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
challengeResetText(player.challenge.chosen)
}}</span>
<p>{{ goalText }}</p>
<span class="green">{{ unref(current.reward) }}</span
<span class="green">{{ unref(current.reward) }}.</span
><br />
<template v-if="current.firstTime">
<span class="yellow">{{ unref(current.firstTime) }}</span>
Expand Down
Loading

0 comments on commit c10b45c

Please sign in to comment.