Improved reaper

This commit is contained in:
Auxilor 2021-03-04 18:16:30 +00:00
parent eb87c1dc06
commit dd9181f615
4 changed files with 16 additions and 12 deletions

View File

@ -223,7 +223,7 @@ import com.willfp.ecoenchants.enchantments.ecoenchants.special.Pentashot;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Preservation; import com.willfp.ecoenchants.enchantments.ecoenchants.special.Preservation;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Prosperity; import com.willfp.ecoenchants.enchantments.ecoenchants.special.Prosperity;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Razor; import com.willfp.ecoenchants.enchantments.ecoenchants.special.Razor;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Reaper; import com.willfp.ecoenchants.enchantments.ecoenchants.normal.Reaper;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Repairing; import com.willfp.ecoenchants.enchantments.ecoenchants.special.Repairing;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Soulbound; import com.willfp.ecoenchants.enchantments.ecoenchants.special.Soulbound;
import com.willfp.ecoenchants.enchantments.ecoenchants.special.Spring; import com.willfp.ecoenchants.enchantments.ecoenchants.special.Spring;

View File

@ -1,4 +1,4 @@
package com.willfp.ecoenchants.enchantments.ecoenchants.special; package com.willfp.ecoenchants.enchantments.ecoenchants.normal;
import com.willfp.ecoenchants.enchantments.EcoEnchant; import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType; import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
@ -6,7 +6,9 @@ import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
public class Reaper extends EcoEnchant { public class Reaper extends EcoEnchant {
public Reaper() { public Reaper() {
super( super(
"reaper", EnchantmentType.SPECIAL "reaper", EnchantmentType.NORMAL
); );
} }
// Actual code is in soulbound.
} }

View File

@ -42,17 +42,18 @@ public class Soulbound extends EcoEnchant {
return; return;
} }
if (player.getKiller() instanceof Player) { if (player.getKiller() != null) {
Player killer = (Player) player.getKiller(); Player killer = player.getKiller();
if (EnchantChecks.mainhand(killer, EcoEnchants.REAPER)) { int reaperLevel = EnchantChecks.getMainhandLevel(killer, EcoEnchants.REAPER);
if (reaperLevel > 0) {
if (!(EcoEnchants.REAPER.getDisabledWorlds().contains(killer.getWorld()))) { if (!(EcoEnchants.REAPER.getDisabledWorlds().contains(killer.getWorld()))) {
int points = EnchantChecks.getMainhandLevel(killer, EcoEnchants.REAPER); if (EnchantmentUtils.passedChance(EcoEnchants.REAPER, reaperLevel)) {
if (EnchantmentUtils.passedChance(EcoEnchants.REAPER, points)) {
return; return;
} }
} }
} }
} }
for (ItemStack itemStack : player.getInventory().getContents()) { for (ItemStack itemStack : player.getInventory().getContents()) {
if (itemStack == null) { if (itemStack == null) {
continue; continue;

View File

@ -3,22 +3,23 @@
# #
name: "Reaper" name: "Reaper"
description: Gives you a chance to knock out things with a soulbound. description: Chance to prevent your opponents soulbound from working.
enabled: true enabled: true
obtaining: obtaining:
table: true table: true
villager: false villager: false
loot: false loot: false
rarity: veryspecial rarity: legendary
general-config: general-config:
targets: targets:
- hoe - sword
- axe
grindstoneable: true grindstoneable: true
disabled-in-worlds: [] disabled-in-worlds: []
conflicts: [] conflicts: []
maximum-level: 5 maximum-level: 3
config: config:
chance-per-level: 2 chance-per-level: 2