tweak Archaeology rewards

This commit is contained in:
nossr50 2019-06-24 22:30:20 -07:00
parent 2dda0bf27a
commit ee2a1b332e
2 changed files with 21 additions and 7 deletions

View File

@ -3,8 +3,10 @@ package com.gmail.nossr50.commands.skills;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.locale.LocaleLoader; import com.gmail.nossr50.locale.LocaleLoader;
import com.gmail.nossr50.skills.excavation.ExcavationManager;
import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.Permissions;
import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.TextComponentFactory;
import com.gmail.nossr50.util.player.UserManager;
import com.gmail.nossr50.util.skills.RankUtils; import com.gmail.nossr50.util.skills.RankUtils;
import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.chat.TextComponent;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -43,6 +45,9 @@ public class ExcavationCommand extends SkillCommand {
protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) { protected List<String> statsDisplay(Player player, float skillValue, boolean hasEndurance, boolean isLucky) {
List<String> messages = new ArrayList<String>(); List<String> messages = new ArrayList<String>();
ExcavationManager excavationManager = UserManager.getPlayer(player).getExcavationManager();
if (canGigaDrill) { if (canGigaDrill) {
messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength) messages.add(getStatMessage(SubSkillType.EXCAVATION_GIGA_DRILL_BREAKER, gigaDrillBreakerLength)
+ (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : "")); + (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) : "")); //messages.add(LocaleLoader.getString("Excavation.Effect.Length", gigaDrillBreakerLength) + (hasEndurance ? LocaleLoader.getString("Perks.ActivationTime.Bonus", gigaDrillBreakerLengthEndurance) : ""));
} }
if(Permissions.isSubSkillEnabled(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) { if(canUseSubskill(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)) {
String rank = String.valueOf(RankUtils.getRank(player, SubSkillType.EXCAVATION_ARCHAEOLOGY)); messages.add(getStatMessage(SubSkillType.EXCAVATION_ARCHAEOLOGY, percent.format(excavationManager.getArchaelogyExperienceOrbChance()), String.valueOf(excavationManager.getExperienceOrbsReward())));
messages.add(getStatMessage(SubSkillType.EXCAVATION_ARCHAEOLOGY, rank, rank));
} }
return messages; return messages;

View File

@ -44,12 +44,10 @@ public class ExcavationManager extends SkillManager {
if (skillLevel >= treasure.getDropLevel() if (skillLevel >= treasure.getDropLevel()
&& RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), PrimarySkillType.EXCAVATION, treasure.getDropChance())) { && RandomChanceUtil.checkRandomChanceExecutionSuccess(getPlayer(), PrimarySkillType.EXCAVATION, treasure.getDropChance())) {
int rank = RankUtils.getRank(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY);
//Spawn Vanilla XP orbs if a dice roll succeeds //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 experienceOrb = (ExperienceOrb) getPlayer().getWorld().spawnEntity(location, EntityType.EXPERIENCE_ORB);
experienceOrb.setExperience(rank); experienceOrb.setExperience(getExperienceOrbsReward());
} }
xp += treasure.getXp(); xp += treasure.getXp();
@ -62,6 +60,18 @@ public class ExcavationManager extends SkillManager {
applyXpGain(xp, XPGainReason.PVE); 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) public void printExcavationDebug(Player player, BlockState blockState)
{ {
if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) { if (Permissions.isSubSkillEnabled(getPlayer(), SubSkillType.EXCAVATION_ARCHAEOLOGY)) {