Merge pull request #1751 from IvarK/auto-achievement-tweak

Improve auto-achievement behavior
This commit is contained in:
cyip92 2021-08-15 15:44:52 -05:00 committed by GitHub
commit 83f313aa09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 5 deletions

View File

@ -41,6 +41,7 @@ Vue.component("normal-achievements-tab", {
achievementPower: 0,
achTPeffect: 0,
achCountdown: 0,
missingAchievements: 0,
showAutoAchieve: false,
isAutoAchieveActive: false,
hideCompletedRows: false,
@ -67,7 +68,8 @@ Vue.component("normal-achievements-tab", {
update() {
this.achievementPower = Achievements.power;
this.achTPeffect = RealityUpgrade(8).config.effect();
this.achCountdown = Achievements.timeToNextAutoAchieve() / getGameSpeedupFactor();
this.achCountdown = Achievements.timeToNextAutoAchieve / getGameSpeedupFactor();
this.missingAchievements = Achievements.preReality.countWhere(a => !a.isUnlocked);
this.showAutoAchieve = PlayerProgress.realityUnlocked() && !Perk.achievementGroup6.isBought;
this.isAutoAchieveActive = player.reality.autoAchieve;
this.hideCompletedRows = player.options.hideCompletedAchievementRows;
@ -124,7 +126,12 @@ Vue.component("normal-achievements-tab", {
</div>
</div>
<div v-if="achCountdown > 0" class="c-achievements-tab__header">
Automatically gain the next missing Achievement in {{ timeDisplayNoDecimals(achCountdown) }}.
Automatically gain the next missing Achievement in
{{ timeDisplayNoDecimals(achCountdown) }}<span v-if="!isAutoAchieveActive"> once Auto is turned on</span>.
(left-to-right, top-to-bottom)
</div>
<div v-else-if="achCountdown === 0 && missingAchievements !== 0" class="c-achievements-tab__header">
Automatically gain the next missing Achievement as soon as you enable Auto Achievements.
(left-to-right, top-to-bottom)
</div>
<div class="l-achievement-grid">

View File

@ -109,7 +109,10 @@ const Achievements = {
autoAchieveUpdate(diff) {
if (!PlayerProgress.realityUnlocked()) return;
if (!player.reality.autoAchieve) return;
if (!player.reality.autoAchieve) {
player.reality.achTimer = Math.clampMax(player.reality.achTimer + diff, this.period);
return;
}
if (Achievements.preReality.every(a => a.isUnlocked)) return;
if (Perk.achievementGroup6.isBought) {
for (const achievement of Achievements.preReality) {
@ -129,11 +132,11 @@ const Achievements = {
player.reality.gainedAutoAchievements = true;
},
timeToNextAutoAchieve() {
get timeToNextAutoAchieve() {
if (!PlayerProgress.realityUnlocked()) return 0;
if (GameCache.achievementPeriod.value === 0) return 0;
if (Achievements.preReality.countWhere(a => !a.isUnlocked) === 0) return 0;
return Math.max(this.period - player.reality.achTimer, 1);
return this.period - player.reality.achTimer;
},
_power: new Lazy(() => {