(Location at)
| 71 | } |
| 72 | |
| 73 | public void punch(Location at) { |
| 74 | Area a = new Area(at, radius); |
| 75 | |
| 76 | for (Entity i : a.getNearbyEntities()) { |
| 77 | if (ignore.contains(i)) { |
| 78 | continue; |
| 79 | } |
| 80 | |
| 81 | Vector force = VectorMath.direction(at, i.getLocation()); |
| 82 | double damage = 0; |
| 83 | double distance = i.getLocation().distance(at); |
| 84 | |
| 85 | if (forceMin < forceMax) { |
| 86 | force.clone().multiply(((1D - (distance / radius)) * (forceMax - forceMin)) + forceMin); |
| 87 | } |
| 88 | |
| 89 | if (damageMin < damageMax) { |
| 90 | damage = ((1D - (distance / radius)) * (damageMax - damageMin)) + damageMin; |
| 91 | } |
| 92 | |
| 93 | try { |
| 94 | if (i instanceof LivingEntity && damage > 0) { |
| 95 | ((LivingEntity) i).damage(damage); |
| 96 | } |
| 97 | |
| 98 | i.setVelocity(i.getVelocity().add(force)); |
| 99 | } catch (Exception e) { |
| 100 | |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | public Impulse ignore(Entity player) { |
| 106 | ignore.add(player); |
no test coverage detected