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