Add additional altered effects, refactor glyph effect display code

This commit is contained in:
SpectralFlame 2019-09-02 15:57:22 -05:00
parent c7bb78a473
commit 3796c318c1
12 changed files with 95 additions and 33 deletions

View File

@ -292,7 +292,7 @@
The container loses RM over time, which means that the RM multiplier decreases over time.<br>
When you reach 1e14 RM inside of the container, you permanately unlock Teresa's Reality. In game, it is described as the following:<br>
<div style="text-align: center">
<i>"Start Teresa's Reality. Glyph TT generation is disabled and you gain less IP and EP (x^0.6). The more antimatter you reach, the better the reward."</i>
<i>"Start Teresa's Reality. Glyph TT generation is disabled and you gain less IP and EP (x^0.55). The more antimatter you reach, the better the reward."</i>
</div>
The reward for beating Teresa is multiplying the power gained from glyph sacrifices.<br>
At 1e18 RM, you unlock Teresa's Eternity Point generator. This works like Time Study 181, in the sense that you gain 1% of your peaked EP/Min per second.<br>

View File

@ -71,7 +71,7 @@ Vue.component("teresa-tab", {
<div class="l-mechanics-container">
<div class="l-teresa-unlocks l-teresa-mechanic-container">
<div class="c-teresa-unlock c-teresa-run-button" v-if="unlocks[0]" @click="startRun()">
Start Teresa's Reality. Glyph TT generation is disabled and you gain less IP and EP (x^0.6).
Start Teresa's Reality. Glyph TT generation is disabled and you gain less IP and EP (x^0.55).
<br><br>
Highest antimatter in Teresa's Reality: {{ shorten(bestAM, 2, 0) }}
</div>

View File

@ -11,7 +11,18 @@ Vue.component("current-glyph-effects", {
return GameDatabase.reality.glyphEffects[this.effect.id];
},
formatValue() {
return this.effectConfig.formatEffect(this.effect.value.value);
const baseValue = this.effect.value.value;
const value1 = this.effectConfig.formatEffect(baseValue);
const value2 = this.effectConfig.conversion === undefined
? ""
: this.effectConfig.formatEffect(this.effectConfig.conversion(baseValue));
const desc = typeof this.effectConfig.totalDesc === "function"
? this.effectConfig.totalDesc()
: this.effectConfig.totalDesc;
return desc
.replace("\n", "<br>")
.replace("{value}", value1)
.replace("{value2}", value2);
},
valueClass() {
return this.effect.value.capped ? "c-current-glyph-effects__effect--capped" : "";
@ -19,9 +30,7 @@ Vue.component("current-glyph-effects", {
},
template: `
<div>
{{effectConfig.totalDescSplit[0]}}
<span :class="valueClass">{{formatValue}}</span>
{{effectConfig.totalDescSplit[1]}}
</div>`
}
},
@ -53,7 +62,7 @@ Vue.component("current-glyph-effects", {
Currently active glyph effects:
</div>
<div v-if="isSoftcapActive" class="l-current-glyph-effects__capped-header">
<span class="c-current-glyph-effects__effect--capped">Colored</span> numbers have a reduced effect
<span class="c-current-glyph-effects__effect--capped">Colored</span> effects have been reduced due to a softcap
</div>
<div v-if="noEffects">
None (equip glyphs to get their effects)

View File

@ -75,7 +75,7 @@ const AutoSacTypeTab = {
</div>
<div v-for="effect in effects" class="l-auto-sac-type-tab__row-wrapper">
<div class="c-auto-sac-type-tab__effect-desc l-auto-sac-type-tab__effect-desc" :style="descStyle">
{{effect.genericDesc}}
{{ typeof effect.genericDesc === "function" ? effect.genericDesc() : effect.genericDesc }}
</div>
<input type="number" min="0" max="999" :value="effectScores[effect.id]"
@blur="setEffectScore(effect.id, $event)"

View File

@ -264,10 +264,11 @@ const Ra = {
};
const GlyphAlteration = {
get replacementThreshold() {
// Adding a secondary effect to some effects
get additionThreshold() {
return 1e40;
},
// One-time massive boost
// One-time massive boost of a single effect
get empowermentThreshold() {
return 1e50;
},
@ -282,8 +283,8 @@ const GlyphAlteration = {
}
return sacPower;
},
isReplaced(type) {
return Ra.has(RA_UNLOCKS.ALTERED_GLYPHS) && this.getSacrificePower(type) >= this.replacementThreshold;
isAdded(type) {
return Ra.has(RA_UNLOCKS.ALTERED_GLYPHS) && this.getSacrificePower(type) >= this.additionThreshold;
},
isEmpowered(type) {
return Ra.has(RA_UNLOCKS.ALTERED_GLYPHS) && this.getSacrificePower(type) >= this.empowermentThreshold;

View File

@ -17,8 +17,7 @@ class DimBoost {
return new Decimal(1);
}
return Effects
.max(
let boost = Effects.max(
2,
InfinityUpgrade.dimboostMult,
InfinityChallenge(7).reward,
@ -33,6 +32,8 @@ class DimBoost {
Achievement(142),
GlyphEffect.dimBoostPower
).powEffectsOf(InfinityUpgrade.dimboostMult.chargedEffect);
if (GlyphAlteration.isAdded("effarig")) boost = boost.pow(getSecondaryGlyphEffect("effarigforgotten"));
return boost;
}
static get maxShiftTier() {

View File

@ -77,14 +77,14 @@ class GlyphEffectConfig {
this.combine = GlyphEffectConfig.setupCombine(setup);
/** @member {string[]} Split up single effect description (prefix and suffix to formatted value)*/
this.singleDescSplit = GlyphEffectConfig.splitOnFormat(this.singleDesc);
/** @member {string[]} Split up total effect description (prefix and suffix to formatted value)*/
this.totalDescSplit = GlyphEffectConfig.splitOnFormat(this.totalDesc);
/** @member{string[]} conversion function to produce altered glyph effect */
this.conversion = setup.conversion;
}
/** @private */
static checkInputs(setup) {
const KNOWN_KEYS = ["id", "bitmaskIndex", "glyphTypes", "singleDesc", "totalDesc", "genericDesc",
"effect", "formatEffect", "combine", "softcap"];
"effect", "formatEffect", "combine", "softcap", "conversion"];
const unknownField = Object.keys(setup).find(k => !KNOWN_KEYS.includes(k));
if (unknownField !== undefined) {
throw new Error(`Glyph effect "${setup.id}" includes unrecognized field "${unknownField}"`);
@ -159,7 +159,7 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 1,
glyphTypes: ["time", "reality"],
singleDesc: "Multiply game speed by {value}",
totalDesc: "Game runs × {value} faster ",
totalDesc: "Game runs ×{value} faster",
genericDesc: "Game speed multiplier",
effect: (level, strength) => (GlyphAlteration.isEmpowered("time")
? 1 + Math.pow(level, 0.55)
@ -187,11 +187,16 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 3,
glyphTypes: ["time", "reality"],
singleDesc: "Multiply EP gain by {value}",
totalDesc: "EP gain ×{value}",
genericDesc: "EP gain multiplier",
totalDesc: () => (GlyphAlteration.isAdded("time")
? "EP gain ×{value} and ^{value2}"
: "EP gain ×{value}"),
genericDesc: () => (GlyphAlteration.isAdded("time")
? "EP gain multiplier and power"
: "EP gain multiplier"),
effect: (level, strength) => Math.pow(level * strength, 3) * 100,
formatEffect: x => shorten(x, 2, 0),
formatEffect: x => shorten(x, 2, 3),
combine: GlyphCombiner.multiply,
conversion: x => Math.max(1, Math.pow(Math.log10(x), 2) / 240),
}, {
id: "dilationdilationMult",
bitmaskIndex: 4,
@ -218,12 +223,17 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 6,
glyphTypes: ["dilation", "reality"],
singleDesc: "Generates {value} TT per hour",
totalDesc: "Generating {value} TT per hour",
genericDesc: "TT generation",
totalDesc: () => (GlyphAlteration.isAdded("dilation")
? "Generating {value} TT/hour and TT generation x{value2}"
: "Generating {value} TT per hour"),
genericDesc: () => (GlyphAlteration.isAdded("dilation")
? "TT generation and multiplier"
: "TT generation"),
effect: (level, strength) => Math.pow(level * strength, 0.5) / 10000,
/** @type {function(number): string} */
formatEffect: x => shorten(3600 * x, 2, 2),
combine: GlyphCombiner.add,
conversion: x => Math.pow(50 * x, 1.6),
}, {
id: "dilationpow",
bitmaskIndex: 7,
@ -260,11 +270,16 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 10,
glyphTypes: ["replication", "reality"],
singleDesc: "Multiply DT gain by \nlog₁₀(replicanti)×{value}",
totalDesc: "DT gain from log₁₀(replicanti)×{value}",
genericDesc: "DT gain multiplier (log₁₀(replicanti))",
totalDesc: () => (GlyphAlteration.isAdded("replication")
? "DT gain and replication speed from log₁₀(replicanti)×{value}"
: "DT gain from log₁₀(replicanti)×{value}"),
genericDesc: () => (GlyphAlteration.isAdded("replication")
? "DT+replicanti mult (log₁₀(replicanti))"
: "DT gain multiplier (log₁₀(replicanti))"),
effect: (level, strength) => 0.0003 * Math.pow(level, 0.3) * Math.pow(strength, 0.65),
formatEffect: x => shorten(x, 5, 5),
combine: GlyphCombiner.add,
conversion: x => x,
}, {
id: "replicationglyphlevel",
bitmaskIndex: 11,
@ -306,13 +321,18 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 14,
glyphTypes: ["infinity", "reality"],
singleDesc: "Multiply IP gain by {value}",
totalDesc: "IP gain ×{value}",
genericDesc: "IP gain multiplier",
totalDesc: () => (GlyphAlteration.isAdded("infinity")
? "IP gain ×{value} and ^{value2}"
: "IP gain ×{value}"),
genericDesc: () => (GlyphAlteration.isAdded("infinity")
? "IP gain multiplier and power"
: "IP gain multiplier"),
effect: (level, strength) => Math.pow(level * (strength + 1), 6) * 10000,
formatEffect: x => shorten(x, 2, 0),
formatEffect: x => shorten(x, 2, 3),
combine: GlyphCombiner.multiply,
// eslint-disable-next-line no-negated-condition
softcap: value => ((Effarig.eternityCap !== undefined) ? Math.min(value, Effarig.eternityCap.toNumber()) : value)
softcap: value => ((Effarig.eternityCap !== undefined) ? Math.min(value, Effarig.eternityCap.toNumber()) : value),
conversion: x => Math.max(1, Math.pow(Math.log10(x), 2) / 1000),
}, {
id: "infinityinfmult",
bitmaskIndex: 15,
@ -330,9 +350,13 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 16,
glyphTypes: ["power", "reality"],
singleDesc: "Normal Dimension multipliers ^{value}",
genericDesc: () => (GlyphAlteration.isAdded("power")
? "ND multipliers ^x and MD multiplier"
: "Normal Dimension multipliers ^x"),
effect: (level, strength) => 1.015 + Math.pow(level, 0.2) * Math.pow(strength, 0.4) / 75,
formatEffect: x => shorten(x, 3, 3),
combine: GlyphCombiner.multiply,
conversion: x => x,
}, {
id: "powermult",
bitmaskIndex: 17,
@ -375,6 +399,7 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 21,
glyphTypes: ["effarig"],
singleDesc: "Reality Machine multiplier x{value}",
genericDesc: "Reality Machine multiplier",
effect: (level, strength) => (GlyphAlteration.isEmpowered("effarig")
? Math.pow(level, 0.95) * 5
: Math.pow(level, 0.6) * strength),
@ -385,6 +410,7 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 22,
glyphTypes: ["effarig"],
singleDesc: "Instability starting glyph level +{value}",
genericDesc: "Instability starting level",
effect: (level, strength) => Math.floor(10 * Math.pow(level * strength, 0.5)),
formatEffect: x => shortenSmallInteger(x),
combine: GlyphCombiner.add,
@ -393,7 +419,7 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 23,
glyphTypes: ["effarig"],
singleDesc: "All achievement related effects ^{value}",
genericDesc: "Achievement effects power",
genericDesc: "Achievement effects ^x",
effect: (level, strength) => 1 + Math.pow(level, 0.4) * Math.pow(strength, 0.6) / 60,
formatEffect: x => shorten(x, 3, 3),
combine: GlyphCombiner.multiply,
@ -402,11 +428,16 @@ GameDatabase.reality.glyphEffects = [
bitmaskIndex: 24,
glyphTypes: ["effarig"],
singleDesc: "Raise the bonus gained from buying 10 Dimensions to a power of ^{value}",
totalDesc: "Multiplier from \"Buy 10\" ^{value}",
genericDesc: "\"Buy 10\" bonus multiplier ^x",
totalDesc: () => (GlyphAlteration.isAdded("effarig")
? "Multiplier from \"Buy 10\" ^{value} and dimboosts ^{value2}"
: "Multiplier from \"Buy 10\" ^{value}"),
genericDesc: () => (GlyphAlteration.isAdded("power")
? "\"Buy 10\" and dimboost multipliers ^x"
: "\"Buy 10\" multiplier ^x"),
effect: (level, strength) => 1 + 2 * Math.pow(level, 0.25) * Math.pow(strength, 0.4),
formatEffect: x => shorten(x, 2, 2),
combine: GlyphCombiner.multiply,
conversion: x => Math.sqrt(x),
}, {
id: "effarigdimensions",
bitmaskIndex: 25,

View File

@ -36,7 +36,9 @@ class MatterDimensionState {
}
get power() {
return Decimal.pow(1.1, this.dimension.powerUpgrades).times(Laitela.realityReward);
let power = Decimal.pow(1.1, this.dimension.powerUpgrades).times(Laitela.realityReward)
if (GlyphAlteration.isAdded("power")) power = power.times(getSecondaryGlyphEffect("powerpow"));
return power;
}
get chanceCost() {

View File

@ -90,6 +90,7 @@ function getReplicantiInterval(noMod, intervalIn) {
interval = interval.times(Decimal.pow(ReplicantiGrowth.scaleFactor, increases));
}
interval = interval.divide(getAdjustedGlyphEffect("replicationspeed"));
if (GlyphAlteration.isAdded("replication")) interval = interval.divide(getSecondaryGlyphEffect("replicationdtgain"));
interval = interval.divide(RA_UNLOCKS.TT_BOOST.effect.replicanti());
interval = interval.dividedByEffectOf(AlchemyResource.replication);
interval = interval.divide(Effects.max(1, CompressionUpgrade.replicantiSpeedFromDB));

View File

@ -484,6 +484,16 @@ function getAdjustedGlyphEffect(effectKey) {
return GameCache.glyphEffects.value[effectKey];
}
/**
* Takes the glyph effect value and feeds it through the conversion function that gives the value of the secondary
* effect from glyph alteration.
* @param {string} effectKey
* @return {number | Decimal}
*/
function getSecondaryGlyphEffect(effectKey) {
return GameDatabase.reality.glyphEffects[effectKey].conversion(getAdjustedGlyphEffect(effectKey));
}
/**
* Finds all equipped glyphs with the specified effect and returns an array of effect values.
* @param {string} effectKey

View File

@ -142,6 +142,9 @@ function gainedInfinityPoints() {
} else if (V.isRunning) {
ip = ip.pow(0.5);
}
if (GlyphAlteration.isAdded("infinity")) {
ip = ip.pow(getSecondaryGlyphEffect("infinityipgain"));
}
return ip.floor();
}
@ -164,6 +167,9 @@ function gainedEternityPoints() {
} else if (V.isRunning) {
ep = ep.pow(0.5);
}
if (GlyphAlteration.isAdded("time")) {
ep = ep.pow(getSecondaryGlyphEffect("timeeternity"));
}
return ep.floor();
}
@ -802,6 +808,7 @@ function getTTPerSecond() {
let ttMult = RA_UNLOCKS.TT_BOOST.effect.ttGen();
if (Enslaved.isRunning) ttMult *= 1e-3;
if (Ra.has(RA_UNLOCKS.TT_ACHIEVEMENT)) ttMult *= RA_UNLOCKS.TT_ACHIEVEMENT.effect();
if (GlyphAlteration.isAdded("dilation")) ttMult *= getSecondaryGlyphEffect("dilationTTgen");
// Glyph TT generation
const glyphTT = Teresa.isRunning

View File

@ -742,7 +742,7 @@
<span>Teresa</span>
<div class="c-component-block">
<div style="display: flex; flex-direction: column">
<div class="c-teresa-unlock c-teresa-run-button">Start a new reality. TT generation is disabled and you gain less IP and EP (x^0.6). The further you get the better the reward.<br><br>Multiplies power gained from glyph sacrifice by 1e308x, based on realities.</div>
<div class="c-teresa-unlock c-teresa-run-button">Start a new reality. TT generation is disabled and you gain less IP and EP (x^0.55). The further you get the better the reward.<br><br>Multiplies power gained from glyph sacrifice by 1e308x, based on realities.</div>
<div class="c-teresa-unlock">Teresa Reality Machine pour unlock</div>
<div class="o-teresa-shop-button">Teresa perk point shop button</div>
<button class="o-primary-btn c-teresa-pour">Pour RM</button>