Пример #1
0
 public void affect(Entity entity) {
   BendingHitEvent event = new BendingHitEvent(this, entity);
   Bending.callEvent(event);
   if (event.isCancelled()) {
     return;
   }
   DamageTools.damageEntity(bender, entity, this, DAMAGE);
   Enflamed.enflame(player, entity, 4, this);
 }
Пример #2
0
 private void affect(Entity entity) {
   BendingHitEvent event = new BendingHitEvent(this, entity);
   Bending.callEvent(event);
   if (event.isCancelled()) {
     return;
   }
   if (entity == player) {
     return;
   }
   Vector direction = origin.clone().subtract(entity.getLocation()).toVector();
   double distance = direction.length();
   entity.setVelocity(
       entity.getVelocity().add(direction.normalize().multiply(PUSH * distance / RADIUS)));
   entity.setFallDistance(0);
 }
Пример #3
0
  private void affect(Entity entity) {
    BendingHitEvent event = new BendingHitEvent(ability, entity);
    Bending.callEvent(event);
    if (event.isCancelled()) {
      return;
    }

    double damage = DAMAGE;
    if (bender.hasPath(BendingPath.TOUGH)) {
      damage *= 0.85;
    }

    if (bender.hasPath(BendingPath.RECKLESS)) {
      damage *= 1.15;
    }

    if (entity instanceof LivingEntity) {
      DamageTools.damageEntity(bender, entity, ability, damage);
    }

    Vector vector = direction.clone();
    vector.setY(.5);
    entity.setVelocity(vector);
  }
 @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
 public void onBendingHit(BendingHitEvent event) {
   if (event.getTarget() != null
           && event.getAbility() != null
           && ProtectionManager.isEntityProtected(event.getTarget())
       || ProtectionManager.isLocationProtectedFromBending(
           event.getAbility().getPlayer(),
           event.getAbility().getRegister(),
           event.getTarget().getLocation())) {
     event.setCancelled(true);
   }
 }