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

     1  package effect
     2  
     3  import (
     4  	"github.com/df-mc/dragonfly/server/world"
     5  	"image/color"
     6  )
     7  
     8  // HealthBoost causes the affected entity to have its maximum health changed for a specific duration.
     9  type HealthBoost struct {
    10  	nopLasting
    11  }
    12  
    13  // Start ...
    14  func (HealthBoost) Start(e world.Entity, lvl int) {
    15  	if l, ok := e.(living); ok {
    16  		l.SetMaxHealth(l.MaxHealth() + 4*float64(lvl))
    17  	}
    18  }
    19  
    20  // End ...
    21  func (HealthBoost) End(e world.Entity, lvl int) {
    22  	if l, ok := e.(living); ok {
    23  		l.SetMaxHealth(l.MaxHealth() - 4*float64(lvl))
    24  	}
    25  }
    26  
    27  // RGBA ...
    28  func (HealthBoost) RGBA() color.RGBA {
    29  	return color.RGBA{R: 0xf8, G: 0x7d, B: 0x23, A: 0xff}
    30  }