AirBurst - Damage

Added config options
This commit is contained in:
nathank33 2014-11-22 18:38:21 -08:00
parent 85b47daf04
commit 3dd61fd561
3 changed files with 19 additions and 3 deletions

View file

@ -154,6 +154,7 @@ public class ConfigManager {
config.addDefault("Abilities.Air.AirBurst.FallThreshold", 10);
config.addDefault("Abilities.Air.AirBurst.PushFactor", 1.5);
config.addDefault("Abilities.Air.AirBurst.ChargeTime", 1750);
config.addDefault("Abilities.Air.AirBurst.Damage", 0);
config.addDefault("Abilities.Air.AirScooter.Enabled", true);
config.addDefault("Abilities.Air.AirScooter.Description", "AirScooter is a fast means of transportation. To use, sprint, jump then click with "

View file

@ -9,6 +9,7 @@ import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
@ -46,6 +47,7 @@ public class AirBlast {
private double speedfactor;
private double range = defaultrange;
private double pushfactor = defaultpushfactor;
private double damage = 0;
private boolean otherorigin = false;
private int ticks = 0;
@ -260,8 +262,17 @@ public class AirBlast {
entity.getWorld().playEffect(entity.getLocation(), Effect.EXTINGUISH, 0);
entity.setFireTicks(0);
Methods.breakBreathbendingHold(entity);
if (damage > 0 && entity instanceof LivingEntity && !entity.equals(player) && !affectedentities.contains(entity)) {
Methods.damageEntity(player, entity, damage);
affectedentities.add(entity);
}
}
}
public void setDamage(double dmg) {
this.damage = dmg;
}
public static void progressAll() {
for (int id : instances.keySet())

View file

@ -22,6 +22,7 @@ public class AirBurst {
private static double threshold = config.getDouble("Abilities.Air.AirBurst.FallThreshold");
private static double pushfactor = config.getDouble("Abilities.Air.AirBurst.PushFactor");
private static double damage = config.getDouble("Abilities.Air.AirBurst.Damage");
private static double deltheta = 10;
private static double delphi = 10;
@ -70,8 +71,9 @@ public class AirBurst {
z = r * Math.cos(rtheta);
Vector direction = new Vector(x, z, y);
if (direction.angle(vector) <= angle) {
new AirBlast(location, direction.normalize(), player,
AirBlast blast = new AirBlast(location, direction.normalize(), player,
pushfactor, this);
blast.setDamage(damage);
}
}
}
@ -93,8 +95,9 @@ public class AirBurst {
y = r * Math.sin(rphi) * Math.sin(rtheta);
z = r * Math.cos(rtheta);
Vector direction = new Vector(x, z, y);
new AirBlast(location, direction.normalize(), player,
AirBlast blast = new AirBlast(location, direction.normalize(), player,
pushfactor, this);
blast.setDamage(damage);
}
}
}
@ -131,8 +134,9 @@ public class AirBurst {
y = r * Math.sin(rphi) * Math.sin(rtheta);
z = r * Math.cos(rtheta);
Vector direction = new Vector(x, z, y);
new AirBlast(location, direction.normalize(), player,
AirBlast blast = new AirBlast(location, direction.normalize(), player,
pushfactor, new AirBurst());
blast.setDamage(damage);
}
}
}