1+ package net .swofty .type .skyblockgeneric .enchantment .impl ;
2+
3+ import net .swofty .commons .statistics .ItemStatistic ;
4+ import net .swofty .commons .statistics .ItemStatistics ;
5+ import net .swofty .type .skyblockgeneric .collection .CustomCollectionAward ;
6+ import net .swofty .type .skyblockgeneric .enchantment .EnchantmentType ;
7+ import net .swofty .type .skyblockgeneric .enchantment .abstr .ConflictingEnch ;
8+ import net .swofty .type .skyblockgeneric .enchantment .abstr .Ench ;
9+ import net .swofty .type .skyblockgeneric .enchantment .abstr .EnchFromTable ;
10+ import net .swofty .type .skyblockgeneric .user .SkyBlockPlayer ;
11+ import net .swofty .type .skyblockgeneric .utility .groups .EnchantItemGroups ;
12+ import org .jetbrains .annotations .NotNull ;
13+
14+ import java .util .HashMap ;
15+ import java .util .List ;
16+ import java .util .Map ;
17+
18+ public class EnchantmentFortune implements Ench , EnchFromTable , ConflictingEnch {
19+
20+ public static final int [] MINING_FORTUNE_BONUS = new int []{10 , 20 , 30 , 45 };
21+
22+ @ Override
23+ public String getDescription (int level ) {
24+ return "Grants §a+" + MINING_FORTUNE_BONUS [level - 1 ] + " " + ItemStatistic .MINING_FORTUNE .getDisplayName () +
25+ "§7, which increases your chance for multiple drops." ;
26+ }
27+
28+ @ Override
29+ public ApplyLevels getLevelsToApply (@ NotNull SkyBlockPlayer player ) {
30+ HashMap <Integer , Integer > levels = new HashMap <>(Map .of (
31+ 4 , 0
32+ ));
33+
34+ if (player .hasCustomCollectionAward (CustomCollectionAward .FORTUNE_DISCOUNT )) {
35+ levels .replaceAll ((k , v ) -> (int ) (v * 0.75 ));
36+ }
37+
38+ return new ApplyLevels (levels );
39+ }
40+
41+ @ Override
42+ public List <EnchantItemGroups > getGroups () {
43+ return List .of (EnchantItemGroups .GAUNTLET , EnchantItemGroups .PICKAXE , EnchantItemGroups .DRILL );
44+ }
45+
46+ @ Override
47+ public ItemStatistics getStatistics (int level ) {
48+ return ItemStatistics .builder ()
49+ .withBase (ItemStatistic .MINING_FORTUNE , (double ) MINING_FORTUNE_BONUS [level - 1 ])
50+ .build ();
51+ }
52+
53+ @ Override
54+ public TableLevels getLevelsFromTableToApply (@ NotNull SkyBlockPlayer player ) {
55+ HashMap <Integer , Integer > levels = new HashMap <>(Map .of (
56+ 1 , 15 ,
57+ 2 , 30 ,
58+ 3 , 45
59+ ));
60+
61+ if (player .hasCustomCollectionAward (CustomCollectionAward .FORTUNE_DISCOUNT )) {
62+ levels .replaceAll ((k , v ) -> (int ) (v * 0.75 ));
63+ }
64+
65+ return new TableLevels (levels );
66+ }
67+
68+ @ Override
69+ public int getRequiredBookshelfPower () {
70+ return 0 ;
71+ }
72+
73+ @ Override
74+ public List <EnchantmentType > getConflictingEnchantments () {
75+ return List .of (EnchantmentType .SILK_TOUCH );
76+ }
77+ }
0 commit comments