Update Air Abilities to reflect change

This commit is contained in:
Jack Lin 2015-07-15 14:25:32 +12:00
parent 293c830cbd
commit 1d907fe134
11 changed files with 67 additions and 53 deletions

View file

@ -34,18 +34,20 @@ public class AirBlast extends BaseAbility {
private static ConcurrentHashMap<Player, Location> origins = new ConcurrentHashMap<Player, Location>();
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

View file

@ -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() {

View file

@ -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

View file

@ -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();
}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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