MineInAbyss / Mobzy

Config-driven custom mobs for Spigot using ECS
https://mineinabyss.com/Mobzy/
MIT License
41 stars 7 forks source link

Add "should ignore armor" boolean to !<geary:deal_damage> #53

Closed Boy0000 closed 3 years ago

0ffz commented 3 years ago

If anyone wants to implement this, call it ignoreArmor and default to false

pixelfac commented 3 years ago

Do I need to also implement the system for ignoring armor, or just make the bool that basically does nothing

Norazan commented 3 years ago

Do I need to also implement the system for ignoring armor, or just make the bool that basically does nothing

Also implement it. For a simple way to do this, just calling the bukkit Entity.damage() function takes armor into account. The code thats written there right now sets the HP directly, essentially ignoring armor.

pixelfac commented 3 years ago

I'm trying to implement the logic, but IntelliJ keeps giving me inferred type is Unit but Double was expected at bukkit.damage()

val bukkit = entity.toBukkit<LivingEntity>() ?: return false
        val ignoreArmor = false
        bukkit.health = if (ignoreArmor) (bukkit.health - damage.randomOrMin()).coerceAtLeast(minHealth) else bukkit.damage(damage.randomOrMin());
        return true
Norazan commented 3 years ago

bukkit.damage() doesn't return a health value, its a void function that deals damage to the target

pixelfac commented 3 years ago

ez fix https://github.com/MineInAbyss/Geary/pull/15