Added cap for goliath

This commit is contained in:
Auxilor 2020-11-13 21:49:27 +00:00
parent 0d50c5e2a8
commit 3e0e7696f8
2 changed files with 8 additions and 1 deletions

View File

@ -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);
}
}

View File

@ -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
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