From 1d907fe13492bca55a44cb39ce8478737223d5a3 Mon Sep 17 00:00:00 2001 From: Jack Lin Date: Wed, 15 Jul 2015 14:25:32 +1200 Subject: [PATCH] Update Air Abilities to reflect change --- .../ProjectKorra/airbending/AirBlast.java | 23 +++++++++++-------- .../ProjectKorra/airbending/AirBubble.java | 11 +++++---- .../ProjectKorra/airbending/AirBurst.java | 7 +++++- .../ProjectKorra/airbending/AirMethods.java | 2 +- .../ProjectKorra/airbending/AirScooter.java | 13 ++++++----- .../ProjectKorra/airbending/AirShield.java | 16 ++++++------- .../ProjectKorra/airbending/AirSpout.java | 5 ++-- .../ProjectKorra/airbending/AirSuction.java | 11 +++++---- .../ProjectKorra/airbending/AirSwipe.java | 13 ++++++----- .../airbending/FlightAbility.java | 6 ++--- .../ProjectKorra/airbending/Tornado.java | 13 ++++++----- 11 files changed, 67 insertions(+), 53 deletions(-) diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java b/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java index 1cf4e13d..e41b0f75 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java @@ -34,18 +34,20 @@ public class AirBlast extends BaseAbility { private static ConcurrentHashMap origins = new ConcurrentHashMap(); - static final int maxticks = 10000; - public static double speed = config.getDouble("Abilities.Air.AirBlast.Speed"); public static double defaultrange = config.getDouble("Abilities.Air.AirBlast.Range"); public static double affectingradius = config.getDouble("Abilities.Air.AirBlast.Radius"); public static double defaultpushfactor = config.getDouble("Abilities.Air.AirBlast.Push"); private static double originselectrange = 10; + /* Package visible variables */ + static final int maxticks = 10000; static double maxspeed = 1. / defaultpushfactor; + /* End Package visible variables */ + // public static long interval = 2000; public static byte full = 0x0; - - public Location location; + + private Location location; private Location origin; private Vector direction; private Player player; @@ -254,15 +256,15 @@ public class AirBlast extends BaseAbility { } @SuppressWarnings("deprecation") - public void progress() { + public boolean progress() { if (player.isDead() || !player.isOnline()) { remove(); - return; + return false; } if (GeneralMethods.isRegionProtectedFromBuild(player, "AirBlast", location)) { remove(); - return; + return false; } speedfactor = speed * (ProjectKorra.time_step / 1000.); @@ -271,7 +273,7 @@ public class AirBlast extends BaseAbility { if (ticks > maxticks) { remove(); - return; + return false; } Block block = location.getBlock(); for (Block testblock : GeneralMethods.getBlocksAroundPoint(location, affectingradius)) { @@ -407,7 +409,7 @@ public class AirBlast extends BaseAbility { } } remove(); - return; + return false; } /* @@ -419,7 +421,7 @@ public class AirBlast extends BaseAbility { double dist = location.distance(origin); if (Double.isNaN(dist) || dist > range) { remove(); - return; + return false; } for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, affectingradius)) { @@ -427,6 +429,7 @@ public class AirBlast extends BaseAbility { } advanceLocation(); + return true; } @Override diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirBubble.java b/src/com/projectkorra/ProjectKorra/airbending/AirBubble.java index a5a1616c..ffe92ccc 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirBubble.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirBubble.java @@ -94,28 +94,29 @@ public class AirBubble extends BaseAbility { } @Override - public void progress() { + public boolean progress() { if (player.isDead() || !player.isOnline()) { remove(); - return; + return false; } if (!player.isSneaking()) { remove(); - return; + return false; } if (GeneralMethods.getBoundAbility(player) != null) { if (GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirBubble") && GeneralMethods.canBend(player.getName(), "AirBubble")) { pushWater(); - return; + return false; } if (GeneralMethods.getBoundAbility(player).equalsIgnoreCase("WaterBubble") && GeneralMethods.canBend(player.getName(), "WaterBubble")) { pushWater(); - return; + return false; } } remove(); + return true; } private void pushWater() { diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java b/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java index 4266d40f..80c649d4 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirBurst.java @@ -147,16 +147,19 @@ public class AirBurst extends BaseAbility { } @Override - public void progress() { + public boolean progress() { if (!GeneralMethods.canBend(player.getName(), "AirBurst")) { remove(); + return false; } if (GeneralMethods.getBoundAbility(player) == null) { remove(); + return false; } if (!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirBurst")) { remove(); + return false; } if (System.currentTimeMillis() > starttime + chargetime && !charged) { @@ -168,6 +171,7 @@ public class AirBurst extends BaseAbility { sphereBurst(); } else { remove(); + return false; } } else if (charged) { Location location = player.getEyeLocation(); @@ -179,6 +183,7 @@ public class AirBurst extends BaseAbility { // Methods.getIntCardinalDirection(player.getEyeLocation() // .getDirection()), 3); } + return true; } @Override diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirMethods.java b/src/com/projectkorra/ProjectKorra/airbending/AirMethods.java index db88a5a0..e9ab4f9e 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirMethods.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirMethods.java @@ -170,7 +170,7 @@ public class AirMethods { AirSwipe.removeAll(StockAbilities.AirSwipe); Tornado.removeAll(StockAbilities.Tornado);; AirBurst.removeAll(StockAbilities.AirBurst); - Suffocate.removeAll(); + Suffocate.removeAll(StockAbilities.Suffocate); AirCombo.removeAll(); FlightAbility.removeAll(); } diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java b/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java index 37c63c86..6f9bdc42 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java @@ -93,26 +93,26 @@ public class AirScooter extends BaseAbility { } @Override - public void progress() { + public boolean progress() { getFloor(); // Methods.verbose(player); if (floorblock == null) { remove(); - return; + return false; } if (!GeneralMethods.canBend(player.getName(), "AirScooter")) { remove(); - return; + return false; } if (!player.isOnline() || player.isDead() || !player.isFlying()) { remove(); - return; + return false; } if (GeneralMethods.isRegionProtectedFromBuild(player, "AirScooter", player.getLocation())) { remove(); - return; + return false; } // if (Methods @@ -134,7 +134,7 @@ public class AirScooter extends BaseAbility { time = System.currentTimeMillis(); if (player.getVelocity().length() < speed * .5) { remove(); - return; + return false; } spinScooter(); } @@ -157,6 +157,7 @@ public class AirScooter extends BaseAbility { if (GeneralMethods.rand.nextInt(4) == 0) { AirMethods.playAirbendingSound(player.getLocation()); } + return true; } @Override diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirShield.java b/src/com/projectkorra/ProjectKorra/airbending/AirShield.java index edc309f0..5c0001df 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirShield.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirShield.java @@ -83,39 +83,39 @@ public class AirShield extends BaseAbility { } @Override - public void progress() { + public boolean progress() { if (player.isDead() || !player.isOnline()) { remove(); - return; + return false; } if (GeneralMethods.isRegionProtectedFromBuild(player, "AirShield", player.getLocation())) { remove(); - return; + return false; } speedfactor = 1; if (!GeneralMethods.canBend(player.getName(), "AirShield") || player.getEyeLocation().getBlock().isLiquid()) { remove(); - return; + return false; } if (GeneralMethods.getBoundAbility(player) == null) { remove(); - return; + return false; } if (isToggle) { if (((!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirShield")) || (!player .isSneaking())) && !AvatarState.isAvatarState(player)) { remove(); - return; + return false; } } else { if (((!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirShield")) || (!player .isSneaking()))) { remove(); - return; + return false; } } @@ -126,7 +126,7 @@ public class AirShield extends BaseAbility { // return false; // } rotateShield(); - return; + return true; } @Override diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirSpout.java b/src/com/projectkorra/ProjectKorra/airbending/AirSpout.java index 3ea52428..9ccef0d2 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirSpout.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirSpout.java @@ -99,14 +99,14 @@ public class AirSpout extends BaseAbility { } @Override - public void progress() { + public boolean progress() { if (!GeneralMethods.canBend(player.getName(), "AirSpout") // || !Methods.hasAbility(player, Abilities.AirSpout) || player.getEyeLocation().getBlock().isLiquid() || GeneralMethods.isSolid(player.getEyeLocation().getBlock()) || player.isDead() || !player.isOnline()) { remove(); - return; + return false; } player.setFallDistance(0); player.setSprinting(false); @@ -125,6 +125,7 @@ public class AirSpout extends BaseAbility { } else { remove(); } + return true; } @Override diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java b/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java index 5a411600..d94c6bff 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java @@ -200,15 +200,15 @@ public class AirSuction extends BaseAbility { } @Override - public void progress() { + public boolean progress() { if (player.isDead() || !player.isOnline()) { remove(); - return; + return false; } if (GeneralMethods.isRegionProtectedFromBuild(player, "AirSuction", location)) { remove(); - return; + return false; } speedfactor = speed * (ProjectKorra.time_step / 1000.); @@ -216,7 +216,7 @@ public class AirSuction extends BaseAbility { if (ticks > maxticks) { remove(); - return; + return false; } // if (player.isSneaking() // && Methods.getBendingAbility(player) == Abilities.AirSuction) { @@ -226,7 +226,7 @@ public class AirSuction extends BaseAbility { if ((location.distance(origin) > range) || (location.distance(origin) <= 1)) { remove(); - return; + return false; } for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, @@ -288,6 +288,7 @@ public class AirSuction extends BaseAbility { } advanceLocation(); + return true; } @Override diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java b/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java index e86173ba..ce3869be 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java @@ -297,27 +297,27 @@ public class AirSwipe extends BaseAbility { } @Override - public void progress() { + public boolean progress() { if (player.isDead() || !player.isOnline()) { remove(); - return; + return false; } speedfactor = speed * (ProjectKorra.time_step / 1000.); if (!charging) { if (elements.isEmpty()) { remove(); - return; + return false; } advanceSwipe(); } else { if (GeneralMethods.getBoundAbility(player) == null) { remove(); - return; + return false; } if (!GeneralMethods.getBoundAbility(player).equalsIgnoreCase("AirSwipe") || !GeneralMethods.canBend(player.getName(), "AirSwipe")) { remove(); - return; + return false; } if (!player.isSneaking()) { @@ -337,11 +337,12 @@ public class AirSwipe extends BaseAbility { factor = 1; damage *= factor; pushfactor *= factor; - return; + return true; } else if (System.currentTimeMillis() >= time + maxchargetime) { AirMethods.playAirbendingParticles(player.getEyeLocation(), 10); } } + return true; } @Override diff --git a/src/com/projectkorra/ProjectKorra/airbending/FlightAbility.java b/src/com/projectkorra/ProjectKorra/airbending/FlightAbility.java index 95af1295..2b3183ca 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/FlightAbility.java +++ b/src/com/projectkorra/ProjectKorra/airbending/FlightAbility.java @@ -77,10 +77,10 @@ public class FlightAbility extends BaseAbility { } @Override - public void progress() { + public boolean progress() { if (!AirMethods.canFly(player, false, isHovering(player))) { remove(player); - return; + return false; } if (flight == null) @@ -93,7 +93,7 @@ public class FlightAbility extends BaseAbility { } else { player.setVelocity(player.getEyeLocation().getDirection().normalize()); } - + return true; } @Override diff --git a/src/com/projectkorra/ProjectKorra/airbending/Tornado.java b/src/com/projectkorra/ProjectKorra/airbending/Tornado.java index c6272cbc..be3b1b1a 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/Tornado.java +++ b/src/com/projectkorra/ProjectKorra/airbending/Tornado.java @@ -106,30 +106,31 @@ public class Tornado extends BaseAbility { } @Override - public void progress() { + public boolean progress() { if (player.isDead() || !player.isOnline()) { remove(); - return; + return false; } if (!GeneralMethods.canBend(player.getName(), "Tornado") || player.getEyeLocation().getBlock().isLiquid()) { remove(); - return; + return false; } String abil = GeneralMethods.getBoundAbility(player); if (abil == null) { remove(); - return; + return false; } if (!abil.equalsIgnoreCase("Tornado") || !player.isSneaking()) { remove(); - return; + return false; } if (GeneralMethods.isRegionProtectedFromBuild(player, "AirBlast", origin)) { remove(); - return; + return false; } rotateTornado(); + return true; } @Override