mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-09-11 04:39:32 +00:00
Combustion
New Firebending Ability, launches a Fireball from the player.
This commit is contained in:
parent
0aa7b05fc9
commit
d117adb44d
Binary file not shown.
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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. "
|
||||
|
|
|
@ -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())) {
|
||||
|
|
107
src/com/projectkorra/ProjectKorra/firebending/Combustion.java
Normal file
107
src/com/projectkorra/ProjectKorra/firebending/Combustion.java
Normal file
|
@ -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<Integer> fireballs = new ArrayList<Integer>();
|
||||
|
||||
private Player player;
|
||||
private long starttime;
|
||||
private boolean charged = false;
|
||||
public static ConcurrentHashMap<Player, Combustion> instances = new ConcurrentHashMap<Player, Combustion>();
|
||||
public static HashMap<String, Long> cooldowns = new HashMap<String, Long>();
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
}
|
|
@ -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."
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue