Chi no longer takes fall damage if sprinting

This commit is contained in:
MistPhizzle 2014-07-19 20:41:17 -04:00
parent 4ef2e12287
commit b90552537f

View file

@ -929,7 +929,7 @@ public class PKListener implements Listener {
Entity en = e.getEntity();
if (en instanceof Player) {
// Player p = (Player) en; // This is the player getting hurt.
// Player p = (Player) en; // This is the player getting hurt.
if (e.getDamager() instanceof Player) { // This is the player hitting someone.
Player sourceplayer = (Player) e.getDamager();
Player targetplayer = (Player) e.getEntity();
@ -960,27 +960,27 @@ public class PKListener implements Listener {
}
}
// Player damager = (Player) e.getDamager();
// if (Methods.canBendPassive(damager.getName(), Element.Chi)) {
// if (e.getCause() == DamageCause.ENTITY_ATTACK) {
// if (Methods.isWeapon(damager.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
// return;
// }
// if (damager.getItemInHand() != null && Methods.isWeapon(damager.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
// // Above method checks if the player has an item in their hand, if it is a weapon, and if they can bend with weapons.
// if (Methods.getBoundAbility(damager) == null || Methods.getBoundAbility(damager).equalsIgnoreCase("RapidPunch")) { // We don't want them to be able to block chi if an ability is bound.
// if (ChiPassive.willChiBlock(p)) {
// ChiPassive.blockChi(p);
// }
// }
// if (Methods.getBoundAbility(damager).equalsIgnoreCase("Paralyze")) {
// if (ChiPassive.willChiBlock(p)) {
// new Paralyze((Player) e.getDamager(), e.getEntity());
// }
// }
// }
// }
// }
// Player damager = (Player) e.getDamager();
// if (Methods.canBendPassive(damager.getName(), Element.Chi)) {
// if (e.getCause() == DamageCause.ENTITY_ATTACK) {
// if (Methods.isWeapon(damager.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
// return;
// }
// if (damager.getItemInHand() != null && Methods.isWeapon(damager.getItemInHand().getType()) && !ProjectKorra.plugin.getConfig().getBoolean("Properties.Chi.CanBendWithWeapons")) {
// // Above method checks if the player has an item in their hand, if it is a weapon, and if they can bend with weapons.
// if (Methods.getBoundAbility(damager) == null || Methods.getBoundAbility(damager).equalsIgnoreCase("RapidPunch")) { // We don't want them to be able to block chi if an ability is bound.
// if (ChiPassive.willChiBlock(p)) {
// ChiPassive.blockChi(p);
// }
// }
// if (Methods.getBoundAbility(damager).equalsIgnoreCase("Paralyze")) {
// if (ChiPassive.willChiBlock(p)) {
// new Paralyze((Player) e.getDamager(), e.getEntity());
// }
// }
// }
// }
// }
}
}
}
@ -1032,11 +1032,16 @@ public class PKListener implements Listener {
&& Methods.isBender(player.getName(), Element.Chi)
&& event.getCause() == DamageCause.FALL
&& Methods.canBendPassive(player.getName(), Element.Chi)) {
if (player.isSprinting()) {
event.setDamage(0);
event.setCancelled(true);
} else {
double initdamage = event.getDamage();
double newdamage = event.getDamage() * ChiPassive.FallReductionFactor;
double finaldamage = initdamage - newdamage;
event.setDamage(finaldamage);
}
}
if (!event.isCancelled() && event.getCause() == DamageCause.FALL) {
Player source = Flight.getLaunchedBy(player);