Skip to content

Commit 0619107

Browse files
committed
added some enchants + mob types
1 parent 3b6348f commit 0619107

31 files changed

Lines changed: 570 additions & 33 deletions

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/collection/CustomCollectionAward.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@ public enum CustomCollectionAward {
2121
SHARPNESS_DISCOUNT("§9Sharpness §7Exp Discount §a(-25%)"),
2222
SMITE_DISCOUNT("§9Smite §7Exp Discount §a(-25%)"),
2323
ENDER_SLAYER_DISCOUNT("§9Ender Slayer §7Exp Discount §a(-25%)"),
24+
GIANT_KILLER_DISCOUNT("§9Giant Killer §7Exp Discount §a(-25%)"),
25+
EXECUTE_DISCOUNT("§9Execute §7Exp Discount §a(-25%)"),
26+
IMPALING_DISCOUNT("§9Impaling §7Exp Discount §a(-25%)"),
27+
BANE_OF_ARTHROPODS_DISCOUNT("§9Bane of Arthropods §7Exp Discount §a(-25%)"),
28+
CUBISM_DISCOUNT("§9Cubism §7Exp Discount §a(-25%)"),
2429

2530
// BAGS
2631
QUIVER("§aQuiver"),

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/enchantment/EnchantmentType.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public enum EnchantmentType {
2626
SMITE(EnchantmentSmite.class),
2727
SILK_TOUCH(EnchantmentSilkTouch.class),
2828
SMELTING_TOUCH(EnchantmentSmeltingTouch.class),
29+
GIANT_KILLER(EnchantmentGiantKiller.class),
30+
EXECUTE(EnchantmentExecute.class),
31+
IMPALING(EnchantmentImpaling.class),
32+
BANE_OF_ARTHROPODS(EnchantmentBaneOfArthropods.class),
33+
CUBISM(EnchantmentCubism.class),
2934
;
3035

3136
private final Class<? extends Ench> clazz;
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package net.swofty.type.skyblockgeneric.enchantment.impl;
2+
3+
import net.minestom.server.entity.LivingEntity;
4+
import net.swofty.commons.statistics.ItemStatistic;
5+
import net.swofty.commons.statistics.ItemStatistics;
6+
import net.swofty.type.skyblockgeneric.collection.CustomCollectionAward;
7+
import net.swofty.type.skyblockgeneric.enchantment.abstr.Ench;
8+
import net.swofty.type.skyblockgeneric.enchantment.abstr.EnchFromTable;
9+
import net.swofty.type.skyblockgeneric.enchantment.abstr.EventBasedEnchant;
10+
import net.swofty.type.skyblockgeneric.entity.mob.MobType;
11+
import net.swofty.type.skyblockgeneric.entity.mob.SkyBlockMob;
12+
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
13+
import net.swofty.type.skyblockgeneric.utility.groups.EnchantItemGroups;
14+
import org.jetbrains.annotations.NotNull;
15+
16+
import java.util.HashMap;
17+
import java.util.List;
18+
import java.util.Map;
19+
20+
public class EnchantmentBaneOfArthropods implements Ench, EnchFromTable, EventBasedEnchant {
21+
22+
public static final double[] DAMAGE_MULTIPLIERS = new double[]{5.0, 10.0, 15.0, 20.0, 30.0, 40.0, 50.0};
23+
24+
@Override
25+
public String getDescription(int level) {
26+
return "Increases damage dealt to " + MobType.ARTHROPOD.getFullDisplayName() + "§7 mobs by §a" +
27+
DAMAGE_MULTIPLIERS[level - 1] + "%§7.";
28+
}
29+
30+
@Override
31+
public ApplyLevels getLevelsToApply(@NotNull SkyBlockPlayer player) {
32+
HashMap<Integer, Integer> levels = new HashMap<>(Map.of(
33+
4, 25,
34+
5, 30,
35+
6, 100,
36+
7, 200
37+
));
38+
39+
if (player.hasCustomCollectionAward(CustomCollectionAward.BANE_OF_ARTHROPODS_DISCOUNT)) {
40+
levels.replaceAll((k, v) -> (int) (v * 0.75));
41+
}
42+
43+
return new ApplyLevels(levels);
44+
}
45+
46+
@Override
47+
public List<EnchantItemGroups> getGroups() {
48+
return List.of(EnchantItemGroups.SWORD, EnchantItemGroups.FISHING_WEAPON,
49+
EnchantItemGroups.GAUNTLET, EnchantItemGroups.LONG_SWORD);
50+
}
51+
52+
@Override
53+
public ItemStatistics getStatisticsOnDamage(SkyBlockPlayer causer, LivingEntity receiver, int level) {
54+
if (receiver instanceof SkyBlockMob skyBlockMob && skyBlockMob.getMobTypes().contains(MobType.ARTHROPOD)) {
55+
return ItemStatistics.builder().withBase(ItemStatistic.DAMAGE, DAMAGE_MULTIPLIERS[level - 1]).build();
56+
}
57+
58+
return ItemStatistics.empty();
59+
}
60+
61+
@Override
62+
public TableLevels getLevelsFromTableToApply(@NotNull SkyBlockPlayer player) {
63+
HashMap<Integer, Integer> levels = new HashMap<>(Map.of(
64+
1, 10,
65+
2, 15,
66+
3, 20,
67+
4, 25,
68+
5, 30
69+
));
70+
71+
if (player.hasCustomCollectionAward(CustomCollectionAward.BANE_OF_ARTHROPODS_DISCOUNT)) {
72+
levels.replaceAll((k, v) -> (int) (v * 0.75));
73+
}
74+
75+
return new TableLevels(levels);
76+
}
77+
78+
@Override
79+
public int getRequiredBookshelfPower() {
80+
return 0;
81+
}
82+
}

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/enchantment/impl/EnchantmentCritical.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public ApplyLevels getLevelsToApply(@NotNull SkyBlockPlayer player) {
3333
));
3434

3535
if (player.hasCustomCollectionAward(CustomCollectionAward.CRITICAL_DISCOUNT)) {
36-
// Discount 25%
3736
levels.replaceAll((k, v) -> (int) (v * 0.75));
3837
}
3938

@@ -63,7 +62,6 @@ public TableLevels getLevelsFromTableToApply(@NotNull SkyBlockPlayer player) {
6362
));
6463

6564
if (player.hasCustomCollectionAward(CustomCollectionAward.CRITICAL_DISCOUNT)) {
66-
// Discount 25%
6765
levels.replaceAll((k, v) -> (int) (v * 0.75));
6866
}
6967

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
package net.swofty.type.skyblockgeneric.enchantment.impl;
2+
3+
import net.minestom.server.entity.EntityType;
4+
import net.minestom.server.entity.LivingEntity;
5+
import net.swofty.commons.statistics.ItemStatistic;
6+
import net.swofty.commons.statistics.ItemStatistics;
7+
import net.swofty.type.skyblockgeneric.collection.CustomCollectionAward;
8+
import net.swofty.type.skyblockgeneric.enchantment.abstr.Ench;
9+
import net.swofty.type.skyblockgeneric.enchantment.abstr.EnchFromTable;
10+
import net.swofty.type.skyblockgeneric.enchantment.abstr.EventBasedEnchant;
11+
import net.swofty.type.skyblockgeneric.entity.mob.MobType;
12+
import net.swofty.type.skyblockgeneric.entity.mob.SkyBlockMob;
13+
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
14+
import net.swofty.type.skyblockgeneric.utility.groups.EnchantItemGroups;
15+
import org.jetbrains.annotations.NotNull;
16+
17+
import java.util.HashMap;
18+
import java.util.List;
19+
import java.util.Map;
20+
21+
public class EnchantmentCubism implements Ench, EnchFromTable, EventBasedEnchant {
22+
23+
public static final double[] DAMAGE_MULTIPLIERS = new double[]{5.0, 10.0, 15.0, 20.0, 30.0, 40.0};
24+
25+
@Override
26+
public String getDescription(int level) {
27+
return "Increases damage dealt to " + MobType.CUBIC.getFullDisplayName() + "§7 mobs by §a" +
28+
DAMAGE_MULTIPLIERS[level - 1] + "%§7.";
29+
}
30+
31+
@Override
32+
public ApplyLevels getLevelsToApply(@NotNull SkyBlockPlayer player) {
33+
HashMap<Integer, Integer> levels = new HashMap<>(Map.of(
34+
4, 40,
35+
5, 50,
36+
6, 200
37+
));
38+
39+
if (player.hasCustomCollectionAward(CustomCollectionAward.CUBISM_DISCOUNT)) {
40+
levels.replaceAll((k, v) -> (int) (v * 0.75));
41+
}
42+
43+
return new ApplyLevels(levels);
44+
}
45+
46+
@Override
47+
public List<EnchantItemGroups> getGroups() {
48+
return List.of(EnchantItemGroups.SWORD, EnchantItemGroups.FISHING_WEAPON,
49+
EnchantItemGroups.GAUNTLET, EnchantItemGroups.LONG_SWORD,
50+
EnchantItemGroups.BOW);
51+
}
52+
53+
@Override
54+
public ItemStatistics getStatisticsOnDamage(SkyBlockPlayer causer, LivingEntity receiver, int level) {
55+
if (receiver instanceof SkyBlockMob skyBlockMob && skyBlockMob.getMobTypes().contains(MobType.CUBIC)) {
56+
return ItemStatistics.builder().withBase(ItemStatistic.DAMAGE, DAMAGE_MULTIPLIERS[level - 1]).build();
57+
}
58+
59+
return ItemStatistics.empty();
60+
}
61+
62+
@Override
63+
public TableLevels getLevelsFromTableToApply(@NotNull SkyBlockPlayer player) {
64+
HashMap<Integer, Integer> levels = new HashMap<>(Map.of(
65+
1, 10,
66+
2, 20,
67+
3, 30,
68+
4, 40,
69+
5, 50
70+
));
71+
72+
if (player.hasCustomCollectionAward(CustomCollectionAward.CUBISM_DISCOUNT)) {
73+
levels.replaceAll((k, v) -> (int) (v * 0.75));
74+
}
75+
76+
return new TableLevels(levels);
77+
}
78+
79+
@Override
80+
public int getRequiredBookshelfPower() {
81+
return 3;
82+
}
83+
}

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/enchantment/impl/EnchantmentEfficiency.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public ApplyLevels getLevelsToApply(@NotNull SkyBlockPlayer player) {
3434
));
3535

3636
if (player.hasCustomCollectionAward(CustomCollectionAward.EFFICIENCY_DISCOUNT)) {
37-
// Discount 25%
3837
levels.replaceAll((k, v) -> (int) (v * 0.75));
3938
}
4039

@@ -57,7 +56,6 @@ public TableLevels getLevelsFromTableToApply(@NotNull SkyBlockPlayer player) {
5756
));
5857

5958
if (player.hasCustomCollectionAward(CustomCollectionAward.EFFICIENCY_DISCOUNT)) {
60-
// Discount 25%
6159
levels.replaceAll((k, v) -> (int) (v * 0.75));
6260
}
6361

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/enchantment/impl/EnchantmentEnderSlayer.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import net.swofty.type.skyblockgeneric.enchantment.abstr.Ench;
99
import net.swofty.type.skyblockgeneric.enchantment.abstr.EnchFromTable;
1010
import net.swofty.type.skyblockgeneric.enchantment.abstr.EventBasedEnchant;
11+
import net.swofty.type.skyblockgeneric.entity.mob.MobType;
1112
import net.swofty.type.skyblockgeneric.entity.mob.SkyBlockMob;
1213
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
1314
import net.swofty.type.skyblockgeneric.utility.groups.EnchantItemGroups;
@@ -23,7 +24,7 @@ public class EnchantmentEnderSlayer implements Ench, EnchFromTable, EventBasedEn
2324

2425
@Override
2526
public String getDescription(int level) {
26-
return "Increases damage dealt to Endermite, Enderman and Ender Dragons by §a" + MULTIPLIERS[level - 1] + "%§7.";
27+
return "Increases damage dealt to " + MobType.ENDER.getFullDisplayName() + "§7 mobs by §a" + MULTIPLIERS[level - 1] + "%§7.";
2728
}
2829

2930
@Override
@@ -36,7 +37,6 @@ public ApplyLevels getLevelsToApply(@NotNull SkyBlockPlayer player) {
3637
));
3738

3839
if (player.hasCustomCollectionAward(CustomCollectionAward.ENDER_SLAYER_DISCOUNT)) {
39-
// Discount 25%
4040
levels.replaceAll((k, v) -> (int) (v * 0.75));
4141
}
4242

@@ -50,11 +50,10 @@ public List<EnchantItemGroups> getGroups() {
5050

5151
@Override
5252
public ItemStatistics getStatisticsOnDamage(SkyBlockPlayer causer, LivingEntity receiver, int level) {
53-
if (receiver instanceof SkyBlockMob skyBlockMob) {
54-
if (skyBlockMob.getEntityType() == EntityType.ENDERMITE || skyBlockMob.getEntityType() == EntityType.ENDERMAN || skyBlockMob.getEntityType() == EntityType.ENDER_DRAGON) {
55-
return ItemStatistics.builder().withBase(ItemStatistic.DAMAGE, MULTIPLIERS[level - 1]).build();
56-
}
53+
if (receiver instanceof SkyBlockMob skyBlockMob && skyBlockMob.getMobTypes().contains(MobType.ENDER)) {
54+
return ItemStatistics.builder().withBase(ItemStatistic.DAMAGE, MULTIPLIERS[level - 1]).build();
5755
}
56+
5857
return ItemStatistics.empty();
5958
};
6059

@@ -69,7 +68,6 @@ public TableLevels getLevelsFromTableToApply(@NotNull SkyBlockPlayer player) {
6968
));
7069

7170
if (player.hasCustomCollectionAward(CustomCollectionAward.ENDER_SLAYER_DISCOUNT)) {
72-
// Discount 25%
7371
levels.replaceAll((k, v) -> (int) (v * 0.75));
7472
}
7573

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
package net.swofty.type.skyblockgeneric.enchantment.impl;
2+
3+
import net.minestom.server.entity.LivingEntity;
4+
import net.minestom.server.entity.attribute.Attribute;
5+
import net.swofty.commons.statistics.ItemStatistic;
6+
import net.swofty.commons.statistics.ItemStatistics;
7+
import net.swofty.type.skyblockgeneric.collection.CustomCollectionAward;
8+
import net.swofty.type.skyblockgeneric.enchantment.abstr.Ench;
9+
import net.swofty.type.skyblockgeneric.enchantment.abstr.EnchFromTable;
10+
import net.swofty.type.skyblockgeneric.enchantment.abstr.EventBasedEnchant;
11+
import net.swofty.type.skyblockgeneric.user.SkyBlockPlayer;
12+
import net.swofty.type.skyblockgeneric.utility.groups.EnchantItemGroups;
13+
import org.jetbrains.annotations.NotNull;
14+
15+
import java.util.HashMap;
16+
import java.util.List;
17+
import java.util.Map;
18+
19+
public class EnchantmentExecute implements Ench, EnchFromTable, EventBasedEnchant {
20+
21+
public static final double[] DAMAGE_MULTIPLIERS = new double[]{0.2, 0.4, 0.6, 0.8, 1.0, 1.25};
22+
23+
@Override
24+
public String getDescription(int level) {
25+
return "Increases damage dealt by §a" + DAMAGE_MULTIPLIERS[level - 1] + "%§7 for each percent of health missing on your target.";
26+
}
27+
28+
@Override
29+
public ApplyLevels getLevelsToApply(@NotNull SkyBlockPlayer player) {
30+
HashMap<Integer, Integer> levels = new HashMap<>(Map.of(
31+
4, 40,
32+
5, 50,
33+
6, 200
34+
));
35+
36+
if (player.hasCustomCollectionAward(CustomCollectionAward.EXECUTE_DISCOUNT)) {
37+
levels.replaceAll((k, v) -> (int) (v * 0.75));
38+
}
39+
40+
return new ApplyLevels(levels);
41+
}
42+
43+
@Override
44+
public List<EnchantItemGroups> getGroups() {
45+
return List.of(EnchantItemGroups.SWORD, EnchantItemGroups.FISHING_WEAPON,
46+
EnchantItemGroups.GAUNTLET, EnchantItemGroups.LONG_SWORD);
47+
}
48+
49+
@Override
50+
public ItemStatistics getStatisticsOnDamage(SkyBlockPlayer causer, LivingEntity receiver, int level) {
51+
if (causer == null || receiver == null) {
52+
return ItemStatistics.empty();
53+
}
54+
55+
double targetMaxHealth = receiver.getAttributeValue(Attribute.MAX_HEALTH);
56+
double targetCurrentHealth = receiver.getHealth();
57+
58+
if (targetMaxHealth <= 0 || targetCurrentHealth >= targetMaxHealth) {
59+
return ItemStatistics.empty();
60+
}
61+
62+
double missingHealthPercentage = ((targetMaxHealth - targetCurrentHealth) / targetMaxHealth) * 100;
63+
double damageMultiplier = missingHealthPercentage * DAMAGE_MULTIPLIERS[level - 1];
64+
65+
return ItemStatistics.builder().withBase(ItemStatistic.DAMAGE, damageMultiplier).build();
66+
}
67+
68+
@Override
69+
public TableLevels getLevelsFromTableToApply(@NotNull SkyBlockPlayer player) {
70+
HashMap<Integer, Integer> levels = new HashMap<>(Map.of(
71+
1, 20,
72+
2, 25,
73+
3, 30,
74+
4, 40,
75+
5, 50
76+
));
77+
78+
if (player.hasCustomCollectionAward(CustomCollectionAward.EXECUTE_DISCOUNT)) {
79+
levels.replaceAll((k, v) -> (int) (v * 0.75));
80+
}
81+
82+
return new TableLevels(levels);
83+
}
84+
85+
@Override
86+
public int getRequiredBookshelfPower() {
87+
return 10;
88+
}
89+
}

type.skyblockgeneric/src/main/java/net/swofty/type/skyblockgeneric/enchantment/impl/EnchantmentFirstStrike.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public ApplyLevels getLevelsToApply(@NotNull SkyBlockPlayer player) {
3434
));
3535

3636
if (player.hasCustomCollectionAward(CustomCollectionAward.FIRST_STRIKE_DISCOUNT)) {
37-
// Discount 25%
3837
levels.replaceAll((k, v) -> (int) (v * 0.75));
3938
}
4039

@@ -73,7 +72,6 @@ public TableLevels getLevelsFromTableToApply(@NotNull SkyBlockPlayer player) {
7372
));
7473

7574
if (player.hasCustomCollectionAward(CustomCollectionAward.FIRST_STRIKE_DISCOUNT)) {
76-
// Discount 25%
7775
levels.replaceAll((k, v) -> (int) (v * 0.75));
7876
}
7977

0 commit comments

Comments
 (0)