From ee2a1b332e45a779de5f9961b8079e528c455154 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 24 Jun 2019 22:30:20 -0700 Subject: [PATCH] tweak Archaeology rewards --- .../commands/skills/ExcavationCommand.java | 10 +++++++--- .../skills/excavation/ExcavationManager.java | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java index 3d3c07f1e..a729258dc 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/ExcavationCommand.java @@ -3,8 +3,10 @@ package com.gmail.nossr50.commands.skills; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.skills.excavation.ExcavationManager; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; +import com.gmail.nossr50.util.player.UserManager; import com.gmail.nossr50.util.skills.RankUtils; import net.md_5.bungee.api.chat.TextComponent; import org.bukkit.entity.Player; @@ -43,6 +45,9 @@ public class ExcavationCommand extends SkillCommand { protected List statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { List messages = new ArrayList(); + + ExcavationManager excavationManager = UserManager.getPlayer(player).getExcavationManager(); + if (canGigaDrill) { messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : "")); @@ -50,9 +55,8 @@ public class ExcavationCommand extends SkillCommand { //messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : "")); } - if(Permissions.isSubSkillEnabled(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) { - String rank = String.valueOf(RankUtils.getRank(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)); - messages.add(getStatMessage(SubSkillType.EXCAVATION_ARCHAEOLOGY, rank, rank)); + if(canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) { + messages.add(getStatMessage(SubSkillType.EXCAVATION_ARCHAEOLOGY, percent.format(excavationManager.getArchaelogyExperienceOrbChance()), String.valueOf(excavationManager.getExperienceOrbsReward()))); } return messages; diff --git a/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java b/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java index 44d34b1ea..65036d27a 100644 --- a/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java +++ b/src/main/java/com/gmail/nossr50/skills/excavation/ExcavationManager.java @@ -44,12 +44,10 @@ public class ExcavationManager extends SkillManager { if (skillLevel >= treasure.getDropLevel() && RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), PrimarySkillType.EXCAVATION, treasure.getDropChance())) { - int rank = RankUtils.getRank(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY); - //Spawn Vanilla XP orbs if a dice roll succeeds - if(RandomChanceUtil.rollDice(rank, 100)) { + if(RandomChanceUtil.rollDice(getArchaelogyExperienceOrbChance(), 100)) { ExperienceOrb experienceOrb = (ExperienceOrb) getPlayer().getWorld().spawnEntity(location, EntityType.EXPERIENCE_ORB); - experienceOrb.setExperience(rank); + experienceOrb.setExperience(getExperienceOrbsReward()); } xp += treasure.getXp(); @@ -62,6 +60,18 @@ public class ExcavationManager extends SkillManager { applyXpGain(xp, XPGainReason.PVE); } + public int getExperienceOrbsReward() { + return 5 * getArchaeologyRank(); + } + + public double getArchaelogyExperienceOrbChance() { + return getArchaeologyRank() * 2; + } + + public int getArchaeologyRank() { + return RankUtils.getRank(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY); + } + public void printExcavationDebug(Player player, BlockState blockState) { if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) {