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

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