Fix available conditions for chilling frost and stealth in Habitica (#129234)

Co-authored-by: Joostlek <joostlek@outlook.com>
This commit is contained in:
Manu 2024-10-29 14:24:23 +01:00 committed by GitHub
parent 07c070e253
commit 79c602f59c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -121,9 +121,11 @@ CLASS_SKILLS: tuple[HabiticaButtonEntityDescription, ...] = (
key=HabitipyButtonEntity.FROST,
translation_key=HabitipyButtonEntity.FROST,
press_fn=lambda coordinator: coordinator.api.user.class_.cast["frost"].post(),
# chilling frost can only be cast once per day (streaks buff is false)
available_fn=(
lambda data: data.user["stats"]["lvl"] >= 14
and data.user["stats"]["mp"] >= 40
and not data.user["stats"]["buffs"]["streaks"]
),
class_needed=MAGE,
entity_picture="shop_frost.png",
@ -190,9 +192,21 @@ CLASS_SKILLS: tuple[HabiticaButtonEntityDescription, ...] = (
press_fn=(
lambda coordinator: coordinator.api.user.class_.cast["stealth"].post()
),
# Stealth buffs stack and it can only be cast if the amount of
# unfinished dailies is smaller than the amount of buffs
available_fn=(
lambda data: data.user["stats"]["lvl"] >= 14
and data.user["stats"]["mp"] >= 45
and data.user["stats"]["buffs"]["stealth"]
< len(
[
r
for r in data.tasks
if r.get("type") == "daily"
and r.get("isDue") is True
and r.get("completed") is False
]
)
),
class_needed=ROGUE,
entity_picture="shop_stealth.png",
@ -204,8 +218,10 @@ CLASS_SKILLS: tuple[HabiticaButtonEntityDescription, ...] = (
available_fn=(
lambda data: data.user["stats"]["lvl"] >= 11
and data.user["stats"]["mp"] >= 15
and data.user["stats"]["hp"] < 50
),
class_needed=HEALER,
entity_picture="shop_heal.png",
),
HabiticaButtonEntityDescription(
key=HabitipyButtonEntity.BRIGHTNESS,