From 3e0e7696f8de87dc2f52e58665fd1bed47d88818 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 13 Nov 2020 21:49:27 +0000 Subject: [PATCH] Added cap for goliath --- .../enchantments/ecoenchants/normal/Goliath.java | 6 ++++++ Plugin/src/main/resources/enchants/normal/goliath.yml | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java index a3e24f6f..8855d32a 100644 --- a/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java +++ b/Plugin/src/main/java/com/willfp/ecoenchants/enchantments/ecoenchants/normal/Goliath.java @@ -5,6 +5,8 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants; import org.bukkit.attribute.Attribute; import org.bukkit.entity.LivingEntity; import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.kingdoms.utils.caffeine.checkerframework.checker.units.qual.A; + public final class Goliath extends EcoEnchant { public Goliath() { super( @@ -25,6 +27,10 @@ public final class Goliath extends EcoEnchant { double damage = event.getDamage(); double multiplier = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier"); double bonus = 1 + (multiplier * level * timesMoreHealth); + if(bonus - 1 > this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-cap")) { + bonus = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "multiplier-cap") + 1; + } + A event.setDamage(damage * bonus); } } diff --git a/Plugin/src/main/resources/enchants/normal/goliath.yml b/Plugin/src/main/resources/enchants/normal/goliath.yml index dfd3144e..c1a684e4 100644 --- a/Plugin/src/main/resources/enchants/normal/goliath.yml +++ b/Plugin/src/main/resources/enchants/normal/goliath.yml @@ -20,4 +20,5 @@ general-config: maximum-level: 8 config: - multiplier: 0.01 # If enemy has 200 health, and you have 20 w/ goliath 8 then your damage is multiplied by: ((200/10)*8*0.01) + 1 = 2.6 \ No newline at end of file + multiplier: 0.01 # If enemy has 200 health, and you have 20 w/ goliath 8 then your damage is multiplied by: ((200/10)*8*0.01) + 1 = 2.6 + multiplier-cap: 2.5 # Never deal more than x times more damage \ No newline at end of file