mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 06:07:21 +01:00
Lost Masterclasser Quest Line (#9183)
* fix(sprites): serve animated GIFs Also add new GIF for upcoming quest line * feat(content): Masterclasser capstone quest Also fixes Quests page for clearer lock/unlock display * chore(sprites): compile * feat(achievements): award quest completionist cheevo * feat(quests): Siphoning Void fix Achievements page styling and text spacing fix display of Rage bar on party page * test(quests): Lost Masterclasser * chore(news): Bailey * fix(test): only use Masterclasser in relevant scenario
This commit is contained in:
@@ -712,8 +712,9 @@ function _getUserUpdateForQuestReward (itemToAward, allAwardedItems) {
|
||||
return updates;
|
||||
}
|
||||
|
||||
async function _updateUserWithRetries (userId, updates, numTry = 1) {
|
||||
return await User.update({_id: userId}, updates).exec()
|
||||
async function _updateUserWithRetries (userId, updates, numTry = 1, query = {}) {
|
||||
query._id = userId;
|
||||
return await User.update(query, updates).exec()
|
||||
.then((raw) => {
|
||||
return raw;
|
||||
}).catch((err) => {
|
||||
@@ -772,6 +773,33 @@ schema.methods.finishQuest = async function finishQuest (quest) {
|
||||
}
|
||||
});
|
||||
|
||||
if (questK === 'lostMasterclasser4') {
|
||||
let lostMasterclasserQuery = {
|
||||
'achievements.lostMasterclasser': {$ne: true},
|
||||
'achievements.quests.mayhemMistiflying1': {$gt: 0},
|
||||
'achievements.quests.mayhemMistiflying2': {$gt: 0},
|
||||
'achievements.quests.mayhemMistiflying3': {$gt: 0},
|
||||
'achievements.quests.stoikalmCalamity1': {$gt: 0},
|
||||
'achievements.quests.stoikalmCalamity2': {$gt: 0},
|
||||
'achievements.quests.stoikalmCalamity3': {$gt: 0},
|
||||
'achievements.quests.taskwoodsTerror1': {$gt: 0},
|
||||
'achievements.quests.taskwoodsTerror2': {$gt: 0},
|
||||
'achievements.quests.taskwoodsTerror3': {$gt: 0},
|
||||
'achievements.quests.dilatoryDistress1': {$gt: 0},
|
||||
'achievements.quests.dilatoryDistress2': {$gt: 0},
|
||||
'achievements.quests.dilatoryDistress3': {$gt: 0},
|
||||
'achievements.quests.lostMasterclasser1': {$gt: 0},
|
||||
'achievements.quests.lostMasterclasser2': {$gt: 0},
|
||||
'achievements.quests.lostMasterclasser3': {$gt: 0},
|
||||
};
|
||||
let lostMasterclasserUpdate = {
|
||||
$set: {'achievements.lostMasterclasser': true},
|
||||
};
|
||||
promises.concat(participants.map(userId => {
|
||||
return _updateUserWithRetries(userId, lostMasterclasserUpdate, null, lostMasterclasserQuery);
|
||||
}));
|
||||
}
|
||||
|
||||
return Bluebird.all(promises);
|
||||
};
|
||||
|
||||
@@ -788,6 +816,10 @@ schema.methods._processBossQuest = async function processBossQuest (options) {
|
||||
let group = this;
|
||||
let quest = questScrolls[group.quest.key];
|
||||
let down = progress.down * quest.boss.str; // multiply by boss strength
|
||||
// Everyone takes damage
|
||||
let updates = {
|
||||
$inc: {'stats.hp': down},
|
||||
};
|
||||
|
||||
group.quest.progress.hp -= progress.up;
|
||||
// TODO Create a party preferred language option so emits like this can be localized. Suggestion: Always display the English version too. Or, if English is not displayed to the players, at least include it in a new field in the chat object that's visible in the database - essential for admins when troubleshooting quests!
|
||||
@@ -806,15 +838,19 @@ schema.methods._processBossQuest = async function processBossQuest (options) {
|
||||
// TODO To make Rage effects more expandable, let's turn these into functions in quest.boss.rage
|
||||
if (quest.boss.rage.healing) group.quest.progress.hp += group.quest.progress.hp * quest.boss.rage.healing;
|
||||
if (group.quest.progress.hp > quest.boss.hp) group.quest.progress.hp = quest.boss.hp;
|
||||
if (quest.boss.rage.mpDrain) {
|
||||
updates.$set = {'stats.mp': 0};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Everyone takes damage
|
||||
await User.update({
|
||||
_id: {$in: this.getParticipatingQuestMembers()},
|
||||
}, {
|
||||
$inc: {'stats.hp': down},
|
||||
}, {multi: true}).exec();
|
||||
await User.update(
|
||||
{_id:
|
||||
{$in: this.getParticipatingQuestMembers()},
|
||||
},
|
||||
updates,
|
||||
{multi: true}
|
||||
).exec();
|
||||
// Apply changes the currently cronning user locally so we don't have to reload it to get the updated state
|
||||
// TODO how to mark not modified? https://github.com/Automattic/mongoose/pull/1167
|
||||
// must be notModified or otherwise could overwrite future changes: if the user is saved it'll save
|
||||
|
||||
Reference in New Issue
Block a user