mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Revert "feature: adding hp notification for boss damage" (#8340)
This commit is contained in:
@@ -709,26 +709,12 @@ schema.methods._processBossQuest = async function processBossQuest (options) {
|
||||
}
|
||||
}
|
||||
|
||||
let promises = [];
|
||||
|
||||
// Everyone takes damage
|
||||
if (down !== 0) {
|
||||
let members = await User.find({
|
||||
_id: {$in: this.getParticipatingQuestMembers()},
|
||||
}).select('notifications stats.hp');
|
||||
|
||||
_.each(members, (member) => {
|
||||
member.stats.hp += down;
|
||||
let bossNotification = _.find(member.notifications, {type: 'BOSS_DAMAGE'});
|
||||
if (bossNotification) {
|
||||
bossNotification.data.damageTaken += down;
|
||||
bossNotification.markModified('data.damageTaken');
|
||||
} else {
|
||||
member.addNotification('BOSS_DAMAGE', {damageTaken: down});
|
||||
}
|
||||
promises.push(member.save());
|
||||
});
|
||||
}
|
||||
await User.update({
|
||||
_id: {$in: this.getParticipatingQuestMembers()},
|
||||
}, {
|
||||
$inc: {'stats.hp': down},
|
||||
}, {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
|
||||
@@ -740,11 +726,10 @@ schema.methods._processBossQuest = async function processBossQuest (options) {
|
||||
group.sendChat(`\`You defeated ${quest.boss.name('en')}! Questing party members receive the rewards of victory.\``);
|
||||
|
||||
// Participants: Grant rewards & achievements, finish quest
|
||||
promises.push(group.finishQuest(shared.content.quests[group.quest.key]));
|
||||
await group.finishQuest(shared.content.quests[group.quest.key]);
|
||||
}
|
||||
|
||||
promises.push(group.save());
|
||||
return await Bluebird.all(promises);
|
||||
return await group.save();
|
||||
};
|
||||
|
||||
schema.methods._processCollectionQuest = async function processCollectionQuest (options) {
|
||||
|
||||
Reference in New Issue
Block a user