Пример #1
0
  public Suffocate(Player player) {
    this.player = player;
    bplayer = GeneralMethods.getBendingPlayer(player.getName());
    targets = new ArrayList<LivingEntity>();
    tasks = new ArrayList<BukkitRunnable>();
    time = System.currentTimeMillis();

    // reloadVariables();
    reqConstantAim = REQUIRE_CONSTANT_AIM;
    canSuffUndead = CAN_SUFFOCATE_UNDEAD;
    chargeTime = CHARGE_TIME;
    cooldown = COOLDOWN;
    particleScale = ANIM_PARTICLE_AMOUNT;
    range = RANGE;
    radius = ANIM_RADIUS;
    speedFactor = ANIM_SPEED;
    aimRadius = AIM_RADIUS;
    damage = DAMAGE;
    damageDelay = DAMAGE_INITIAL_DELAY;
    damageRepeat = DAMAGE_INTERVAL;
    slow = SLOW;
    slowRepeat = SLOW_INTERVAL;
    slowDelay = SLOW_DELAY;
    blind = BLIND;
    blindDelay = BLIND_DELAY;
    blindRepeat = BLIND_INTERVAL;

    if (instances.containsKey(player)) {
      return;
    }

    if (AvatarState.isAvatarState(player)) {
      cooldown = 0;
      chargeTime = 0;
      reqConstantAim = false;
      damage = AvatarState.getValue(damage);
      range *= 2;
      slow = AvatarState.getValue(slow);
      slowRepeat = AvatarState.getValue(slowRepeat);
      blind = AvatarState.getValue(blind);
      blindRepeat = AvatarState.getValue(blindRepeat);
    }
    if (particleScale < 1) particleScale = 1;
    else if (particleScale > 2) particleScale = 2;

    if (AvatarState.isAvatarState(player)) {
      for (Entity ent : GeneralMethods.getEntitiesAroundPoint(player.getLocation(), range))
        if (ent instanceof LivingEntity && !ent.equals(player)) targets.add((LivingEntity) ent);
    } else {
      // Entity ent = GeneralMethods.getTargetedEntity(player, range, new ArrayList<Entity>());
      List<Entity> entities = new ArrayList<Entity>();
      for (int i = 0; i < 6; i++) {
        Location location = GeneralMethods.getTargetedLocation(player, i, transparent);
        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 (!canSuffUndead) {
      for (int i = 0; i < targets.size(); i++) {
        LivingEntity target = targets.get(i);
        if (GeneralMethods.isUndead(target)) {
          targets.remove(i);
          i--;
        }
      }
    }

    if (targets.size() == 0) return;
    else if (bplayer.isOnCooldown("suffocate")) return;
    bplayer.addCooldown("suffocate", cooldown);
    instances.put(player, this);
  }
Пример #2
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();
  }