Subtract XP with Hardcore mode

Adds #1529
This commit is contained in:
TfT_02 2013-10-20 20:02:16 +02:00
parent d410251595
commit e0599a0dea
3 changed files with 25 additions and 11 deletions

View File

@ -53,6 +53,7 @@ Version 1.4.07-dev
! Changed default XP multiplier for repairing shears
! Changed "Shake" drops for Witches. They no longer drop water bottles, since they no longer drop them in Vanilla.
! Changed fishing exploit prevention, by default it will no longer send global sounds, effects and messages.
! Changed Hardcore modes, they will also subtract experience
! Changed various values to double in advanced.yml for the sake of consistency.
! Nerfed Fishing "Master Angler" (removed skill level based bonus) and also made the modifiers configurable
! Nerfed Archery damage to eliminate constant one-hit kills.

View File

@ -19,22 +19,27 @@ public final class HardcoreManager {
}
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
int totalLost = 0;
int totalLevelsLost = 0;
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
int playerSkillLevel = playerProfile.getSkillLevel(skillType);
int playerSkillXpLevel = playerProfile.getSkillXpLevel(skillType);
if (playerSkillLevel <= 0) {
continue;
}
int levelsLost = (int) (playerSkillLevel * (statLossPercentage * 0.01D));
totalLost += levelsLost;
double statsLost = playerSkillLevel * (statLossPercentage * 0.01D);
int levelsLost = (int) statsLost;
int xpLost = (int) Math.floor(playerSkillXpLevel * (statsLost - levelsLost));
totalLevelsLost += levelsLost;
playerProfile.modifySkill(skillType, playerSkillLevel - levelsLost);
playerProfile.removeXp(skillType, xpLost);
}
player.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PlayerDeath", totalLost));
player.sendMessage(LocaleLoader.getString("Hardcore.DeathStatLoss.PlayerDeath", totalLevelsLost));
}
public static void invokeVampirism(Player killer, Player victim) {
@ -46,7 +51,7 @@ public final class HardcoreManager {
PlayerProfile killerProfile = UserManager.getPlayer(killer).getProfile();
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
int totalStolen = 0;
int totalLevelsStolen = 0;
for (SkillType skillType : SkillType.NON_CHILD_SKILLS) {
int killerSkillLevel = killerProfile.getSkillLevel(skillType);
@ -56,16 +61,24 @@ public final class HardcoreManager {
continue;
}
int levelsStolen = (int) (victimSkillLevel * (vampirismStatLeechPercentage * 0.01D));
totalStolen += levelsStolen;
int victimSkillXpLevel = victimProfile.getSkillXpLevel(skillType);
double statsStolen = victimSkillLevel * (vampirismStatLeechPercentage * 0.01D);
int levelsStolen = (int) statsStolen;
int xpStolen = (int) Math.floor(victimSkillXpLevel * (statsStolen - levelsStolen));
totalLevelsStolen += levelsStolen;
killerProfile.modifySkill(skillType, killerSkillLevel + levelsStolen);
killerProfile.addExperience(skillType, xpStolen);
victimProfile.modifySkill(skillType, victimSkillLevel - levelsStolen);
victimProfile.removeXp(skillType, xpStolen);
}
if (totalStolen > 0) {
killer.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.Killer.Success", totalStolen, victim.getName()));
victim.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.Victim.Success", killer.getName(), totalStolen));
if (totalLevelsStolen > 0) {
killer.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.Killer.Success", totalLevelsStolen, victim.getName()));
victim.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.Victim.Success", killer.getName(), totalLevelsStolen));
}
else {
killer.sendMessage(LocaleLoader.getString("Hardcore.Vampirism.Killer.Failure", victim.getName()));

View File

@ -785,7 +785,7 @@ Perks.ActivationTime.Bonus=[[GOLD]] ({0}s with Endurance Perk)
Hardcore.Mode.Disabled=[[GOLD]][mcMMO] Hardcore mode {0} disabled. {1}
Hardcore.Mode.Enabled=[[GOLD]][mcMMO] Hardcore mode {0} enabled. {1}
Hardcore.DeathStatLoss.Name=Skill Death Penalty
Hardcore.DeathStatLoss.PlayerDeath=[[GOLD]][mcMMO] [[DARK_RED]]You have lost [[BLUE]]{0}[[DARK_RED]] from death.
Hardcore.DeathStatLoss.PlayerDeath=[[GOLD]][mcMMO] [[DARK_RED]]You have lost [[BLUE]]{0}[[DARK_RED]] levels from death.
Hardcore.DeathStatLoss.PercentageChanged=[[GOLD]][mcMMO] The stat loss percentage was changed to {0}.
Hardcore.Vampirism.Name=Vampirism
Hardcore.Vampirism.Killer.Failure=[[GOLD]][mcMMO] [[YELLOW]]{0}[[GRAY]] was too unskilled to grant you any knowledge.