Many changes to Hardcore / Vampirism

This commit is contained in:
nossr50 2012-05-21 23:30:16 -07:00
parent a4d1a18850
commit f4332761f9
3 changed files with 22 additions and 1 deletions

View File

@ -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

View File

@ -21,7 +21,6 @@ public class HardcoreListener implements Listener {
Hardcore.invokeVampirism(((Player)player.getKiller()), player);
}
}
Hardcore.invokeStatPenalty(player);
}
}

View File

@ -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!");
}
}