Added boosts to Fishing chance depending on conditions. Also, the

kraken, now with 100% more sound!
This commit is contained in:
GJ 2013-05-01 21:57:42 -04:00
parent 5c026be0cd
commit e7c749ee3a
5 changed files with 47 additions and 4 deletions

View File

@ -20,6 +20,7 @@ Version 1.4.06-dev
+ 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 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 displaying partial names when trying to use /ptp
= Fixed wolves from Call of the Wild only having 8 health

View File

@ -1,5 +1,8 @@
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.datatypes.skills.SkillType;
import com.gmail.nossr50.locale.LocaleLoader;
@ -61,7 +64,18 @@ public class FishingCommand extends SkillCommand {
// MASTER ANGLER
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];
}
}

View File

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

View File

@ -7,6 +7,7 @@ import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.WeatherType;
import org.bukkit.World;
import org.bukkit.block.Biome;
@ -81,7 +82,8 @@ public class FishingManager extends SkillManager {
world.strikeLightningEffect(location);
world.strikeLightningEffect(location);
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);
kraken.setCustomName("The Kraken");
@ -187,7 +189,19 @@ public class FishingManager extends SkillManager {
}
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);
}
/**

View File

@ -32,6 +32,7 @@ public final class Misc {
public static final float POP_VOLUME = 0.2F;
public static final float BAT_VOLUME = 1.0F;
public static final float BAT_PITCH = 0.6F;
public static final float GHAST_VOLUME = 1.0F;
private Misc() {};
@ -43,6 +44,10 @@ public final class Misc {
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) {
return (entity == null || entity.hasMetadata("NPC") || (mcMMO.isCombatTagEnabled() && entity instanceof HumanEntity && ((HumanEntity) entity).getName().contains("PvpLogger")));
}