mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
Added "Master Angler" ability to Fishing.
This ability increases the chance that a fish will bite the line while fishing.
This commit is contained in:
parent
7525de1a72
commit
4f87cb6446
@ -8,6 +8,7 @@ Key:
|
||||
- Removal
|
||||
|
||||
Version 1.4.06-dev
|
||||
+ Added "Master Angler" ability to Fishing.
|
||||
+ Added health display for mobs during combat.
|
||||
+ Added new API method to McMMOPlayerLevelUpEvent to set levels gained
|
||||
+ Added new permission node for /ptp; mcmmo.commands.ptp.send (enabled by default)
|
||||
|
@ -15,11 +15,13 @@ public class FishingCommand extends SkillCommand {
|
||||
private String shakeChance;
|
||||
private String shakeChanceLucky;
|
||||
private int fishermansDietRank;
|
||||
private String biteChance;
|
||||
|
||||
private boolean canTreasureHunt;
|
||||
private boolean canMagicHunt;
|
||||
private boolean canShake;
|
||||
private boolean canFishermansDiet;
|
||||
private boolean canMasterAngler;
|
||||
|
||||
public FishingCommand() {
|
||||
super(SkillType.FISHING);
|
||||
@ -27,12 +29,14 @@ public class FishingCommand extends SkillCommand {
|
||||
|
||||
@Override
|
||||
protected void dataCalculations() {
|
||||
boolean isStorming = player.getWorld().hasStorm();
|
||||
|
||||
// TREASURE HUNTER
|
||||
if (canTreasureHunt) {
|
||||
lootTier = mcMMOPlayer.getFishingManager().getLootTier();
|
||||
double enchantChance = lootTier * AdvancedConfig.getInstance().getFishingMagicMultiplier();
|
||||
|
||||
if (player.getWorld().hasStorm()) {
|
||||
if (isStorming) {
|
||||
chanceRaining = LocaleLoader.getString("Fishing.Chance.Raining");
|
||||
enchantChance *= 1.1D;
|
||||
}
|
||||
@ -53,6 +57,11 @@ public class FishingCommand extends SkillCommand {
|
||||
if (canFishermansDiet) {
|
||||
fishermansDietRank = calculateRank(Fishing.fishermansDietMaxLevel, Fishing.fishermansDietRankLevel1);
|
||||
}
|
||||
|
||||
// MASTER ANGLER
|
||||
if (canMasterAngler) {
|
||||
biteChance = calculateAbilityDisplayValues((skillValue / 4) / (isStorming ? 300 : 500))[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -61,11 +70,12 @@ public class FishingCommand extends SkillCommand {
|
||||
canMagicHunt = Permissions.magicHunter(player);
|
||||
canShake = Permissions.shake(player);
|
||||
canFishermansDiet = Permissions.fishermansDiet(player);
|
||||
canMasterAngler = Permissions.masterAngler(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean effectsHeaderPermissions() {
|
||||
return canTreasureHunt || canMagicHunt || canShake;
|
||||
return canTreasureHunt || canMagicHunt || canShake || canMasterAngler;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -87,15 +97,23 @@ public class FishingCommand extends SkillCommand {
|
||||
if (canFishermansDiet) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.6"), LocaleLoader.getString("Fishing.Effect.7")));
|
||||
}
|
||||
|
||||
if (canMasterAngler) {
|
||||
player.sendMessage(LocaleLoader.getString("Effects.Template", LocaleLoader.getString("Fishing.Effect.8"), LocaleLoader.getString("Fishing.Effect.9")));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean statsHeaderPermissions() {
|
||||
return canTreasureHunt || canMagicHunt || canShake;
|
||||
return canTreasureHunt || canMagicHunt || canShake || canMasterAngler;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void statsDisplay() {
|
||||
if (canMasterAngler) {
|
||||
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Chance", biteChance));
|
||||
}
|
||||
|
||||
if (canTreasureHunt) {
|
||||
player.sendMessage(LocaleLoader.getString("Fishing.Ability.Rank", lootTier));
|
||||
}
|
||||
|
@ -174,6 +174,12 @@ public class PlayerListener implements Listener {
|
||||
FishingManager fishingManager = UserManager.getPlayer(player).getFishingManager();
|
||||
|
||||
switch (event.getState()) {
|
||||
case FISHING:
|
||||
if (fishingManager.canMasterAngler()) {
|
||||
fishingManager.masterAngler(event.getHook());
|
||||
}
|
||||
break;
|
||||
|
||||
case CAUGHT_FISH:
|
||||
fishingManager.handleFishing((Item) event.getCaught());
|
||||
|
||||
|
@ -9,6 +9,7 @@ import java.util.Map;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Fish;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -41,6 +42,10 @@ public class FishingManager extends SkillManager {
|
||||
return target instanceof LivingEntity && getSkillLevel() >= AdvancedConfig.getInstance().getShakeUnlockLevel() && Permissions.shake(getPlayer());
|
||||
}
|
||||
|
||||
public boolean canMasterAngler() {
|
||||
return Permissions.masterAngler(getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the loot tier
|
||||
*
|
||||
@ -86,6 +91,10 @@ public class FishingManager extends SkillManager {
|
||||
return SkillUtils.handleFoodSkills(getPlayer(), skill, eventFoodLevel, Fishing.fishermansDietRankLevel1, Fishing.fishermansDietMaxLevel, rankChange);
|
||||
}
|
||||
|
||||
public void masterAngler(Fish hook) {
|
||||
hook.setBiteChance(Math.min(hook.getBiteChance() * (getSkillLevel() / 4.0), 1.0));
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the results from a successful fishing trip
|
||||
*
|
||||
|
@ -143,6 +143,7 @@ public final class Permissions {
|
||||
public static boolean fishermansDiet(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.fishing.fishermansdiet"); }
|
||||
public static boolean fishingTreasureHunter(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.fishing.treasures"); }
|
||||
public static boolean magicHunter(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.fishing.magic"); }
|
||||
public static boolean masterAngler(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.fishing.masterangler"); }
|
||||
public static boolean shake(Permissible permissible) { return permissible.hasPermission("mcmmo.ability.fishing.shakemob"); }
|
||||
|
||||
/* HERBALISM */
|
||||
|
@ -98,6 +98,7 @@ Excavation.Skills.GigaDrillBreaker.Other.On=[[GREEN]]{0}[[DARK_GREEN]] has used
|
||||
Excavation.Skillup=[[YELLOW]]Excavation skill increased by {0}. Total ({1})
|
||||
|
||||
#FISHING
|
||||
Fishing.Ability.Chance=[[RED]]Bite Chance: [[YELLOW]]{0}
|
||||
Fishing.Ability.Info=[[RED]]Magic Hunter: [[GRAY]] **Improves With Treasure Hunter Rank**
|
||||
Fishing.Ability.Locked.0=LOCKED UNTIL {0}+ SKILL (SHAKE)
|
||||
Fishing.Ability.Rank=[[RED]]Treasure Hunter Rank: [[YELLOW]]{0}/5
|
||||
@ -111,6 +112,8 @@ Fishing.Effect.4=Shake (vs. Entities)
|
||||
Fishing.Effect.5=Shake items off of mobs w/ fishing pole
|
||||
Fishing.Effect.6=Fisherman's Diet
|
||||
Fishing.Effect.7=Improves hunger restored from fished foods
|
||||
Fishing.Effect.8=Master Angler
|
||||
Fishing.Effect.9=Improves chance of getting a bite while fishing
|
||||
Fishing.Enchant.Chance=[[RED]]Magic Hunter Chance: [[YELLOW]]{0}
|
||||
Fishing.Chance.Raining=[[BLUE]] Rain Bonus
|
||||
Fishing.ItemFound=[[GRAY]]Treasure found!
|
||||
|
@ -254,6 +254,7 @@ permissions:
|
||||
children:
|
||||
mcmmo.ability.fishing.fishermansdiet: true
|
||||
mcmmo.ability.fishing.magic: true
|
||||
mcmmo.ability.fishing.masterangler: true
|
||||
mcmmo.ability.fishing.shakemob: true
|
||||
mcmmo.ability.fishing.treasures: true
|
||||
mcmmo.ability.fishing.vanillaxpboost: true
|
||||
@ -261,6 +262,8 @@ permissions:
|
||||
description: Allows access to the Fishermans's Diet ability
|
||||
mcmmo.ability.fishing.magic:
|
||||
description: Allows enchanted drops from Fishing
|
||||
mcmmo.ability.fishing.masterangler:
|
||||
description: Allows access to the Master Angler ability
|
||||
mcmmo.ability.fishing.shakemob:
|
||||
description: Allows access to the Shake Mob ability
|
||||
mcmmo.ability.fishing.treasures:
|
||||
|
Loading…
Reference in New Issue
Block a user