Example #1
0
  public AirCombo(Player player, String ability) {
    super(player);

    this.abilityName = ability;
    this.affectedEntities = new ArrayList<>();
    this.tasks = new ArrayList<>();
    this.flights = new ArrayList<>();

    if (!bPlayer.canBendIgnoreBindsCooldowns(this)) {
      return;
    }

    if (bPlayer.isOnCooldown(ability)) {
      return;
    }

    if (ability.equalsIgnoreCase("Twister")) {
      this.range = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Range");
      this.speed = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Speed");
      this.cooldown = getConfig().getLong("Abilities.Air.AirCombo.Twister.Cooldown");
      this.twisterHeight = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Height");
      this.twisterRadius = getConfig().getDouble("Abilities.Air.AirCombo.Twister.Radius");
      this.twisterDegreeParticles =
          getConfig().getDouble("Abilities.Air.AirCombo.Twister.DegreesPerParticle");
      this.twisterHeightParticles =
          getConfig().getDouble("Abilities.Air.AirCombo.Twister.HeightPerParticle");
      this.twisterRemoveDelay = getConfig().getLong("Abilities.Air.AirCombo.Twister.RemoveDelay");
    } else if (ability.equalsIgnoreCase("AirStream")) {
      this.range = getConfig().getDouble("Abilities.Air.AirCombo.AirStream.Range");
      this.speed = getConfig().getDouble("Abilities.Air.AirCombo.AirStream.Speed");
      this.cooldown = getConfig().getLong("Abilities.Air.AirCombo.AirStream.Cooldown");
      this.airStreamMaxEntityHeight =
          getConfig().getDouble("Abilities.Air.AirCombo.AirStream.EntityHeight");
      this.airStreamEntityCarryDuration =
          getConfig().getLong("Abilities.Air.AirCombo.AirStream.EntityDuration");
    } else if (ability.equalsIgnoreCase("AirSweep")) {
      this.damage = getConfig().getDouble("Abilities.Air.AirCombo.AirSweep.Damage");
      this.range = getConfig().getDouble("Abilities.Air.AirCombo.AirSweep.Range");
      this.speed = getConfig().getDouble("Abilities.Air.AirCombo.AirSweep.Speed");
      this.knockback = getConfig().getDouble("Abilities.Air.AirCombo.AirSweep.Knockback");
      this.cooldown = getConfig().getLong("Abilities.Air.AirCombo.AirSweep.Cooldown");
    }

    if (bPlayer.isAvatarState()) {
      this.cooldown = 0;
      this.damage = AvatarState.getValue(damage);
      this.range = AvatarState.getValue(range);
      this.knockback = knockback * 1.4;
      this.airStreamMaxEntityHeight = AvatarState.getValue(airStreamMaxEntityHeight);
      this.airStreamEntityCarryDuration = AvatarState.getValue(airStreamEntityCarryDuration);
    }
    bPlayer.addCooldown(this);
    start();
  }
  public LavaSurgeWall(Player player) {
    super(player);

    this.interval = 30;
    this.radius = getConfig().getDouble("Abilities.Water.Surge.Wall.Radius");
    this.range = getConfig().getDouble("Abilities.Water.Surge.Wall.Range");
    this.cooldown = GeneralMethods.getGlobalCooldown();

    LavaSurgeWave wave = getAbility(player, LavaSurgeWave.class);
    if (wave != null && wave.isProgressing()) {
      LavaSurgeWave.launch(player);
      return;
    }

    if (bPlayer.isAvatarState()) {
      radius = AvatarState.getValue(radius);
      range = AvatarState.getValue(range);
    }

    if (!bPlayer.canBend(this)) {
      return;
    }
  }
Example #3
0
  public void progress() {
    if (player.isDead() || !player.isOnline()) {
      remove();
      return;
    }

    if (!charging) {
      if (elements.isEmpty()) {
        remove();
        return;
      }
      advanceSwipe();
    } else {
      if (!bPlayer.canBend(this)) {
        remove();
        return;
      }

      if (!player.isSneaking()) {
        double factor = 1;
        if (System.currentTimeMillis() >= startTime + maxChargeTime) {
          factor = maxChargeFactor;
        } else if (bPlayer.isAvatarState()) {
          factor = AvatarState.getValue(factor);
        } else {
          factor =
              maxChargeFactor
                  * (double) (System.currentTimeMillis() - startTime)
                  / (double) maxChargeTime;
        }

        charging = false;
        launch();
        factor = Math.max(1, factor);
        damage *= factor;
        pushFactor *= factor;
        return;
      } else if (System.currentTimeMillis() >= startTime + maxChargeTime) {
        playAirbendingParticles(player.getEyeLocation(), particles);
      }
    }
  }
Example #4
0
  public Suffocate(Player player) {
    super(player);
    ability = this;
    if (bPlayer.isOnCooldown(this)) {
      return;
    } else if (hasAbility(player, Suffocate.class)) {
      return;
    }

    this.started = false;
    this.requireConstantAim = getConfig().getBoolean("Abilities.Air.Suffocate.RequireConstantAim");
    this.canSuffocateUndead =
        getConfig().getBoolean("Abilities.Air.Suffocate.CanBeUsedOnUndeadMobs");
    this.particleCount = getConfig().getInt("Abilities.Air.Suffocate.AnimationParticleAmount");
    this.animationSpeed = getConfig().getDouble("Abilities.Air.Suffocate.AnimationSpeed");
    this.chargeTime = getConfig().getLong("Abilities.Air.Suffocate.ChargeTime");
    this.cooldown = getConfig().getLong("Abilities.Air.Suffocate.Cooldown");
    this.range = getConfig().getDouble("Abilities.Air.Suffocate.Range");
    this.radius = getConfig().getDouble("Abilities.Air.Suffocate.AnimationRadius");
    this.constantAimRadius =
        getConfig().getDouble("Abilities.Air.Suffocate.RequireConstantAimRadius");
    this.damage = getConfig().getDouble("Abilities.Air.Suffocate.Damage");
    this.damageDelay = getConfig().getDouble("Abilities.Air.Suffocate.DamageInitialDelay");
    this.damageRepeat = getConfig().getDouble("Abilities.Air.Suffocate.DamageInterval");
    this.slow = getConfig().getInt("Abilities.Air.Suffocate.SlowPotency");
    this.slowRepeat = getConfig().getDouble("Abilities.Air.Suffocate.SlowInterval");
    this.slowDelay = getConfig().getDouble("Abilities.Air.Suffocate.SlowDelay");
    this.blind = getConfig().getInt("Abilities.Air.Suffocate.BlindPotentcy");
    this.blindDelay = getConfig().getDouble("Abilities.Air.Suffocate.BlindDelay");
    this.blindRepeat = getConfig().getDouble("Abilities.Air.Suffocate.BlindInterval");
    this.targets = new ArrayList<>();
    this.tasks = new ArrayList<>();

    if (bPlayer.isAvatarState()) {
      cooldown = 0;
      chargeTime = 0;
      requireConstantAim = false;
      damage = AvatarState.getValue(damage);
      range *= 2;
      slow = AvatarState.getValue(slow);
      slowRepeat = AvatarState.getValue(slowRepeat);
      blind = AvatarState.getValue(blind);
      blindRepeat = AvatarState.getValue(blindRepeat);
    }

    if (particleCount < 1) {
      particleCount = 1;
    } else if (particleCount > 2) {
      particleCount = 2;
    }

    if (bPlayer.isAvatarState()) {
      for (Entity ent : GeneralMethods.getEntitiesAroundPoint(player.getLocation(), range)) {
        if (ent instanceof LivingEntity && !ent.equals(player)) {
          targets.add((LivingEntity) ent);
        }
      }
    } else {
      // Location location = GeneralMethods.getTargetedLocation(player, 6,
      // getTransparentMaterial());
      // List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, 1.5);
      List<Entity> entities = new ArrayList<Entity>();
      for (int i = 0; i < 6; i++) {
        Location location = GeneralMethods.getTargetedLocation(player, i, getTransparentMaterial());
        entities = GeneralMethods.getEntitiesAroundPoint(location, 1.7);
        if (entities.contains(player)) entities.remove(player);
        if (entities != null && !entities.isEmpty() && !entities.contains(player)) {
          break;
        }
      }
      if (entities == null || entities.isEmpty()) {
        return;
      }
      Entity target = entities.get(0);
      if (target != null && target instanceof LivingEntity) {
        targets.add((LivingEntity) target);
      }
    }

    if (!canSuffocateUndead) {
      for (int i = 0; i < targets.size(); i++) {
        LivingEntity target = targets.get(i);
        if (GeneralMethods.isUndead(target)) {
          targets.remove(i);
          i--;
        }
      }
    }

    bPlayer.addCooldown(this);
    start();
  }