2
0
Эх сурвалжийг харах

Added boosts to Fishing chance depending on conditions. Also, the
kraken, now with 100% more sound!

GJ 12 жил өмнө
parent
commit
e7c749ee3a

+ 1 - 0
Changelog.txt

@@ -20,6 +20,7 @@ Version 1.4.06-dev
  + Added configurable cooldown and warmup times when using /ptp
  + Added configurable cooldown and warmup times when using /ptp
  + Added a new Party item share category "Misc" which contains a list of configurable items. (By default all tools and armor)
  + Added a new Party item share category "Misc" which contains a list of configurable items. (By default all tools and armor)
  + Added fishing exploit prevention
  + Added fishing exploit prevention
+ + Added boosts to Fishing chance depending on conditions
  = Fixed bug where players were able to join the same party multiple times
  = Fixed bug where players were able to join the same party multiple times
  = Fixed displaying partial names when trying to use /ptp
  = Fixed displaying partial names when trying to use /ptp
  = Fixed wolves from Call of the Wild only having 8 health
  = Fixed wolves from Call of the Wild only having 8 health

+ 15 - 1
src/main/java/com/gmail/nossr50/commands/skills/FishingCommand.java

@@ -1,5 +1,8 @@
 package com.gmail.nossr50.commands.skills;
 package com.gmail.nossr50.commands.skills;
 
 
+import org.bukkit.block.Biome;
+import org.bukkit.entity.EntityType;
+
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.config.AdvancedConfig;
 import com.gmail.nossr50.datatypes.skills.SkillType;
 import com.gmail.nossr50.datatypes.skills.SkillType;
 import com.gmail.nossr50.locale.LocaleLoader;
 import com.gmail.nossr50.locale.LocaleLoader;
@@ -61,7 +64,18 @@ public class FishingCommand extends SkillCommand {
 
 
         // MASTER ANGLER
         // MASTER ANGLER
         if (canMasterAngler) {
         if (canMasterAngler) {
-            biteChance = calculateAbilityDisplayValues(((Math.max((skillValue / 200.0), 1.0)) / (isStorming ? 300 : 500)) * 100.0)[0];
+            double rawBiteChance = ((Math.max((skillValue / 200.0), 1.0)) / (isStorming ? 300 : 500));
+            Biome biome = player.getLocation().getBlock().getBiome();
+
+            if (biome == Biome.RIVER || biome == Biome.OCEAN) {
+                rawBiteChance = rawBiteChance * 2.0;
+            }
+
+            if (player.isInsideVehicle() && player.getVehicle().getType() == EntityType.BOAT) {
+                rawBiteChance = rawBiteChance * 2.0;
+            }
+
+            biteChance = calculateAbilityDisplayValues(rawBiteChance * 100.0)[0];
         }
         }
     }
     }
 
 

+ 10 - 1
src/main/java/com/gmail/nossr50/runnables/skills/KrakenAttackTask.java

@@ -1,9 +1,14 @@
 package com.gmail.nossr50.runnables.skills;
 package com.gmail.nossr50.runnables.skills;
 
 
+import org.bukkit.Location;
+import org.bukkit.Sound;
+import org.bukkit.World;
 import org.bukkit.entity.Player;
 import org.bukkit.entity.Player;
 import org.bukkit.entity.Squid;
 import org.bukkit.entity.Squid;
 import org.bukkit.scheduler.BukkitRunnable;
 import org.bukkit.scheduler.BukkitRunnable;
 
 
+import com.gmail.nossr50.util.Misc;
+
 public class KrakenAttackTask extends BukkitRunnable {
 public class KrakenAttackTask extends BukkitRunnable {
     private Squid kraken;
     private Squid kraken;
     private Player player;
     private Player player;
@@ -16,9 +21,13 @@ public class KrakenAttackTask extends BukkitRunnable {
     @Override
     @Override
     public void run() {
     public void run() {
         if (!player.isDead()) {
         if (!player.isDead()) {
+            Location location = player.getLocation();
+            World world = player.getWorld();
+
             kraken.teleport(player);
             kraken.teleport(player);
             player.damage(1, kraken);
             player.damage(1, kraken);
-            player.getWorld().strikeLightningEffect(player.getLocation());
+            world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
+            world.strikeLightningEffect(location);
         }
         }
         else {
         else {
             kraken.remove();
             kraken.remove();

+ 16 - 2
src/main/java/com/gmail/nossr50/skills/fishing/FishingManager.java

@@ -7,6 +7,7 @@ import java.util.List;
 import org.bukkit.ChatColor;
 import org.bukkit.ChatColor;
 import org.bukkit.Location;
 import org.bukkit.Location;
 import org.bukkit.Material;
 import org.bukkit.Material;
+import org.bukkit.Sound;
 import org.bukkit.WeatherType;
 import org.bukkit.WeatherType;
 import org.bukkit.World;
 import org.bukkit.World;
 import org.bukkit.block.Biome;
 import org.bukkit.block.Biome;
@@ -81,7 +82,8 @@ public class FishingManager extends SkillManager {
         world.strikeLightningEffect(location);
         world.strikeLightningEffect(location);
         world.strikeLightningEffect(location);
         world.strikeLightningEffect(location);
         player.sendMessage("THE KRAKEN HAS BEEN UNLEASHED!");
         player.sendMessage("THE KRAKEN HAS BEEN UNLEASHED!");
-        mcMMO.p.getServer().broadcastMessage(player.getDisplayName() + ChatColor.RED + "has unleashed the kraken!");
+        world.playSound(location, Sound.GHAST_SCREAM, Misc.GHAST_VOLUME, Misc.getGhastPitch());
+        mcMMO.p.getServer().broadcastMessage(player.getDisplayName() + ChatColor.RED + " has unleashed the kraken!");
 
 
         Squid kraken = (Squid) world.spawnEntity(player.getEyeLocation(), EntityType.SQUID);
         Squid kraken = (Squid) world.spawnEntity(player.getEyeLocation(), EntityType.SQUID);
         kraken.setCustomName("The Kraken");
         kraken.setCustomName("The Kraken");
@@ -187,7 +189,19 @@ public class FishingManager extends SkillManager {
     }
     }
 
 
     public void masterAngler(Fish hook) {
     public void masterAngler(Fish hook) {
-        hook.setBiteChance(Math.min(hook.getBiteChance() * Math.max((getSkillLevel() / 200.0), 1.0), 1.0));
+        Player player = getPlayer();
+        Biome biome = player.getLocation().getBlock().getBiome();
+        double biteChance = Math.min(hook.getBiteChance() * Math.max((getSkillLevel() / 200.0), 1.0), 1.0);
+
+        if (biome == Biome.RIVER || biome == Biome.OCEAN) {
+            biteChance = biteChance * 2.0;
+        }
+
+        if (player.isInsideVehicle() && player.getVehicle().getType() == EntityType.BOAT) {
+            biteChance = biteChance * 2.0;
+        }
+
+        hook.setBiteChance(biteChance);
     }
     }
 
 
     /**
     /**

+ 5 - 0
src/main/java/com/gmail/nossr50/util/Misc.java

@@ -32,6 +32,7 @@ public final class Misc {
     public static final float POP_VOLUME       = 0.2F;
     public static final float POP_VOLUME       = 0.2F;
     public static final float BAT_VOLUME       = 1.0F;
     public static final float BAT_VOLUME       = 1.0F;
     public static final float BAT_PITCH        = 0.6F;
     public static final float BAT_PITCH        = 0.6F;
+    public static final float GHAST_VOLUME     = 1.0F;
 
 
     private Misc() {};
     private Misc() {};
 
 
@@ -43,6 +44,10 @@ public final class Misc {
         return ((getRandom().nextFloat() - getRandom().nextFloat()) * 0.7F + 1.0F) * 2.0F;
         return ((getRandom().nextFloat() - getRandom().nextFloat()) * 0.7F + 1.0F) * 2.0F;
     }
     }
 
 
+    public static float getGhastPitch() {
+        return (getRandom().nextFloat() - getRandom().nextFloat()) * 0.2F + 1.0F;
+    }
+
     public static boolean isNPCEntity(Entity entity) {
     public static boolean isNPCEntity(Entity entity) {
         return (entity == null || entity.hasMetadata("NPC") || (mcMMO.isCombatTagEnabled() && entity instanceof HumanEntity && ((HumanEntity) entity).getName().contains("PvpLogger")));
         return (entity == null || entity.hasMetadata("NPC") || (mcMMO.isCombatTagEnabled() && entity instanceof HumanEntity && ((HumanEntity) entity).getName().contains("PvpLogger")));
     }
     }