32 lines
967 B
Python
32 lines
967 B
Python
from __future__ import annotations
|
|
from typing import TYPE_CHECKING
|
|
|
|
from actions import BaseAction
|
|
|
|
if TYPE_CHECKING:
|
|
from stats import Stats
|
|
|
|
class BaseUseable:
|
|
"""Base type for useable items, with various utilities"""
|
|
|
|
def apply(self, stats: Stats) -> BaseAction:
|
|
"""Use this item's effects"""
|
|
raise NotImplementedError()
|
|
|
|
|
|
class PotionOfHealing(BaseUseable): #TODO: Finish the potion of healing
|
|
"""Restore a specified amount of health to the given Stats object"""
|
|
amount: int
|
|
|
|
def __init__(self, amount: int):
|
|
self.amount = amount
|
|
|
|
def apply(self, stats: Stats) -> BaseAction:
|
|
"""Use this item's effects"""
|
|
raise NotImplementedError()
|
|
|
|
# NOTE: NetHack's version
|
|
# Healing: 8d4 | 6d4 | 4d4. If the result is above MaxHP, MaxHP is incrased by 1 | 1 | 0.
|
|
# Extra Healing: 8d8 | 6d8 | 4d8. If the result is above MaxHP, MaxHP is incrased by 5 | 2 | 0.
|
|
# Full Healing: 400 | 400 | 400. If the result is above MaxHP, MaxHP is incrased by 8 | 4 | 0.
|