mirror of
https://github.com/Auxilor/EcoEnchants.git
synced 2024-12-27 20:37:34 +01:00
Added chance to conclude, finality, and finishing
This commit is contained in:
parent
004485c3f8
commit
979bb8c9b8
@ -6,6 +6,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
|||||||
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.nms.Target;
|
import com.willfp.ecoenchants.nms.Target;
|
||||||
import com.willfp.ecoenchants.nms.TridentStack;
|
import com.willfp.ecoenchants.nms.TridentStack;
|
||||||
|
import com.willfp.ecoenchants.util.Rand;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -17,7 +18,7 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class Conclude extends EcoEnchant {
|
public class Conclude extends EcoEnchant {
|
||||||
public Conclude() {
|
public Conclude() {
|
||||||
super(
|
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;
|
if (!EnchantChecks.item(item, this)) return;
|
||||||
int level = EnchantChecks.getItemLevel(item, this);
|
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");
|
double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
|
||||||
if (!(victim.getHealth() <= level * minhealth))
|
if (!(victim.getHealth() <= level * minhealth))
|
||||||
return;
|
return;
|
||||||
|
@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
|||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.nms.Target;
|
import com.willfp.ecoenchants.nms.Target;
|
||||||
|
import com.willfp.ecoenchants.util.Rand;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -14,7 +15,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
public class Finality extends EcoEnchant {
|
public class Finality extends EcoEnchant {
|
||||||
public Finality() {
|
public Finality() {
|
||||||
super(
|
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;
|
if (!EnchantChecks.arrow(arrow, this)) return;
|
||||||
int level = EnchantChecks.getArrowLevel(arrow, this);
|
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");
|
double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
|
||||||
if (!(((LivingEntity) event.getEntity()).getHealth() <= level * minhealth))
|
if (!(((LivingEntity) event.getEntity()).getHealth() <= level * minhealth))
|
||||||
return;
|
return;
|
||||||
|
@ -5,6 +5,7 @@ import com.willfp.ecoenchants.enchantments.EcoEnchantBuilder;
|
|||||||
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
import com.willfp.ecoenchants.enchantments.EcoEnchants;
|
||||||
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
import com.willfp.ecoenchants.enchantments.util.checks.EnchantChecks;
|
||||||
import com.willfp.ecoenchants.nms.Target;
|
import com.willfp.ecoenchants.nms.Target;
|
||||||
|
import com.willfp.ecoenchants.util.Rand;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -12,7 +13,7 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
public class Finishing extends EcoEnchant {
|
public class Finishing extends EcoEnchant {
|
||||||
public Finishing() {
|
public Finishing() {
|
||||||
super(
|
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;
|
if (!EnchantChecks.mainhand(player, this)) return;
|
||||||
int level = EnchantChecks.getMainhandLevel(player, this);
|
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");
|
double minhealth = this.getConfig().getDouble(EcoEnchants.CONFIG_LOCATION + "minimum-health-per-level");
|
||||||
if (!(((LivingEntity) event.getEntity()).getHealth() <= level * minhealth))
|
if (!(((LivingEntity) event.getEntity()).getHealth() <= level * minhealth))
|
||||||
return;
|
return;
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
# Conclude EcoEnchant
|
# Conclude EcoEnchant
|
||||||
#
|
#
|
||||||
|
|
||||||
config-version: 4.0 # Don't edit this.
|
config-version: 4.1 # Don't edit this.
|
||||||
|
|
||||||
name: "Conclude"
|
name: "Conclude"
|
||||||
|
|
||||||
description: Instantly kill entities on low health.
|
description: Chance to instantly kill entities on low health.
|
||||||
|
|
||||||
obtaining:
|
obtaining:
|
||||||
table: true
|
table: true
|
||||||
@ -21,3 +21,4 @@ general-config:
|
|||||||
|
|
||||||
config:
|
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
|
@ -2,11 +2,11 @@
|
|||||||
# Finality EcoEnchant
|
# Finality EcoEnchant
|
||||||
#
|
#
|
||||||
|
|
||||||
config-version: 4.0 # Don't edit this.
|
config-version: 4.1 # Don't edit this.
|
||||||
|
|
||||||
name: "Finality"
|
name: "Finality"
|
||||||
|
|
||||||
description: Instantly kill entities on low health.
|
description: Chance to instantly kill entities on low health.
|
||||||
|
|
||||||
obtaining:
|
obtaining:
|
||||||
table: true
|
table: true
|
||||||
@ -21,3 +21,4 @@ general-config:
|
|||||||
|
|
||||||
config:
|
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
|
@ -2,11 +2,11 @@
|
|||||||
# Finishing EcoEnchant
|
# Finishing EcoEnchant
|
||||||
#
|
#
|
||||||
|
|
||||||
config-version: 4.0 # Don't edit this.
|
config-version: 4.1 # Don't edit this.
|
||||||
|
|
||||||
name: "Finishing"
|
name: "Finishing"
|
||||||
|
|
||||||
description: Instantly kill entities on low health.
|
description: Chance to instantly kill entities on low health.
|
||||||
|
|
||||||
obtaining:
|
obtaining:
|
||||||
table: true
|
table: true
|
||||||
@ -21,3 +21,4 @@ general-config:
|
|||||||
|
|
||||||
config:
|
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
|
@ -17,7 +17,7 @@ obtaining:
|
|||||||
general-config:
|
general-config:
|
||||||
grindstoneable: true
|
grindstoneable: true
|
||||||
conflicts: []
|
conflicts: []
|
||||||
maximum-level: 3
|
maximum-level: 6
|
||||||
|
|
||||||
config:
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user