diff --git a/Dev Builds/Korra.jar b/Dev Builds/Korra.jar index cf8e5e14..b0196b77 100644 Binary files a/Dev Builds/Korra.jar and b/Dev Builds/Korra.jar differ diff --git a/src/com/projectkorra/ProjectKorra/Ability/StockAbilities.java b/src/com/projectkorra/ProjectKorra/Ability/StockAbilities.java index 1a7fc725..0316d8a6 100644 --- a/src/com/projectkorra/ProjectKorra/Ability/StockAbilities.java +++ b/src/com/projectkorra/ProjectKorra/Ability/StockAbilities.java @@ -18,7 +18,7 @@ public enum StockAbilities { AvatarState, // Project Korra - Extraction, Smokescreen; + Extraction, Smokescreen, Combustion; private enum AirbendingAbilities { AirBlast, AirBubble, AirShield, AirSuction, AirSwipe, Tornado, AirScooter, AirSpout, AirBurst; @@ -33,7 +33,7 @@ public enum StockAbilities { } private enum FirebendingAbilities { - HeatControl, Blaze, FireJet, Illumination, WallOfFire, FireBlast, Lightning, FireBurst, FireShield; + HeatControl, Blaze, FireJet, Illumination, WallOfFire, FireBlast, Lightning, FireBurst, FireShield, Combustion; } private enum ChiblockingAbilities { diff --git a/src/com/projectkorra/ProjectKorra/BendingManager.java b/src/com/projectkorra/ProjectKorra/BendingManager.java index 5bdc45b9..ad953f79 100644 --- a/src/com/projectkorra/ProjectKorra/BendingManager.java +++ b/src/com/projectkorra/ProjectKorra/BendingManager.java @@ -32,6 +32,7 @@ import com.projectkorra.ProjectKorra.earthbending.EarthPassive; import com.projectkorra.ProjectKorra.earthbending.EarthTunnel; import com.projectkorra.ProjectKorra.earthbending.Shockwave; import com.projectkorra.ProjectKorra.earthbending.Tremorsense; +import com.projectkorra.ProjectKorra.firebending.Combustion; import com.projectkorra.ProjectKorra.firebending.Cook; import com.projectkorra.ProjectKorra.firebending.FireBlast; import com.projectkorra.ProjectKorra.firebending.FireBurst; @@ -120,6 +121,7 @@ public class BendingManager implements Runnable { Lightning.progressAll(); WallOfFire.manage(); WaterReturn.progressAll(); + Combustion.progressAll(); for (Player p : RapidPunch.instance.keySet()) RapidPunch.instance.get(p).startPunch(p); diff --git a/src/com/projectkorra/ProjectKorra/ConfigManager.java b/src/com/projectkorra/ProjectKorra/ConfigManager.java index 7ed1036a..cefb2c01 100644 --- a/src/com/projectkorra/ProjectKorra/ConfigManager.java +++ b/src/com/projectkorra/ProjectKorra/ConfigManager.java @@ -396,6 +396,13 @@ public class ConfigManager { 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.Combustion.Enabled", true); + config.addDefault("Abilities.Fire.Combustion.Description", "Combustion is a powerful ability only known by a few skilled Firebenders. It allows the bender to Firebend with their mind, concentrating energy to create a powerful blast. This technique is highly destructive and very effective, capable of use at long range. This ability has a long cooldown."); + config.addDefault("Abilities.Fire.Combustion.Cooldown", 25000); + config.addDefault("Abilities.Fire.Combustion.ChargeTime", 5000); + config.addDefault("Abilities.Fire.Combustion.BreakBlocks", false); + config.addDefault("Abilities.Fire.Combustion.Power", 1); config.addDefault("Abilities.Fire.FireBlast.Enabled", true); config.addDefault("Abilities.Fire.FireBlast.Description","FireBlast is the most fundamental bending technique of a firebender. " diff --git a/src/com/projectkorra/ProjectKorra/PKListener.java b/src/com/projectkorra/ProjectKorra/PKListener.java index 82098385..ea22ffa4 100644 --- a/src/com/projectkorra/ProjectKorra/PKListener.java +++ b/src/com/projectkorra/ProjectKorra/PKListener.java @@ -85,6 +85,7 @@ import com.projectkorra.ProjectKorra.earthbending.Extraction; import com.projectkorra.ProjectKorra.earthbending.Shockwave; import com.projectkorra.ProjectKorra.earthbending.Tremorsense; import com.projectkorra.ProjectKorra.firebending.ArcOfFire; +import com.projectkorra.ProjectKorra.firebending.Combustion; import com.projectkorra.ProjectKorra.firebending.Cook; import com.projectkorra.ProjectKorra.firebending.Enflamed; import com.projectkorra.ProjectKorra.firebending.Extinguish; @@ -177,6 +178,10 @@ public class PKListener implements Listener { } Smokescreen.snowballs.remove(id); } + if (Combustion.fireballs.contains(id)) { + Location loc = event.getEntity().getLocation(); + loc.getWorld().createExplosion(loc.getX(), loc.getY(), loc.getZ(), (float) ProjectKorra.plugin.getConfig().getDouble("Abilities.Fire.Combustion.Power"), true, ProjectKorra.plugin.getConfig().getBoolean("Abilities.Fire.Combustion.BreakBlocks")); + } } @EventHandler(priority = EventPriority.HIGHEST) @@ -405,6 +410,9 @@ public class PKListener implements Listener { if (abil.equalsIgnoreCase("Lightning")) { new Lightning(player); } + if (abil.equalsIgnoreCase("Combustion")) { + new Combustion(player); + } } } } @@ -494,6 +502,10 @@ public class PKListener implements Listener { public void onEntityExplode(EntityExplodeEvent event) { if (event.isCancelled()) return; + if (event.getEntity() instanceof org.bukkit.entity.Fireball && Combustion.fireballs.contains(event.getEntity().getEntityId())) { + event.setCancelled(true); + } + for (Block block : event.blockList()) { EarthBlast blast = EarthBlast.getBlastFromSource(block); @@ -513,6 +525,8 @@ public class PKListener implements Listener { Methods.removeRevertIndex(block); } } + + } @@ -805,7 +819,7 @@ public class PKListener implements Listener { if (event.getCause() == DamageCause.FIRE && FireStream.ignitedblocks.containsKey(entity.getLocation().getBlock())) { new Enflamed(entity, FireStream.ignitedblocks.get(entity.getLocation().getBlock())); } - + if (Enflamed.isEnflamed(entity) && event.getCause() == DamageCause.FIRE_TICK) { event.setCancelled(true); Enflamed.dealFlameDamage(entity); @@ -935,6 +949,10 @@ public class PKListener implements Listener { fireball.dealDamage(entity); return; } + + if (Combustion.fireballs.contains(source.getEntityId())) { + e.setCancelled(true); + } if (e.getCause() == DamageCause.LIGHTNING) { if (Lightning.isNearbyChannel(source.getLocation())) { diff --git a/src/com/projectkorra/ProjectKorra/firebending/Combustion.java b/src/com/projectkorra/ProjectKorra/firebending/Combustion.java new file mode 100644 index 00000000..aa408e29 --- /dev/null +++ b/src/com/projectkorra/ProjectKorra/firebending/Combustion.java @@ -0,0 +1,107 @@ +package com.projectkorra.ProjectKorra.firebending; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ConcurrentHashMap; + +import org.bukkit.Effect; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; + +import com.projectkorra.ProjectKorra.Methods; +import com.projectkorra.ProjectKorra.ProjectKorra; +import com.projectkorra.ProjectKorra.Ability.AvatarState; +import com.projectkorra.ProjectKorra.Utilities.ParticleEffect; + +public class Combustion { + + public static long chargeTime = ProjectKorra.plugin.getConfig().getLong("Abilities.Fire.Combustion.ChargeTime"); + public static long cooldown = ProjectKorra.plugin.getConfig().getLong("Abilities.Fire.Combustion.Cooldown"); + + public static List fireballs = new ArrayList(); + + private Player player; + private long starttime; + private boolean charged = false; + public static ConcurrentHashMap instances = new ConcurrentHashMap(); + public static HashMap cooldowns = new HashMap(); + + public Combustion(Player player) { + if (instances.containsKey(player)) { + return; + } + if (cooldowns.containsKey(player.getName())) { + if (cooldowns.get(player.getName()) + cooldown >= System.currentTimeMillis()) { + return; + } else { + cooldowns.remove(player.getName()); + } + } + this.player = player; + starttime = System.currentTimeMillis(); + instances.put(player, this); + } + + private void progress() { + + if (!instances.containsKey(player)) { + return; + } + + if (player.isDead() || !player.isOnline()) { + instances.remove(player); + return; + } + + if (!Methods.canBend(player.getName(), "Combustion")) { + instances.remove(player); + return; + } + + if (Methods.getBoundAbility(player) == null || !Methods.getBoundAbility(player).equalsIgnoreCase("Combustion")) { + instances.remove(player); + return; + } + + long warmup = chargeTime; + if (AvatarState.isAvatarState(player)) { + warmup = 0; + } + + if (System.currentTimeMillis() > starttime + warmup) { + charged = true; + } + + if (charged) { + if (player.isSneaking()) { + player.getWorld().playEffect(player.getEyeLocation(), Effect.SMOKE, 10); + } else { + launchFireball(); + cooldowns.put(player.getName(), System.currentTimeMillis()); + instances.remove(player); + } + } else { + if (!player.isSneaking()) { + instances.remove(player); + } + } + + for (Entity entity: player.getWorld().getEntities()) { + if (fireballs.contains(entity.getEntityId())) { + ParticleEffect.CLOUD.display(entity.getLocation(), 1.0F, 1.0F, 1.0F, 1.0F, 30); + } + } + } + + public static void progressAll() { + for (Player player: instances.keySet()) { + instances.get(player).progress(); + } + } + + private void launchFireball() { + fireballs.add(player.launchProjectile(org.bukkit.entity.Fireball.class).getEntityId()); + } + +} diff --git a/src/config.yml b/src/config.yml index 9671ec30..6a54c807 100644 --- a/src/config.yml +++ b/src/config.yml @@ -292,6 +292,13 @@ Abilities: Range: 9 RingOfFire: Range: 7 + Combustion: + Enabled: true + Description: "Combustion is a powerful ability only known by a few skilled Firebenders. It allows the bender to Firebend with their mind, concentrating energy to create a powerful blast. This technique is highly destructive and very effective, capable of use at long range. This ability has a long cooldown." + Cooldown: 25000 + ChargeTime: 5000 + BreakBlocks: false + Power: 1 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." diff --git a/src/plugin.yml b/src/plugin.yml index 1646f42b..afcb1452 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -100,6 +100,7 @@ permissions: bending.ability.Illumination: true bending.ability.Lightning: true bending.ability.WallOfFire: true + bending.ability.Combustion: true bending.message.daymessage: true bending.fire.passive: true bending.chi: