Address PR comments

This commit is contained in:
SpectralFlame 2019-08-08 19:34:52 -05:00
parent ce83a8c71d
commit baf6720b5d
21 changed files with 142 additions and 119 deletions

View File

@ -19,7 +19,15 @@ Vue.component("alchemy-resource-info", {
return this.resource.isBaseResource;
},
reactionText() {
return this.resource.reactionText;
const resource = this.resource;
if (resource.reaction === null) return "Base Resource";
const isReality = resource.reaction._product.id === ALCHEMY_RESOURCE.REALITY;
const reagentStrings = [];
for (const reagent of resource.reaction._reagents) {
reagentStrings.push(`${isReality ? "" : reagent.cost}${reagent.resource.symbol}`);
}
const product = Math.floor(100 * resource.reaction.baseProduction * resource.reaction.reactionEfficiency) / 100;
return `${reagentStrings.join(" + ")}${isReality ? "" : product}${resource.reaction._product.symbol}`;
},
effectConfig() {
const resource = this.resource;

View File

@ -4,30 +4,35 @@ Vue.component("compression-button", {
data() {
return {
timeShards: new Decimal(0),
shardRequirement: new Decimal("1e3500000"),
canCompress: false,
isRunning: false,
hasGain: false,
requiredForGain: new Decimal(0),
entanglementGain: 0
};
},
computed: {
shardRequirement() {
return TimeCompression.timeShardRequirement;
},
canCompress() {
return this.timeShards.gte(this.shardRequirement);
}
},
methods: {
update() {
this.timeShards.copyFrom(player.timeShards);
this.canCompress = this.timeShards.gte(this.shardRequirement);
this.isRunning = player.celestials.ra.compression.active;
if (!this.isRunning) return;
this.hasGain = getEntanglementGain() > 0;
this.hasGain = TimeCompression.entanglementGain > 0;
if (this.hasGain) {
this.entanglementGain = getEntanglementGain();
this.entanglementGain = TimeCompression.entanglementGain;
} else {
this.requiredForGain.copyFrom(minAntimatterForEntanglement());
this.requiredForGain.copyFrom(TimeCompression.minAntimatterForEntanglement);
}
}
},
template:
`<button class="o-compression-btn" onclick="toggleCompression()">
`<button class="o-compression-btn" onclick="TimeCompression.toggle()">
<span v-if="!canCompress && !isRunning">
Time compression requires {{ shorten(shardRequirement) }} time shards to activate.
<br>

View File

@ -25,13 +25,8 @@ Vue.component("compression-upgrade", {
methods: {
update() {
this.isBought = this.upgrade.isBought;
if (this.isBought) {
// eslint-disable-next-line no-bitwise
this.isActive = new Decimal(this.upgrade.config.resource()).gte(this.upgrade.config.threshold()) ^
this.upgrade.config.invertedCondition;
} else {
this.isAffordable = this.upgrade.isAffordable;
}
this.isActive = this.upgrade.canBeApplied;
this.isAffordable = this.upgrade.isAffordable;
}
},
template:
@ -54,8 +49,8 @@ Vue.component("compression-upgrade", {
singular="Entanglement"
plural="Entanglement"
/>
<div v-else-if="isActive">Active!</div>
<div v-else>Inactive</div>
<div v-else-if="isActive">Active! (Cost: {{ upgrade.config.cost }})</div>
<div v-else>Inactive (Cost: {{ upgrade.config.cost }})</div>
</button>
</div>`
});

View File

@ -4,7 +4,7 @@ Vue.component("time-compression-tab", {
data() {
return {
entanglement: 0,
recordAntimatter: new Decimal(0),
totalEntanglement: 0,
respec: false,
};
},
@ -43,7 +43,7 @@ Vue.component("time-compression-tab", {
methods: {
update() {
this.entanglement = player.celestials.ra.compression.entanglement;
this.recordAntimatter.copyFrom(player.dilation.tachyonParticles);
this.totalEntanglement = TimeCompression.totalEntanglement;
this.respec = player.celestials.ra.compression.respec;
}
},
@ -54,6 +54,9 @@ Vue.component("time-compression-tab", {
<span class="c-dilation-tab__tachyons">{{shorten(entanglement, 2, 2)}}</span>
Entanglement.
</span>
<span>
Your total entanglement is {{shorten(totalEntanglement, 2, 2)}}.
</span>
<compression-button />
<span>
Time compression is a stronger type of dilation which dilates values twice, <br>

View File

@ -42,8 +42,8 @@ Vue.component("normal-dim-shift-row", {
this.requirement.amount = requirement.amount;
this.isBuyable = requirement.isSatisfied;
this.isShift = DimBoost.isShift;
this.purchasedBoosts = DimBoost.purchasedBoosts();
this.freeBoosts = DimBoost.freeBoosts();
this.purchasedBoosts = DimBoost.purchasedBoosts;
this.freeBoosts = DimBoost.freeBoosts;
},
softReset() {
softResetBtnClick();

View File

@ -42,8 +42,8 @@ Vue.component("new-dim-shift-row", {
this.requirement.amount = requirement.amount;
this.isBuyable = requirement.isSatisfied;
this.isShift = DimBoost.isShift;
this.purchasedBoosts = DimBoost.purchasedBoosts();
this.freeBoosts = DimBoost.freeBoosts();
this.purchasedBoosts = DimBoost.purchasedBoosts;
this.freeBoosts = DimBoost.freeBoosts;
},
softReset() {
softResetBtnClick();

View File

@ -15,18 +15,18 @@ Vue.component("game-header", {
// won't trigger display update if we, say, switch from one challenge to another
function celestialReality(celestial, name) {
return {
name: () => name,
name: () => `${name} Reality`,
isActive: token => token,
activityToken: () => celestial.isRunning
};
}
return [
celestialReality(Teresa, "Teresa's Reality"),
celestialReality(Effarig, "Effarig's Reality"),
celestialReality(Enslaved, "The Enslaved Ones' Reality"),
celestialReality(V, "V's Reality"),
celestialReality(Ra, "Ra's Reality"),
celestialReality(Laitela, "Lai'tela's Reality"),
celestialReality(Teresa, "Teresa's"),
celestialReality(Effarig, "Effarig's"),
celestialReality(Enslaved, "The Enslaved Ones'"),
celestialReality(V, "V's"),
celestialReality(Ra, "Ra's"),
celestialReality(Laitela, "Lai'tela's"),
{
name: () => "Time Dilation",
isActive: token => token,

View File

@ -38,7 +38,7 @@ Vue.component("statistics-tab", {
methods: {
update() {
this.totalAntimatter.copyFrom(player.totalAntimatter);
this.boosts = DimBoost.purchasedBoosts();
this.boosts = DimBoost.purchasedBoosts;
this.galaxies = Math.round(player.galaxies);
this.realTimePlayed.setFrom(Date.now() - player.gameCreatedTime);
const progress = PlayerProgress.current;

View File

@ -69,7 +69,7 @@ Autobuyer.dimboost = new class DimBoostAutobuyerState extends IntervaledAutobuye
maxBuyDimBoosts();
return;
}
if (DimBoost.purchasedBoosts() >= this.maxDimBoosts && player.galaxies < this.galaxies) {
if (DimBoost.purchasedBoosts >= this.maxDimBoosts && player.galaxies < this.galaxies) {
return;
}
if (this.isBulkBuyUnlocked && !DimBoost.isShift) {

View File

@ -33,17 +33,6 @@ class AlchemyResourceState extends GameMechanicState {
return this.config.effect(this.amount);
}
get reactionText() {
if (this.reaction === null) return "Base Resource";
const isReality = this.reaction._product.id === ALCHEMY_RESOURCE.REALITY;
const reagentStrings = [];
for (const reagent of this.reaction._reagents) {
reagentStrings.push(`${isReality ? "" : reagent.cost}${reagent.resource.symbol}`);
}
const produced = `${Math.floor(100 * this.reaction.baseProduction * this.reaction.reactionEfficiency) / 100}`;
return `${reagentStrings.join(" + ")}${isReality ? "" : produced}${this.reaction._product.symbol}`;
}
get reaction() {
return AlchemyReactions.all[this.id];
}

View File

@ -1,58 +1,72 @@
"use strict";
function toggleCompression() {
if (player.timeShards.lt(new Decimal("1e3500000")) && !Ra.isCompressed) {
return;
const TimeCompression = {
get timeShardRequirement() {
return new Decimal("1e3500000");
},
toggle() {
if (player.timeShards.lt(this.timeShardRequirement) && !Ra.isCompressed) {
return;
}
if (Ra.isCompressed) {
this.rewardEntanglement();
}
eternity(false, false, { switchingDilation: true });
player.dilation.active = false;
Ra.isCompressed = !Ra.isCompressed;
},
get totalEntanglement() {
return Ra.entanglement + Ra.spentEntanglement;
},
// Updates entanglement
rewardEntanglement() {
const newEntanglement = TimeCompression.entanglementThisRun;
Ra.entanglement = Math.max(Ra.entanglement, newEntanglement - Ra.spentEntanglement);
},
// Returns how much entanglement the current run will give
get entanglementThisRun() {
if (!Ra.isCompressed) {
return 0;
}
const value = player.antimatter;
const entanglementMult = Effects.max(1, CompressionUpgrade.moreEntanglement);
return 308 * Math.clamp((Math.pow(value.log10() / 2e5, 0.4) - 1) / 10 * entanglementMult, 0, 1);
},
// Returns amount of entanglement gained this run, used only for display purposes
get entanglementGain() {
return Math.max(0, this.entanglementThisRun - this.totalEntanglement);
},
// Returns the mimimum antimatter to gain entanglement, only used for display
get minAntimatterForEntanglement() {
if (this.totalEntanglement === 308) {
return Decimal.pow10(9e15);
}
const entanglementMult = Effects.max(1, CompressionUpgrade.moreEntanglement);
return Decimal.pow10(2e5 * Math.pow(1 + this.totalEntanglement / (30.8 * entanglementMult), 2.5));
}
if (Ra.isCompressed) {
rewardEntanglement();
}
eternity(false, false, { switchingDilation: true });
player.dilation.active = false;
Ra.isCompressed = !Ra.isCompressed;
}
function totalEntanglement() {
return Ra.entanglement + Ra.spentEntanglement;
}
// Updates entanglement
function rewardEntanglement() {
const newEntanglement = entanglementThisRun();
Ra.entanglement = Math.max(Ra.entanglement, newEntanglement - Ra.spentEntanglement);
}
// Returns how much entanglement the current run will give
function entanglementThisRun() {
if (!Ra.isCompressed) {
return 0;
}
const value = player.antimatter;
const entanglementMult = Effects.max(1, CompressionUpgrade.moreEntanglement);
return 308 * Math.clamp((Math.pow(value.log10() / 2e5, 0.4) - 1) / 10 * entanglementMult, 0, 1);
}
// Returns amount of entanglement gained this run, used only for display purposes
function getEntanglementGain() {
return Math.max(0, entanglementThisRun() - totalEntanglement());
}
// Returns the mimimum antimatter to gain entanglement, only used for display
function minAntimatterForEntanglement() {
if (Ra.entanglement === 100) {
return Decimal.pow10(9e15);
}
const entanglementMult = Effects.max(1, CompressionUpgrade.moreEntanglement);
return Decimal.pow10(2e5 * Math.pow(1 + totalEntanglement() / (30.8 * entanglementMult), 2.5));
}
class CompressionUpgradeState extends SetPurchasableMechanicState {
class CompressionUpgradeState extends BitPurchasableMechanicState {
get currency() {
return Currency.entanglement;
}
get set() {
return player.celestials.ra.compression.upgrades;
get bitIndex() {
return this.id;
}
get bits() {
return player.celestials.ra.compression.upgradeBits;
}
set bits(value) {
player.celestials.ra.compression.upgradeBits = value;
}
get canBeApplied() {
@ -77,3 +91,12 @@ const CompressionUpgrade = (function() {
matterBoost: new CompressionUpgradeState(db.matterBoost)
};
})();
const CompressionUpgrades = {
all: Object.values(CompressionUpgrade),
respec() {
Ra.entanglement += Ra.spentEntanglement;
player.celestials.ra.compression.upgradeBits = 0;
player.celestials.ra.compression.respec = false;
}
};

View File

@ -253,21 +253,14 @@ const Ra = {
player.celestials.ra.compression.entanglement = value;
},
get spentEntanglement() {
const upgradeNames = Object.keys(CompressionUpgrade);
let spentTotal = 0;
for (const name of upgradeNames) {
const upgrade = CompressionUpgrade[name];
for (const upgrade of CompressionUpgrades.all) {
if (upgrade.isBought) {
spentTotal += upgrade.cost;
}
}
return spentTotal;
},
respecEntanglement() {
this.entanglement += this.spentEntanglement;
player.celestials.ra.compression.upgrades = new Set();
player.celestials.ra.compression.respec = false;
},
get isRunning() {
return player.celestials.ra.run;
},

View File

@ -42,7 +42,7 @@ class DimBoost {
static get isShift() {
// Player starts with 4 unlocked dimensions,
// hence there are just 4 (or 2, if in Auto DimBoosts challenge) shifts
return DimBoost.purchasedBoosts() + 4 < this.maxShiftTier;
return DimBoost.purchasedBoosts + 4 < this.maxShiftTier;
}
static get requirement() {
@ -50,7 +50,7 @@ class DimBoost {
}
static bulkRequirement(bulk) {
const targetResets = DimBoost.purchasedBoosts() + bulk;
const targetResets = DimBoost.purchasedBoosts + bulk;
const tier = Math.min(targetResets + 3, this.maxShiftTier);
let amount = 20;
@ -78,16 +78,16 @@ class DimBoost {
return new DimBoostRequirement(tier, amount);
}
static purchasedBoosts() {
static get purchasedBoosts() {
return player.dimensionBoosts;
}
static freeBoosts() {
static get freeBoosts() {
return Math.floor(Effects.max(0, CompressionUpgrade.freeBoost));
}
static totalBoosts() {
return this.purchasedBoosts() + this.freeBoosts();
return this.purchasedBoosts + this.freeBoosts;
}
}

View File

@ -396,7 +396,7 @@ let player = {
compression: {
active: false,
entanglement: 0,
upgrades: new Set(),
upgradeBits: 0,
respec: false
},
},

View File

@ -367,7 +367,7 @@ function completeReality(force, reset, auto = false) {
NormalDimensions.reset();
secondSoftReset();
if (player.celestials.ra.disCharge) disChargeAll();
if (player.celestials.ra.compression.respec) Ra.respecEntanglement();
if (player.celestials.ra.compression.respec) CompressionUpgrades.respec();
player.celestials.ra.peakGamespeed = 1;
if (isRUPG10Bought) {
player.eternities = new Decimal(100);

View File

@ -79,7 +79,7 @@ GameDatabase.achievements.normal = [
id: 25,
name: "Boosting to the max",
tooltip: "Buy 10 Dimension Boosts.",
checkRequirement: () => DimBoost.purchasedBoosts() >= 10,
checkRequirement: () => DimBoost.purchasedBoosts >= 10,
checkEvent: GameEvent.DIMBOOST_AFTER
},
{
@ -190,7 +190,7 @@ GameDatabase.achievements.normal = [
id: 43,
name: "Zero Deaths",
tooltip: "Get to Infinity without Dimension shifts, boosts or Antimatter Galaxies in a challenge.",
checkRequirement: () => player.galaxies === 0 && DimBoost.purchasedBoosts() === 0,
checkRequirement: () => player.galaxies === 0 && DimBoost.purchasedBoosts === 0,
checkEvent: GameEvent.BIG_CRUNCH_BEFORE,
reward: "Dimensions 1-4 are 25% stronger.",
effect: 1.25
@ -373,7 +373,7 @@ GameDatabase.achievements.normal = [
checkRequirement: () =>
NormalChallenge(11).isRunning &&
NormalDimension(1).amount.eq(1) &&
DimBoost.purchasedBoosts() === 0 &&
DimBoost.purchasedBoosts === 0 &&
player.galaxies === 0,
checkEvent: GameEvent.BIG_CRUNCH_BEFORE,
reward: "1st Dimensions are 3 times stronger.",
@ -766,7 +766,7 @@ GameDatabase.achievements.normal = [
player.infinityPoints.exponent >= 100 &&
NormalDimension(1).amount.eq(0) &&
player.infinitied.eq(0) &&
DimBoost.purchasedBoosts() <= 4 &&
DimBoost.purchasedBoosts <= 4 &&
player.galaxies <= 1 &&
player.replicanti.galaxies === 0,
checkEvent: GameEvent.GAME_TICK_AFTER,

View File

@ -32,7 +32,7 @@ GameDatabase.celestials.compression = {
threshold: () => new Decimal("1e1500000"),
currentDisplay: () => shorten(player.replicanti.amount),
invertedCondition: false,
effect: () => Math.pow(DimBoost.freeBoosts(), 25)
effect: () => Math.pow(DimBoost.freeBoosts, 25)
},
strongerDilationGalaxies: {
id: 3,

View File

@ -50,7 +50,7 @@ GameDatabase.celestials.v = {
name: "Matterception",
description: value => `Get ${value} Dimensional Boosts while dilating time, inside EC5.`,
values: [50, 52, 54, 56, 58, 60],
condition: x => player.dilation.active && EternityChallenge(5).isRunning && DimBoost.purchasedBoosts() >= x
condition: x => player.dilation.active && EternityChallenge(5).isRunning && DimBoost.purchasedBoosts >= x
}
]
};

View File

@ -17,6 +17,7 @@ GameDatabase.tabs = [
name: "Infinity Dimensions",
symbol: "∞",
component: "infinity-dim-tab",
newUIComponent: "new-inf-dimensions-tab",
condition: () => player.eternities.gt(0) || InfinityDimension(1).isUnlocked
},
{
@ -24,6 +25,7 @@ GameDatabase.tabs = [
name: "Time Dimensions",
symbol: "Δ",
component: "time-dim-tab",
newUIComponent: "new-time-dimensions-tab",
condition: () => player.eternities.gt(0)
},
{

View File

@ -423,15 +423,8 @@ GameStorage.devMigrations = {
delete player.autoEternityMode;
},
GameStorage.migrations.convertNewsToSet,
// Decimalified eternity count
player => {
player.eternities = new Decimal(player.eternities);
player.reality.partEternitied = new Decimal(player.reality.partEternitied);
},
player => {
player.dimensionBoosts = player.resets;
delete player.resets;
}
GameStorage.migrations.convertEternityCountToDecimal,
GameStorage.migrations.renameDimboosts
],
patch(player) {

View File

@ -117,6 +117,8 @@ GameStorage.migrations = {
GameStorage.migrations.renameMoney(player);
GameStorage.migrations.moveAutobuyers(player);
GameStorage.migrations.convertNewsToSet(player);
GameStorage.migrations.convertEternityCountToDecimal(player);
GameStorage.migrations.renameDimboosts(player);
}
},
@ -569,6 +571,16 @@ GameStorage.migrations = {
delete player.newsArray;
},
convertEternityCountToDecimal(player) {
player.eternities = new Decimal(player.eternities);
player.reality.partEternitied = new Decimal(player.reality.partEternitied);
},
renameDimboosts(player) {
player.dimensionBoosts = player.resets;
delete player.resets;
},
prePatch(saveData) {
// Initialize all possibly undefined properties that were not present in
// previous versions and which could be overwritten by deepmerge