Ejemplo n.º 1
0
  public FreezeMelt(Player player) {
    BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());

    if (!WaterMethods.canIcebend(player)) {
      return;
    }
    if (bPlayer.isOnCooldown("PhaseChange")) {
      return;
    }
    bPlayer.addCooldown("PhaseChange", cooldown);

    int range = (int) WaterMethods.waterbendingNightAugment(defaultrange, player.getWorld());
    int radius = (int) WaterMethods.waterbendingNightAugment(defaultradius, player.getWorld());
    if (AvatarState.isAvatarState(player)) {
      range = AvatarState.getValue(range);
    }

    Location location = GeneralMethods.getTargetedLocation(player, range);
    for (Block block : GeneralMethods.getBlocksAroundPoint(location, radius)) {
      if (isFreezable(player, block)) {
        freeze(player, block);
      }
    }
  }
Ejemplo n.º 2
0
  @SuppressWarnings("deprecation")
  private void advanceSwipe() {
    affectedentities.clear();
    for (Vector direction : elements.keySet()) {
      Location location = elements.get(direction);
      if (direction != null && location != null) {
        location = location.clone().add(direction.clone().multiply(speedfactor));
        elements.replace(direction, location);

        if (location.distance(origin) > range
            || GeneralMethods.isRegionProtectedFromBuild(player, "AirSwipe", location)) {
          elements.remove(direction);
        } else {
          AirMethods.removeAirSpouts(location, player);
          WaterMethods.removeWaterSpouts(location, player);

          double radius = FireBlast.AFFECTING_RADIUS;
          Player source = player;
          if (EarthBlast.annihilateBlasts(location, radius, source)
              || WaterManipulation.annihilateBlasts(location, radius, source)
              || FireBlast.annihilateBlasts(location, radius, source)
              || Combustion.removeAroundPoint(location, radius)) {
            elements.remove(direction);
            damage = 0;
            remove();
            continue;
          }

          Block block = location.getBlock();
          for (Block testblock : GeneralMethods.getBlocksAroundPoint(location, affectingradius)) {
            if (testblock.getType() == Material.FIRE) {
              testblock.setType(Material.AIR);
            }
            if (isBlockBreakable(testblock)) {
              GeneralMethods.breakBlock(testblock);
            }
          }

          if (block.getType() != Material.AIR) {
            if (isBlockBreakable(block)) {
              GeneralMethods.breakBlock(block);
            } else {
              elements.remove(direction);
            }
            if (block.getType() == Material.LAVA || block.getType() == Material.STATIONARY_LAVA) {
              if (block.getData() == full) {
                block.setType(Material.OBSIDIAN);
              } else {
                block.setType(Material.COBBLESTONE);
              }
            }
          } else {
            AirMethods.playAirbendingParticles(location, 3, 0.2F, 0.2F, 0);
            if (GeneralMethods.rand.nextInt(4) == 0) {
              AirMethods.playAirbendingSound(location);
            }
            affectPeople(location, direction);
          }
        }
        // } else {
        // elements.remove(direction);
      }
    }

    if (elements.isEmpty()) {
      remove();
    }
  }
Ejemplo n.º 3
0
  @SuppressWarnings("deprecation")
  private void advanceSwipe() {
    affectedEntities.clear();
    for (Vector direction : elements.keySet()) {
      Location location = elements.get(direction);
      if (direction != null && location != null) {
        location = location.clone().add(direction.clone().multiply(speed));
        elements.replace(direction, location);

        if (location.distanceSquared(origin) > range * range
            || GeneralMethods.isRegionProtectedFromBuild(this, location)) {
          elements.remove(direction);
        } else {
          removeAirSpouts(location, player);
          WaterAbility.removeWaterSpouts(location, player);

          if (EarthBlast.annihilateBlasts(location, radius, player)
              || WaterManipulation.annihilateBlasts(location, radius, player)
              || FireBlast.annihilateBlasts(location, radius, player)
              || Combustion.removeAroundPoint(location, radius)) {
            elements.remove(direction);
            damage = 0;
            remove();
            continue;
          }

          Block block = location.getBlock();
          for (Block testblock : GeneralMethods.getBlocksAroundPoint(location, radius)) {
            if (testblock.getType() == Material.FIRE) {
              testblock.setType(Material.AIR);
            }
            if (isBlockBreakable(testblock)) {
              GeneralMethods.breakBlock(testblock);
            }
          }

          if (block.getType() != Material.AIR) {
            if (isBlockBreakable(block)) {
              GeneralMethods.breakBlock(block);
            } else {
              elements.remove(direction);
            }
            if (isLava(block)) {
              if (block.getData() == 0x0) {
                block.setType(Material.OBSIDIAN);
              } else {
                block.setType(Material.COBBLESTONE);
              }
            }
          } else {
            playAirbendingParticles(location, particles, 0.2F, 0.2F, 0);
            if (random.nextInt(4) == 0) {
              playAirbendingSound(location);
            }
            affectPeople(location, direction);
          }
        }
      }
    }
    if (elements.isEmpty()) {
      remove();
    }
  }