Vuefy eternity milestones

This commit is contained in:
Andrei Andreev 2018-12-23 16:03:51 +03:00
parent 5356413586
commit 9507954ac9
14 changed files with 270 additions and 23 deletions

View File

@ -876,9 +876,10 @@
<script type="text/javascript" src="javascripts/core/secret-formula/challenges/infinity-challenges.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/infinity/infinity-upgrades.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/infinity/break-infinity-upgrades.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/time-studies/normal-time-studies.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/time-studies/ec-time-studies.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/time-studies/dilation-time-studies.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/eternity/time-studies/normal-time-studies.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/eternity/time-studies/ec-time-studies.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/eternity/time-studies/dilation-time-studies.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/eternity/eternity-milestones.js"></script>
<script type="text/javascript" src="javascripts/core/secret-formula/reality/perks.js"></script>

View File

@ -1,4 +1,61 @@
Vue.component("eternity-milestones-tab", {
computed: {
milestones() {
return Object.values(GameDatabase.eternity.milestones)
.sort((a, b) => a.eternities - b.eternities)
.map(data => new EternityMilestoneInfo(data));
},
rows() {
return this.milestones.length / 3;
}
},
methods: {
milestone(row, column) {
return this.milestones[(row - 1) * 3 + column - 1];
}
},
template:
`<div>Eternity milestones</div>`
`<div class="l-eternity-milestone-grid">
<div v-for="row in rows" class="l-eternity-milestone-grid__row">
<eternity-milestone
v-for="column in 3"
:key="row * 3 + column"
:milestone="milestone(row, column)"
class="l-eternity-milestone-grid__cell"
/>
</div>
</div>`
});
Vue.component("eternity-milestone", {
props: {
milestone: Object
},
data() {
return {
isReached: false
};
},
computed: {
eternities() {
return this.milestone.data.eternities;
},
descriptionClassObject() {
return {
"o-eternity-milestone__description": true,
"o-eternity-milestone__description--reached": this.isReached,
"o-eternity-milestone__description--small-font": this.milestone.data.description.length > 80
};
}
},
methods: {
update() {
this.isReached = this.milestone.isReached;
}
},
template:
`<div class="l-eternity-milestone">
<span class="o-eternity-milestone__goal">{{eternities}} {{"Eternity" | pluralize(eternities, "Eternities")}}:</span>
<button :class="descriptionClassObject">{{milestone.data.description}}</button>
</div>`
});

View File

@ -17,7 +17,7 @@ Vue.component("ip-multiplier-button", {
},
methods: {
update() {
this.isAutoUnlocked = player.eternities > 0;
this.isAutoUnlocked = EternityMilestone.autobuyerIPMult.isReached;
this.isAutobuyerOn = player.infMultBuyer;
}
},

View File

@ -59,7 +59,7 @@ Vue.mixin({
}
});
Vue.filter('pluralize', function (value, amount) {
Vue.filter("pluralize", function (value, amount, plural) {
if (value === undefined || amount === undefined)
throw "Arguments must be defined";
let isSingular = true;
@ -71,7 +71,7 @@ Vue.filter('pluralize', function (value, amount) {
}
else
throw "Amount must be either a number or Decimal";
return isSingular ? value : value + "s";
return isSingular ? value : (plural !== undefined ? plural : value + "s");
});
VTooltip.VTooltip.options.defaultClass = 'general-tooltip';

View File

@ -365,7 +365,7 @@ class DimboostAutobuyerInfo extends AutobuyerInfo {
* @returns {boolean}
*/
get isBuyMaxUnlocked() {
return player.eternities >= 10;
return EternityMilestone.autobuyMaxDimboosts.isReached;
}
/**
@ -454,7 +454,7 @@ class GalaxyAutobuyerInfo extends AutobuyerInfo {
* @returns {boolean}
*/
get isBuyMaxUnlocked() {
return player.eternities > 8;
return EternityMilestone.autobuyMaxGalaxies.isReached;
}
/**
@ -475,7 +475,7 @@ class GalaxyAutobuyerInfo extends AutobuyerInfo {
if (!this.canTick()) return;
if (!Galaxy.requirement.isSatisfied) return;
if (this.limit <= player.galaxies) return;
if (player.eternities >= 9 && this.buyMaxInterval > 0) {
if (this.isBuyMaxUnlocked && this.buyMaxInterval > 0) {
this.buyMax();
}
else {
@ -569,7 +569,7 @@ class InfinityAutobuyerInfo extends AutobuyerInfo {
* @returns {boolean}
*/
get hasAdditionalModes() {
return player.eternities > 4;
return EternityMilestone.bigCrunchModes.isReached;
}
/**
@ -651,7 +651,7 @@ Autobuyer.eternity = {
* @returns {boolean}
*/
get isUnlocked() {
return player.eternities >= 100;
return EternityMilestone.autobuyerEternity.isReached;
},
/**
* @returns {boolean}

View File

@ -249,4 +249,43 @@ function resetInfinityPoints() {
if (player.reality.perks.includes(54)) ip = 2e130;
else if (player.reality.perks.includes(53)) ip = 2e15;
player.infinityPoints = new Decimal(ip);
}
}
class EternityMilestoneInfo {
constructor(data) {
this._getData = () => data;
}
get data() {
return this._getData();
}
get isReached() {
return player.eternities >= this.data.eternities;
}
}
const EternityMilestone = function() {
const db = GameDatabase.eternity.milestones;
const infinityDims = Array.dimensionTiers
.map(tier => new EternityMilestoneInfo(db["autobuyerID" + tier]));
return {
autobuyerIPMult: new EternityMilestoneInfo(db.autobuyerIPMult),
keepAutobuyers: new EternityMilestoneInfo(db.keepAutobuyers),
autobuyerReplicantiGalaxy: new EternityMilestoneInfo(db.autobuyerReplicantiGalaxy),
keepInfinityUpgrades: new EternityMilestoneInfo(db.keepInfinityUpgrades),
bigCrunchModes: new EternityMilestoneInfo(db.bigCrunchModes),
autoIC: new EternityMilestoneInfo(db.autoIC),
autobuyMaxGalaxies: new EternityMilestoneInfo(db.autobuyMaxGalaxies),
autobuyMaxDimboosts: new EternityMilestoneInfo(db.autobuyMaxDimboosts),
autobuyerID: tier => infinityDims[tier - 1],
keepBreakUpgrades: new EternityMilestoneInfo(db.keepBreakUpgrades),
autoUnlockID: new EternityMilestoneInfo(db.autoUnlockID),
unlockAllND: new EternityMilestoneInfo(db.unlockAllND),
autobuyerReplicantiChance: new EternityMilestoneInfo(db.autobuyerReplicantiChance),
unlockReplicanti: new EternityMilestoneInfo(db.unlockReplicanti),
autobuyerReplicantiInterval: new EternityMilestoneInfo(db.autobuyerReplicantiInterval),
autobuyerReplicantiMaxGalaxies: new EternityMilestoneInfo(db.autobuyerReplicantiMaxGalaxies),
autobuyerEternity: new EternityMilestoneInfo(db.autobuyerEternity),
};
}();

View File

@ -184,7 +184,7 @@ const ReplicantiUpgrade = {
return nearestPercent(this.current) >= this.cap;
},
get isAutobuyerUnlocked() {
return player.eternities >= 40;
return EternityMilestone.autobuyerReplicantiChance.isReached;
}
},
interval: {
@ -219,7 +219,7 @@ const ReplicantiUpgrade = {
return this.current <= this.cap;
},
get isAutobuyerUnlocked() {
return player.eternities >= 60;
return EternityMilestone.autobuyerReplicantiInterval.isReached;
},
applyModifiers(value) {
return getReplicantiInterval(false, value);
@ -258,7 +258,7 @@ const ReplicantiUpgrade = {
return false;
},
get isAutobuyerUnlocked() {
return player.eternities >= 80;
return EternityMilestone.autobuyerReplicantiMaxGalaxies.isReached;
},
get extra() {
return Effects.max(

View File

@ -0,0 +1,98 @@
GameDatabase.eternity.milestones = {
autobuyerIPMult: {
eternities: 1,
description: "Unlock IP multiplier autobuyer"
},
keepAutobuyers: {
eternities: 2,
description: "You keep your autobuyers on Eternity"
},
autobuyerReplicantiGalaxy: {
eternities: 3,
description: "Unlock Replicanti galaxy autobuyer"
},
keepInfinityUpgrades: {
eternities: 4,
description: "You keep your infinity upgrades on Eternity"
},
bigCrunchModes: {
eternities: 5,
description: "Unlock more Big Crunch autobuyer options"
},
autoIC: {
eternities: 7,
description: "You complete Infinity Challenges as soon as you unlock them (you get sacrifice autobuyer immediately)"
},
autobuyMaxGalaxies: {
eternities: 9,
description: "Unlock autobuy max Antimatter Galaxies"
},
autobuyMaxDimboosts: {
eternities: 10,
description: "Unlock autobuy max Dimension Boosts"
},
autobuyerID1: {
eternities: 11,
description: "Unlock autobuyer for the 1st Infinity Dimension"
},
autobuyerID2: {
eternities: 12,
description: "Unlock autobuyer for the 2nd Infinity Dimension"
},
autobuyerID3: {
eternities: 13,
description: "Unlock autobuyer for the 3rd Infinity Dimension"
},
autobuyerID4: {
eternities: 14,
description: "Unlock autobuyer for the 4th Infinity Dimension"
},
autobuyerID5: {
eternities: 15,
description: "Unlock autobuyer for the 5th Infinity Dimension"
},
autobuyerID6: {
eternities: 16,
description: "Unlock autobuyer for the 6th Infinity Dimension"
},
autobuyerID7: {
eternities: 17,
description: "Unlock autobuyer for the 7th Infinity Dimension"
},
autobuyerID8: {
eternities: 18,
description: "Unlock autobuyer for the 8th Infinity Dimension"
},
keepBreakUpgrades: {
eternities: 20,
description: "You keep your Breaking Infinity upgrades on Eternity"
},
autoUnlockID: {
eternities: 25,
description: "You automatically unlock Infinity Dimensions upon reaching them"
},
unlockAllND: {
eternities: 30,
description: "Start with all Normal Dimensions available for purchase"
},
autobuyerReplicantiChance: {
eternities: 40,
description: "Unlock autobuyer for the Replicanti chance upgrade"
},
unlockReplicanti: {
eternities: 50,
description: "You start with Replicanti unlocked"
},
autobuyerReplicantiInterval: {
eternities: 60,
description: "Unlock autobuyer for the Replicanti interval upgrade"
},
autobuyerReplicantiMaxGalaxies: {
eternities: 80,
description: "Unlock autobuyer for the Replicanti galaxy upgrade"
},
autobuyerEternity: {
eternities: 100,
description: "Unlock autobuyer for Eternities"
}
};

View File

@ -1,4 +1,4 @@
GameDatabase.timeStudies.dilation = [
GameDatabase.eternity.timeStudies.dilation = [
{
id: 1,
cost: 5000,

View File

@ -1,4 +1,4 @@
GameDatabase.timeStudies.ec = [
GameDatabase.eternity.timeStudies.ec = [
{
id: 1,
cost: 30,

View File

@ -1,4 +1,4 @@
GameDatabase.timeStudies.normal = [
GameDatabase.eternity.timeStudies.normal = [
{
id: 11,
cost: 1,

View File

@ -1,7 +1,9 @@
const GameDatabase = {
challenges: {},
infinity: {},
timeStudies: {},
eternity: {
timeStudies: {}
},
reality: {}
};

View File

@ -594,7 +594,7 @@ NormalTimeStudyInfo.paths = [
];
NormalTimeStudyInfo.studies = mapGameData(
GameDatabase.timeStudies.normal,
GameDatabase.eternity.timeStudies.normal,
data => new NormalTimeStudyInfo(data)
);
@ -676,7 +676,7 @@ class ECTimeStudyInfo extends TimeStudyInfo {
}
ECTimeStudyInfo.studies = mapGameData(
GameDatabase.timeStudies.ec,
GameDatabase.eternity.timeStudies.ec,
data => new ECTimeStudyInfo(data)
);
@ -716,7 +716,7 @@ class DilationTimeStudyInfo extends TimeStudyInfo {
}
DilationTimeStudyInfo.studies = mapGameData(
GameDatabase.timeStudies.dilation,
GameDatabase.eternity.timeStudies.dilation,
data => new DilationTimeStudyInfo(data)
);

View File

@ -4265,6 +4265,56 @@ screen and (max-width: 480px) {
/*#endregion Break Infinity*/
/*#region Eternity Milestones*/
.l-eternity-milestone-grid {
display: flex;
flex-direction: column;
align-items: center;
}
.l-eternity-milestone-grid__row {
display: flex;
flex-direction: row;
}
.l-eternity-milestone-grid__cell {
margin: .5rem .8rem;
}
.o-eternity-milestone__goal {
font-size: 2rem;
text-align: left;
}
.o-eternity-milestone__description {
width: 25rem;
height: 6rem;
color: black;
background-color: dimgrey;
font-weight: bold;
border: .1rem solid #691fa5;
transition-duration: 0.2s;
border-radius: .4rem;
font-family: Typewriter, serif;
font-size: 1.2rem;
}
.o-eternity-milestone__description--reached {
background-color: #8d48c3;
}
.o-eternity-milestone__description--small-font {
font-size: 1.1rem;
}
.l-eternity-milestone {
display: flex;
flex-direction: column;
}
/*#endregion Eternity Milestones*/
/*#region Modals*/
/*#region c-modal*/