from core.tuning.skill import SkillTuning
from siege import game


class Regen(object):
    NAME = "Regen"
    ICON = SkillTuning.REGENERATE.ICON

    def __init__(self, owner, level, duration):
        hp = owner.stats.HP
        hpRegen = owner.stats.HPRegen
        self.adjustment = hp.getMax() / (34 - level * 2)
        hpRegen.adjust(self.adjustment)

    def onRemove(self, owner):
        hpRegen = owner.stats.HPRegen
        hpRegen.adjust(-self.adjustment)

    def isPositive(self):
        return True

    @staticmethod
    def register():
        game.effects.register(Regen.NAME, Regen)
