mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
New cards — Congratulations, Get Well (#8655)
* Add card and achievement sprite for Congrats card
* Add data regarding Congrats card
* Add Get Well card
* Add Get Well images
* Add schema
* Remove `if (!target.flags) target.flags = {};` code from cards
* Remove white backgrounds for congrats sprites
* add inital tests for cards
* Fix card tests
* Fix invalid urls in tests
* Update POST-user_class_cast_spellId.test.js
* Update POST-user_class_cast_spellId.test.js
* Update POST-user_class_cast_spellId.test.js
* Update congrats card sprite
* Fix card logic
* Fix user schema
* Change achievement values for new cards to Number
* Resize congrats and getwell cards
This will make them be sized properly
* Separate Market from Drops
* Extract cards to new section
* fix(sprites): revert spritesheet changes
* Add flags if target does not have them
This commit is contained in:
@@ -181,7 +181,7 @@ let ultimateGearAchievs = ['healer', 'rogue', 'warrior', 'mage'].reduce((achievs
|
||||
}, {});
|
||||
Object.assign(achievementsData, ultimateGearAchievs);
|
||||
|
||||
let cardAchievs = ['greeting', 'thankyou', 'nye', 'valentine', 'birthday'].reduce((achievs, type) => {
|
||||
let cardAchievs = ['greeting', 'thankyou', 'nye', 'valentine', 'birthday', 'congrats', 'getwell'].reduce((achievs, type) => {
|
||||
achievs[`${type}Cards`] = {
|
||||
icon: `achievement-${type}`,
|
||||
titleKey: `${type}CardAchievementTitle`,
|
||||
|
||||
@@ -144,6 +144,16 @@ api.cardTypes = {
|
||||
messageOptions: 1,
|
||||
yearRound: true,
|
||||
},
|
||||
congrats: {
|
||||
key: 'congrats',
|
||||
messageOptions: 5,
|
||||
yearRound: true,
|
||||
},
|
||||
getwell: {
|
||||
key: 'getwell',
|
||||
messageOptions: 4,
|
||||
yearRound: true,
|
||||
},
|
||||
};
|
||||
|
||||
api.special = api.spells.special;
|
||||
|
||||
@@ -511,6 +511,62 @@ spells.special = {
|
||||
if (!target.flags) target.flags = {};
|
||||
target.flags.cardReceived = true;
|
||||
|
||||
user.stats.gp -= 10;
|
||||
},
|
||||
},
|
||||
congrats: {
|
||||
text: t('congratsCard'),
|
||||
mana: 0,
|
||||
value: 10,
|
||||
immediateUse: true,
|
||||
silent: true,
|
||||
target: 'user',
|
||||
notes: t('congratsCardNotes'),
|
||||
cast (user, target) {
|
||||
if (user === target) {
|
||||
if (!user.achievements.congrats) user.achievements.congrats = 0;
|
||||
user.achievements.congrats++;
|
||||
} else {
|
||||
each([user, target], (u) => {
|
||||
if (!u.achievements.congrats) u.achievements.congrats = 0;
|
||||
u.achievements.congrats++;
|
||||
});
|
||||
}
|
||||
|
||||
if (!target.items.special.congratsReceived) target.items.special.congratsReceived = [];
|
||||
target.items.special.congratsReceived.push(user.profile.name);
|
||||
|
||||
if (!target.flags) target.flags = {};
|
||||
target.flags.cardReceived = true;
|
||||
|
||||
user.stats.gp -= 10;
|
||||
},
|
||||
},
|
||||
getwell: {
|
||||
text: t('getwellCard'),
|
||||
mana: 0,
|
||||
value: 10,
|
||||
immediateUse: true,
|
||||
silent: true,
|
||||
target: 'user',
|
||||
notes: t('getwellCardNotes'),
|
||||
cast (user, target) {
|
||||
if (user === target) {
|
||||
if (!user.achievements.getwell) user.achievements.getwell = 0;
|
||||
user.achievements.getwell++;
|
||||
} else {
|
||||
each([user, target], (u) => {
|
||||
if (!u.achievements.getwell) u.achievements.getwell = 0;
|
||||
u.achievements.getwell++;
|
||||
});
|
||||
}
|
||||
|
||||
if (!target.items.special.getwellReceived) target.items.special.getwellReceived = [];
|
||||
target.items.special.getwellReceived.push(user.profile.name);
|
||||
|
||||
if (!target.flags) target.flags = {};
|
||||
target.flags.cardReceived = true;
|
||||
|
||||
user.stats.gp -= 10;
|
||||
},
|
||||
},
|
||||
|
||||
@@ -240,7 +240,7 @@ function _getSeasonalAchievements (user, language) {
|
||||
|
||||
_addPlural(result, user, {path: 'costumeContests', language});
|
||||
|
||||
let cardAchievements = ['greeting', 'thankyou', 'nye', 'valentine', 'birthday'];
|
||||
let cardAchievements = ['greeting', 'thankyou', 'nye', 'valentine', 'birthday', 'congrats', 'getwell'];
|
||||
cardAchievements.forEach(path => {
|
||||
_addSimpleWithCount(result, user, {path, key: `${path}Cards`, language});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user