From f4332761f9a03af913cf18e068f84f13b6f3fc3f Mon Sep 17 00:00:00 2001 From: nossr50 Date: Mon, 21 May 2012 23:30:16 -0700 Subject: [PATCH] Many changes to Hardcore / Vampirism --- Changelog.txt | 4 ++++ .../nossr50/listeners/HardcoreListener.java | 1 - .../java/com/gmail/nossr50/util/Hardcore.java | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index cfbd949d9..e12eddeba 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -14,6 +14,10 @@ Version 1.3.08 = Fixed exploit where you could gain tons of Acrobatics XP from spamming Ender Pearls = Fixed normal pistons marking a block as user-placed on retract if it wasn't a sticky piston (thanks turt2live!) = Fixed handling of the Unbreaking enchantment so that tools are actually damaged as they should now + ! Changed Hardcore Vampirism to steal a minimum of 1 skill level from a player no matter the percentage + ! Changed Hardcore & Vampirism to not be executed if percentages were set to zero or below + ! Changed Vampirism to actually remove stats from the victim + ! Changed Vampirism to inform the victim of their stat loss ! Changed Mining to allow Silk Touch to work again since the dupe exploit has been fixed. ! Changed Metrics to also report if the server uses plugin profiling diff --git a/src/main/java/com/gmail/nossr50/listeners/HardcoreListener.java b/src/main/java/com/gmail/nossr50/listeners/HardcoreListener.java index 53d37bc8e..b394336c9 100644 --- a/src/main/java/com/gmail/nossr50/listeners/HardcoreListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/HardcoreListener.java @@ -21,7 +21,6 @@ public class HardcoreListener implements Listener { Hardcore.invokeVampirism(((Player)player.getKiller()), player); } } - Hardcore.invokeStatPenalty(player); } } diff --git a/src/main/java/com/gmail/nossr50/util/Hardcore.java b/src/main/java/com/gmail/nossr50/util/Hardcore.java index 9ab3ffc45..301f98945 100644 --- a/src/main/java/com/gmail/nossr50/util/Hardcore.java +++ b/src/main/java/com/gmail/nossr50/util/Hardcore.java @@ -9,11 +9,16 @@ import com.gmail.nossr50.datatypes.SkillType; public class Hardcore { public static void invokeStatPenalty(Player player) { + if(Config.getInstance().getHardcoreDeathStatPenaltyPercentage() <= 0) + return; + PlayerProfile PP = Users.getProfile(player); for(SkillType st : SkillType.values()) { + if(st.equals(SkillType.ALL)) continue; + int newValue = (int) (PP.getSkillLevel(st) - (PP.getSkillLevel(st) * (Config.getInstance().getHardcoreDeathStatPenaltyPercentage() * 0.01D))); if(newValue < 0) @@ -26,16 +31,29 @@ public class Hardcore { } public static void invokeVampirism(Player killer, Player defender) { + if(Config.getInstance().getHardcoreVampirismStatLeechPercentage() <= 0) + return; + PlayerProfile PPk = Users.getProfile(killer); PlayerProfile PPd = Users.getProfile(defender); for(SkillType st : SkillType.values()) { if(st.equals(SkillType.ALL)) continue; + + if(PPd.getSkillLevel(st) <= 0) + continue; + int newValue = (int) (PPd.getSkillLevel(st) * (Config.getInstance().getHardcoreVampirismStatLeechPercentage() * 0.01D)); + + if(newValue <= 0) + newValue = 1; + PPk.modifySkill(st, newValue+PPk.getSkillLevel(st)); + PPd.modifySkill(st, PPd.getSkillLevel(st)-newValue); } killer.sendMessage(ChatColor.GOLD+"[mcMMO] "+ChatColor.DARK_AQUA+"You've stolen knowledge from that player."); + defender.sendMessage(ChatColor.GOLD+"[mcMMO] "+ChatColor.YELLOW+killer.getName()+ChatColor.DARK_AQUA+" has stolen knowledge from you!"); } } \ No newline at end of file