Added chance to conclude, finality, and finishing
This commit is contained in:
@@ -6,6 +6,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
||||
import com.willfp.ecoenchants.nms.Target;
|
||||
import com.willfp.ecoenchants.nms.TridentStack;
|
||||
import com.willfp.ecoenchants.util.Rand;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -17,7 +18,7 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class Conclude extends EcoEnchant {
|
||||
public Conclude() {
|
||||
super(
|
||||
new EcoEnchantBuilder("conclude", EnchantmentType.NORMAL, Target.Applicable.TRIDENT, 4.0)
|
||||
new EcoEnchantBuilder("conclude", EnchantmentType.NORMAL, Target.Applicable.TRIDENT, 4.1)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -37,6 +38,9 @@ public class Conclude extends EcoEnchant {
|
||||
if (!EnchantChecks.item(item, this)) return;
|
||||
int level = EnchantChecks.getItemLevel(item, this);
|
||||
|
||||
if (Rand.randFloat(0, 1) > level * 0.01 * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level"))
|
||||
return;
|
||||
|
||||
double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
|
||||
if (!(victim.getHealth() <= level * minhealth))
|
||||
return;
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
||||
import com.willfp.ecoenchants.nms.Target;
|
||||
import com.willfp.ecoenchants.util.Rand;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -14,7 +15,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
public class Finality extends EcoEnchant {
|
||||
public Finality() {
|
||||
super(
|
||||
new EcoEnchantBuilder("finality", EnchantmentType.NORMAL, Target.Applicable.BOW, 4.0)
|
||||
new EcoEnchantBuilder("finality", EnchantmentType.NORMAL, Target.Applicable.BOW, 4.1)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -36,6 +37,9 @@ public class Finality extends EcoEnchant {
|
||||
if (!EnchantChecks.arrow(arrow, this)) return;
|
||||
int level = EnchantChecks.getArrowLevel(arrow, this);
|
||||
|
||||
if (Rand.randFloat(0, 1) > level * 0.01 * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level"))
|
||||
return;
|
||||
|
||||
double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
|
||||
if (!(((LivingEntity) event.getEntity()).getHealth() <= level * minhealth))
|
||||
return;
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
||||
import com.willfp.ecoenchants.nms.Target;
|
||||
import com.willfp.ecoenchants.util.Rand;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@@ -12,7 +13,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
public class Finishing extends EcoEnchant {
|
||||
public Finishing() {
|
||||
super(
|
||||
new EcoEnchantBuilder("finishing", EnchantmentType.NORMAL, Target.Applicable.SWORD, 4.0)
|
||||
new EcoEnchantBuilder("finishing", EnchantmentType.NORMAL, Target.Applicable.SWORD, 4.1)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -32,6 +33,9 @@ public class Finishing extends EcoEnchant {
|
||||
if (!EnchantChecks.mainhand(player, this)) return;
|
||||
int level = EnchantChecks.getMainhandLevel(player, this);
|
||||
|
||||
if (Rand.randFloat(0, 1) > level * 0.01 * this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "chance-per-level"))
|
||||
return;
|
||||
|
||||
double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
|
||||
if (!(((LivingEntity) event.getEntity()).getHealth() <= level * minhealth))
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user