From bca1298918a4ae5eb2391b124a1437d459183a4c Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 17 Jun 2019 11:03:40 -0700 Subject: [PATCH] Wire up swords config --- Changelog.txt | 1 + .../commands/skills/SwordsCommand.java | 11 ++++++---- .../gmail/nossr50/config/AdvancedConfig.java | 21 ------------------- .../runnables/skills/BleedTimerTask.java | 5 ++--- .../nossr50/skills/swords/SwordsManager.java | 11 +++++----- 5 files changed, 15 insertions(+), 34 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index b30e3904f..c5c6a8fcc 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -43,6 +43,7 @@ Version 2.2.0 Nearby players using super abilities is now sent to your chat instead of the action bar by default Increased the default recipe cost for Chimaera Wing from 5 to 40 Blast Mining Damage Decrease now scales more smoothly from ranks 1-8 + Fixed a bug where Rupture wasn't using the base ticks setting from config when determining how many ticks of rupture to apply Admins will now be notified if a player trips over-fishing exploit detection 3+ times in a row (Locale: "Fishing.OverFishingDetected") Note: Admins are players who are an operator or have adminchat permission. diff --git a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java index cfb6921a3..eb6f945b5 100644 --- a/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/skills/SwordsCommand.java @@ -1,9 +1,9 @@ package com.gmail.nossr50.commands.skills; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.locale.LocaleLoader; +import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.Permissions; import com.gmail.nossr50.util.TextComponentFactory; import com.gmail.nossr50.util.player.UserManager; @@ -70,8 +70,11 @@ public class SwordsCommand extends SkillCommand { List messages = new ArrayList<>(); int ruptureTicks = UserManager.getPlayer(player).getSwordsManager().getRuptureBleedTicks(); - double ruptureDamagePlayers = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamagePlayer() * 1.5D : AdvancedConfig.getInstance().getRuptureDamagePlayer(); - double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? AdvancedConfig.getInstance().getRuptureDamageMobs() * 1.5D : AdvancedConfig.getInstance().getRuptureDamageMobs(); + double ruptureDamagePlayer = mcMMO.getConfigManager().getConfigSwords().getRuptureDamagePlayer(); + double pveRupture = mcMMO.getConfigManager().getConfigSwords().getRuptureDamageMobs(); + + double pvpDamageRupture = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? ruptureDamagePlayer * 1.5D : ruptureDamagePlayer; + double ruptureDamageMobs = RankUtils.getRank(player, SubSkillType.SWORDS_RUPTURE) >= 3 ? pveRupture * 1.5D : pveRupture; if (canCounter) { messages.add(getStatMessage(SubSkillType.SWORDS_COUNTER_ATTACK, counterChance) @@ -83,7 +86,7 @@ public class SwordsCommand extends SkillCommand { + (isLucky ? LocaleLoader.getString("Perks.Lucky.Bonus", bleedChanceLucky) : "")); messages.add(getStatMessage(true, true, SubSkillType.SWORDS_RUPTURE, String.valueOf(ruptureTicks), - String.valueOf(ruptureDamagePlayers), + String.valueOf(pvpDamageRupture), String.valueOf(ruptureDamageMobs))); messages.add(LocaleLoader.getString("Swords.Combat.Rupture.Note")); diff --git a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java index 658086763..8c2aac8a4 100644 --- a/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java +++ b/src/main/java/com/gmail/nossr50/config/AdvancedConfig.java @@ -173,27 +173,6 @@ public class AdvancedConfig extends ConfigValidated { return getDoubleValue(SKILLS, FISHING, MASTER_ANGLER, BIOME_MODIFIER); } - /* SWORDS */ - public double getRuptureDamagePlayer() { - return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_PLAYER); - } - - public double getRuptureDamageMobs() { - return getDoubleValue(SKILLS, SWORDS, RUPTURE, DAMAGE_MOBS); - } - - public int getRuptureMaxTicks() { - return getIntValue(SKILLS, SWORDS, RUPTURE, MAX_TICKS); - } - - public double getCounterAttackModifier() { - return getDoubleValue(SKILLS, SWORDS, COUNTER_ATTACK, DAMAGE_MODIFIER); - } - - public double getSerratedStrikesModifier() { - return getDoubleValue(SKILLS, SWORDS, SERRATED_STRIKES, DAMAGE_MODIFIER); - } - /* TAMING */ public double getGoreModifier() { return getDoubleValue(SKILLS, TAMING, GORE, MODIFIER); diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java index c8382043f..b6039bc85 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/BleedTimerTask.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.runnables.skills; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.util.MobHealthbarUtils; @@ -93,7 +92,7 @@ public class BleedTimerTask extends BukkitRunnable { double damage; if (target instanceof Player) { - damage = AdvancedConfig.getInstance().getRuptureDamagePlayer(); + damage = mcMMO.getConfigManager().getConfigSwords().getRuptureDamagePlayer(); //Above Bleed Rank 3 deals 50% more damage if (containerEntry.getValue().toolTier >= 4 && containerEntry.getValue().bleedRank >= 3) @@ -112,7 +111,7 @@ public class BleedTimerTask extends BukkitRunnable { } } else { - damage = AdvancedConfig.getInstance().getRuptureDamageMobs(); + damage = mcMMO.getConfigManager().getConfigSwords().getRuptureDamageMobs(); // debugMessage+="BaseDMG=["+damage+"], "; diff --git a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java index e98680394..04d3345aa 100644 --- a/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java +++ b/src/main/java/com/gmail/nossr50/skills/swords/SwordsManager.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.skills.swords; -import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.datatypes.interactions.NotificationType; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.skills.PrimarySkillType; @@ -107,10 +106,10 @@ public class SwordsManager extends SkillManager { } public int getRuptureBleedTicks() { - int bleedTicks = 2 * RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE); + int bleedTicks = mcMMO.getConfigManager().getConfigSwords().getRuptureBaseTicks() * RankUtils.getRank(getPlayer(), SubSkillType.SWORDS_RUPTURE); - if (bleedTicks > AdvancedConfig.getInstance().getRuptureMaxTicks()) - bleedTicks = AdvancedConfig.getInstance().getRuptureMaxTicks(); + /*if (bleedTicks > AdvancedConfig.getInstance().getRuptureMaxTicks()) + bleedTicks = AdvancedConfig.getInstance().getRuptureMaxTicks();*/ return bleedTicks; } @@ -123,7 +122,7 @@ public class SwordsManager extends SkillManager { */ public void counterAttackChecks(LivingEntity attacker, double damage) { if (RandomChanceUtil.isActivationSuccessful(SkillActivationType.RANDOM_LINEAR_100_SCALE_WITH_CAP, SubSkillType.SWORDS_COUNTER_ATTACK, getPlayer())) { - CombatUtils.dealDamage(attacker, damage / AdvancedConfig.getInstance().getCounterAttackModifier(), getPlayer()); + CombatUtils.dealDamage(attacker, damage / mcMMO.getConfigManager().getConfigSwords().getCounterAttackDamageModifier(), getPlayer()); mcMMO.getNotificationManager().sendPlayerInformation(getPlayer(), NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.Countered"); @@ -140,6 +139,6 @@ public class SwordsManager extends SkillManager { * @param damage The amount of damage initially dealt by the event */ public void serratedStrikes(LivingEntity target, double damage, Map modifiers) { - CombatUtils.applyAbilityAoE(getPlayer(), target, damage / AdvancedConfig.getInstance().getSerratedStrikesModifier(), modifiers, skill); + CombatUtils.applyAbilityAoE(getPlayer(), target, damage / mcMMO.getConfigManager().getConfigSwords().getSerratedStrikesDamageModifier(), modifiers, skill); } }