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;
    }
  }
Esempio n. 2
0
  public EarthColumn(Player player) {
    BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());

    if (bPlayer.isOnCooldown("RaiseEarth")) return;

    try {
      if (AvatarState.isAvatarState(player)) {
        height = (int) (2. / 5. * (double) AvatarState.getValue(height));
      }
      block = BlockSource.getEarthSourceBlock(player, range, ClickType.LEFT_CLICK);
      if (block == null) return;
      origin = block.getLocation();
      location = origin.clone();
      distance =
          EarthMethods.getEarthbendableBlocksLength(
              player, block, direction.clone().multiply(-1), height);
    } catch (IllegalStateException e) {
      return;
    }

    this.player = player;

    loadAffectedBlocks();

    if (distance != 0) {
      if (canInstantiate()) {
        id = ID;
        instances.put(id, this);
        bPlayer.addCooldown("RaiseEarth", GeneralMethods.getGlobalCooldown());
        if (ID >= Integer.MAX_VALUE) {
          ID = Integer.MIN_VALUE;
        }
        ID++;
        time = System.currentTimeMillis() - interval;
      }
    }
  }
  public static void throwEarth(Player player) {
    ArrayList<EarthBlast> ignore = new ArrayList<EarthBlast>();

    BendingPlayer bPlayer = GeneralMethods.getBendingPlayer(player.getName());
    if (bPlayer.isOnCooldown("EarthBlast")) {
      return;
    }

    boolean cooldown = false;
    for (int id : instances.keySet()) {
      EarthBlast blast = instances.get(id);
      if (blast.player == player && !blast.progressing) {
        blast.throwEarth();
        cooldown = true;
        ignore.add(blast);
      }
    }

    if (cooldown) {
      bPlayer.addCooldown("EarthBlast", GeneralMethods.getGlobalCooldown());
    }

    redirectTargettedBlasts(player, ignore);
  }