Files
bl/logic/service/fight/input/divine_energy.go
xinian 9c6f3988de
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
refactor: 重构 CurrentPet 为 CurPet
2026-04-04 04:34:43 +08:00

42 lines
772 B
Go

package input
func (our *Input) CurrentDivineEnergy() int {
currentPet := our.PrimaryCurPet()
if currentPet == nil {
return 0
}
return currentPet.DivineEnergy
}
func (our *Input) AddDivineEnergy(value int) bool {
currentPet := our.PrimaryCurPet()
if currentPet == nil || value <= 0 {
return false
}
currentPet.DivineEnergy += value
if currentPet.DivineEnergy < 0 {
currentPet.DivineEnergy = 0
}
return true
}
func (our *Input) ConsumeDivineEnergy() int {
currentPet := our.PrimaryCurPet()
if currentPet == nil {
return 0
}
value := currentPet.DivineEnergy
currentPet.DivineEnergy = 0
return value
}
func (our *Input) ClearDivineEnergy() {
currentPet := our.PrimaryCurPet()
if currentPet == nil {
return
}
currentPet.DivineEnergy = 0
}