diff --git a/src/com/projectkorra/ProjectKorra/ConfigManager.java b/src/com/projectkorra/ProjectKorra/ConfigManager.java index c1981926..48da455a 100644 --- a/src/com/projectkorra/ProjectKorra/ConfigManager.java +++ b/src/com/projectkorra/ProjectKorra/ConfigManager.java @@ -333,6 +333,12 @@ public class ConfigManager { config.addDefault("Abilities.Earth.Tremorsense.LightThreshold", 7); config.addDefault("Abilities.Earth.Tremorsense.Cooldown", 1000); + config.addDefault("Abilities.Fire.Blaze.Enabled", true); + config.addDefault("Abilities.Fire.Blaze.Description", "To use, simply left-click in any direction. An arc of fire will flow from your location, igniting anything in its path. Additionally, tap sneak to engulf the area around you in roaring flames."); + config.addDefault("Abilities.Fire.Blaze.ArcOfFire.Arc", 20); + config.addDefault("Abilities.Fire.Blaze.ArcOfFire.Range", 9); + config.addDefault("Abilities.Fire.Blaze.RingOfFire.Range", 7); + config.addDefault("Abilities.Fire.FireBlast.Enabled", true); config.addDefault("Abilities.Fire.FireBlast.Description","FireBlast is the most fundamental bending technique of a firebender. " + "To use, simply left-click in a direction. A blast of fire will be created at your fingertips. " diff --git a/src/com/projectkorra/ProjectKorra/PKListener.java b/src/com/projectkorra/ProjectKorra/PKListener.java index 1cf332dc..d5be7476 100644 --- a/src/com/projectkorra/ProjectKorra/PKListener.java +++ b/src/com/projectkorra/ProjectKorra/PKListener.java @@ -77,6 +77,7 @@ import com.projectkorra.ProjectKorra.earthbending.EarthTunnel; import com.projectkorra.ProjectKorra.earthbending.EarthWall; import com.projectkorra.ProjectKorra.earthbending.Shockwave; import com.projectkorra.ProjectKorra.earthbending.Tremorsense; +import com.projectkorra.ProjectKorra.firebending.ArcOfFire; import com.projectkorra.ProjectKorra.firebending.Cook; import com.projectkorra.ProjectKorra.firebending.Enflamed; import com.projectkorra.ProjectKorra.firebending.Extinguish; @@ -85,6 +86,7 @@ import com.projectkorra.ProjectKorra.firebending.FireJet; import com.projectkorra.ProjectKorra.firebending.FireStream; import com.projectkorra.ProjectKorra.firebending.Fireball; import com.projectkorra.ProjectKorra.firebending.Illumination; +import com.projectkorra.ProjectKorra.firebending.RingOfFire; import com.projectkorra.ProjectKorra.waterbending.Bloodbending; import com.projectkorra.ProjectKorra.waterbending.FreezeMelt; import com.projectkorra.ProjectKorra.waterbending.IceSpike2; @@ -293,6 +295,9 @@ public class PKListener implements Listener { if (Methods.isWeapon(player.getItemInHand().getType()) && !plugin.getConfig().getBoolean("Properties.Fire.CanBendWithWeapons")) { return; } + if (abil.equalsIgnoreCase("Blaze")) { + new RingOfFire(player); + } if (abil.equalsIgnoreCase("FireBlast")) { new Fireball(player); } @@ -554,6 +559,9 @@ public class PKListener implements Listener { return; } + if (abil.equalsIgnoreCase("Blaze")) { + new ArcOfFire(player); + } if (abil.equalsIgnoreCase("FireBlast")) { new FireBlast(player); } diff --git a/src/com/projectkorra/ProjectKorra/firebending/ArcOfFire.java b/src/com/projectkorra/ProjectKorra/firebending/ArcOfFire.java new file mode 100644 index 00000000..3f0cd9e4 --- /dev/null +++ b/src/com/projectkorra/ProjectKorra/firebending/ArcOfFire.java @@ -0,0 +1,78 @@ +package com.projectkorra.ProjectKorra.firebending; + +import java.util.HashMap; +import java.util.Map; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import com.projectkorra.ProjectKorra.Methods; +import com.projectkorra.ProjectKorra.ProjectKorra; +import com.projectkorra.ProjectKorra.Ability.AvatarState; + +public class ArcOfFire { + + // private static ConcurrentHashMap timers = new + // ConcurrentHashMap(); + // static final long soonesttime = Tools.timeinterval; + + private static int defaultarc = ProjectKorra.plugin.getConfig().getInt("Abilities.Fire.Blaze.ArcOfFire.Arc"); + private static int defaultrange = ProjectKorra.plugin.getConfig().getInt("Abilities.Fire.Blaze.ArcOfFire.Range"); + private static int stepsize = 2; + + public static Map cooldowns = new HashMap(); + + public ArcOfFire(Player player) { + // if (timers.containsKey(player)) { + // if (System.currentTimeMillis() < timers.get(player) + soonesttime) { + // return; + // } + // } + // timers.put(player, System.currentTimeMillis()); + if (cooldowns.containsKey(player.getName())) { + if (cooldowns.get(player.getName()) + ProjectKorra.plugin.getConfig().getLong("Properties.GlobalCooldown") >= System.currentTimeMillis()) { + return; + } else { + cooldowns.remove(player.getName()); + } + } + + Location location = player.getLocation(); + + int arc = (int) Methods.firebendingDayAugment(defaultarc, + player.getWorld()); + + for (int i = -arc; i <= arc; i += stepsize) { + double angle = Math.toRadians((double) i); + Vector direction = player.getEyeLocation().getDirection().clone(); + + double x, z, vx, vz; + x = direction.getX(); + z = direction.getZ(); + + vx = x * Math.cos(angle) - z * Math.sin(angle); + vz = x * Math.sin(angle) + z * Math.cos(angle); + + direction.setX(vx); + direction.setZ(vz); + + int range = defaultrange; + if (AvatarState.isAvatarState(player)) + range = AvatarState.getValue(range); + + new FireStream(location, direction, player, range); + } + + cooldowns.put(player.getName(), System.currentTimeMillis()); + } + + public static String getDescription() { + return "To use, simply left-click in any direction. " + + "An arc of fire will flow from your location, " + + "igniting anything in its path." + + " Additionally, tap sneak to engulf the area around you " + + "in roaring flames."; + } + +} \ No newline at end of file diff --git a/src/com/projectkorra/ProjectKorra/firebending/RingOfFire.java b/src/com/projectkorra/ProjectKorra/firebending/RingOfFire.java new file mode 100644 index 00000000..1c6cef50 --- /dev/null +++ b/src/com/projectkorra/ProjectKorra/firebending/RingOfFire.java @@ -0,0 +1,65 @@ +package com.projectkorra.ProjectKorra.firebending; + +import org.bukkit.Location; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import com.projectkorra.ProjectKorra.ProjectKorra; +import com.projectkorra.ProjectKorra.Ability.AvatarState; + +public class RingOfFire { + + // private static ConcurrentHashMap timers = new + // ConcurrentHashMap(); + // static final long soonesttime = Tools.timeinterval; + + static final int defaultrange = ProjectKorra.plugin.getConfig().getInt("Abilities.Fire.Blaze.RingOfFire.Range"); + + public RingOfFire(Player player) { + // if (timers.containsKey(player)) { + // if (System.currentTimeMillis() < timers.get(player) + soonesttime) { + // return; + // } + // } + // timers.put(player, System.currentTimeMillis()); + if (ArcOfFire.cooldowns.containsKey(player.getName())) { + if (ArcOfFire.cooldowns.get(player.getName()) + ProjectKorra.plugin.getConfig().getLong("Properties.GlobalCooldown") >= System.currentTimeMillis()) { + return; + } else { + ArcOfFire.cooldowns.remove(player.getName()); + } + } + + Location location = player.getLocation(); + + for (double degrees = 0; degrees < 360; degrees += 10) { + double angle = Math.toRadians(degrees); + Vector direction = player.getEyeLocation().getDirection().clone(); + + double x, z, vx, vz; + x = direction.getX(); + z = direction.getZ(); + + vx = x * Math.cos(angle) - z * Math.sin(angle); + vz = x * Math.sin(angle) + z * Math.cos(angle); + + direction.setX(vx); + direction.setZ(vz); + + int range = defaultrange; + if (AvatarState.isAvatarState(player)) + range = AvatarState.getValue(range); + + new FireStream(location, direction, player, range); + } + + ArcOfFire.cooldowns.put(player.getName(), System.currentTimeMillis()); + } + + public static String getDescription() { + return "To use, simply left-click. " + + "A circle of fire will emanate from you, " + + "engulfing everything around you. Use with extreme caution."; + } + +} \ No newline at end of file diff --git a/src/config.yml b/src/config.yml index 31514908..c8bc513f 100644 --- a/src/config.yml +++ b/src/config.yml @@ -228,6 +228,14 @@ Abilities: LightThreshold: 7 Cooldown: 1000 Fire: + Blaze: + Enabled: true + Description: "To use, simply click in any direction. An arc of fire will flow from your location, igniting anything in its path. Additionally, tap sneak to engulf the area around you in roaring flames." + ArcOfFire: + Arc: 20 + Range: 9 + RingOfFire: + Range: 7 FireBlast: Enabled: true Description: "FireBlast is the most fundamental technique of a firebender. To use, simply left-click in a direction. A blast of fire will be created at your fingertips. If this blast contacts an enemy, it will dissipate and engulf them in flames, doing additional damage and knocking them back slightly. If the blast hits terrain, it will ignite the nearby area. Additionally, if you hold sneak, you will charge up the fireblast. If you release it when it's charged, it will instead launch a powerful fireball that explodes on contact."