Example #1
0
  private void affect(LivingEntity entity) {
    int damage = (int) WaterMethods.waterbendingNightAugment(defaultdamage, player.getWorld());
    if (entity instanceof Player) {
      BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
      if (bPlayer.canBeSlowed()) {
        PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 70, 2);
        new TempPotionEffect(entity, effect);
        bPlayer.slow(10);
        // entity.damage(damage, player);
        GeneralMethods.damageEntity(player, entity, damage, "IceBlast");
      }
    } else {
      PotionEffect effect = new PotionEffect(PotionEffectType.SLOW, 70, 2);
      new TempPotionEffect(entity, effect);
      // entity.damage(damage, player);
      GeneralMethods.damageEntity(player, entity, damage, "IceBlast");
    }
    AirMethods.breakBreathbendingHold(entity);

    for (int x = 0; x < 30; x++) {
      ParticleEffect.ITEM_CRACK.display(
          new ParticleEffect.ItemData(Material.ICE, (byte) 0),
          new Vector(
              ((Math.random() - 0.5) * .5),
              ((Math.random() - 0.5) * .5),
              ((Math.random() - 0.5) * .5)),
          .3f,
          location,
          257.0D);
    }
  }
Example #2
0
 public void breakParticles(int amount) {
   for (int x = 0; x < amount; x++) {
     ParticleEffect.ITEM_CRACK.display(
         new ParticleEffect.ItemData(Material.ICE, (byte) 0),
         new Vector(
             ((Math.random() - 0.5) * .5),
             ((Math.random() - 0.5) * .5),
             ((Math.random() - 0.5) * .5)),
         2f,
         location,
         257.0D);
     ParticleEffect.SNOW_SHOVEL.display(
         location, (float) Math.random(), (float) Math.random(), (float) Math.random(), 0, 2);
   }
   location.getWorld().playSound(location, Sound.BLOCK_GLASS_HIT, 5, 1.3f);
 }
Example #3
0
  private void progress() {
    BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
    if (player.isDead()
        || !player.isOnline()
        || !GeneralMethods.canBend(player.getName(), "IceBlast")
        || bPlayer.isOnCooldown("IceBlast")) {
      cancel();
      return;
    }

    if (!player.getWorld().equals(location.getWorld())) {
      cancel();
      return;
    }

    if (player.getEyeLocation().distance(location) >= range) {
      if (progressing) {
        breakParticles(20);
        cancel();
        returnWater();
      } else {
        breakParticles(20);
        cancel();
      }
      return;
    }

    if ((GeneralMethods.getBoundAbility(player) == null
            || !GeneralMethods.getBoundAbility(player).equalsIgnoreCase("IceBlast"))
        && prepared) {
      cancel();
      return;
    }

    if (System.currentTimeMillis() < time + interval) return;

    time = System.currentTimeMillis();

    if (progressing) {

      Vector direction;

      if (location.getBlockY() == firstdestination.getBlockY()) settingup = false;

      if (location.distance(destination) <= 2) {
        cancel();
        returnWater();
        return;
      }

      if (settingup) {
        direction = GeneralMethods.getDirection(location, firstdestination).normalize();
      } else {
        direction = GeneralMethods.getDirection(location, destination).normalize();
      }

      location.add(direction);

      Block block = location.getBlock();

      if (block.equals(sourceblock)) return;

      source.revertBlock();
      source = null;

      if (EarthMethods.isTransparentToEarthbending(player, block) && !block.isLiquid()) {
        GeneralMethods.breakBlock(block);
      } else if (!WaterMethods.isWater(block)) {
        breakParticles(20);
        cancel();
        returnWater();
        return;
      }

      if (GeneralMethods.isRegionProtectedFromBuild(player, "IceBlast", location)) {
        cancel();
        returnWater();
        return;
      }

      for (Entity entity : GeneralMethods.getEntitiesAroundPoint(location, affectingradius)) {
        if (entity.getEntityId() != player.getEntityId() && entity instanceof LivingEntity) {
          affect((LivingEntity) entity);
          progressing = false;
          returnWater();
        }
      }

      if (!progressing) {
        cancel();
        return;
      }

      sourceblock = block;
      source = new TempBlock(sourceblock, Material.PACKED_ICE, data);

      for (int x = 0; x < 10; x++) {
        ParticleEffect.ITEM_CRACK.display(
            new ParticleEffect.ItemData(Material.ICE, (byte) 0),
            new Vector(
                ((Math.random() - 0.5) * .5),
                ((Math.random() - 0.5) * .5),
                ((Math.random() - 0.5) * .5)),
            .5f,
            location,
            257.0D);
        ParticleEffect.SNOW_SHOVEL.display(
            location,
            (float) (Math.random() - 0.5),
            (float) (Math.random() - 0.5),
            (float) (Math.random() - 0.5),
            0,
            5);
      }
      if (GeneralMethods.rand.nextInt(4) == 0) {
        WaterMethods.playIcebendingSound(location);
      }
      location = location.add(direction.clone());

    } else if (prepared) {
      WaterMethods.playFocusWaterEffect(sourceblock);
    }
  }