From 3d9f99bc57362cbf46543ab976829aa7be8ed57e Mon Sep 17 00:00:00 2001 From: Benford Whitaker Date: Sat, 22 Jun 2019 18:31:10 -0400 Subject: [PATCH] earthpillars bug + earthblast & iceblast improvements (#988) ## Additions * Improved earthblast and iceblast aiming. ## Fixes * Fixed earthpillars bug where using the ability while not around entities creates a loop until the player is around other entities. --- .../projectkorra/earthbending/EarthBlast.java | 26 +++++++++++++------ .../earthbending/combo/EarthPillars.java | 1 + .../waterbending/ice/IceSpikeBlast.java | 2 +- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java index 89c9975d..dfd194ec 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthBlast.java @@ -364,15 +364,25 @@ public class EarthBlast extends EarthAbility { } final Entity target = GeneralMethods.getTargetedEntity(this.player, this.range, new ArrayList()); - if (target == null) { - this.destination = this.getTargetEarthBlock((int) this.range).getLocation(); - this.firstDestination = this.sourceBlock.getLocation().clone(); - this.firstDestination.setY(this.destination.getY()); + if (target != null) { + this.destination = target.getLocation(); } else { - this.destination = ((LivingEntity) target).getEyeLocation(); - this.firstDestination = this.sourceBlock.getLocation().clone(); - this.firstDestination.setY(this.destination.getY()); - this.destination = GeneralMethods.getPointOnLine(this.firstDestination, this.destination, this.range); + this.destination = getTargetLocation(); + } + + if (this.sourceBlock == null) { + return; + } + this.location = this.sourceBlock.getLocation(); + if (this.destination.distanceSquared(this.location) < 1) { + return; + } + + this.firstDestination = this.location.clone(); + if (this.destination.getY() - this.location.getY() > 2) { + this.firstDestination.setY(this.destination.getY() - 1); + } else { + this.firstDestination.add(0, 2, 0); } if (this.destination.distanceSquared(this.location) <= 1) { diff --git a/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java b/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java index f6f6ad30..288074f2 100644 --- a/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java +++ b/src/com/projectkorra/projectkorra/earthbending/combo/EarthPillars.java @@ -86,6 +86,7 @@ public class EarthPillars extends EarthAbility implements ComboAbility { } if (this.entities.isEmpty()) { + remove(); return; } firstTime = false; diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java index 10b50d9d..3e9a3df4 100644 --- a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java +++ b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java @@ -257,7 +257,7 @@ public class IceSpikeBlast extends IceAbility { if (target == null) { this.destination = GeneralMethods.getTargetedLocation(this.player, this.range, true, getTransparentMaterials()); } else { - this.destination = target.getEyeLocation(); + this.destination = target.getLocation(); } if (this.sourceBlock == null) {