mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-09-11 12:49:32 +00:00
Fix shockwave
- Fixed shockwave fall version - Removed various unnecessary methods called when fall damage was taken.
This commit is contained in:
parent
147d89c778
commit
5d244d0eac
|
@ -799,26 +799,19 @@ public class PKListener implements Listener {
|
||||||
if (bPlayer == null) {
|
if (bPlayer == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL) {
|
if (bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL) {
|
||||||
Shockwave shockwave = new Shockwave(player);
|
new Shockwave(player, true);
|
||||||
shockwave.fallShockwave();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bPlayer.hasElement(Element.AIR) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.AIR)) {
|
if (!event.isCancelled() && bPlayer.hasElement(Element.AIR) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.AIR)) {
|
||||||
new Flight(player);
|
|
||||||
player.setAllowFlight(true);
|
|
||||||
new AirBurst(player, true);
|
new AirBurst(player, true);
|
||||||
player.setFallDistance(0);
|
|
||||||
event.setDamage(0D);
|
event.setDamage(0D);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.WATER) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.WATER)) {
|
if (!event.isCancelled() && bPlayer.hasElement(Element.WATER) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.WATER)) {
|
||||||
if (WaterPassive.applyNoFall(player)) {
|
if (WaterPassive.applyNoFall(player)) {
|
||||||
new Flight(player);
|
|
||||||
player.setAllowFlight(true);
|
|
||||||
player.setFallDistance(0);
|
|
||||||
event.setDamage(0D);
|
event.setDamage(0D);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -826,9 +819,6 @@ public class PKListener implements Listener {
|
||||||
|
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.EARTH)) {
|
if (!event.isCancelled() && bPlayer.hasElement(Element.EARTH) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.EARTH)) {
|
||||||
if (EarthPassive.softenLanding(player)) {
|
if (EarthPassive.softenLanding(player)) {
|
||||||
new Flight(player);
|
|
||||||
player.setAllowFlight(true);
|
|
||||||
player.setFallDistance(0);
|
|
||||||
event.setDamage(0D);
|
event.setDamage(0D);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -837,7 +827,6 @@ public class PKListener implements Listener {
|
||||||
if (!event.isCancelled() && bPlayer.hasElement(Element.CHI) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.CHI)) {
|
if (!event.isCancelled() && bPlayer.hasElement(Element.CHI) && event.getCause() == DamageCause.FALL && bPlayer.canBendPassive(Element.CHI)) {
|
||||||
if (player.isSprinting()) {
|
if (player.isSprinting()) {
|
||||||
event.setDamage(0);
|
event.setDamage(0);
|
||||||
event.setCancelled(true);
|
|
||||||
} else {
|
} else {
|
||||||
double initdamage = event.getDamage();
|
double initdamage = event.getDamage();
|
||||||
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
|
double newdamage = event.getDamage() * ChiPassive.getFallReductionFactor();
|
||||||
|
@ -1369,7 +1358,7 @@ public class PKListener implements Listener {
|
||||||
new CollapseWall(player);
|
new CollapseWall(player);
|
||||||
}
|
}
|
||||||
if (abil.equalsIgnoreCase("Shockwave")) {
|
if (abil.equalsIgnoreCase("Shockwave")) {
|
||||||
new Shockwave(player);
|
new Shockwave(player, false);
|
||||||
}
|
}
|
||||||
if (abil.equalsIgnoreCase("EarthGrab")) {
|
if (abil.equalsIgnoreCase("EarthGrab")) {
|
||||||
new EarthGrab(player, false);
|
new EarthGrab(player, false);
|
||||||
|
|
|
@ -17,7 +17,7 @@ public class Shockwave extends EarthAbility {
|
||||||
private double threshold;
|
private double threshold;
|
||||||
private double range;
|
private double range;
|
||||||
|
|
||||||
public Shockwave(Player player) {
|
public Shockwave(Player player, boolean fall) {
|
||||||
super(player);
|
super(player);
|
||||||
|
|
||||||
this.angle = Math.toRadians(getConfig().getDouble("Abilities.Earth.Shockwave.Angle"));
|
this.angle = Math.toRadians(getConfig().getDouble("Abilities.Earth.Shockwave.Angle"));
|
||||||
|
@ -35,20 +35,24 @@ public class Shockwave extends EarthAbility {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fall) {
|
||||||
|
fallShockwave();
|
||||||
|
}
|
||||||
|
|
||||||
start();
|
start();
|
||||||
bPlayer.addCooldown(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fallShockwave() {
|
public void fallShockwave() {
|
||||||
if (!bPlayer.canBendIgnoreCooldowns(this)) {
|
if (!bPlayer.canBendIgnoreCooldowns(this)) {
|
||||||
return;
|
return;
|
||||||
} else if (player.getFallDistance() < threshold || !isEarthbendable(player.getLocation().add(0, -1, 0).getBlock())) {
|
} else if (player.getFallDistance() < threshold || !isEarthbendable(player.getLocation().clone().subtract(0, 1, 0).getBlock())) {
|
||||||
return;
|
return;
|
||||||
} else if(bPlayer.isOnCooldown("Shockwave")) {
|
} else if (bPlayer.isOnCooldown("Shockwave")) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
areaShockwave();
|
areaShockwave();
|
||||||
|
bPlayer.addCooldown(this);
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue