Improve multiplier tab behavior for challenges

This commit is contained in:
SpectralFlame 2023-04-12 08:06:29 -05:00 committed by cyip92
parent c887b28578
commit a9627c7ffa
3 changed files with 92 additions and 10 deletions

View File

@ -8,18 +8,33 @@ import { MultiplierTabIcons } from "./icons";
// See index.js for documentation
GameDatabase.multiplierTabValues.AD = {
total: {
name: dim => (dim ? `AD ${dim} Multiplier` : "Base AD Production"),
name: dim => {
if (dim) return `AD ${dim} Multiplier`;
if (!NormalChallenge(12).isRunning) return "Base AD Production";
return `Base AD Production from ${MultiplierTabHelper.isNC12ProducingEven() ? "Even" : "Odd"} Dimensions`;
},
displayOverride: dim => {
if (dim) return formatX(AntimatterDimension(dim).multiplier, 2, 2);
const highestDim = AntimatterDimension(
EternityChallenge(7).isRunning ? 7 : MultiplierTabHelper.activeDimCount("AD")).totalAmount;
if (dim) {
const singleMult = NormalChallenge(12).isRunning
? MultiplierTabHelper.multInNC12(dim)
: AntimatterDimension(dim).multiplier;
return formatX(singleMult, 2, 2);
}
const maxTier = EternityChallenge(7).isRunning ? 7 : MultiplierTabHelper.activeDimCount("AD");
if (NormalChallenge(12).isRunning) return `${format(MultiplierTabHelper.actualNC12Production(), 2)}/sec`;
return `${format(AntimatterDimensions.all
.filter(ad => ad.isProducing)
.map(ad => ad.multiplier)
.reduce((x, y) => x.times(y), DC.D1)
.times(highestDim), 2)}/sec`;
.times(AntimatterDimension(maxTier).totalAmount), 2)}/sec`;
},
multValue: dim => {
if (NormalChallenge(12).isRunning) {
if (!dim) return MultiplierTabHelper.actualNC12Production();
return (MultiplierTabHelper.isNC12ProducingEven() ? dim % 2 === 0 : dim % 2 === 1)
? MultiplierTabHelper.multInNC12(dim)
: DC.D1;
}
const mult = dim
? AntimatterDimension(dim).multiplier
: AntimatterDimensions.all
@ -348,13 +363,44 @@ GameDatabase.multiplierTabValues.AD = {
effectNC: {
name: dim => (dim ? `Normal Challenge Effect (AD ${dim})` : "Normal Challenge Effects"),
multValue: dim => {
// Depending on the challenge itself and the game state, this could be either a nerf or a buff, so we make
// sure to render a x or / conditionally. This requires we calculate the value itself again, however
displayOverride: dim => {
const formatFn = num => (num.gte(1) ? formatX(num, 2, 2) : `/${format(num.reciprocal(), 2, 2)}`);
let dimMults = Array.repeat(DC.D1, 9);
if (NormalChallenge(2).isRunning) {
dimMults = Array.repeat(new Decimal(player.chall2Pow), 9);
} else if (NormalChallenge(3).isRunning) {
dimMults[1] = new Decimal(player.chall3Pow);
} else if (NormalChallenge(12).isRunning) {
}
if (NormalChallenge(3).isRunning) {
dimMults[1] = dimMults[1].times(player.chall3Pow);
}
if (NormalChallenge(12).isRunning) {
dimMults[2] = AntimatterDimension(2).totalAmount.pow(0.6);
dimMults[4] = AntimatterDimension(4).totalAmount.pow(0.4);
dimMults[6] = AntimatterDimension(6).totalAmount.pow(0.2);
}
if (dim) return formatFn(dimMults[dim]);
let totalMult = DC.D1;
for (let tier = 1; tier <= MultiplierTabHelper.activeDimCount("AD"); tier++) {
totalMult = totalMult.times(dimMults[tier]);
}
return formatFn(totalMult);
},
// This and displayOverride contain largely the same code
multValue: dim => {
let dimMults = Array.repeat(DC.D1, 9);
// Do not change this to an else-if, as NC2/NC3 need to be enterable simultaneously in IC1
if (NormalChallenge(2).isRunning) {
dimMults = Array.repeat(new Decimal(player.chall2Pow), 9);
}
if (NormalChallenge(3).isRunning) {
dimMults[1] = dimMults[1].times(player.chall3Pow);
}
if (NormalChallenge(12).isRunning) {
dimMults[2] = AntimatterDimension(2).totalAmount.pow(0.6);
dimMults[4] = AntimatterDimension(4).totalAmount.pow(0.4);
dimMults[6] = AntimatterDimension(6).totalAmount.pow(0.2);

View File

@ -201,6 +201,42 @@ export const MultiplierTabHelper = {
pluralizeDimensions(dims) {
return dims === 1 ? "Dimension\xa0" : "Dimensions";
},
// All of the following NC12-related functions are to make the parsing within the GameDB entry easier in terms of
// which set of Dimensions are actually producing within NC12 - in nearly every case, one of the odd/even sets will
// produce significantly more than the other, so we simply assume the larger one is active and the other isn't
evenDimNC12Production() {
const nc12Pow = tier => ([2, 4, 6].includes(tier) ? 0.1 * (8 - tier) : 0);
const maxTier = Math.clampMin(2 * Math.floor(MultiplierTabHelper.activeDimCount("AD") / 2), 2);
return AntimatterDimensions.all
.filter(ad => ad.isProducing && ad.tier % 2 === 0)
.map(ad => ad.multiplier.times(ad.amount.pow(nc12Pow(ad.tier))))
.reduce((x, y) => x.times(y), DC.D1)
.times(AntimatterDimension(maxTier).totalAmount);
},
oddDimNC12Production() {
const maxTier = Math.clampMin(2 * Math.floor(MultiplierTabHelper.activeDimCount("AD") / 2 - 0.5) + 1, 1);
return AntimatterDimensions.all
.filter(ad => ad.isProducing && ad.tier % 2 === 1)
.map(ad => ad.multiplier)
.reduce((x, y) => x.times(y), DC.D1)
.times(AntimatterDimension(maxTier).totalAmount);
},
actualNC12Production() {
return Decimal.max(this.evenDimNC12Production(), this.oddDimNC12Production());
},
multInNC12(dim) {
const nc12Pow = tier => ([2, 4, 6].includes(tier) ? 0.1 * (8 - tier) : 0);
const ad = AntimatterDimension(dim);
return ad.isProducing ? ad.multiplier.times(ad.totalAmount.pow(nc12Pow(dim))) : DC.D1;
},
isNC12ProducingEven() {
return this.evenDimNC12Production().gt(this.oddDimNC12Production());
}
};

View File

@ -141,7 +141,7 @@ const targetedEffects = {
},
eternityChallenge: {
checkFn: MultiplierTabHelper.ECDimCheck,
ID: [2, 4, 7, 9],
ID: [2, 4, 9],
TD: [1, 10],
},
};