mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
fix: special are not "AllowedToFeed" (#10808)
* fix: special are not "AllowedToFeed" * fix lint
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
|
|
||||||
|
import content from 'common/script/content';
|
||||||
|
|
||||||
|
const specialPets = Object.keys(content.specialPets);
|
||||||
|
|
||||||
function getText (textOrFunction) {
|
function getText (textOrFunction) {
|
||||||
if (textOrFunction instanceof Function) {
|
if (textOrFunction instanceof Function) {
|
||||||
return textOrFunction();
|
return textOrFunction();
|
||||||
@@ -18,10 +22,12 @@ export function isHatchable (animal, userItems) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function isAllowedToFeed (animal, userItems) {
|
export function isAllowedToFeed (animal, userItems) {
|
||||||
return isOwned('pet', animal, userItems) && !isOwned('mount', animal, userItems);
|
return !specialPets.includes(animal.key) &&
|
||||||
|
isOwned('pet', animal, userItems) &&
|
||||||
|
!isOwned('mount', animal, userItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createAnimal (egg, potion, type, content, userItems) {
|
export function createAnimal (egg, potion, type, _content, userItems) {
|
||||||
let animalKey = `${egg.key}-${potion.key}`;
|
let animalKey = `${egg.key}-${potion.key}`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -31,7 +37,7 @@ export function createAnimal (egg, potion, type, content, userItems) {
|
|||||||
eggName: getText(egg.text),
|
eggName: getText(egg.text),
|
||||||
potionKey: potion.key,
|
potionKey: potion.key,
|
||||||
potionName: getText(potion.text),
|
potionName: getText(potion.text),
|
||||||
name: content[`${type}Info`][animalKey].text(),
|
name: _content[`${type}Info`][animalKey].text(),
|
||||||
isOwned () {
|
isOwned () {
|
||||||
return isOwned(type, this, userItems);
|
return isOwned(type, this, userItems);
|
||||||
},
|
},
|
||||||
@@ -46,3 +52,4 @@ export function createAnimal (egg, potion, type, content, userItems) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user