Files
mc/server/entity/effect/health_boost.go
T

34 lines
665 B
Go
Raw Normal View History

2026-07-09 08:33:57 +08:00
package effect
import (
"github.com/df-mc/dragonfly/server/world"
"image/color"
)
// HealthBoost causes the affected entity to have its maximum health changed
// for a specific duration.
var HealthBoost healthBoost
type healthBoost struct {
nopLasting
}
// Start ...
func (healthBoost) Start(e world.Entity, lvl int) {
if l, ok := e.(living); ok {
l.SetMaxHealth(l.MaxHealth() + 4*float64(lvl))
}
}
// End ...
func (healthBoost) End(e world.Entity, lvl int) {
if l, ok := e.(living); ok {
l.SetMaxHealth(l.MaxHealth() - 4*float64(lvl))
}
}
// RGBA ...
func (healthBoost) RGBA() color.RGBA {
return color.RGBA{R: 0xf8, G: 0x7d, B: 0x23, A: 0xff}
}