AirBlast and AirBurst Changes (#1017)

## Removals
* Removes `AirBurst#getAffectedEntities()`, shouldn't allow direct access to the list

## Misc. Changes
* Lowers "friction" in AirBlast knockback for entities on the ground
* Ignore "friction" in AirBlast when the AirBurst source isn't null
* Changes entity velocity comparison to only add vectors angled > pi/3 from push vector
* Increase default AirBurst push option
This commit is contained in:
Benford Whitaker 2019-09-08 23:41:49 -04:00 committed by Christopher Martin
parent 0f2940f5eb
commit 2091e58c35
3 changed files with 49 additions and 55 deletions

View file

@ -218,7 +218,6 @@ public class AirBlast extends AirAbility {
}
}
if (!affectedEntities.contains(entity)) {
final boolean isUser = entity.getUniqueId() == this.player.getUniqueId();
double knockback = this.pushFactorForOthers;
@ -245,13 +244,13 @@ public class AirBlast extends AirAbility {
knockback *= 1 - this.location.distance(this.origin) / (2 * this.range);
}
if (GeneralMethods.isSolid(entity.getLocation().add(0, -.5, 0).getBlock())) {
knockback *= .5;
if (GeneralMethods.isSolid(entity.getLocation().add(0, -0.5, 0).getBlock()) && source == null) {
knockback *= 0.85;
}
push.normalize().multiply(knockback);
if (Math.abs(entity.getVelocity().dot(push)) > knockback) {
if (Math.abs(entity.getVelocity().dot(push)) > knockback && entity.getVelocity().angle(push) > Math.PI / 3) {
push.normalize().add(entity.getVelocity()).multiply(knockback);
}
@ -263,13 +262,12 @@ public class AirBlast extends AirAbility {
new HorizontalVelocityTracker(entity, this.player, 200l, this);
}
if (this.damage > 0 && entity instanceof LivingEntity && !entity.equals(this.player)) {
if (this.damage > 0 && entity instanceof LivingEntity && !entity.equals(this.player) && !this.affectedEntities.contains(entity)) {
if (this.source != null) {
DamageHandler.damageEntity(entity, this.damage, this.source);
} else {
DamageHandler.damageEntity(entity, this.damage, this);
}
}
this.affectedEntities.add(entity);
}

View file

@ -321,8 +321,4 @@ public class AirBurst extends AirAbility {
public ArrayList<AirBlast> getBlasts() {
return this.blasts;
}
public ArrayList<Entity> getAffectedEntities() {
return this.affectedEntities;
}
}

View file

@ -811,7 +811,7 @@ public class ConfigManager {
config.addDefault("Abilities.Air.AirBurst.Enabled", true);
config.addDefault("Abilities.Air.AirBurst.FallThreshold", 10);
config.addDefault("Abilities.Air.AirBurst.PushFactor", 1.5);
config.addDefault("Abilities.Air.AirBurst.PushFactor", 2.8);
config.addDefault("Abilities.Air.AirBurst.ChargeTime", 1750);
config.addDefault("Abilities.Air.AirBurst.Damage", 0);
config.addDefault("Abilities.Air.AirBurst.Cooldown", 0);