diff --git a/src/com/projectkorra/projectkorra/ProjectKorra.java b/src/com/projectkorra/projectkorra/ProjectKorra.java index ccdcfdd3..d920a8aa 100644 --- a/src/com/projectkorra/projectkorra/ProjectKorra.java +++ b/src/com/projectkorra/projectkorra/ProjectKorra.java @@ -28,6 +28,7 @@ import com.projectkorra.projectkorra.util.MetricsLite; import com.projectkorra.projectkorra.util.RevertChecker; import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.Updater; +import com.projectkorra.projectkorra.util.attributes.AttributeModifiers; import com.projectkorra.projectkorra.util.logging.PKLogHandler; import com.projectkorra.projectkorra.waterbending.util.WaterbendingManager; @@ -68,6 +69,7 @@ public class ProjectKorra extends JavaPlugin { CoreAbility.registerAbilities(); collisionInitializer.initializeDefaultCollisions(); // must be called after abilities have been registered collisionManager.startCollisionDetection(); + new AttributeModifiers(); Preset.loadExternalPresets(); diff --git a/src/com/projectkorra/projectkorra/ability/CoreAbility.java b/src/com/projectkorra/projectkorra/ability/CoreAbility.java index d2d0e731..637fd36a 100644 --- a/src/com/projectkorra/projectkorra/ability/CoreAbility.java +++ b/src/com/projectkorra/projectkorra/ability/CoreAbility.java @@ -40,6 +40,7 @@ import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.event.AbilityEndEvent; import com.projectkorra.projectkorra.event.AbilityProgressEvent; import com.projectkorra.projectkorra.event.AbilityStartEvent; +import com.projectkorra.projectkorra.util.Attribute.Attributable; import sun.reflect.ReflectionFactory; @@ -491,6 +492,11 @@ public abstract class CoreAbility implements Ability { AddonAbility addon = (AddonAbility) ability; addon.load(); } + + if (ability instanceof Attributable) { + Attributable att = (Attributable) ability; + att.registerAttributes(); + } } catch (Exception e) { } @@ -564,6 +570,12 @@ public abstract class CoreAbility implements Ability { PassiveManager.getPassivesByElement().get(((SubElement) coreAbil.getElement()).getParentElement()).add(name); } } + + + if (coreAbil instanceof Attributable) { + Attributable att = (Attributable) coreAbil; + att.registerAttributes(); + } } catch (Exception | Error e) { plugin.getLogger().warning("The ability " + coreAbil.getName() + " was not able to load, if this message shows again please remove it!"); diff --git a/src/com/projectkorra/projectkorra/airbending/AirBlast.java b/src/com/projectkorra/projectkorra/airbending/AirBlast.java index 80840d98..7f6e4c04 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirBlast.java +++ b/src/com/projectkorra/projectkorra/airbending/AirBlast.java @@ -29,10 +29,12 @@ import com.projectkorra.projectkorra.ability.CoreAbility; import com.projectkorra.projectkorra.ability.util.Collision; import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.object.HorizontalVelocityTracker; +import com.projectkorra.projectkorra.util.Attribute; +import com.projectkorra.projectkorra.util.Attribute.Attributable; import com.projectkorra.projectkorra.util.DamageHandler; import com.projectkorra.projectkorra.util.Flight; -public class AirBlast extends AirAbility { +public class AirBlast extends AirAbility implements Attributable{ private static final int MAX_TICKS = 10000; private static final Map ORIGINS = new ConcurrentHashMap<>(); @@ -44,15 +46,9 @@ public class AirBlast extends AirAbility { private boolean isFromOtherOrigin; private boolean showParticles; private int ticks; - private int particles; - private long cooldown; - private double speedFactor; - private double range; - private double pushFactor; - private double pushFactorForOthers; - private double damage; - private double speed; - private double radius; + int particles; + long cooldown; + double speedFactor, range, pushFactor, pushFactorForOthers, damage, speed, radius; private Location location; private Location origin; private Vector direction; @@ -60,6 +56,14 @@ public class AirBlast extends AirAbility { private Random random; private ArrayList affectedLevers; private ArrayList affectedEntities; + private static Attribute particlesA; + private static Attribute cooldownA; + private static Attribute rangeA; + private static Attribute pushFactorA; + private static Attribute pushFactorForOthersA; + private static Attribute damageA; + private static Attribute speedA; + private static Attribute radiusA; public AirBlast(Player player) { super(player); @@ -111,23 +115,18 @@ public class AirBlast extends AirAbility { this.canPressButtons = false; this.canFlickLevers = false; - if (bPlayer.isAvatarState()) { - this.pushFactor = getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Entities"); - this.pushFactorForOthers = getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Self"); - } - start(); } private void setFields() { - this.particles = getConfig().getInt("Abilities.Air.AirBlast.Particles"); - this.cooldown = getConfig().getLong("Abilities.Air.AirBlast.Cooldown"); - this.range = getConfig().getDouble("Abilities.Air.AirBlast.Range"); - this.speed = getConfig().getDouble("Abilities.Air.AirBlast.Speed"); - this.range = getConfig().getDouble("Abilities.Air.AirBlast.Range"); - this.radius = getConfig().getDouble("Abilities.Air.AirBlast.Radius"); - this.pushFactor = getConfig().getDouble("Abilities.Air.AirBlast.Push.Entities"); - this.pushFactorForOthers = getConfig().getDouble("Abilities.Air.AirBlast.Push.Self"); + this.particles = particlesA.getModified(bPlayer); + this.cooldown = cooldownA.getModified(bPlayer); + this.range = rangeA.getModified(bPlayer); + this.damage = damageA.getModified(bPlayer); + this.speed = speedA.getModified(bPlayer); + this.radius = radiusA.getModified(bPlayer); + this.pushFactor = pushFactorA.getModified(bPlayer); + this.pushFactorForOthers = pushFactorForOthersA.getModified(bPlayer); this.canFlickLevers = getConfig().getBoolean("Abilities.Air.AirBlast.CanFlickLevers"); this.canOpenDoors = getConfig().getBoolean("Abilities.Air.AirBlast.CanOpenDoors"); this.canPressButtons = getConfig().getBoolean("Abilities.Air.AirBlast.CanPressButtons"); @@ -639,4 +638,16 @@ public class AirBlast extends AirAbility { return getConfig().getInt("Abilities.Air.AirBlast.SelectRange"); } + @Override + public void registerAttributes() { + particlesA = new Attribute(this, "particles", getConfig().getInt("Abilities.Air.AirBlast.Particles")); + cooldownA = new Attribute(this, "cooldown", getConfig().getLong("Abilities.Air.AirBlast.Cooldown")); + rangeA = new Attribute(this, "range", getConfig().getDouble("Abilities.Air.AirBlast.Range")); + pushFactorA = new Attribute(this, "pushFactor", getConfig().getDouble("Abilities.Air.AirBlast.Push.Self")); + pushFactorForOthersA = new Attribute(this, "pushFactorForOthers", getConfig().getDouble("Abilities.Air.AirBlast.Push.Entities")); + damageA = new Attribute(this, "damage", getConfig().getDouble("Abilities.Air.AirBlast.Damage")); + speedA = new Attribute(this, "speed", getConfig().getDouble("Abilities.Air.AirBlast.Speed")); + radiusA = new Attribute(this, "radius", getConfig().getDouble("Abilities.Air.AirBlast.Radius")); + } + } diff --git a/src/com/projectkorra/projectkorra/airbending/AirBubble.java b/src/com/projectkorra/projectkorra/airbending/AirBubble.java index 3c600293..4ed8d467 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirBubble.java +++ b/src/com/projectkorra/projectkorra/airbending/AirBubble.java @@ -14,22 +14,26 @@ import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.Element; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.util.Attribute; +import com.projectkorra.projectkorra.util.Attribute.Attributable; import com.projectkorra.projectkorra.waterbending.WaterManipulation; -public class AirBubble extends AirAbility { +public class AirBubble extends AirAbility implements Attributable{ private boolean waterBubble; private double radius; private double airRadius; private double waterRadius; private Map waterOrigins; + private static Attribute airRadiusA; + private static Attribute waterRadiusA; public AirBubble(Player player) { super(player); this.radius = 0; - this.airRadius = getConfig().getDouble("Abilities.Air.AirBubble.Radius"); - this.waterRadius = getConfig().getDouble("Abilities.Water.WaterBubble.Radius"); + this.airRadius = airRadiusA.getModified(bPlayer); + this.waterRadius = waterRadiusA.getModified(bPlayer); this.waterOrigins = new ConcurrentHashMap<>(); start(); } @@ -206,4 +210,10 @@ public class AirBubble extends AirAbility { return waterOrigins; } + @Override + public void registerAttributes() { + airRadiusA = new Attribute(this, "airRadius", getConfig().getDouble("Abilities.Air.AirBubble.Radius")); + waterRadiusA = new Attribute(this, "waterRadius", getConfig().getDouble("Abilities.Water.WaterBubble.Radius")); + } + } diff --git a/src/com/projectkorra/projectkorra/airbending/AirBurst.java b/src/com/projectkorra/projectkorra/airbending/AirBurst.java index 35337301..dfa01427 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirBurst.java +++ b/src/com/projectkorra/projectkorra/airbending/AirBurst.java @@ -11,8 +11,10 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.ProjectKorra; import com.projectkorra.projectkorra.ability.AirAbility; +import com.projectkorra.projectkorra.util.Attribute; +import com.projectkorra.projectkorra.util.Attribute.Attributable; -public class AirBurst extends AirAbility { +public class AirBurst extends AirAbility implements Attributable{ private boolean isCharged; private boolean isFallBurst; @@ -27,6 +29,12 @@ public class AirBurst extends AirAbility { private double particlePercentage; private ArrayList blasts; private ArrayList affectedEntities; + private static Attribute chargeTimeA; + private static Attribute fallThresholdA; + private static Attribute pushFactorA; + private static Attribute damageA; + private static Attribute blastAngleThetaA; + private static Attribute blastAnglePhiA; public AirBurst(Player player, boolean isFallBurst) { super(player); @@ -43,21 +51,17 @@ public class AirBurst extends AirAbility { this.isFallBurst = isFallBurst; this.isCharged = false; this.playerFallDistance = player.getFallDistance(); - this.chargeTime = getConfig().getLong("Abilities.Air.AirBurst.ChargeTime"); - this.fallThreshold = getConfig().getDouble("Abilities.Air.AirBurst.FallThreshold"); - this.pushFactor = getConfig().getDouble("Abilities.Air.AirBurst.PushFactor"); - this.damage = getConfig().getDouble("Abilities.Air.AirBurst.Damage"); - this.blastAnglePhi = getConfig().getDouble("Abilities.Air.AirBurst.AnglePhi"); - this.blastAngleTheta = getConfig().getDouble("Abilities.Air.AirBurst.AngleTheta"); + this.chargeTime = chargeTimeA.getModified(bPlayer); + this.fallThreshold = fallThresholdA.getModified(bPlayer); + this.pushFactor = pushFactorA.getModified(bPlayer); + this.damage = damageA.getModified(bPlayer); + this.blastAnglePhi = blastAnglePhiA.getModified(bPlayer); + this.blastAngleTheta = blastAngleThetaA.getModified(bPlayer); this.sneakParticles = getConfig().getInt("Abilities.Air.AirBurst.SneakParticles"); this.particlePercentage = getConfig().getDouble("Abilities.Air.AirBurst.ParticlePercentage"); this.blasts = new ArrayList<>(); this.affectedEntities = new ArrayList<>(); - - if (bPlayer.isAvatarState()) { - this.chargeTime = getConfig().getLong("Abilities.Avatar.AvatarState.Air.AirBurst.ChargeTime"); - this.damage = getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirBurst.Damage"); - } + start(); } @@ -315,4 +319,14 @@ public class AirBurst extends AirAbility { public ArrayList getAffectedEntities() { return affectedEntities; } + + @Override + public void registerAttributes() { + chargeTimeA = new Attribute(this, "chargeTime", getConfig().getLong("Abilities.Air.AirBurst.ChargeTime")); + fallThresholdA = new Attribute(this, "fallThreshold", getConfig().getDouble("Abilities.Air.AirBurst.FallThreshold")); + pushFactorA = new Attribute(this, "pushFactor", getConfig().getDouble("Abilities.Air.AirBurst.PushFactor")); + damageA = new Attribute(this, "damage", getConfig().getDouble("Abilities.Air.AirBurst.Damage")); + blastAngleThetaA = new Attribute(this, "blastAngleTheta", getConfig().getDouble("Abilities.Air.AirBlast.AngleTheta")); + blastAnglePhiA = new Attribute(this, "blastAnglePhi", getConfig().getDouble("Abilities.Air.AirBlast.AnglePhi")); + } } diff --git a/src/com/projectkorra/projectkorra/airbending/AirScooter.java b/src/com/projectkorra/projectkorra/airbending/AirScooter.java index 719d2e74..25ee5e69 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirScooter.java +++ b/src/com/projectkorra/projectkorra/airbending/AirScooter.java @@ -1,6 +1,5 @@ package com.projectkorra.projectkorra.airbending; -import java.util.ArrayList; import java.util.Random; import org.bukkit.Location; @@ -13,22 +12,28 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.AirAbility; import com.projectkorra.projectkorra.ability.WaterAbility; +import com.projectkorra.projectkorra.util.Attribute; +import com.projectkorra.projectkorra.util.Attribute.Attributable; import com.projectkorra.projectkorra.util.Flight; -public class AirScooter extends AirAbility { +public class AirScooter extends AirAbility implements Attributable{ private double speed; private double interval; private double radius; private long cooldown; private double maxHeightFromGround; + private static Attribute speedA; + private static Attribute intervalA; + private static Attribute radiusA; + private static Attribute cooldownA; + private static Attribute heightA; private Block floorblock; private Random random; - private ArrayList angles; + private double phi = 0; private boolean canFly; private boolean hadFly; - private double phi = 0; public AirScooter(Player player) { super(player); @@ -42,13 +47,12 @@ public class AirScooter extends AirAbility { else if (bPlayer.isOnCooldown(this)) return; - this.speed = getConfig().getDouble("Abilities.Air.AirScooter.Speed"); - this.interval = getConfig().getDouble("Abilities.Air.AirScooter.Interval"); - this.radius = getConfig().getDouble("Abilities.Air.AirScooter.Radius"); - this.cooldown = getConfig().getLong("Abilities.Air.AirScooter.Cooldown"); - this.maxHeightFromGround = getConfig().getDouble("Abilities.Air.AirScooter.MaxHeightFromGround"); + this.speed = speedA.getModified(bPlayer); + this.interval = intervalA.getModified(bPlayer); + this.radius = radiusA.getModified(bPlayer); + this.cooldown = cooldownA.getModified(bPlayer); + this.maxHeightFromGround = heightA.getModified(bPlayer); this.random = new Random(); - this.angles = new ArrayList<>(); canFly = player.getAllowFlight(); hadFly = player.isFlying(); @@ -58,11 +62,7 @@ public class AirScooter extends AirAbility { player.setSprinting(false); player.setSneaking(false); - - for (int i = 0; i < 5; i++) { - angles.add((double) (60 * i)); - } - + start(); } @@ -109,7 +109,7 @@ public class AirScooter extends AirAbility { } Vector velocity = player.getEyeLocation().getDirection().clone().normalize(); - velocity = velocity.clone().normalize().multiply(speed); + velocity = velocity.multiply(speed); /* * checks the players speed and ends the move if they are going too slow */ @@ -125,26 +125,30 @@ public class AirScooter extends AirAbility { * lowers the player based on their distance from the ground. */ double distance = player.getLocation().getY() - (double) floorblock.getY(); - double dx = Math.abs(distance - 2.4); - if (distance > 2.75) { - velocity.setY(-.40 * dx * dx); - } else if (distance < 2) { - velocity.setY(.40 * dx * dx); + if (distance > 2.355) { + velocity.setY(-0.15); + } else if (distance < 1.9) { + velocity.setY(0.15); } else { velocity.setY(0); } + + Vector v = velocity.clone().setY(0); + Block b = floorblock.getLocation().clone().add(v.multiply(1.2)).getBlock(); + if (!GeneralMethods.isSolid(b) && !b.isLiquid()) { + velocity.add(new Vector(0, -0.6, 0)); + } else if (GeneralMethods.isSolid(b.getRelative(BlockFace.UP)) || b.getRelative(BlockFace.UP).isLiquid()) { + velocity.add(new Vector(0, 0.6, 0)); + } - Location loc = player.getLocation(); - if (!WaterAbility.isWater(player.getLocation().add(0, 2, 0).getBlock())) { - loc.setY((double) floorblock.getY() + 1.5); - } else { + if (WaterAbility.isWater(player.getLocation().getBlock())) { + remove(); return; } player.setSprinting(false); player.removePotionEffect(PotionEffectType.SPEED); player.setVelocity(velocity); - if (random.nextInt(4) == 0) { playAirbendingSound(player.getLocation()); } @@ -160,14 +164,10 @@ public class AirScooter extends AirAbility { player.setFlying(hadFly); bPlayer.addCooldown(this); } - - /* - * The particles used for AirScooter phi = how many rings of particles the - * sphere has. theta = how dense the rings are. r = Radius of the sphere - */ + private void spinScooter() { - Location origin = player.getLocation(); - Location origin2 = player.getLocation(); + Location origin = player.getLocation().clone(); + Location origin2 = player.getLocation().clone(); phi += Math.PI / 10 * 4; for (double theta = 0; theta <= 2 * Math.PI; theta += Math.PI / 10) { double r = 0.6; @@ -186,7 +186,7 @@ public class AirScooter extends AirAbility { origin2.subtract(x, y, z); playAirbendingParticles(origin2, 1, 0F, 0F, 0F); origin2.add(x, y, z); - } +} } @Override @@ -262,4 +262,13 @@ public class AirScooter extends AirAbility { public void setCooldown(long cooldown) { this.cooldown = cooldown; } + + @Override + public void registerAttributes() { + speedA = new Attribute(this, "speed", getConfig().getDouble("Abilities.Air.AirScooter.Speed")); + intervalA = new Attribute(this, "interval", getConfig().getDouble("Abilities.Air.AirScooter.Interval")); + radiusA = new Attribute(this, "radius", getConfig().getDouble("Abilities.Air.AirScooter.Radius")); + heightA = new Attribute(this, "height", getConfig().getDouble("Abilities.Air.AirScooter.MaxHeightFromGround")); + cooldownA = new Attribute(this, "cooldown", getConfig().getLong("Abilities.Air.AirScooter.Cooldown")); + } } diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index eb9687eb..3edad32a 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -535,8 +535,8 @@ public class ConfigManager { config.addDefault("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Entities", 4.5); config.addDefault("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Self", 4.0); - config.addDefault("Abilities.Avatar.AvatarState.AirSpout.Height", 26); - config.addDefault("Abilities.Avatar.AvatarState.AirSuction.Push", 3.5); + config.addDefault("Abilities.Avatar.AvatarState.Air.AirSpout.Height", 26); + config.addDefault("Abilities.Avatar.AvatarState.Air.AirSuction.Push", 3.5); config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Cooldown", 1000); config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Damage", 4.5); config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Push", 1.0); diff --git a/src/com/projectkorra/projectkorra/util/Attribute.java b/src/com/projectkorra/projectkorra/util/Attribute.java new file mode 100644 index 00000000..3c3ce825 --- /dev/null +++ b/src/com/projectkorra/projectkorra/util/Attribute.java @@ -0,0 +1,90 @@ +package com.projectkorra.projectkorra.util; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import com.projectkorra.projectkorra.BendingPlayer; +import com.projectkorra.projectkorra.ability.CoreAbility; + +public class Attribute { + + private static Map>> attributes = new HashMap<>(); + + public List> modifiers; + public CoreAbility ability; + public String name; + public TYPE value; + + public Attribute(CoreAbility ability, String name, TYPE value) { + this(ability, name, value, new ArrayList>()); + } + + public Attribute(CoreAbility ability, String name, TYPE value, List> modifiers) { + this.ability = ability; + this.name = name; + this.value = value; + if (!attributes.containsKey(ability)) { + attributes.put(ability, new HashMap>()); + } + attributes.get(ability).put(name.toLowerCase(), this); + this.modifiers = new ArrayList>(modifiers); + } + + public List> getModifiers() { + return modifiers; + } + + public void addModifier(AttributeModifier modifier) { + modifiers.add(modifier); + } + + public CoreAbility getAbility() { + return ability; + } + + public String getName() { + return name; + } + + public TYPE getDefault() { + return value; + } + + public TYPE getModified(BendingPlayer bPlayer) { + TYPE modified = value; + for (AttributeModifier modifier : modifiers) { + if (!modifier.canModify(bPlayer)) { + continue; + } + value = modifier.newValue(value); + } + + return modified; + } + + public static Attribute get(CoreAbility ability, String name) { + Map> map = attributes.containsKey(ability) ? attributes.get(ability) : new HashMap>(); + if (map.isEmpty()) { + return null; + } + if (map.containsKey(name.toLowerCase())) { + return map.get(name.toLowerCase()); + } + return null; + } + + public interface AttributeModifier { + public boolean canModify(BendingPlayer bPlayer); + public TYPE newValue(TYPE value); + } + + public interface Attributable { + + /** + * Registers the {@link Attribute} objects the ability has + */ + public void registerAttributes(); + } +} diff --git a/src/com/projectkorra/projectkorra/util/attributes/AttributeModifiers.java b/src/com/projectkorra/projectkorra/util/attributes/AttributeModifiers.java new file mode 100644 index 00000000..fd02a819 --- /dev/null +++ b/src/com/projectkorra/projectkorra/util/attributes/AttributeModifiers.java @@ -0,0 +1,49 @@ +package com.projectkorra.projectkorra.util.attributes; + +import com.projectkorra.projectkorra.ability.CoreAbility; +import com.projectkorra.projectkorra.airbending.AirBlast; +import com.projectkorra.projectkorra.airbending.AirBurst; +import com.projectkorra.projectkorra.configuration.ConfigManager; +import com.projectkorra.projectkorra.util.Attribute; + +public class AttributeModifiers { + + public AttributeModifiers() { + load(); + } + + @SuppressWarnings("unchecked") + public void load() { + Attribute airBlastPushSelf = (Attribute) Attribute.get(CoreAbility.getAbility(AirBlast.class), "pushFactor"); + airBlastPushSelf.addModifier(new AvatarStateModifier() { + @Override + public Double newValue(Double value) { + return ConfigManager.getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Self"); + } + }); + + Attribute airBlastPushOthers = (Attribute) Attribute.get(CoreAbility.getAbility(AirBlast.class), "pushFactorForOthers"); + airBlastPushOthers.addModifier(new AvatarStateModifier() { + @Override + public Double newValue(Double value) { + return ConfigManager.getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirBlast.Push.Entities"); + } + }); + + Attribute airBurstDamage = (Attribute) Attribute.get(CoreAbility.getAbility(AirBurst.class), "damage"); + airBurstDamage.addModifier(new AvatarStateModifier() { + @Override + public Double newValue(Double value) { + return ConfigManager.getConfig().getDouble("Abilities.Avatar.AvatarState.Air.AirBurst.Damage"); + } + }); + + Attribute airBurstChargetime = (Attribute) Attribute.get(CoreAbility.getAbility(AirBurst.class), "chargeTime"); + airBurstChargetime.addModifier(new AvatarStateModifier() { + @Override + public Long newValue(Long value) { + return ConfigManager.getConfig().getLong("Abilities.Avatar.AvatarState.Air.AirBurst.ChargeTime"); + } + }); + } +} diff --git a/src/com/projectkorra/projectkorra/util/attributes/AvatarStateModifier.java b/src/com/projectkorra/projectkorra/util/attributes/AvatarStateModifier.java new file mode 100644 index 00000000..dc5c8254 --- /dev/null +++ b/src/com/projectkorra/projectkorra/util/attributes/AvatarStateModifier.java @@ -0,0 +1,18 @@ +package com.projectkorra.projectkorra.util.attributes; + +import com.projectkorra.projectkorra.BendingPlayer; +import com.projectkorra.projectkorra.util.Attribute.AttributeModifier; + +public class AvatarStateModifier implements AttributeModifier{ + + @Override + public boolean canModify(BendingPlayer bPlayer) { + return bPlayer.isAvatarState(); + } + + @Override + public TYPE newValue(TYPE value) { + return value; + } + +}