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,30 @@
|
||||
package effect
|
||||
|
||||
import (
|
||||
"github.com/df-mc/dragonfly/server/world"
|
||||
"image/color"
|
||||
)
|
||||
|
||||
// FatalPoison is a lasting effect that causes the affected entity to lose
|
||||
// health gradually. fatalPoison, unlike poison, can kill the entity it is
|
||||
// applied to.
|
||||
var FatalPoison fatalPoison
|
||||
|
||||
type fatalPoison struct {
|
||||
nopLasting
|
||||
}
|
||||
|
||||
// Apply ...
|
||||
func (fatalPoison) Apply(e world.Entity, eff Effect) {
|
||||
interval := max(50>>(eff.Level()-1), 1)
|
||||
if eff.Tick()%interval == 0 {
|
||||
if l, ok := e.(living); ok {
|
||||
l.Hurt(1, PoisonDamageSource{Fatal: true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// RGBA ...
|
||||
func (fatalPoison) RGBA() color.RGBA {
|
||||
return color.RGBA{R: 0x4e, G: 0x93, B: 0x31, A: 0xff}
|
||||
}
|
||||
Reference in New Issue
Block a user