Documentation ¶
Index ¶
- func ID(e Type) (int, bool)
- func Register(id int, e Type)
- func ResultingColour(effects []Effect) (color.RGBA, bool)
- type Absorption
- type Blindness
- type ConduitPower
- type Darkness
- type Effect
- type FatalPoison
- type FireResistance
- type Haste
- type HealthBoost
- type Hunger
- type InstantDamage
- type InstantDamageSource
- type InstantHealingSource
- type InstantHealth
- type Invisibility
- type JumpBoost
- type LastingType
- type Levitation
- type MiningFatigue
- type Nausea
- type NightVision
- type Poison
- type PoisonDamageSource
- type PotentType
- type Regeneration
- type RegenerationHealingSource
- type Resistance
- type Saturation
- type SlowFalling
- type Slowness
- type Speed
- type Strength
- type Type
- type WaterBreathing
- type Weakness
- type Wither
- type WitherDamageSource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ID ¶
ID attempts to return the ID an effect was registered with. If found, the id is returned and the bool true.
Types ¶
type Absorption ¶
type Absorption struct {
// contains filtered or unexported fields
}
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.
type Blindness ¶
type Blindness struct {
// contains filtered or unexported fields
}
Blindness is a lasting effect that greatly reduces the vision range of the entity affected.
type ConduitPower ¶
type ConduitPower struct {
// contains filtered or unexported fields
}
ConduitPower is a lasting effect that grants the affected entity the ability to breathe underwater and allows the entity to break faster when underwater or in the rain. (Similarly to haste.)
func (ConduitPower) Multiplier ¶
func (ConduitPower) Multiplier(lvl int) float64
Multiplier returns the mining speed multiplier from this effect.
type Darkness ¶ added in v0.7.0
type Darkness struct {
// contains filtered or unexported fields
}
Darkness is a lasting effect that causes the player's vision to dim occasionally.
type Effect ¶
type Effect struct {
// contains filtered or unexported fields
}
Effect is an effect that can be added to an entity. Effects are either instant (applying the effect only once) or lasting (applying the effect every tick).
func New ¶ added in v0.3.0
func New(t LastingType, lvl int, d time.Duration) Effect
New creates a new Effect using a LastingType passed. Once added to an entity, the time.Duration passed will be ticked down by the entity until it reaches a duration of 0.
func NewAmbient ¶ added in v0.3.0
func NewAmbient(t LastingType, lvl int, d time.Duration) Effect
NewAmbient creates a new ambient (reduced particles, as when using a beacon) Effect using a LastingType passed. Once added to an entity, the time.Duration passed will be ticked down by the entity until it reaches a duration of 0.
func NewInstant ¶ added in v0.3.0
NewInstant returns a new instant Effect using the Type passed. The effect will be applied to an entity once and will expire immediately after.
func (Effect) Ambient ¶ added in v0.3.0
Ambient returns whether the Effect is an ambient effect, leading to reduced particles shown to the client. False is always returned if the Effect was created using New or NewInstant.
func (Effect) Duration ¶
Duration returns the leftover duration of the Effect. The duration returned is always 0 if NewInstant was used to create the effect.
func (Effect) ParticlesHidden ¶ added in v0.3.0
ParticlesHidden returns true if the Effect had its particles hidden by calling WithoutParticles.
func (Effect) TickDuration ¶ added in v0.3.0
TickDuration ticks the effect duration, subtracting time.Second/20 from the leftover time and returning the resulting Effect.
func (Effect) Type ¶ added in v0.3.0
Type returns the underlying type of the Effect. It is either of the type Type or LastingType, depending on whether it was created using New or NewAmbient, or NewInstant.
func (Effect) WithoutParticles ¶ added in v0.3.0
WithoutParticles returns the same Effect with particles disabled. Adding the effect to players will not display the particles around the player.
type FatalPoison ¶
type FatalPoison struct {
// contains filtered or unexported fields
}
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.
type FireResistance ¶
type FireResistance struct {
// contains filtered or unexported fields
}
FireResistance is a lasting effect that grants immunity to fire & lava damage.
type Haste ¶
type Haste struct {
// contains filtered or unexported fields
}
Haste is a lasting effect that increases the mining speed of a player by 20% for each level of the effect.
func (Haste) Multiplier ¶
Multiplier returns the mining speed multiplier from this effect.
type HealthBoost ¶
type HealthBoost struct {
// contains filtered or unexported fields
}
HealthBoost causes the affected entity to have its maximum health changed for a specific duration.
type Hunger ¶
type Hunger struct {
// contains filtered or unexported fields
}
Hunger is a lasting effect that causes an affected player to gradually lose saturation and food.
type InstantDamage ¶
type InstantDamage struct { // Potency specifies the potency of the instant damage. By default, this value is 1, which means 100% of // the instant damage will be applied to an entity. A lingering damage potion, for example, has a potency // of 0.5: It deals 1.5 hearts damage (per tick) instead of 3. Potency float64 }
InstantDamage is an instant effect that causes a living entity to immediately take some damage, depending on the level and the potency of the effect.
func (InstantDamage) WithPotency ¶ added in v0.5.0
func (i InstantDamage) WithPotency(potency float64) Type
WithPotency ...
type InstantDamageSource ¶ added in v0.8.6
type InstantDamageSource struct{}
InstantDamageSource is used for damage caused by an effect.InstantDamage applied to an entity.
func (InstantDamageSource) Fire ¶ added in v0.8.6
func (InstantDamageSource) Fire() bool
func (InstantDamageSource) ReducedByArmour ¶ added in v0.8.6
func (InstantDamageSource) ReducedByArmour() bool
func (InstantDamageSource) ReducedByResistance ¶ added in v0.8.6
func (InstantDamageSource) ReducedByResistance() bool
type InstantHealingSource ¶ added in v0.8.6
type InstantHealingSource struct{}
InstantHealingSource is a healing source used when an entity regains health from an effect.InstantHealth.
func (InstantHealingSource) HealingSource ¶ added in v0.8.6
func (InstantHealingSource) HealingSource()
type InstantHealth ¶
type InstantHealth struct { // Potency specifies the potency of the instant health. By default, this value is 1, which means 100% of // the instant health will be applied to an entity. A lingering health potion, for example, has a potency // of 0.5: It heals 1 heart (per tick) instead of 2. Potency float64 }
InstantHealth is an instant effect that causes the player that it is applied to immediately regain some health. The amount of health regained depends on the effect level and potency.
func (InstantHealth) Apply ¶
Apply instantly heals the world.Entity passed for a bit of health, depending on the effect level and potency.
func (InstantHealth) WithPotency ¶ added in v0.5.0
func (i InstantHealth) WithPotency(potency float64) Type
WithPotency ...
type Invisibility ¶
type Invisibility struct {
// contains filtered or unexported fields
}
Invisibility is a lasting effect that causes the affected entity to turn invisible. While invisible, the entity's armour is still visible and effect particles will still be displayed.
type JumpBoost ¶
type JumpBoost struct {
// contains filtered or unexported fields
}
JumpBoost is a lasting effect that causes the affected entity to be able to jump much higher, depending on the level of the effect.
type LastingType ¶ added in v0.3.0
type LastingType interface { Type // Start is called for lasting effects when they are initially added to an entity. Start(e world.Entity, lvl int) // End is called for lasting effects when they are removed from an entity. End(e world.Entity, lvl int) }
LastingType represents an effect type that can have a duration. An effect can be made using it by calling effect.New with the LastingType.
type Levitation ¶
type Levitation struct {
// contains filtered or unexported fields
}
Levitation is a lasting effect that causes the affected entity to slowly levitate upwards. It is roughly the opposite of the SlowFalling effect.
type MiningFatigue ¶
type MiningFatigue struct {
// contains filtered or unexported fields
}
MiningFatigue is a lasting effect that decreases the mining speed of a player by 10% for each level of the effect.
func (MiningFatigue) Multiplier ¶
func (MiningFatigue) Multiplier(lvl int) float64
Multiplier returns the mining speed multiplier from this effect.
type Nausea ¶
type Nausea struct {
// contains filtered or unexported fields
}
Nausea is a lasting effect that causes the screen to warp, similarly to when entering a nether portal.
type NightVision ¶
type NightVision struct {
// contains filtered or unexported fields
}
NightVision is a lasting effect that causes the affected entity to see in dark places as though they were fully lit up.
type Poison ¶
type Poison struct {
// contains filtered or unexported fields
}
Poison is a lasting effect that causes the affected entity to lose health gradually. Poison cannot kill, unlike FatalPoison.
type PoisonDamageSource ¶ added in v0.8.6
type PoisonDamageSource struct { // Fatal specifies if the damage was caused by effect.FatalPoison and if // the damage could therefore kill the entity. Fatal bool }
PoisonDamageSource is used for damage caused by an effect.Poison or effect.FatalPoison applied to an entity.
func (PoisonDamageSource) Fire ¶ added in v0.8.6
func (PoisonDamageSource) Fire() bool
func (PoisonDamageSource) ReducedByArmour ¶ added in v0.8.6
func (PoisonDamageSource) ReducedByArmour() bool
func (PoisonDamageSource) ReducedByResistance ¶ added in v0.8.6
func (PoisonDamageSource) ReducedByResistance() bool
type PotentType ¶ added in v0.5.0
type PotentType interface { Type // WithPotency updates the potency of the type with the one given and returns it. WithPotency(potency float64) Type }
PotentType represents an effect type which can have its potency changed.
type Regeneration ¶
type Regeneration struct {
// contains filtered or unexported fields
}
Regeneration is an effect that causes the entity that it is added to slowly regenerate health. The level of the effect influences the speed with which the entity regenerates.
type RegenerationHealingSource ¶ added in v0.8.6
type RegenerationHealingSource struct{}
RegenerationHealingSource is a healing source used when an entity regenerates health from an effect.Regeneration.
func (RegenerationHealingSource) HealingSource ¶ added in v0.8.6
func (RegenerationHealingSource) HealingSource()
type Resistance ¶
type Resistance struct {
// contains filtered or unexported fields
}
Resistance is a lasting effect that reduces the damage taken from any sources except for void damage or custom damage.
func (Resistance) Multiplier ¶
func (Resistance) Multiplier(e world.DamageSource, lvl int) float64
Multiplier returns a damage multiplier for the damage source passed.
type Saturation ¶
type Saturation struct {
// contains filtered or unexported fields
}
Saturation is a lasting effect that causes the affected player to regain food and saturation.
type SlowFalling ¶
type SlowFalling struct {
// contains filtered or unexported fields
}
SlowFalling is a lasting effect that causes the affected entity to fall very slowly.
type Slowness ¶
type Slowness struct {
// contains filtered or unexported fields
}
Slowness is a lasting effect that decreases the movement speed of a living entity by 15% for each level that the effect has.
type Speed ¶
type Speed struct {
// contains filtered or unexported fields
}
Speed is a lasting effect that increases the speed of an entity by 20% for each level that the effect has.
type Strength ¶
type Strength struct {
// contains filtered or unexported fields
}
Strength is a lasting effect that increases the damage dealt with melee attacks when applied to an entity.
func (Strength) Multiplier ¶
Multiplier returns the damage multiplier of the effect.
type Type ¶ added in v0.3.0
type Type interface { // RGBA returns the colour of the effect. If multiple effects are present, the colours will be mixed // together to form a new colour. RGBA() color.RGBA // Apply applies the effect to an entity. This method applies the effect to an entity once for instant effects, such // as healing the world.Entity for instant health. // Apply always has a duration of 0 passed to it for instant effect implementations. For lasting effects that // implement LastingType, the appropriate leftover duration is passed. Apply(e world.Entity, lvl int, d time.Duration) }
Type is an effect implementation that can be applied to an entity.
type WaterBreathing ¶
type WaterBreathing struct {
// contains filtered or unexported fields
}
WaterBreathing is a lasting effect that allows the affected entity to breath underwater until the effect expires.
type Weakness ¶
type Weakness struct {
// contains filtered or unexported fields
}
Weakness is a lasting effect that reduces the damage dealt to other entities with melee attacks.
func (Weakness) Multiplier ¶
Multiplier returns the damage multiplier of the effect.
type Wither ¶
type Wither struct {
// contains filtered or unexported fields
}
Wither is a lasting effect that causes an entity to take continuous damage that is capable of killing an entity.
type WitherDamageSource ¶ added in v0.8.6
type WitherDamageSource struct{}
WitherDamageSource is used for damage caused by an effect.Wither applied to an entity.
func (WitherDamageSource) Fire ¶ added in v0.8.6
func (WitherDamageSource) Fire() bool
func (WitherDamageSource) ReducedByArmour ¶ added in v0.8.6
func (WitherDamageSource) ReducedByArmour() bool
func (WitherDamageSource) ReducedByResistance ¶ added in v0.8.6
func (WitherDamageSource) ReducedByResistance() bool
Source Files ¶
- absorption.go
- blindness.go
- conduit_power.go
- darkness.go
- effect.go
- fatal_poison.go
- fire_resistance.go
- haste.go
- health_boost.go
- hunger.go
- instant_damage.go
- instant_health.go
- invisibility.go
- jump_boost.go
- levitation.go
- mining_fatigue.go
- nausea.go
- night_vision.go
- poison.go
- regeneration.go
- register.go
- resistance.go
- saturation.go
- slow_falling.go
- slowness.go
- speed.go
- strength.go
- water_breathing.go
- weakness.go
- wither.go