Buff wardens

This commit is contained in:
NotAlexNoyle committed 2026-08-10 07:50:07 -04:00
1 parent 3a73c99494
commit e6f6a93187
3 files changed
+45

No files matched your search

+13
View File
@@ -52,4 +52,17 @@ object Config {
fun getWardenChance(): Double {
return config.get("wardenChance") as Double
}
// Defaults are supplied here so configs written before this buff existed keep working
fun getWardenBuffEnabled(): Boolean {
return config.getBoolean("wardenBuffEnabled", true)
}
fun getWardenHealthMultiplier(): Double {
return config.getDouble("wardenHealthMultiplier", 1.73)
}
fun getWardenAttackDamageMultiplier(): Double {
return config.getDouble("wardenAttackDamageMultiplier", 2.8)
}
}
+25
View File
@@ -4,7 +4,10 @@ package plugin
import kotlin.random.Random
import org.bukkit.Material
import org.bukkit.attribute.Attribute
import org.bukkit.entity.Entity
import org.bukkit.entity.EntityType
import org.bukkit.entity.LivingEntity
import org.bukkit.event.EventHandler
import org.bukkit.event.Listener
import org.bukkit.event.entity.CreatureSpawnEvent
@@ -36,6 +39,28 @@ class Listeners : Listener {
if (reason == CreatureSpawnEvent.SpawnReason.RAID && raiderQuantity > 0) {
repeat(raiderQuantity) { world.spawnEntity(pos, type, CreatureSpawnEvent.SpawnReason.CUSTOM) }
}
if (type == EntityType.WARDEN && Config.getWardenBuffEnabled()) {
buffWarden(event.entity)
}
}
// 1.8 combat lets players land 2 full hits per second instead of 1.6 and 1.8 armour absorbs a flat
// 80%, so warden health and melee damage are scaled to keep the fight as hard as it is under 1.9.
// Attribute base values persist in entity NBT, so each warden is buffed once at spawn.
private fun buffWarden(entity: Entity) {
if (entity !is LivingEntity) return
val maxHealth = entity.getAttribute(Attribute.GENERIC_MAX_HEALTH)
if (maxHealth != null) {
maxHealth.baseValue = maxHealth.baseValue * Config.getWardenHealthMultiplier()
entity.health = maxHealth.value
}
val attackDamage = entity.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE)
if (attackDamage != null) {
attackDamage.baseValue = attackDamage.baseValue * Config.getWardenAttackDamageMultiplier()
}
}
@EventHandler(ignoreCancelled = true)
+7
View File
@@ -19,3 +19,10 @@ zombieIron: 0.1
# chance to spawn a warden
wardenChanceEnabled: false
wardenChance: 0.001
# warden buff keeping 1.8 combat as hard as 1.9
# health x1.73 restores time-to-kill lost to the faster 1.8 hit rate
# damage x2.8 offsets 1.8 armour absorbing a flat 80%
wardenBuffEnabled: true
wardenHealthMultiplier: 1.73
wardenAttackDamageMultiplier: 2.8