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

This commit is contained in:
2026-07-09 08:33:57 +08:00
commit 26ed99fda6
845 changed files with 75419 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
package effect
import (
"github.com/df-mc/dragonfly/server/world"
"image/color"
)
// Slowness is a lasting effect that decreases the movement speed of a living
// entity by 15% for each level that the effect has.
var Slowness slowness
type slowness struct {
nopLasting
}
// Start ...
func (slowness) Start(e world.Entity, lvl int) {
slowness := 1 - float64(lvl)*0.15
if slowness <= 0 {
slowness = 0.00001
}
if l, ok := e.(living); ok {
l.SetSpeed(l.Speed() * slowness)
}
}
// End ...
func (slowness) End(e world.Entity, lvl int) {
slowness := 1 - float64(lvl)*0.15
if slowness <= 0 {
slowness = 0.00001
}
if l, ok := e.(living); ok {
l.SetSpeed(l.Speed() / slowness)
}
}
// RGBA ...
func (slowness) RGBA() color.RGBA {
return color.RGBA{R: 0x8b, G: 0xaf, B: 0xe0, A: 0xff}
}