package handler import ( "time" "github.com/denisovdennis/autohero/internal/model" ) // consumeFreeBuffCharge attempts to consume a per-buff-type free charge. // Returns an error if no charges remain for the given buff type. func consumeFreeBuffCharge(hero *model.Hero, bt model.BuffType, now time.Time) error { if hero.SubscriptionActive { return nil } hero.EnsureBuffChargesPopulated(now) return hero.ConsumeBuffCharge(bt, now) } // refundFreeBuffCharge restores a charge for the specific buff type after a failed activation. func refundFreeBuffCharge(hero *model.Hero, bt model.BuffType) { if hero.SubscriptionActive { return } hero.RefundBuffCharge(bt) }