Browse Source

Hardcore mode now has some exploit prevention and much more information

nossr50 13 years ago
parent
commit
160004fa7e
2 changed files with 19 additions and 4 deletions
  1. 2 0
      Changelog.txt
  2. 17 4
      src/main/java/com/gmail/nossr50/util/Hardcore.java

+ 2 - 0
Changelog.txt

@@ -14,10 +14,12 @@ Version 1.3.08
  = Fixed exploit where you could gain tons of Acrobatics XP from spamming Ender Pearls
  = 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 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
  = Fixed handling of the Unbreaking enchantment so that tools are actually damaged as they should now
+ ! Changed Hardcore Vampirism to require the victim to have at least half the skill level of the killer in order for vampirism to proc (this is to avoid exploitation)
  ! Changed Hardcore Vampirism to steal a minimum of 1 skill level from a player no matter the percentage
  ! 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 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 actually remove stats from the victim
  ! Changed Vampirism to inform the victim of their stat loss
  ! Changed Vampirism to inform the victim of their stat loss
+ ! Added more notifications about Vampirism and Hardcore mode
  ! Changed Mining to allow Silk Touch to work again since the dupe exploit has been fixed.
  ! 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
  ! Changed Metrics to also report if the server uses plugin profiling
 
 

+ 17 - 4
src/main/java/com/gmail/nossr50/util/Hardcore.java

@@ -14,6 +14,8 @@ public class Hardcore {
         
         
         PlayerProfile PP = Users.getProfile(player);
         PlayerProfile PP = Users.getProfile(player);
         
         
+        int totalCount = 0;
+        
         for(SkillType st : SkillType.values()) {
         for(SkillType st : SkillType.values()) {
             
             
             if(st.equals(SkillType.ALL))
             if(st.equals(SkillType.ALL))
@@ -24,10 +26,12 @@ public class Hardcore {
             if(newValue < 0)
             if(newValue < 0)
                 newValue = 0;
                 newValue = 0;
             
             
+            totalCount+=PP.getSkillLevel(st)-newValue;
+            
             PP.modifySkill(st, newValue);
             PP.modifySkill(st, newValue);
         }
         }
         
         
-        player.sendMessage(ChatColor.GOLD+"[mcMMO] "+ChatColor.DARK_RED+"You've suffered a penalty to skills from death.");
+        player.sendMessage(ChatColor.GOLD+"[mcMMO] "+ChatColor.DARK_RED+"You've lost "+ChatColor.BLUE+totalCount+ChatColor.DARK_RED+" from death.");
     }
     }
     
     
     public static void invokeVampirism(Player killer, Player defender) {
     public static void invokeVampirism(Player killer, Player defender) {
@@ -37,11 +41,13 @@ public class Hardcore {
         PlayerProfile PPk = Users.getProfile(killer);
         PlayerProfile PPk = Users.getProfile(killer);
         PlayerProfile PPd = Users.getProfile(defender);
         PlayerProfile PPd = Users.getProfile(defender);
         
         
+        int totalCount = 0;
+        
         for(SkillType st : SkillType.values()) {
         for(SkillType st : SkillType.values()) {
             if(st.equals(SkillType.ALL))
             if(st.equals(SkillType.ALL))
                 continue;
                 continue;
             
             
-            if(PPd.getSkillLevel(st) <= 0)
+            if(PPd.getSkillLevel(st) <= 0 || PPd.getSkillLevel(st) < (PPk.getSkillLevel(st)/2))
                 continue;
                 continue;
             
             
             int newValue = (int) (PPd.getSkillLevel(st) * (Config.getInstance().getHardcoreVampirismStatLeechPercentage() * 0.01D));
             int newValue = (int) (PPd.getSkillLevel(st) * (Config.getInstance().getHardcoreVampirismStatLeechPercentage() * 0.01D));
@@ -49,11 +55,18 @@ public class Hardcore {
             if(newValue <= 0)
             if(newValue <= 0)
                 newValue = 1;
                 newValue = 1;
             
             
+            totalCount+=1;
+            
             PPk.modifySkill(st, newValue+PPk.getSkillLevel(st));
             PPk.modifySkill(st, newValue+PPk.getSkillLevel(st));
             PPd.modifySkill(st, PPd.getSkillLevel(st)-newValue);
             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!");
+        if(totalCount >= 1) {
+            killer.sendMessage(ChatColor.GOLD+"[mcMMO] "+ChatColor.DARK_AQUA+"You've stolen "+ChatColor.BLUE+totalCount+ChatColor.DARK_AQUA+" levels from that player.");
+            defender.sendMessage(ChatColor.GOLD+"[mcMMO] "+ChatColor.YELLOW+killer.getName()+ChatColor.DARK_RED+" has stolen "+ChatColor.BLUE+totalCount+ChatColor.DARK_RED+" levels from you!");
+        } else {
+            killer.sendMessage(ChatColor.GOLD+"[mcMMO] "+ChatColor.GRAY+"That player was too unskilled to grant you any knowledge.");
+            defender.sendMessage(ChatColor.GOLD+"[mcMMO] "+ChatColor.YELLOW+killer.getName()+ChatColor.GRAY+" was unable to steal knowledge from you!");
+        }
     }
     }
 }
 }