github.com/df-mc/dragonfly@v0.9.13/server/entity/effect/absorption.go (about)

     1  package effect
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/world"
     5  	"image/color"
     6  )
     7  
     8  // Absorption is a lasting effect that increases the health of an entity over the maximum. Once this extra
     9  // health is lost, it will not regenerate.
    10  type Absorption struct {
    11  	nopLasting
    12  }
    13  
    14  // Start ...
    15  func (Absorption) Start(e world.Entity, lvl int) {
    16  	if i, ok := e.(interface {
    17  		SetAbsorption(health float64)
    18  	}); ok {
    19  		i.SetAbsorption(4 * float64(lvl))
    20  	}
    21  }
    22  
    23  // End ...
    24  func (Absorption) End(e world.Entity, _ int) {
    25  	if i, ok := e.(interface {
    26  		SetAbsorption(health float64)
    27  	}); ok {
    28  		i.SetAbsorption(0)
    29  	}
    30  }
    31  
    32  // RGBA ...
    33  func (Absorption) RGBA() color.RGBA {
    34  	return color.RGBA{R: 0x25, G: 0x52, B: 0xa5, A: 0xff}
    35  }