diff options
| author | davidovski <david@davidovski.xyz> | 2025-10-15 04:01:15 +0100 |
|---|---|---|
| committer | davidovski <david@davidovski.xyz> | 2025-10-15 04:01:15 +0100 |
| commit | dc825ad776f9fe9f763267874f6fa70c4870fc46 (patch) | |
| tree | d8d2bcf26b180f2c1abbab4e0dc1929dd88e05ab /src/main/java/net/uomc/mineshaft/FishCommand.java | |
| parent | 10b327e9f6441a8863227ce3e075a5a587654065 (diff) | |
v5
Diffstat (limited to 'src/main/java/net/uomc/mineshaft/FishCommand.java')
| -rw-r--r-- | src/main/java/net/uomc/mineshaft/FishCommand.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/net/uomc/mineshaft/FishCommand.java b/src/main/java/net/uomc/mineshaft/FishCommand.java index 3df7994..2eac218 100644 --- a/src/main/java/net/uomc/mineshaft/FishCommand.java +++ b/src/main/java/net/uomc/mineshaft/FishCommand.java @@ -25,6 +25,7 @@ import net.uomc.mineshaft.resources.ResourceManager; public class FishCommand extends CooldownCommand { private static final double XP_SPAWN_AMOUNT = 2000; private static final double BOOK_SPAWN_CHANCE = 0.05; + private static final double STRING_SPAWN_CHANCE = 0.5; private static long MIN_WAIT_MS = 1500; private static long MAX_WAIT_MS = 10000; @@ -41,6 +42,7 @@ public class FishCommand extends CooldownCommand { protected FishCommand(Mineshaft bot) { super(bot); setCooldown(20l * 1000l); + this.bot = bot; setDetails(CommandDetails.from("fish", "go fishing")); } @@ -49,7 +51,6 @@ public class FishCommand extends CooldownCommand { public boolean trigger(MessageReceivedEvent e) { e.getMessage().addReaction(Emoji.fromUnicode(EmojiParser.parseToUnicode(REACTION_FISH))).queue(); - double random = Math.random(); long waitTime = MIN_WAIT_MS + (long) (Math.random() * (MAX_WAIT_MS - MIN_WAIT_MS)); long reelTime = MIN_REEL_MS + (long) (Math.random() * (MAX_REEL_MS - MIN_REEL_MS)); @@ -99,12 +100,17 @@ public class FishCommand extends CooldownCommand { public Map<MineshaftItem, Long> getAwards(Member member) { Map<MineshaftItem, Long> award = new HashMap<>(); - if (Math.random() < BOOK_SPAWN_CHANCE) { + double random = Math.random(); + if (random < BOOK_SPAWN_CHANCE) { award.put(MineshaftItem.BOOK, 1l); + } else if (random < STRING_SPAWN_CHANCE) { + award.put(MineshaftItem.STRING, 8l); + award.put(MineshaftItem.XP, (long) Math.ceil(Math.random() * XP_SPAWN_AMOUNT * 0.5)); } else { award.put(MineshaftItem.FISH, Math.random() > 0.5 ? 1l : 2l); award.put(MineshaftItem.XP, (long) Math.ceil(Math.random() * XP_SPAWN_AMOUNT)); } + return award; } } |
