Added chance to conclude, finality, and finishing

This commit is contained in:
Auxilor 2020-08-30 14:47:03 +01:00
parent 004485c3f8
commit 979bb8c9b8
7 changed files with 29 additions and 14 deletions

View File

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

View File

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

View File

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

View File

@ -2,11 +2,11 @@
# Conclude EcoEnchant
#
config-version: 4.0 # Don't edit this.
config-version: 4.1 # Don't edit this.
name: "Conclude"
description: Instantly kill entities on low health.
description: Chance to instantly kill entities on low health.
obtaining:
table: true
@ -20,4 +20,5 @@ general-config:
maximum-level: 5
config:
minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Conclude 5 kills any mobs below 2.5 hearts
minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Conclude 5 kills any mobs below 2.5 hearts
chance-per-level: 10

View File

@ -2,11 +2,11 @@
# Finality EcoEnchant
#
config-version: 4.0 # Don't edit this.
config-version: 4.1 # Don't edit this.
name: "Finality"
description: Instantly kill entities on low health.
description: Chance to instantly kill entities on low health.
obtaining:
table: true
@ -20,4 +20,5 @@ general-config:
maximum-level: 5
config:
minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Finality 5 kills any mobs below 2.5 hearts
minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Finality 5 kills any mobs below 2.5 hearts
chance-per-level: 10

View File

@ -2,11 +2,11 @@
# Finishing EcoEnchant
#
config-version: 4.0 # Don't edit this.
config-version: 4.1 # Don't edit this.
name: "Finishing"
description: Instantly kill entities on low health.
description: Chance to instantly kill entities on low health.
obtaining:
table: true
@ -20,4 +20,5 @@ general-config:
maximum-level: 5
config:
minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Finishing 5 kills any mobs below 2.5 hearts
minimum-health-per-level: 1 # Multiplied by level, eg: if 1, then Finishing 5 kills any mobs below 2.5 hearts
chance-per-level: 10

View File

@ -17,7 +17,7 @@ obtaining:
general-config:
grindstoneable: true
conflicts: []
maximum-level: 3
maximum-level: 6
config:
damage-multiplier-per-level: 0.08 # Damage * Level * Multiplier is used to calculate how much health to heal
damage-multiplier-per-level: 0.04 # Damage * Level * Multiplier is used to calculate how much health to heal