mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
Issue 12220 stealth tooltip show protected dailies (#12255)
* Issue 12220 - Show dailies protected by Stealth A feature on the old site showed the number of dailies protected by casting Stealth. This is now showing again in the Stealth tooltip. The skillNotes section was not being called. It adds additional skill-specific info: the dailies avoided by stealth, whether stealth no longer needs to be cast (dailies already avoided) and whether frost is no longer useful to cast. Speculation: the spellDisabled method had some commented out code regarding Stealth, which may have broken due to a change in how dailies are referenced. I have fixed this line, so it seemed alright to keep the entirety of the skillNotes function as it had been. However, this includes more than just showing dailies in the tooltip. Behavior changes: - tooltip shows dailies avoided for Stealth - tooltip shows maxed out message for Stealth when all dailies are covered - tooltip shows frost already cast message when frost has already been cast * clean up conditions in skillNotes * use future tense for rogue stealth dailies tooltip * use getter for accurate task length * consider stealth disabled based on incomplete dailies due, not all dailies * Issue 12220 - Show dailies protected by Stealth A feature on the old site showed the number of dailies protected by casting Stealth. This is now showing again in the Stealth tooltip. The skillNotes section was not being called. It adds additional skill-specific info: the dailies avoided by stealth, whether stealth no longer needs to be cast (dailies already avoided) and whether frost is no longer useful to cast. Speculation: the spellDisabled method had some commented out code regarding Stealth, which may have broken due to a change in how dailies are referenced. I have fixed this line, so it seemed alright to keep the entirety of the skillNotes function as it had been. However, this includes more than just showing dailies in the tooltip. Behavior changes: - tooltip shows dailies avoided for Stealth - tooltip shows maxed out message for Stealth when all dailies are covered - tooltip shows frost already cast message when frost has already been cast * factor out stealthBuffsToAdd for casting stealth + tooltip previewing dailies avoided * fix merge conflict
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
v-for="(skill, key) in spells[user.stats.class]"
|
||||
v-if="user.stats.lvl >= skill.lvl"
|
||||
:key="key"
|
||||
v-b-popover.hover.auto="skill.notes()"
|
||||
v-b-popover.hover.auto="skillNotes(skill)"
|
||||
class="col-12 col-md-3"
|
||||
@click="castStart(skill)"
|
||||
>
|
||||
@@ -204,9 +204,9 @@
|
||||
</style>
|
||||
|
||||
<script>
|
||||
import spells from '@/../../common/script/content/spells';
|
||||
import spells, { stealthBuffsToAdd } from '@/../../common/script/content/spells';
|
||||
|
||||
import { mapState } from '@/libs/store';
|
||||
import { mapState, mapGetters } from '@/libs/store';
|
||||
import notifications from '@/mixins/notifications';
|
||||
import spellsMixin from '@/mixins/spells';
|
||||
import Drawer from '@/components/ui/drawer';
|
||||
@@ -237,6 +237,9 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
...mapState({ user: 'user.data' }),
|
||||
...mapGetters({
|
||||
getUnfilteredTaskList: 'tasks:getUnfilteredTaskList',
|
||||
}),
|
||||
openStatus () {
|
||||
return this.$store.state.spellOptions.spellDrawOpen ? 1 : 0;
|
||||
},
|
||||
@@ -267,18 +270,12 @@ export default {
|
||||
);
|
||||
},
|
||||
spellDisabled (skill) {
|
||||
if (skill === 'frost' && this.user.stats.buffs.streaks) {
|
||||
return true;
|
||||
}
|
||||
// @TODO: Implement
|
||||
// } else if (skill === 'stealth' && this.user.stats.buffs.stealth
|
||||
// >= this.user.dailys.length) {
|
||||
// return true;
|
||||
// }
|
||||
const incompleteDailiesDue = this.getUnfilteredTaskList('daily').filter(daily => !daily.completed && daily.isDue).length;
|
||||
if (skill === 'frost' && this.user.stats.buffs.streaks) return true;
|
||||
if (skill === 'stealth' && this.user.stats.buffs.stealth >= incompleteDailiesDue) return true;
|
||||
|
||||
return false;
|
||||
},
|
||||
// @TODO is this used?
|
||||
skillNotes (skill) {
|
||||
let notes = skill.notes();
|
||||
|
||||
@@ -289,7 +286,7 @@ export default {
|
||||
} else if (skill.key === 'stealth') {
|
||||
notes = this.$t('spellRogueStealthDaliesAvoided', {
|
||||
originalText: notes,
|
||||
number: this.user.stats.buffs.stealth,
|
||||
number: stealthBuffsToAdd(this.user),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
"spellRogueStealthText": "Stealth",
|
||||
"spellRogueStealthNotes": "With each cast, a few of your undone Dailies won't cause damage tonight. Their streaks and colors won't change. (Based on: PER)",
|
||||
"spellRogueStealthDaliesAvoided": "<%= originalText %> Number of dailies avoided: <%= number %>.",
|
||||
"spellRogueStealthDaliesAvoided": "<%= originalText %> Number of dailies that will be avoided: <%= number %>.",
|
||||
"spellRogueStealthMaxedOut": "You have already avoided all your dailies; there's no need to cast this again.",
|
||||
|
||||
"spellHealerHealText": "Healing Light",
|
||||
|
||||
@@ -45,6 +45,12 @@ function calculateBonus (value, stat, critVal = 1, statScale = 0.5) {
|
||||
return (value < 0 ? 1 : value + 1) + stat * statScale * critVal;
|
||||
}
|
||||
|
||||
export function stealthBuffsToAdd (user) {
|
||||
return Math.ceil(diminishingReturns(
|
||||
statsComputed(user).per, user.tasksOrder.dailys.length * 0.64, 55,
|
||||
));
|
||||
}
|
||||
|
||||
const spells = {};
|
||||
|
||||
spells.wizard = {
|
||||
@@ -208,9 +214,7 @@ spells.rogue = {
|
||||
notes: t('spellRogueStealthNotes'),
|
||||
cast (user) {
|
||||
if (!user.stats.buffs.stealth) user.stats.buffs.stealth = 0;
|
||||
user.stats.buffs.stealth += Math.ceil(diminishingReturns(
|
||||
statsComputed(user).per, user.tasksOrder.dailys.length * 0.64, 55,
|
||||
));
|
||||
user.stats.buffs.stealth += stealthBuffsToAdd(user);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user