up3
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"github.com/df-mc/dragonfly/server/world"
|
||||
"image/color"
|
||||
)
|
||||
|
||||
// Absorption is a lasting effect that increases the health of an entity over
|
||||
// the maximum. Once this extra health is lost, it will not regenerate.
|
||||
var Absorption absorption
|
||||
|
||||
type absorption struct {
|
||||
nopLasting
|
||||
}
|
||||
|
||||
// Start ...
|
||||
func (absorption) Start(e world.Entity, lvl int) {
|
||||
if i, ok := e.(interface {
|
||||
SetAbsorption(health float64)
|
||||
}); ok {
|
||||
i.SetAbsorption(4 * float64(lvl))
|
||||
}
|
||||
}
|
||||
|
||||
// End ...
|
||||
func (absorption) End(e world.Entity, _ int) {
|
||||
if i, ok := e.(interface {
|
||||
SetAbsorption(health float64)
|
||||
}); ok {
|
||||
i.SetAbsorption(0)
|
||||
}
|
||||
}
|
||||
|
||||
// RGBA ...
|
||||
func (absorption) RGBA() color.RGBA {
|
||||
return color.RGBA{R: 0x25, G: 0x52, B: 0xa5, A: 0xff}
|
||||
}
|
||||
Reference in New Issue
Block a user