diff --git a/src/com/projectkorra/projectkorra/airbending/AirBlast.java b/src/com/projectkorra/projectkorra/airbending/AirBlast.java index ca761a02..ae9ac747 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirBlast.java +++ b/src/com/projectkorra/projectkorra/airbending/AirBlast.java @@ -206,12 +206,38 @@ public class AirBlast extends AirAbility { if (this.random.nextInt(4) == 0) { playAirbendingSound(this.location); } + + for (double d = 0; d < speedFactor; d += 0.1) { + if (!checkLocation()) { + remove(); + break; + } + this.location.add(this.direction.clone().multiply(d)); + } + } + + public boolean checkLocation() { if (GeneralMethods.checkDiagonalWall(this.location, this.direction)) { this.remove(); - return; + return false; } - - this.location = this.location.add(this.direction.clone().multiply(this.speedFactor)); + + Block block = location.getBlock(); + if ((!block.isPassable() || block.isLiquid()) && !this.affectedLevers.contains(block)) { + if (block.getType() == Material.LAVA && this.canCoolLava) { + if (LavaFlow.isLavaFlowBlock(block)) { + LavaFlow.removeBlock(block); // TODO: Make more generic for future lava generating moves. + } else if (block.getBlockData() instanceof Levelled && ((Levelled) block.getBlockData()).getLevel() == 0) { + new TempBlock(block, Material.OBSIDIAN); + } else { + new TempBlock(block, Material.COBBLESTONE); + } + } + this.remove(); + return false; + } + + return true; } private void affect(final Entity entity) { @@ -400,20 +426,6 @@ public class AirBlast extends AirAbility { } } - if ((GeneralMethods.isSolid(block) || block.isLiquid()) && !this.affectedLevers.contains(block)) { - if (block.getType() == Material.LAVA && this.canCoolLava) { - if (LavaFlow.isLavaFlowBlock(block)) { - LavaFlow.removeBlock(block); // TODO: Make more generic for future lava generating moves. - } else if (block.getBlockData() instanceof Levelled && ((Levelled) block.getBlockData()).getLevel() == 0) { - new TempBlock(block, Material.OBSIDIAN); - } else { - new TempBlock(block, Material.COBBLESTONE); - } - } - this.remove(); - return; - } - /* * If a player presses shift and AirBlasts straight down then the * AirBlast's location gets messed up and reading the distance returns