mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-29 16:46:46 +01:00
Vampirism for hardcore mode, needs testing.
This commit is contained in:
parent
f7405a82e6
commit
9d510815b4
@ -8,7 +8,7 @@ Key:
|
|||||||
- Removal
|
- Removal
|
||||||
|
|
||||||
Version 1.3.07
|
Version 1.3.07
|
||||||
+ Added new Hardcore mode functionality to mcMMO
|
+ Added new configurable Hardcore mode functionality to mcMMO
|
||||||
+ Added new bypass permission node for the negative penalties of Hardcore mode 'mcmmo.bypass.hardcoremode'
|
+ Added new bypass permission node for the negative penalties of Hardcore mode 'mcmmo.bypass.hardcoremode'
|
||||||
+ Added a permission node for Archery bonus damage
|
+ Added a permission node for Archery bonus damage
|
||||||
+ Added a permission node for Greater Impact ability
|
+ Added a permission node for Greater Impact ability
|
||||||
|
@ -46,8 +46,10 @@ public class Config extends ConfigLoader {
|
|||||||
/* Hardcore Mode */
|
/* Hardcore Mode */
|
||||||
public boolean getHardcoreEnabled() { return config.getBoolean("Hardcore.Enabled", false); }
|
public boolean getHardcoreEnabled() { return config.getBoolean("Hardcore.Enabled", false); }
|
||||||
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss_Penalty_Percentage", 75); }
|
public double getHardcoreDeathStatPenaltyPercentage() { return config.getDouble("Hardcore.Death_Stat_Loss_Penalty_Percentage", 75); }
|
||||||
|
public double getHardcoreVampirismStatLeechPercentage() { return config.getDouble("Hardcore.Vampirism_Stat_Leech_Percentage", 5); }
|
||||||
public boolean getHardcoreVampirismEnabled() { return config.getBoolean("Hardcore.Vampirism", false); }
|
public boolean getHardcoreVampirismEnabled() { return config.getBoolean("Hardcore.Vampirism", false); }
|
||||||
|
|
||||||
|
|
||||||
/* Commands */
|
/* Commands */
|
||||||
public boolean getCommandXPLockEnabled() { return config.getBoolean("Commands.xplock.Enabled", true); }
|
public boolean getCommandXPLockEnabled() { return config.getBoolean("Commands.xplock.Enabled", true); }
|
||||||
public boolean getCommandXPRateEnabled() { return config.getBoolean("Commands.xprate.Enabled", true); }
|
public boolean getCommandXPRateEnabled() { return config.getBoolean("Commands.xprate.Enabled", true); }
|
||||||
|
@ -5,6 +5,7 @@ import org.bukkit.event.EventHandler;
|
|||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.util.Hardcore;
|
import com.gmail.nossr50.util.Hardcore;
|
||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
|
|
||||||
@ -13,7 +14,14 @@ public class HardcoreListener implements Listener {
|
|||||||
@EventHandler()
|
@EventHandler()
|
||||||
public void PlayerDeathEvent(PlayerDeathEvent event) {
|
public void PlayerDeathEvent(PlayerDeathEvent event) {
|
||||||
Player player = event.getEntity(); //Note this returns a Player object for this subevent
|
Player player = event.getEntity(); //Note this returns a Player object for this subevent
|
||||||
|
|
||||||
if(!Permissions.getInstance().hardcoremodeBypass(player)) {
|
if(!Permissions.getInstance().hardcoremodeBypass(player)) {
|
||||||
|
if(player.getKiller() instanceof Player) {
|
||||||
|
if(Config.getInstance().getHardcoreVampirismEnabled()) {
|
||||||
|
Hardcore.invokeVampirism(((Player)player.getKiller()), player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Hardcore.invokeStatPenalty(player);
|
Hardcore.invokeStatPenalty(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,4 +24,18 @@ public class Hardcore {
|
|||||||
|
|
||||||
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 suffered a penalty to skills from death.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void invokeVampirism(Player killer, Player defender) {
|
||||||
|
PlayerProfile PPk = Users.getProfile(killer);
|
||||||
|
PlayerProfile PPd = Users.getProfile(defender);
|
||||||
|
|
||||||
|
for(SkillType st : SkillType.values()) {
|
||||||
|
if(st.equals(SkillType.ALL))
|
||||||
|
continue;
|
||||||
|
int newValue = (int) (PPd.getSkillLevel(st) - (PPd.getSkillLevel(st) * (Config.getInstance().getHardcoreVampirismStatLeechPercentage() * 0.01D)));
|
||||||
|
PPk.modifySkill(st, newValue+PPk.getSkillLevel(st));
|
||||||
|
}
|
||||||
|
|
||||||
|
killer.sendMessage(ChatColor.GOLD+"[mcMMO] "+ChatColor.DARK_AQUA+"You've stolen knowledge from that player.");
|
||||||
|
}
|
||||||
}
|
}
|
@ -38,6 +38,7 @@ Hardcore:
|
|||||||
Enabled: false
|
Enabled: false
|
||||||
Death_Stat_Loss_Penalty_Percentage: 75
|
Death_Stat_Loss_Penalty_Percentage: 75
|
||||||
Vampirism: false
|
Vampirism: false
|
||||||
|
Vampirism_Stat_Leech_Percentage: 5
|
||||||
|
|
||||||
#
|
#
|
||||||
# Settings for mcMMO items
|
# Settings for mcMMO items
|
||||||
|
Loading…
Reference in New Issue
Block a user