You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
569 B
Go

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