Fire burst is now instant
This commit is contained in:
parent
e05f90372a
commit
60a46c8c10
@ -7,21 +7,20 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
@ -29,8 +28,8 @@ public class PerkFireBurst extends Perk
|
||||
{
|
||||
|
||||
private static final int FIRE_TICKS = 60;
|
||||
private static final double LOCATION_Y_MODIFER = 0.25;
|
||||
|
||||
private static final double LOCATION_Y_MODIFER = 1;
|
||||
|
||||
private long _cooldown;
|
||||
private double _range;
|
||||
private double _damage;
|
||||
@ -39,16 +38,15 @@ public class PerkFireBurst extends Perk
|
||||
{
|
||||
super("Fire Burst", new String[] {
|
||||
C.cYellow + "Right Click" + C.cGray + " with Blaze Rod to use " + C.cGreen + "Fire Burst",
|
||||
"Sends out a pulse of fire that deals " + C.cGreen + damage + C.cGray + " damage to",
|
||||
"all players within " + C.cGreen + range + C.cGray + " blocks.",
|
||||
"Cooldown " + C.cGreen + UtilTime.convertString(cooldown, 0, TimeUnit.SECONDS) + C.cGray + "."
|
||||
});
|
||||
"Sends out a pulse of fire that deals " + C.cGreen + damage + C.cGray + " damage to",
|
||||
"all players within " + C.cGreen + range + C.cGray + " blocks.",
|
||||
"Cooldown " + C.cGreen + UtilTime.convertString(cooldown, 0, TimeUnit.SECONDS) + C.cGray + "." });
|
||||
|
||||
_cooldown = cooldown;
|
||||
_range = range;
|
||||
_damage = damage;
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
@ -56,29 +54,29 @@ public class PerkFireBurst extends Perk
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getItemInHand() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (player.getItemInHand().getType() != Material.BLAZE_ROD)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
final Location location = player.getLocation().add(0, LOCATION_Y_MODIFER, 0);
|
||||
|
||||
for (Player other : UtilPlayer.getNearby(location, _range, true))
|
||||
@ -87,42 +85,28 @@ public class PerkFireBurst extends Perk
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
other.setFireTicks(FIRE_TICKS);
|
||||
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, false, true, player.getName(), GetName());
|
||||
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, true, true, player.getName(), GetName());
|
||||
}
|
||||
|
||||
new BukkitRunnable()
|
||||
|
||||
for (double radius = 0; radius < _range; radius += 0.4)
|
||||
{
|
||||
|
||||
double curRange = 0;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 20)
|
||||
{
|
||||
if (curRange >= _range)
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 20)
|
||||
{
|
||||
double x = curRange * Math.cos(theta);
|
||||
double z = curRange * Math.sin(theta);
|
||||
|
||||
location.add(x, 0, z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, location, 0, 0, 0, 0.01F, 1, ViewDist.NORMAL);
|
||||
|
||||
location.subtract(x, 0, z);
|
||||
}
|
||||
|
||||
curRange += 0.5;
|
||||
double x = radius * Math.cos(theta);
|
||||
double z = radius * Math.sin(theta);
|
||||
|
||||
location.add(x, 0, z);
|
||||
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FLAME, location, 0, 0, 0, 0.01F, 1, ViewDist.NORMAL);
|
||||
|
||||
location.subtract(x, 0, z);
|
||||
}
|
||||
}.runTaskTimer(Manager.getPlugin(), 0, 3);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDropItem(PlayerDropItemEvent event)
|
||||
{
|
||||
@ -132,7 +116,7 @@ public class PerkFireBurst extends Perk
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDeath(PlayerDeathEvent event)
|
||||
{
|
||||
@ -148,5 +132,5 @@ public class PerkFireBurst extends Perk
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user