Wizards: Add spells: Gust, RainbowPath, SpectralArrow, IcePrison. Remove spells: ExplosiveRune, HealingRune, LaunchRune, Launch, TeleportRune. Explosions now launch blocks. Other changes done such as modified spells.

This commit is contained in:
libraryaddict 2015-04-03 19:33:49 +13:00
parent bb821996b1
commit 6faf5011a8
26 changed files with 2981 additions and 2722 deletions

View File

@ -30,7 +30,7 @@ public class SpellButton implements IButton
{
wizard.setSpell(player.getInventory().getHeldItemSlot(), _spell);
player.sendMessage(C.cBlue + "Set spell on wand to " + _spell.getElement().getColor() + _spell.getSpellName());
player.sendMessage(C.cBlue + "Spell on wand set to " + _spell.getElement().getColor() + _spell.getSpellName());
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 10, 1);
}

View File

@ -2,28 +2,7 @@ package nautilus.game.arcade.game.games.wizards;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.wizards.spells.SpellBridge;
import nautilus.game.arcade.game.games.wizards.spells.SpellDroom;
import nautilus.game.arcade.game.games.wizards.spells.SpellExplosiveRune;
import nautilus.game.arcade.game.games.wizards.spells.SpellFireball;
import nautilus.game.arcade.game.games.wizards.spells.SpellFlash;
import nautilus.game.arcade.game.games.wizards.spells.SpellHeal;
import nautilus.game.arcade.game.games.wizards.spells.SpellHealingRune;
import nautilus.game.arcade.game.games.wizards.spells.SpellImplode;
import nautilus.game.arcade.game.games.wizards.spells.SpellLance;
import nautilus.game.arcade.game.games.wizards.spells.SpellLaunch;
import nautilus.game.arcade.game.games.wizards.spells.SpellLaunchRune;
import nautilus.game.arcade.game.games.wizards.spells.SpellLightningStrike;
import nautilus.game.arcade.game.games.wizards.spells.SpellMagicMissile;
import nautilus.game.arcade.game.games.wizards.spells.SpellRainbowBeam;
import nautilus.game.arcade.game.games.wizards.spells.SpellRumble;
import nautilus.game.arcade.game.games.wizards.spells.SpellSpeedBoost;
import nautilus.game.arcade.game.games.wizards.spells.SpellSpiderman;
import nautilus.game.arcade.game.games.wizards.spells.SpellStoneWall;
import nautilus.game.arcade.game.games.wizards.spells.SpellSummonWolves;
import nautilus.game.arcade.game.games.wizards.spells.SpellTeleportRune;
import nautilus.game.arcade.game.games.wizards.spells.SpellTrapRune;
import nautilus.game.arcade.game.games.wizards.spells.SpellWizardsCompass;
import nautilus.game.arcade.game.games.wizards.spells.*;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
@ -31,26 +10,6 @@ import org.bukkit.inventory.ItemStack;
public enum SpellType //
{
Bridge(SpellElement.MISC, // Spell element
"Bridge", // Spell name
new ItemStack(Material.FENCE), // Spell icon
SpellBridge.class, // Spell class
3, // Spell max level
50, // Mana cost
20, // Spell cooldown
0, // Mana cost change per level
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 10",
"",
"Left click on the block before the chasm",
"and a mighty dirt bridge will appear!"),
Droom(SpellElement.ATTACK, // Spell element
"Droom", // Spell name
new ItemStack(Material.ANVIL), // Spell icon
@ -68,44 +27,6 @@ public enum SpellType // ❤
"Summons exploding anvils over everyone near you!"),
/*Drain(SpellElement.MISC, // Spell element
"Drain", // Spell name
new ItemStack(Material.BUCKET), // Spell icon
SpellDrain.class, // Spell class
3, // Spell max level
30, // Mana cost
20, // Spell cooldown
-3, // Mana cost change per level
-4, // Cooldown change per level
3, // Item amount in loot
"",
"Right click other players with this spell",
"to empty their mana reserves!", TODO Make this area based and drain completely of mana or a rune and drain passively.
"You gain a third of the absorbed mana!"),*/
ExplosiveRune(SpellElement.RUNES, // Spell element
"Explosive Rune", // Spell name
new ItemStack(Material.FIREBALL), // Spell icon
SpellExplosiveRune.class, // Spell class
3, // Spell max level
60, // Mana cost
30, // Spell cooldown
0, // Mana cost change per level
0, // Cooldown change per level
5, // Item amount in loot
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "Spell Level",
C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level + 1",
"",
"Draws a rune that explodes after a delay!"),
Fireball(SpellElement.ATTACK, // Spell element
"Fireball", // Spell name
new ItemStack(Material.FIREBALL), // Spell icon
@ -142,6 +63,44 @@ public enum SpellType // ❤
"Teleport to the block you are looking at!"),
FrostBarrier(SpellElement.MISC, // Spell element
"Frost Barrier", // Spell name
new ItemStack(Material.ICE), // Spell icon
SpellFrostBarrier.class, // Spell class
3, // Spell max level
60, // Mana cost
30, // Spell cooldown
0, // Mana cost change per level
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Height: " + C.Bold + C.cWhite + "Spell Level + 1",
C.cGold + C.Bold + "Width: " + C.Bold + C.cWhite + "Spell Level x 5",
"",
"Create a wall of ice!"),
Gust(SpellElement.MISC, // Spell element
"Gust", // Spell name
new ItemStack(Material.FEATHER), // Spell icon
SpellGust.class, // Spell class
3, // Spell max level
60, // Mana cost
20, // Spell cooldown
0, // Mana cost change per level
0, // Cooldown change per level
5, // Item amount in loot
C.cGold + C.Bold + "Gust Size: " + C.Bold + C.cWhite + "10 x Spell Level blocks",
C.cGold + C.Bold + "Gust Strenth: " + C.Bold + C.cWhite + "Spell Level x 30%",
"",
"Cast the spell and watch your enemies fly!"),
Heal(SpellElement.SUPPORT, // Spell element
"Heal", // Spell name
new ItemStack(Material.POTION, 1, (short) 8261), // Spell icon
@ -161,26 +120,64 @@ public enum SpellType // ❤
"Use this! Heal yourself up!"),
HealingRune(SpellElement.RUNES, // Spell element
"Rune of Healing", // Spell name
new ItemStack(Material.POTION, 1, (short) 8197), // Spell icon
SpellHealingRune.class, // Spell class
/*Drain(SpellElement.MISC, // Spell element
"Drain", // Spell name
new ItemStack(Material.BUCKET), // Spell icon
SpellDrain.class, // Spell class
3, // Spell max level
30, // Mana cost
20, // Spell cooldown
-3, // Mana cost change per level
-4, // Cooldown change per level
3, // Item amount in loot
"",
"Right click other players with this spell",
"to empty their mana reserves!", TODO Make this area based and drain completely of mana or a rune and drain passively.
"You gain a third of the absorbed mana!"),*/
IcePrison(SpellElement.ATTACK, // Spell element
"Ice Prison", // Spell name
new ItemStack(Material.ICE), // Spell icon
SpellIcePrison.class, // Spell class
3, // Spell max level
60, // Mana cost
30, // Spell cooldown
50, // Mana cost
20, // Spell cooldown
0, // Mana cost change per level
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Size: " + C.Bold + C.cWhite + "(Spell Level x 0.5) + 2",
C.cGold + C.Bold + "Lasts for: " + C.Bold + C.cWhite + "(Spell Level x 3) + 5 seconds",
C.cGold + C.Bold + "Size: " + C.Bold + C.cWhite + "Spell Level + 3",
"",
"Draws a rune of healing players can step inside",
"On impact creates a mighty ice",
"to recover their health."),
"prison to capture thy enemies!"),
IceShards(SpellElement.ATTACK, // Spell element
"Ice Shards", // Spell name
new ItemStack(Material.GHAST_TEAR), // Spell icon
SpellIceShards.class, // Spell class
3, // Spell max level
30, // Mana cost
20, // Spell cooldown
0, // Mana cost change per level
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Shards: " + C.Bold + C.cWhite + "Spell Level + 1",
"",
"Stack the damage and hit them consecutively!",
"Each shard from the same spell will deal",
"more damage for every shard that hit!"),
Implode(SpellElement.MISC, // Spell element
"Implode", // Spell name
@ -205,67 +202,6 @@ public enum SpellType // ❤
"and scatters them about the area"),
Lance(SpellElement.ATTACK, // Spell element
"Lance", // Spell name
new ItemStack(Material.STICK), // Spell icon
SpellLance.class, // Spell class
3, // Spell max level
75, // Mana cost
50, // Spell cooldown
0, // Mana cost change per level
-10, // Cooldown change per level
10, // Item amount in loot
C.cGold + C.Bold + "Lance Size: " + C.Bold + C.cWhite + "Spell Level x 6",
"",
"Summon an lance of explosions!"),
Launch(SpellElement.MISC, // Spell element
"Launch", // Spell name
new ItemStack(Material.FEATHER), // Spell icon
SpellLaunch.class, // Spell class
3, // Spell max level
60, // Mana cost
20, // Spell cooldown
0, // Mana cost change per level
0, // Cooldown change per level
5, // Item amount in loot
C.cGold + C.Bold + "Launch Height: " + C.Bold + C.cWhite + "(Spell Level x 3) + 5 blocks",
"",
"Cast the spell by hitting the victim",
"and they will be sent flying into the air!"),
LaunchRune(SpellElement.RUNES, // Spell element
"Launch Rune", // Spell name
new ItemStack(Material.FEATHER), // Spell icon
SpellLaunchRune.class, // Spell class
3, // Spell max level
60, // Mana cost
30, // Spell cooldown
0, // Mana cost change per level
0, // Cooldown change per level
5, // Item amount in loot
C.cGold + C.Bold + "Launch Height: " + C.Bold + C.cWhite + "(Spell Level x 2) + 5 blocks",
C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level x 0.8",
"",
"Draws a white rune on the ground",
"Rune lasts for a minute and will",
"activate when stepped on to launch",
"the people into the air"),
LightningStrike(SpellElement.ATTACK, // Spell element
"Lightning Strike", // Spell name
new ItemStack(Material.WOOD_AXE), // Spell icon
@ -280,7 +216,7 @@ public enum SpellType // ❤
"",
"Summon a mighty lightning strike",
"to hit the target you point out!"),
MagicMissile(SpellElement.ATTACK, // Spell element
@ -304,6 +240,27 @@ public enum SpellType // ❤
"This creates a magic missile that is commonly attributed to the magic profession."),
Napalm(SpellElement.ATTACK, // Spell element
"Napalm", // Spell name
new ItemStack(Material.FIREBALL), // Spell icon
SpellNapalm.class, // Spell class
3, // Spell max level
60, // Mana cost
60, // Spell cooldown
5, // Mana cost change per level
-10, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "(Spell Level x 4) + 8",
"",
"Create fire into being where your",
"vision falls, a wall of fire!",
"* Fire resistance not included."),
RainbowBeam(SpellElement.ATTACK, // Spell element
"Rainbow Beam", // Spell name
new ItemStack(Material.EMERALD), // Spell icon
@ -315,17 +272,36 @@ public enum SpellType // ❤
1, // Cooldown change per level
10, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 3",
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2*",
C.cGold + C.Bold + "Ramge: " + C.Bold + C.cWhite + "Spell Level x 20",
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "80",
"",
"Magical girl beam of rainbows!",
"Finally you too can be a",
"This may not do much damage,",
"magical girl of love and hope!",
"but it sure is pretty!"),
"Damage lowers after 30 blocks!"),
RainbowPath(SpellElement.MISC, // Spell element
"Rainbow Path", // Spell name
new ItemStack(Material.STAINED_GLASS, 1, (short) 4), // Spell icon
SpellRainbowPath.class, // Spell class
3, // Spell max level
50, // Mana cost
20, // Spell cooldown
0, // Mana cost change per level
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 10",
"",
"Summon into being a mighty path",
"of rainbows for thee to walk on!"),
Rumble(SpellElement.ATTACK, // Spell element
"Rumble", // Spell name
@ -342,13 +318,36 @@ public enum SpellType // ❤
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 10",
C.cGold + C.Bold + "Slowness Level: " + C.Bold + C.cWhite + "Spell Level",
"",
"Creates an targeted earthquake",
"in the direction you point",
"from the block you left click!"),
"from the block you left click!",
"Effected players lose their footing!"),
SpectralArrow(SpellElement.ATTACK, // Spell element
"Spectral Arrow", // Spell name
new ItemStack(Material.ARROW), // Spell icon
SpellSpectralArrow.class, // Spell class
3, // Spell max level
40, // Mana cost
15, // Spell cooldown
-5, // Mana cost change per level
0, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Distance / (8 - Spell Level)",
"",
"Shoot an arrow that penetrates!",
"Further the distance, higher the damage!"),
SpeedBoost(SpellElement.SUPPORT, // Spell element
"Speed Boost", // Spell name
@ -356,12 +355,12 @@ public enum SpellType // ❤
SpellSpeedBoost.class, // Spell class
2, // Spell max level
20, // Mana cost
100, // Spell cooldown
40, // Spell cooldown
0, // Mana cost change per level
0, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 30",
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "20 seconds",
C.cGold + C.Bold + "Strength: " + C.Bold + C.cWhite + "Spell Level",
@ -369,42 +368,6 @@ public enum SpellType // ❤
"Gain a speed potion effect to outrun your enemies"),
Spiderman(SpellElement.MISC, // Spell element
"Spiderman", // Spell name
new ItemStack(Material.WEB), // Spell icon
SpellSpiderman.class, // Spell class
3, // Spell max level
40, // Mana cost
20, // Spell cooldown
-5, // Mana cost change per level
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Webs: " + C.Bold + C.cWhite + "Spell Level x 2",
"",
"Shoot webs just like your favorite hero!"),
StoneWall(SpellElement.MISC, // Spell element
"Stone Wall", // Spell name
new ItemStack(Material.STONE), // Spell icon
SpellStoneWall.class, // Spell class
3, // Spell max level
60, // Mana cost
30, // Spell cooldown
0, // Mana cost change per level
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Height: " + C.Bold + C.cWhite + "Spell Level + 1",
C.cGold + C.Bold + "Width: " + C.Bold + C.cWhite + "Spell Level x 5",
"",
"Create a wall of stone!"),
SummonWolves(SpellElement.ATTACK, // Spell element
"Summon Wolves", // Spell name
new ItemStack(Material.MONSTER_EGG, 1, EntityType.WOLF.getTypeId()), // Spell icon
@ -424,32 +387,7 @@ public enum SpellType // ❤
"They will fight for you and after 30 seconds, will disappear"),
TeleportRune(SpellElement.RUNES, // Spell element
"Teleport Rune", // Spell name
new ItemStack(Material.ENDER_PEARL), // Spell icon
SpellTeleportRune.class, // Spell class
3, // Spell max level
70, // Mana cost
40, // Spell cooldown
-5, // Mana cost change per level
-5, // Cooldown change per level
4, // Item amount in loot
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 25",
C.cGold + C.Bold + "Size: " + C.Bold + C.cWhite + "Spell Level x 1.5",
"",
"This draws a teleport rune on the ground",
"The created rune is usable by anyone and lasts",
"for 5 seconds after the 2 second warmup period.",
"The teleport is one way, you cannot return."),
TrapRune(SpellElement.RUNES, // Spell element
TrapRune(SpellElement.MISC, // Spell element
"Trap Rune", // Spell name
new ItemStack(Material.TRAP_DOOR), // Spell icon
SpellTrapRune.class, // Spell class
@ -472,6 +410,23 @@ public enum SpellType // ❤
"The rune takes 5 seconds to prepare and will damage even you!"),
WebShot(SpellElement.ATTACK, // Spell element
"Web Shot", // Spell name
new ItemStack(Material.WEB), // Spell icon
SpellWebShot.class, // Spell class
3, // Spell max level
40, // Mana cost
20, // Spell cooldown
-5, // Mana cost change per level
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Webs: " + C.Bold + C.cWhite + "Spell Level x 2",
"",
"Shoot webs just like your favorite hero!"),
WizardsCompass(SpellElement.MISC, // Spell element
"Wizard's Compass", // Spell name
new ItemStack(Material.COMPASS), // Spell icon
@ -489,19 +444,16 @@ public enum SpellType // ❤
public enum SpellElement
{
ATTACK(0, 0, 1, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cRed + "Attack Spells")
ATTACK(1, 0, 2, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cRed + "Attack Spells")
.addLore(C.cGray + "Spells of destruction").build(), C.cRed),
MISC(7, 7, 8, new ItemBuilder(Material.COAL_BLOCK).setTitle(C.cDGray + "Misc Spells").addLore(
MISC(7, 6, 8, new ItemBuilder(Material.COAL_BLOCK).setTitle(C.cDGray + "Misc Spells").addLore(
C.cGray + "Misc spells that don't fit in",
"These spells generally effect the world itself").build(), C.cGray),
RUNES(3, 3, 3, new ItemBuilder(Material.NETHER_STAR).setTitle(C.cGold + "Rune Spells")
.addLore(C.cGray + "Spells for creation of runes").build(), C.cGold),
SUPPORT(5, 5, 5, new ItemBuilder(Material.IRON_BOOTS).setTitle(C.cDGreen + "Support Spells")
SUPPORT(4, 4, 4, new ItemBuilder(Material.IRON_BOOTS).setTitle(C.cDGreen + "Support Spells")
.addLore(C.cGray + "Spells of assistance").build(), C.cDGreen);
private String _chatColor;
@ -627,6 +579,16 @@ public enum SpellType // ❤
_itemAmount = itemAmount;
}
public int getBaseCooldown()
{
return _spellCooldown;
}
public int getBaseManaCost()
{
return _spellCost;
}
public String[] getDesc()
{
return _desc;
@ -642,16 +604,6 @@ public enum SpellType // ❤
return _itemAmount;
}
public int getBaseManaCost()
{
return _spellCost;
}
public int getBaseCooldown()
{
return _spellCooldown;
}
public int getManaCost(Wizard wizard)
{
return Math.max(0,

View File

@ -3,6 +3,8 @@ package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.explosion.CustomExplosion;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
@ -20,109 +22,113 @@ import org.bukkit.metadata.FixedMetadataValue;
public class SpellDroom extends Spell implements SpellClick
{
private ArrayList<FallingBlock> _fallingBlocks = new ArrayList<FallingBlock>();
private ArrayList<FallingBlock> _fallingBlocks = new ArrayList<FallingBlock>();
@Override
public void castSpell(Player player)
{
ArrayList<Player> players = new ArrayList<Player>();
players.add(player);
int radius = 4 + (getSpellLevel(player) * 2);
@Override
public void castSpell(Player player)
{
ArrayList<Player> players = new ArrayList<Player>();
players.add(player);
int radius = 4 + (getSpellLevel(player) * 2);
for (Entity entity : player.getNearbyEntities(radius, radius * 3, radius))
{
if (entity instanceof Player && Wizards.IsAlive(entity))
{
players.add((Player) entity);
}
}
for (Entity entity : player.getNearbyEntities(radius, radius * 3, radius))
{
if (entity instanceof Player && Wizards.IsAlive(entity))
{
players.add((Player) entity);
}
}
ArrayList<FallingBlock> newFallingBlocks = new ArrayList<FallingBlock>();
ArrayList<FallingBlock> newFallingBlocks = new ArrayList<FallingBlock>();
for (Player p : players)
{
Location loc = p.getLocation().clone().add(0, 15 + (getSpellLevel(player) * 3), 0);
int lowered = 0;
for (Player p : players)
{
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, p.getLocation(), 0, 0, 0, 0, 1);
Location loc = p.getLocation().clone().add(0, 15 + (getSpellLevel(player) * 3), 0);
int lowered = 0;
while (lowered < 5 && loc.getBlock().getType() != Material.AIR)
{
lowered++;
loc = loc.add(0, -1, 0);
}
while (lowered < 5 && loc.getBlock().getType() != Material.AIR)
{
lowered++;
loc = loc.add(0, -1, 0);
}
if (loc.getBlock().getType() == Material.AIR)
{
if (loc.getBlock().getType() == Material.AIR)
{
FallingBlock anvil = p.getWorld().spawnFallingBlock(loc.getBlock().getLocation().add(0.5, 0.5, 0.5),
Material.ANVIL, (byte) 0);
FallingBlock anvil = p.getWorld().spawnFallingBlock(loc.getBlock().getLocation().add(0.5, 0.5, 0.5),
Material.ANVIL, (byte) 0);
anvil.setMetadata("ExplosionSize", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
1 + (getSpellLevel(player) / 2F)));
anvil.setMetadata("ExplosionSize", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
1 + (getSpellLevel(player) / 2F)));
anvil.setMetadata("Wizard", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), player));
anvil.setMetadata("Wizard", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), player));
anvil.getWorld().playSound(anvil.getLocation(), Sound.ANVIL_USE, 1.9F, 0);
anvil.getWorld().playSound(anvil.getLocation(), Sound.ANVIL_USE, 1.9F, 0);
newFallingBlocks.add(anvil);
newFallingBlocks.add(anvil);
}
}
}
}
if (!newFallingBlocks.isEmpty())
{
_fallingBlocks.addAll(newFallingBlocks);
charge(player);
}
}
if (!newFallingBlocks.isEmpty())
{
_fallingBlocks.addAll(newFallingBlocks);
charge(player);
}
}
private void handleAnvil(Entity entity)
{
_fallingBlocks.remove(entity);
private void handleAnvil(Entity entity)
{
_fallingBlocks.remove(entity);
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), entity.getLocation(),
(float) entity.getMetadata("ExplosionSize").get(0).asDouble(), "Droom");
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager()
.GetExplosion(), entity.getLocation(), (float) entity.getMetadata("ExplosionSize").get(0).asDouble(), "Droom");
explosion.setPlayer((Player) entity.getMetadata("Wizard").get(0).value(), true);
explosion.setPlayer((Player) entity.getMetadata("Wizard").get(0).value(), true);
explosion.setDropItems(false);
explosion.setFallingBlockExplosion(true);
explosion.explode();
explosion.setDropItems(false);
entity.remove();
}
explosion.explode();
@EventHandler
public void onDrop(ItemSpawnEvent event)
{
Iterator<FallingBlock> itel = _fallingBlocks.iterator();
FallingBlock b = null;
entity.remove();
}
while (itel.hasNext())
{
FallingBlock block = itel.next();
@EventHandler
public void onDrop(ItemSpawnEvent event)
{
Iterator<FallingBlock> itel = _fallingBlocks.iterator();
FallingBlock b = null;
if (block.isDead())
{
b = block;
break;
}
}
while (itel.hasNext())
{
FallingBlock block = itel.next();
if (b != null)
{
event.setCancelled(true);
handleAnvil(b);
}
}
if (block.isDead())
{
b = block;
break;
}
}
@EventHandler
public void onPlace(EntityChangeBlockEvent event)
{
if (_fallingBlocks.contains(event.getEntity()))
{
handleAnvil(event.getEntity());
event.setCancelled(true);
}
}
if (b != null)
{
event.setCancelled(true);
handleAnvil(b);
}
}
@EventHandler
public void onPlace(EntityChangeBlockEvent event)
{
if (_fallingBlocks.contains(event.getEntity()))
{
handleAnvil(event.getEntity());
event.setCancelled(true);
}
}
}

View File

@ -1,79 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import nautilus.game.arcade.game.games.wizards.spells.subclasses.ExplosiveRune;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.util.Vector;
public class SpellExplosiveRune extends Spell implements SpellClick
{
private ArrayList<ExplosiveRune> _explosiveRunes = new ArrayList<ExplosiveRune>();
@Override
public void castSpell(Player p)
{
Vector vector = p.getEyeLocation().getDirection();
vector.normalize().multiply(0.5);
float trapSize = Math.max(1, 1 + getSpellLevel(p));
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, (int) ((trapSize * 4) + 12));
if (list.size() > 1)
{
Location loc = list.get(0).getLocation().add(0.5, 0, 0.5);
ExplosiveRune rune = new ExplosiveRune(Wizards.getArcadeManager().GetDamage(), loc, p, trapSize);
if (!isValid(rune))
{
p.sendMessage(C.cGreen + "Cannot draw rune on wall");
return;
}
_explosiveRunes.add(rune);
charge(p);
}
}
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
Iterator<ExplosiveRune> itel = _explosiveRunes.iterator();
while (itel.hasNext())
{
ExplosiveRune rune = itel.next();
if (rune.onTick())
{
itel.remove();
}
}
}
}
private boolean isValid(ExplosiveRune rune)
{
return !UtilBlock.solid(rune.getLocation().getBlock())
|| UtilBlock.solid(rune.getLocation().getBlock().getRelative(BlockFace.DOWN));
}
}

View File

@ -18,49 +18,52 @@ import org.bukkit.util.Vector;
public class SpellFireball extends Spell implements SpellClick
{
@EventHandler
public void onHit(ProjectileHitEvent event)
{
Projectile projectile = event.getEntity();
if (projectile.hasMetadata("FireballSpell"))
{
projectile.remove();
@EventHandler
public void onHit(ProjectileHitEvent event)
{
Projectile projectile = event.getEntity();
if (projectile.hasMetadata("FireballSpell"))
{
projectile.remove();
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), projectile.getLocation(),
projectile.getMetadata("FireballYield").get(0).asFloat(), "Fireball");
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager()
.GetExplosion(), projectile.getLocation(), projectile.getMetadata("FireballYield").get(0).asFloat(),
"Fireball");
explosion.setPlayer((Player) projectile.getMetadata("FireballSpell").get(0).value(), true);
explosion.setPlayer((Player) projectile.getMetadata("FireballSpell").get(0).value(), true);
explosion.setDropItems(false);
explosion.setFallingBlockExplosion(true);
explosion.explode();
explosion.setDropItems(false);
}
}
explosion.explode();
@Override
public void castSpell(Player p)
{
org.bukkit.entity.Fireball fireball = (org.bukkit.entity.Fireball) p.getWorld().spawnEntity(p.getEyeLocation(),
EntityType.FIREBALL);
}
}
Vector vector = p.getEyeLocation().getDirection().normalize().multiply(0.14);
@Override
public void castSpell(Player p)
{
org.bukkit.entity.Fireball fireball = (org.bukkit.entity.Fireball) p.getWorld().spawnEntity(p.getEyeLocation(),
EntityType.FIREBALL);
// We can't call the bukkit methods because for some weird reason, it enforces a certain speed.
EntityFireball eFireball = ((CraftFireball) fireball).getHandle();
eFireball.dirX = vector.getX();
eFireball.dirY = vector.getY();
eFireball.dirZ = vector.getZ();
Vector vector = p.getEyeLocation().getDirection().normalize().multiply(0.14);
fireball.setBounce(false);
fireball.setShooter(p);
fireball.setYield(0);
fireball.setMetadata("FireballSpell", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
fireball.setMetadata("FireballYield", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
(getSpellLevel(p) * 0.25F) + 0.8F));
// We can't call the bukkit methods because for some weird reason, it enforces a certain speed.
EntityFireball eFireball = ((CraftFireball) fireball).getHandle();
eFireball.dirX = vector.getX();
eFireball.dirY = vector.getY();
eFireball.dirZ = vector.getZ();
p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F);
charge(p);
}
fireball.setBounce(false);
fireball.setShooter(p);
fireball.setYield(0);
fireball.setMetadata("FireballSpell", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
fireball.setMetadata("FireballYield", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
(getSpellLevel(p) * 0.25F) + 0.8F));
p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F);
charge(p);
}
}

View File

@ -1,48 +1,69 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.List;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class SpellFlash extends Spell implements SpellClick
{
@Override
public void castSpell(Player player)
{
int maxTeleportDistance = 20 + (10 * getSpellLevel(player));
List<Block> list = player.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, maxTeleportDistance);
if (list.size() > 1 && list.get(1).getType() != Material.AIR)
{
Block b = list.get(0);
if (b.getLocation().distance(player.getLocation()) > 2)
{
Location loc = b.getLocation().clone().add(0.5, 0.5, 0.5);
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
player.setFallDistance(0);
player.teleport(loc);
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
charge(player);
}
}
}
@Override
public void castSpell(Player player)
{
int maxRange = 20 + (10 * getSpellLevel(player));
double curRange = 0;
while (curRange <= maxRange)
{
Location newTarget = player.getLocation().add(new Vector(0, 0.2, 0))
.add(player.getLocation().getDirection().multiply(curRange));
if (!UtilBlock.airFoliage(newTarget.getBlock())
|| !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))
break;
// Progress Forwards
curRange += 0.2;
// Smoke Trail
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, newTarget.clone().add(0, 0.5, 0), 0, 0, 0, 0, 1);
}
// Modify Range
curRange -= 0.4;
if (curRange < 0)
curRange = 0;
// Destination
Location loc = player.getLocation()
.add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0)));
if (curRange > 0)
{
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
player.setFallDistance(0);
player.eject();
player.leaveVehicle();
player.teleport(loc);
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
charge(player);
}
}
}

View File

@ -19,7 +19,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.scheduler.BukkitRunnable;
public class SpellStoneWall extends Spell implements SpellClickBlock
public class SpellFrostBarrier extends Spell implements SpellClickBlock
{
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
@ -36,7 +36,7 @@ public class SpellStoneWall extends Spell implements SpellClickBlock
{
itel.remove();
if (entry.getKey().getType() == Material.STONE)
if (entry.getKey().getType() == Material.ICE)
{
entry.getKey().setType(Material.AIR);
}
@ -67,7 +67,7 @@ public class SpellStoneWall extends Spell implements SpellClickBlock
if (block.getType() == Material.AIR)
{
block.setTypeIdAndData(Material.STONE.getId(), (byte) 0, false);
block.setTypeIdAndData(Material.ICE.getId(), (byte) 0, false);
_wallExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
@ -83,7 +83,7 @@ public class SpellStoneWall extends Spell implements SpellClickBlock
if (!UtilBlock.airFoliage(b))
break;
b.setTypeIdAndData(Material.STONE.getId(), (byte) 0, false);
b.setTypeIdAndData(Material.ICE.getId(), (byte) 0, false);
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
@ -16,7 +17,8 @@ public class SpellGust extends Spell implements SpellClick
@Override
public void castSpell(Player player)
{
Vector vector = player.getLocation().getDirection().normalize().multiply(0.3);
Vector vector = player.getLocation().getDirection().setY(0).normalize().setY(0.3)
.multiply(0.8 + (getSpellLevel(player) * 0.3D));
HashMap<Player, Double> effected = UtilPlayer.getPlayersInPyramid(player, 45, 10 * getSpellLevel(player));

View File

@ -1,70 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import nautilus.game.arcade.game.games.wizards.spells.subclasses.HealingRune;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class SpellHealingRune extends Spell implements SpellClick
{
private ArrayList<HealingRune> _healingRunes = new ArrayList<HealingRune>();
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
Iterator<HealingRune> itel = _healingRunes.iterator();
while (itel.hasNext())
{
HealingRune rune = itel.next();
if (rune.onTick())
{
itel.remove();
}
}
}
}
@Override
public void castSpell(Player player)
{
Block b = player.getTargetBlock(null, 25 * getSpellLevel(player));
while (b.getType() != Material.AIR && b.getY() < 250)
{
b = b.getRelative(BlockFace.UP);
}
if (b.getRelative(BlockFace.DOWN).getType() == Material.AIR)
{
player.sendMessage(ChatColor.RED + "Unable to place a rune!");
return;
}
Location firstTeleport = player.getLocation();
firstTeleport.setY(firstTeleport.getBlockY());
HealingRune healingRune = new HealingRune(Wizards, firstTeleport, getSpellLevel(player));
_healingRunes.add(healingRune);
charge(player);
}
}

View File

@ -0,0 +1,121 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
public class SpellIcePrison extends Spell implements SpellClick, IThrown
{
private HashMap<Block, Long> _prisonExpires = new HashMap<Block, Long>();
@Override
public void castSpell(final Player player)
{
shoot(player, getSpellLevel(player));
charge(player);
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != data.GetThrower())
{
IcePrison(data);
}
}
@Override
public void Expire(ProjectileUser data)
{
IcePrison(data);
}
public void IcePrison(ProjectileUser data)
{
Location loc = data.GetThrown().getLocation();
data.GetThrown().remove();
HashMap<Block, Double> blocks = UtilBlock.getInRadius(loc.getBlock(),
data.GetThrown().getMetadata("PrisonStrength").get(0).asDouble(), true);
for (Block block : blocks.keySet())
{
if (UtilBlock.airFoliage(block))
{
block.setType(Material.ICE);
_prisonExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
}
loc.getWorld().playSound(loc, Sound.ANVIL_LAND, 1.7F, 0.8F);
}
@Override
public void Idle(ProjectileUser data)
{
IcePrison(data);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
Iterator<Entry<Block, Long>> itel = _prisonExpires.entrySet().iterator();
while (itel.hasNext())
{
Entry<Block, Long> entry = itel.next();
if (entry.getValue() < System.currentTimeMillis())
{
itel.remove();
if (entry.getKey().getType() == Material.ICE)
{
entry.getKey().setType(Material.AIR);
}
}
}
}
private void shoot(Player player, int spellLevel)
{
if (Wizards.IsAlive(player))
{
org.bukkit.entity.Item ent = player.getWorld().dropItem(
player.getLocation().add(0, 0.5, 0),
ItemStackFactory.Instance.CreateStack(Material.PACKED_ICE, (byte) 0, 1, "Ice Prison" + player.getName() + " "
+ System.currentTimeMillis()));
ent.setMetadata("PrisonStrength", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), 3 + spellLevel));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.7, false, 0, 0.2, 10, false);
Wizards.getArcadeManager().GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2d);
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0.8F);
}
}
}

View File

@ -0,0 +1,164 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector;
public class SpellIceShards extends Spell implements SpellClick, IThrown
{
private HashMap<ArrayList<Entity>, Integer> _hitShards = new HashMap<ArrayList<Entity>, Integer>();
private HashMap<ArrayList, Long> _shardsExpire = new HashMap<ArrayList, Long>();
@Override
public void castSpell(final Player player)
{
final ArrayList<Entity> firedShards = new ArrayList<Entity>();
_shardsExpire.put(firedShards, System.currentTimeMillis() + 60000);
shoot(player, firedShards);
for (int i = 1; i <= getSpellLevel(player); i++)
{
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
@Override
public void run()
{
shoot(player, firedShards);
}
}, i * 4);
}
charge(player);
}
@EventHandler
public void onSecond(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
if (!Wizards.IsLive())
return;
Iterator<Entry<ArrayList, Long>> itel = _shardsExpire.entrySet().iterator();
while (itel.hasNext())
{
Entry<ArrayList, Long> entry = itel.next();
if (entry.getValue() < System.currentTimeMillis())
{
itel.remove();
_hitShards.remove(entry.getKey());
}
}
}
private void shoot(Player player, ArrayList<Entity> firedShards)
{
if (Wizards.IsAlive(player))
{
// Boost
org.bukkit.entity.Item ent = player.getWorld().dropItem(
player.getLocation().add(0, 0.5, 0),
ItemStackFactory.Instance.CreateStack(Material.GHAST_TEAR, (byte) 0, 1, "Ice Shard " + player.getName() + " "
+ System.currentTimeMillis()));
firedShards.add(ent);
UtilAction.velocity(ent, player.getLocation().getDirection(), 2.3, false, 0, 0.2, 10, false);
Wizards.getArcadeManager().GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2d);
player.getWorld().playSound(player.getLocation(), Sound.CLICK, 1.2F, 0.8F);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null)
{
int timesHit = 0;
for (ArrayList<Entity> arrayList : _hitShards.keySet())
{
if (arrayList.contains(data.GetThrown()))
{
timesHit = _hitShards.get(arrayList);
_hitShards.put(arrayList, timesHit + 1);
break;
}
}
// Damage Event
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 2 + (timesHit * 2), false, false,
false, UtilEnt.getName(data.GetThrower()), "Ice Shard");
if (timesHit > 0)
{
UtilPlayer.message(data.GetThrower(), "Ice Shards" + ": " + F.elem(timesHit + " Consecutive Hits") + C.cGray
+ " (" + F.skill("+" + (2 + (timesHit * 2)) + " Damage") + C.cGray + ")");
}
}
handleShard(data);
}
private void handleShard(ProjectileUser data)
{
data.GetThrown().remove();
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, Material.ICE);
}
@Override
public void Idle(ProjectileUser data)
{
handleShard(data);
}
@Override
public void Expire(ProjectileUser data)
{
handleShard(data);
}
}

View File

@ -1,85 +1,157 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.scheduler.BukkitRunnable;
public class SpellImplode extends Spell implements SpellClick
{
@Override
public void castSpell(Player p)
{
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 50);
@Override
public void castSpell(final Player p)
{
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 50);
if (list.size() > 1)
{
BlockFace face = list.get(0).getFace(list.get(1));
if (list.size() > 1)
{
Block centerBlock = list.get(0);
Block centerBlock = list.get(0);
int maxDist = (int) Math.floor(centerBlock.getLocation().distance(p.getLocation().getBlock().getLocation())) / 2;
final Location centerLocation = centerBlock.getLocation().clone().add(0.5, 0.5, 0.5);
final ArrayList<Block> effectedBlocks = new ArrayList<Block>();
int size = (int) (1.5F + (getSpellLevel(p) * 0.7F));
for (int i = 0; i < Math.min(maxDist, getSpellLevel(p) * 2); i++)
{
if (centerBlock.getRelative(face) != null)
{
centerBlock = centerBlock.getRelative(face);
}
}
for (int x = -size * 2; x <= size * 2; x++)
{
for (int y = -size * 2; y <= size * 2; y++)
{
for (int z = -size * 2; z <= size * 2; z++)
{
Block effectedBlock = centerBlock.getRelative(x, y, z);
Location centerLocation = centerBlock.getLocation().clone().add(0.5, 0.5, 0.5);
int size = (int) (1.5F + (getSpellLevel(p) * 0.7F));
if (effectedBlock.getType() == Material.AIR || effectedBlock.getType() == Material.BEDROCK
|| effectedBlocks.contains(effectedBlock))
{
continue;
}
for (int x = -size * 2; x <= size * 2; x++)
{
for (int y = -size; y <= size; y++)
{
for (int z = -size * 2; z <= size * 2; z++)
{
Block effectedBlock = centerBlock.getRelative(x, y, z);
if ((centerLocation.distance(effectedBlock.getLocation().add(0.5, 0.5, 0.5)) + Math.abs(y / 4D))
if (effectedBlock.getLocation().distance(centerBlock.getLocation()) <= size * 2
&& !(effectedBlock.getState() instanceof InventoryHolder))
{
<= ((size * 2) + UtilMath.random.nextFloat())
if (effectedBlock.getType() == Material.BEDROCK)
{
continue;
}
&& !(effectedBlock.getState() instanceof InventoryHolder))
{
FallingBlock block = effectedBlock.getWorld().spawnFallingBlock(effectedBlock.getLocation(),
effectedBlock.getType(), effectedBlock.getData());
effectedBlocks.add(effectedBlock);
}
}
}
}
block.setVelocity(centerLocation.toVector()
.subtract(effectedBlock.getLocation().add(0.5, 0.5, 0.5).toVector()).normalize());
Collections.shuffle(effectedBlocks);
block.setDropItem(false);
new BukkitRunnable()
{
int timesRan;
Iterator<Block> bItel;
effectedBlock.setType(Material.AIR);
}
}
}
}
public void run()
{
{
Block block = effectedBlocks.get(UtilMath.r(effectedBlocks.size()));
block.getWorld().playSound(block.getLocation(),
new Random().nextBoolean() ? Sound.DIG_GRAVEL : Sound.DIG_GRASS, 2,
UtilMath.random.nextFloat() / 4);
}
for (Player player : Bukkit.getOnlinePlayers())
{
player.playSound(player == p ? p.getLocation() : centerBlock.getLocation(), Sound.ENDERDRAGON_GROWL, 1.5F, 1.5F);
}
if (timesRan % 3 == 0)
{
for (int a = 0; a < Math.ceil(effectedBlocks.size() / 3D); a++)
{
if (bItel == null || !bItel.hasNext())
{
bItel = effectedBlocks.iterator();
}
charge(p);
}
}
Block block = bItel.next();
for (int i = 0; i < 6; i++)
{
BlockFace face = BlockFace.values()[i];
Block b = block.getRelative(face);
if (UtilBlock.airFoliage(b))
{
UtilParticle.PlayParticle(
ParticleType.BLOCK_CRACK.getParticle(block.getType(), block.getData()),
block.getLocation().add(
0.5 + (face.getModX() * 0.6D),
0.5 + (face.getModY() * 0.6D),
0.5 + (face.getModZ() * 0.6D)),
face.getModX() / 2F, face.getModX() / 2F, face.getModX() / 2F, 0, 6);
}
}
}
}
if (effectedBlocks.isEmpty())
{
cancel();
}
else if (timesRan++ >= 20)
{
Iterator<Block> itel = effectedBlocks.iterator();
while (itel.hasNext())
{
Block block = itel.next();
if (block.getType() == Material.AIR || block.getState() instanceof InventoryHolder)
{
itel.remove();
continue;
}
}
Wizards.getArcadeManager().GetExplosion().BlockExplosion(effectedBlocks, centerLocation, false);
for (Player player : Bukkit.getOnlinePlayers())
{
player.playSound(player == p ? p.getLocation() : centerLocation, Sound.ENDERDRAGON_GROWL, 1.5F, 1.5F);
}
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
charge(p);
}
}
}

View File

@ -1,101 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.explosion.CustomExplosion;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class SpellLance extends Spell implements SpellClick
{
private ArrayList<Entry<ArrayList<Location>, Player>> _locations = new ArrayList<Entry<ArrayList<Location>, Player>>();
@Override
public void castSpell(Player player)
{
// Player p = UtilPlayer.getPlayerInSight(player, 10 * getSpellLevel(player), true);
Location l = null;
// if (p == null)
// {
List<Block> b = player.getLastTwoTargetBlocks(UtilBlock.blockPassSet, 6 * getSpellLevel(player));
if (!b.isEmpty())
l = b.get(0).getLocation().add(0.5, 0.5, 0.5).add(player.getEyeLocation().getDirection().normalize().multiply(2));
/* }
else
{
l = p.getEyeLocation();
}*/
if (l != null)
{
ArrayList<Location> locs = UtilShapes.getLinesDistancedPoints(player.getLocation(), l, 1.5);
Iterator<Location> itel = locs.iterator();
while (itel.hasNext())
{
Location loc = itel.next();
if (loc.distance(player.getLocation()) <= 1.5)
{
itel.remove();
}
}
if (!locs.isEmpty())
{
charge(player);
explode(locs.remove(0), player);
if (!locs.isEmpty())
{
_locations.add(new HashMap.SimpleEntry(locs, player));
}
}
}
}
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
Iterator<Entry<ArrayList<Location>, Player>> itel = _locations.iterator();
while (itel.hasNext())
{
Entry<ArrayList<Location>, Player> next = itel.next();
explode(next.getKey().remove(0), next.getValue());
if (next.getKey().isEmpty())
{
itel.remove();
}
}
}
}
private void explode(Location loc, Player player)
{
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), loc, 1.2F, "Lance");
explosion.setPlayer(player, false);
explosion.setDropItems(false);
explosion.setIgnoreRate(false);
explosion.explode();
}
}

View File

@ -1,100 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import nautilus.game.arcade.game.games.wizards.spells.subclasses.LaunchRune;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.util.Vector;
public class SpellLaunchRune extends Spell implements SpellClick
{
private ArrayList<LaunchRune> _launchRunes = new ArrayList<LaunchRune>();
@Override
public void castSpell(Player p)
{
Vector vector = p.getEyeLocation().getDirection();
vector.normalize().multiply(0.5);
Vector v = p.getEyeLocation().toVector();
int i = 0;
Location loc = null;
int spellLevel = getSpellLevel(p);
final float trapSize = Math.max(1, spellLevel * 0.8F);
while (i++ < (trapSize * 4) + 12)
{
v.add(vector);
Block b = v.toLocation(p.getWorld()).getBlock();
if (UtilBlock.solid(b))
{
while (UtilBlock.solid(b))
{
double dist = Math.sqrt(Math.pow(v.getX() - v.getBlockX(), 2) + Math.pow(v.getY() - v.getBlockY(), 2)
+ Math.pow(v.getZ() - v.getBlockZ(), 2)) + 0.01;
b = v.subtract(vector.normalize().multiply(dist)).toLocation(p.getWorld()).getBlock();
}
loc = v.toLocation(p.getWorld());
loc.setY(loc.getBlockY());
}
}
if (loc == null)
return;
LaunchRune rune = new LaunchRune(Wizards, p, loc, trapSize, spellLevel);
if (!isValid(rune))
{
p.sendMessage(C.cGreen + "Cannot draw rune on wall");
return;
}
_launchRunes.add(rune);
charge(p);
}
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
Iterator<LaunchRune> itel = _launchRunes.iterator();
while (itel.hasNext())
{
LaunchRune rune = itel.next();
if (rune.onTick())
{
itel.remove();
}
}
}
}
private boolean isValid(LaunchRune rune)
{
return !UtilBlock.solid(rune.getLocation().getBlock())
|| UtilBlock.solid(rune.getLocation().getBlock().getRelative(BlockFace.DOWN));
}
}

View File

@ -49,7 +49,7 @@ public class SpellLightningStrike extends Spell implements SpellClick
lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
}
}, 20);
}, 8);
charge(p);
}

View File

@ -0,0 +1,99 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.Random;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
public class SpellNapalm extends Spell implements SpellClick
{
@Override
public void castSpell(Player player)
{
final int length = 8 + (4 * getSpellLevel(player));
final Vector vector = player.getLocation().getDirection().normalize().multiply(0.5);
final Location loc = player.getLocation().add(vector.clone().multiply(2));
final Location playerLoc = player.getLocation();
new BukkitRunnable()
{
int blocksTravelled;
public void run()
{
for (int i = 0; i < 4; i++)
{
loc.add(vector);
if (!UtilBlock.airFoliage(loc.getBlock()))
{
cancel();
break;
}
for (int x = -1; x <= 1; x++)
{
for (int y = -1; y <= 1; y++)
{
for (int z = -1; z <= 1; z++)
{
if (loc.getBlockY() + y < 256 && loc.getBlockY() + y > 0)
{
Block block = loc.getBlock().getRelative(x, y, z);
if (UtilMath.offset(playerLoc, block.getLocation()) < 2)
{
continue;
}
if (!UtilAlg.HasSight(loc, block.getLocation().add(0.5, 0.5, 0.5)))
{
continue;
}
if (block.getType() == Material.AIR)
{
for (int a = 0; a < 6; a++)
{
Block b = block.getRelative(BlockFace.values()[a]);
if (b.getType().isFlammable())
{
block.setType(Material.FIRE);
block.getWorld().playSound(block.getLocation(), Sound.FIRE_IGNITE, 1,
1 + ((new Random().nextFloat() - 0.5F) / 3F));
break;
}
}
}
}
}
}
}
}
blocksTravelled += 2;
if (blocksTravelled >= length)
{
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 1);
charge(player);
}
}

View File

@ -17,47 +17,57 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class SpellRainbowBeam extends Spell implements SpellClick
{
@Override
public void castSpell(Player p)
{
Entity entityTarget = UtilPlayer.getEntityInSight(p, 20 * getSpellLevel(p), true, true, true, 1.9F);
@Override
public void castSpell(Player p)
{
Entity entityTarget = UtilPlayer.getEntityInSight(p, 80, true, true, true, 1.9F);
if (!(entityTarget instanceof LivingEntity))
{
entityTarget = null;
}
if (!(entityTarget instanceof LivingEntity))
{
entityTarget = null;
}
Location loc;
if (entityTarget != null)
{
Location loc;
if (entityTarget != null)
{
loc = p.getEyeLocation().add(
p.getEyeLocation().getDirection().normalize()
.multiply(0.3 + p.getEyeLocation().distance(((LivingEntity) entityTarget).getEyeLocation())));
loc = p.getEyeLocation().add(
p.getEyeLocation().getDirection().normalize()
.multiply(0.3 + p.getEyeLocation().distance(((LivingEntity) entityTarget).getEyeLocation())));
// The above code makes the beam appear to hit them where you aimed.
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent((LivingEntity) entityTarget, p, null, DamageCause.CUSTOM, (getSpellLevel(p) * 2) + 4F, true,
true, false, "Rainbow Beam", "Rainbow Beam");
double damage = (getSpellLevel(p) * 2) + 4F;
double dist = loc.distance(p.getLocation()) - (80 * .2D);
p.playSound(entityTarget.getLocation(), Sound.LEVEL_UP, (getSpellLevel(p) * 2) + 6, 1);
// If target is more than 20% away
if (dist > 0)
{
damage -= damage * (dist / (80 * .8D));
}
else
{
loc = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 20 * getSpellLevel(p)).get(0).getLocation()
.add(0.5, 0.5, 0.5);
}
damage = Math.max(1, damage);
}
for (Location l : UtilShapes.getLinesDistancedPoints(p.getEyeLocation().subtract(0, 0.1, 0), loc, 1))
{
l.getWorld().spigot().playEffect(l, Effect.POTION_SWIRL, 0, 0, 0, 0, 0, 500, 1, 30);
}
// The above code makes the beam appear to hit them where you aimed.
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent((LivingEntity) entityTarget, p, null, DamageCause.CUSTOM, damage, true, true, false,
"Rainbow Beam", "Rainbow Beam");
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.5F, 1);
p.playSound(entityTarget.getLocation(), Sound.LEVEL_UP, (getSpellLevel(p) * 2) + 6, 1);
charge(p);
}
}
else
{
loc = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 80).get(0).getLocation().add(0.5, 0.5, 0.5);
}
for (Location l : UtilShapes.getLinesDistancedPoints(p.getEyeLocation().subtract(0, 0.1, 0), loc, 0.3))
{
l.getWorld().spigot().playEffect(l, Effect.POTION_SWIRL, 0, 0, 0, 0, 0, 500, 1, 30);
}
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.5F, 1);
charge(p);
}
}

View File

@ -7,6 +7,7 @@ import java.util.Map.Entry;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
@ -61,7 +62,7 @@ public class SpellRainbowPath extends Spell implements SpellClick, SpellClickBlo
@Override
public void castSpell(Player p)
{
Vector vector = p.getEyeLocation().getDirection().setY(0).normalize();
Vector vector = p.getEyeLocation().getDirection().normalize().setY(-1);
vector.setX(Math.round(vector.getX()));
vector.setZ(Math.round(vector.getZ()));
@ -72,11 +73,14 @@ public class SpellRainbowPath extends Spell implements SpellClick, SpellClickBlo
@Override
public void castSpell(Player p, final Block target)
{
final Vector vector = p.getEyeLocation().getDirection().normalize().multiply(0.5);
vector.setY(Math.max(Math.min(vector.getY(), -0.5), 0.5));
vector.normalize();
final BlockFace face = radial[Math.round(p.getLocation().getYaw() / 45f) & 0x7];
p.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, Material.WOOL.getId(), _rainbow[UtilMath.r(_rainbow.length)]);
double yMod = Math.min(Math.max(p.getLocation().getPitch() / 30, -1), 1);
final Vector vector = new Vector(face.getModX(), -yMod, face.getModZ());
p.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, Material.WOOL.getId(),
_rainbow[UtilMath.r(_rainbow.length)]);
p.getWorld().playSound(p.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
final int maxDist = 10 * getSpellLevel(p);
@ -97,12 +101,14 @@ public class SpellRainbowPath extends Spell implements SpellClick, SpellClickBlo
}
loc.add(vector);
Block block = loc.getBlock();
BlockFace[] faces = UtilShapes.getSideBlockFaces(block, face);
Block[] bs = new Block[]
{
block, UtilAlg.getLeft(vector).toLocation(block.getWorld()).getBlock(),
UtilAlg.getRight(vector).toLocation(block.getWorld()).getBlock()
block, block.getRelative(faces[0]), block.getRelative(faces[1])
};
for (Block b : bs)
@ -119,7 +125,7 @@ public class SpellRainbowPath extends Spell implements SpellClick, SpellClickBlo
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
block.getWorld().playSound(block.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
}

View File

@ -1,15 +1,26 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Collection;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.AnimalTamer;
@ -17,164 +28,274 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable;
public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
{
final private BlockFace[] _radial =
{
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
};
final private BlockFace[] _radial =
{
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
};
public void castSpell(Player player)
{
Block block = player.getLocation().add(0, -1, 0).getBlock();
public void castSpell(Player player)
{
Block block = player.getLocation().add(0, -1, 0).getBlock();
if (!UtilBlock.solid(block))
{
block = block.getRelative(BlockFace.DOWN);
}
if (!UtilBlock.solid(block))
{
block = block.getRelative(BlockFace.DOWN);
}
castSpell(player, block);
}
castSpell(player, block);
}
@Override
public void castSpell(final Player player, final Block target)
{
@EventHandler
public void onDamage(CustomDamageEvent event)
{
if (event.GetReason() != null && event.GetReason().equals("Rumble"))
{
event.AddKnockback("Rumble", 1);
}
}
if (UtilBlock.solid(target))
{
@Override
public void castSpell(final Player player, final Block target)
{
final BlockFace moveDirection = _radial[Math.round(player.getEyeLocation().getYaw() / 45f) & 0x7];
final int spellLevel = getSpellLevel(player);
final int damage = 4 + (spellLevel * 2);
final int maxDist = 10 * spellLevel;
if (UtilBlock.solid(target))
{
player.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, target.getTypeId());
final BlockFace moveDirection = _radial[Math.round(player.getEyeLocation().getYaw() / 45f) & 0x7];
final int spellLevel = getSpellLevel(player);
final int damage = 4 + (spellLevel * 2);
final int maxDist = 10 * spellLevel;
new BukkitRunnable()
{
private Block _currentBlock = target;
private int _distTravelled = 0;
private ArrayList<Integer> _effected = new ArrayList<Integer>();
private ArrayList<Block> _previousBlocks = new ArrayList<Block>();
playBlockEffect(target);
@Override
public void run()
{
if (!player.isOnline() || !Wizards.IsAlive(player))
{
cancel();
return;
}
new BukkitRunnable()
{
private Block _currentBlock = target;
private int _distTravelled = 0;
private ArrayList<Integer> _effected = new ArrayList<Integer>();
private ArrayList<Block> _previousBlocks = new ArrayList<Block>();
_currentBlock = _currentBlock.getRelative(moveDirection);
private void endRun()
{
ArrayList<Block> bs = new ArrayList<Block>();
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
{
BlockFace[] faces = UtilShapes.getSideBlockFaces(_currentBlock, moveDirection);
_currentBlock = _currentBlock.getRelative(BlockFace.UP);
bs.add(_currentBlock);
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
{
cancel();
return;
}
for (int i = 1; i <= Math.min(4, Math.floor(_distTravelled / (8D - spellLevel))) + 1; i++)
{
for (int a = 0; a < faces.length; a++)
{
Block b = _currentBlock.getRelative(faces[a], i);
}
else if (!UtilBlock.solid(_currentBlock) && _currentBlock.getY() > 0)
{
if (UtilBlock.solid(b))
{
bs.add(b);
}
}
}
_currentBlock = _currentBlock.getRelative(BlockFace.DOWN);
for (Block block : bs)
{
}
ArrayList<Block> toExplode = new ArrayList<Block>();
if (!UtilBlock.solid(_currentBlock))
{
cancel();
return;
}
toExplode.add(block);
ArrayList<Block> bs = new ArrayList<Block>();
for (BlockFace face : new BlockFace[]
{
BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH, BlockFace.NORTH, BlockFace.UP,
BlockFace.DOWN
})
{
if (UtilMath.random.nextBoolean())
{
Block b = block.getRelative(face);
BlockFace[] faces = UtilShapes.getSideBlockFaces(_currentBlock, moveDirection);
if (b.getType() != Material.AIR && b.getType() != Material.BEDROCK)
{
if (!toExplode.contains(b))
{
toExplode.add(b);
}
}
}
}
bs.add(_currentBlock);
Wizards.getArcadeManager().GetExplosion()
.BlockExplosion(toExplode, block.getLocation().add(0.5, 0, 0.5), false);
}
for (int i = 1; i <= Math.min(4, Math.floor(_distTravelled / (8D - spellLevel))) + 1; i++)
{
for (int a = 0; a < faces.length; a++)
{
Block b = _currentBlock.getRelative(faces[a], i);
cancel();
}
if (UtilBlock.solid(b))
{
bs.add(b);
}
}
}
@Override
public void run()
{
if (!player.isOnline() || !Wizards.IsAlive(player))
{
endRun();
return;
}
_previousBlocks.addAll(bs);
_currentBlock = _currentBlock.getRelative(moveDirection);
for (Block b : _previousBlocks)
{
for (Entity entity : b.getChunk().getEntities())
{
if (entity instanceof LivingEntity && player != entity && !_effected.contains(entity.getEntityId()))
{
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
{
if (entity instanceof Tameable)
{
AnimalTamer tamer = ((Tameable) entity).getOwner();
_currentBlock = _currentBlock.getRelative(BlockFace.UP);
if (tamer != null && tamer == player)
{
continue;
}
}
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
{
endRun();
return;
}
Location loc = entity.getLocation();
}
else if (!UtilBlock.solid(_currentBlock) && _currentBlock.getY() > 0)
{
if (loc.getBlockX() == b.getX() && loc.getBlockZ() == b.getZ())
{
_currentBlock = _currentBlock.getRelative(BlockFace.DOWN);
if (entity instanceof Player && !Wizards.IsAlive(entity))
{
continue;
}
}
double height = loc.getY() - b.getY();
if (height >= 0 && height <= 2)
{
Wizards.Manager.GetDamage().NewDamageEvent((LivingEntity) entity, player, null,
DamageCause.CUSTOM, damage, false, true, false, "Rumble", "Rumble");
}
if (!UtilBlock.solid(_currentBlock))
{
endRun();
return;
}
_effected.add(entity.getEntityId());
}
}
}
}
ArrayList<Block> effectedBlocks = new ArrayList<Block>();
_previousBlocks = bs;
BlockFace[] faces = UtilShapes.getSideBlockFaces(_currentBlock, moveDirection);
for (Block b : bs)
{
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId(), 19); // 19 being particle view
// distance
}
effectedBlocks.add(_currentBlock);
if (_distTravelled++ >= maxDist)
{
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 1);
playBlockEffect(_currentBlock);
charge(player);
}
}
for (int i = 1; i <= Math.min(4, Math.floor(_distTravelled / (8D - spellLevel))) + 1; i++)
{
for (int a = 0; a < faces.length; a++)
{
Block b = _currentBlock.getRelative(faces[a], i);
if (UtilBlock.solid(b))
{
effectedBlocks.add(b);
playBlockEffect(b);
}
}
}
_previousBlocks.addAll(effectedBlocks);
for (Block b : _previousBlocks)
{
for (Entity entity : b.getChunk().getEntities())
{
if (entity instanceof LivingEntity && player != entity && !_effected.contains(entity.getEntityId()))
{
if (entity instanceof Tameable)
{
AnimalTamer tamer = ((Tameable) entity).getOwner();
if (tamer != null && tamer == player)
{
continue;
}
}
Location loc = entity.getLocation();
if (loc.getBlockX() == b.getX() && loc.getBlockZ() == b.getZ())
{
if (entity instanceof Player && !Wizards.IsAlive(entity))
{
continue;
}
double height = loc.getY() - b.getY();
if (height >= 0 && height <= 2)
{
Wizards.Manager.GetDamage().NewDamageEvent((LivingEntity) entity, player, null,
DamageCause.CUSTOM, damage, true, true, false, "Rumble", "Rumble");
if (entity instanceof Player)
{
Wizards.getArcadeManager()
.GetCondition()
.Factory()
.Slow("Rumble", (LivingEntity) entity, player, 60, spellLevel, false, false,
false, false);
}
}
_effected.add(entity.getEntityId());
}
}
}
}
_previousBlocks = effectedBlocks;
if (_distTravelled++ >= maxDist)
{
endRun();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 1);
charge(player);
}
}
private void playBlockEffect(Block block)
{
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());/*
final int entityId = UtilEnt.getNewEntityId();
PacketPlayOutSpawnEntity fallingSpawn = new PacketPlayOutSpawnEntity();
fallingSpawn.a = entityId;
fallingSpawn.b = (block.getX() * 32) + 16;
fallingSpawn.c = (block.getY() * 32) + 4;
fallingSpawn.d = (block.getZ() * 32) + 16;
fallingSpawn.i = 70;
fallingSpawn.k = block.getTypeId() | block.getData() << 16;
fallingSpawn.f = 10000;
final Collection<? extends Player> players = Bukkit.getOnlinePlayers();
for (Player player : players)
{
UtilPlayer.sendPacket(player, fallingSpawn);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
public void run()
{
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(new int[]
{
entityId
});
for (Player player : players)
{
UtilPlayer.sendPacket(player, destroyPacket);
}
}
}, 15);*/
}
}

View File

@ -0,0 +1,85 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.metadata.FixedMetadataValue;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
public class SpellSpectralArrow extends Spell implements SpellClick
{
private HashMap<Arrow, Location> _spectralArrows = new HashMap<Arrow, Location>();
@Override
public void castSpell(Player player)
{
Arrow arrow = player.shootArrow();
arrow.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), getSpellLevel(player)));
_spectralArrows.put(arrow, player.getLocation());
charge(player);
}
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<Arrow> itel = _spectralArrows.keySet().iterator();
while (itel.hasNext())
{
Arrow entity = itel.next();
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, entity.getLocation(), 0, 0, 0, 0, 1);
}
}
@EventHandler
public void onSecond(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
Iterator<Arrow> itel = _spectralArrows.keySet().iterator();
while (itel.hasNext())
{
Arrow entity = itel.next();
if (entity.isOnGround() || !entity.isValid())
{
itel.remove();
}
}
}
@EventHandler
public void onDamage(CustomDamageEvent event)
{
Location loc = _spectralArrows.remove(event.GetDamagerEntity(true));
if (loc != null)
{
int spellLevel = event.GetDamagerEntity(true).getMetadata("SpellLevel").get(0).asInt();
event.AddMod("Negate Damage", "Negate Damage", -event.GetDamage(), false);
event.AddMod("Spectral Arrow", "Spectral Arrow", loc.distance(event.GetDamageeEntity().getLocation()) / (7D - spellLevel), true);
}
}
}

View File

@ -1,87 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import nautilus.game.arcade.game.games.wizards.spells.subclasses.TeleportRune;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class SpellTeleportRune extends Spell implements SpellClick
{
private ArrayList<TeleportRune> _teleportRunes = new ArrayList<TeleportRune>();
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
Iterator<TeleportRune> itel = _teleportRunes.iterator();
while (itel.hasNext())
{
TeleportRune rune = itel.next();
if (rune.tickRune())
{
itel.remove();
}
}
}
}
@Override
public void castSpell(Player player)
{
Block b = player.getTargetBlock(null, 25 * getSpellLevel(player));
while (b.getType() != Material.AIR && b.getY() < 250)
{
b = b.getRelative(BlockFace.UP);
}
if (b.getRelative(BlockFace.DOWN).getType() == Material.AIR)
{
player.sendMessage(ChatColor.RED + "Unable to place a rune!");
return;
}
Location firstTeleport = player.getLocation();
for (int i = 0; i < 3 && firstTeleport.getBlockY() > 1
&& !UtilBlock.solid(firstTeleport.getBlock().getRelative(BlockFace.DOWN)); i++)
{
firstTeleport.add(0, -1, 0);
}
firstTeleport = firstTeleport.getBlock().getLocation().add(firstTeleport.getX() % 1, 0, firstTeleport.getZ() % 1);
Location secondTeleport = b.getLocation().add(0.5, 0, 0.5);
double runeSize = 1.5D * getSpellLevel(player);
if (firstTeleport.distance(secondTeleport) > runeSize * 2)
{
TeleportRune teleportRune = new TeleportRune(firstTeleport, secondTeleport, runeSize);
_teleportRunes.add(teleportRune);
charge(player);
}
else
{
player.sendMessage(ChatColor.RED + "Target location too close");
}
}
}

View File

@ -6,6 +6,8 @@ import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.updater.UpdateType;
@ -16,7 +18,6 @@ import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import nautilus.game.arcade.game.games.wizards.spells.subclasses.TrapRune;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -26,179 +27,194 @@ import org.bukkit.event.EventHandler;
public class SpellTrapRune extends Spell implements SpellClick
{
private ArrayList<TrapRune> _runes = new ArrayList<TrapRune>();
private ArrayList<TrapRune> _runes = new ArrayList<TrapRune>();
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
Iterator<TrapRune> itel = _runes.iterator();
while (itel.hasNext())
{
TrapRune rune = itel.next();
if (!rune.RuneCaster.isOnline() || UtilPlayer.isSpectator(rune.RuneCaster))
{
itel.remove();
}
else if (rune.TicksLived++ > 2000)
{
itel.remove();
}
else
{
if (rune.TicksLived <= 100)
{
if (rune.TicksLived % 15 == 0)
initialParticles(rune.RuneLocation, rune.RuneSize);
}
else
{
if (!isValid(rune))
{
trapCard(rune);
itel.remove();
}
else
{
for (Player player : Wizards.GetPlayers(true))
{
if (isInTrap(rune.RuneLocation, player.getLocation(), rune.RuneSize))
{
trapCard(rune);
itel.remove();
break;
}
}
}
}
}
}
}
}
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
Iterator<TrapRune> itel = _runes.iterator();
while (itel.hasNext())
{
TrapRune rune = itel.next();
public void initialParticles(Location trapLocation, double trapSize)
{
for (Location loc : getBox(trapLocation, trapSize, 0.3))
{
for (double y = 0; y < 1; y += 0.2)
{
trapLocation.getWorld().spigot().playEffect(loc, Effect.FLAME, 0, 0, 0, 0, 0, 0, 1, 30);
}
}
}
if (!rune.RuneCaster.isOnline() || UtilPlayer.isSpectator(rune.RuneCaster))
{
itel.remove();
}
else if (rune.TicksLived++ > 2000)
{
itel.remove();
}
else
{
if (rune.TicksLived <= 100)
{
if (rune.TicksLived % 15 == 0)
{
initialParticles(rune.RuneLocation, rune.RuneSize);
}
private ArrayList<Location> getBox(Location trapLocation, double trapSize, double spacing)
{
ArrayList<Location> boxLocs = getBoxCorners(trapLocation, trapSize);
ArrayList<Location> returns = new ArrayList<Location>();
if (rune.TicksLived == 100)
{
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, rune.RuneLocation, 0, rune.RuneSize / 4, 0,
rune.RuneSize / 4, (int) (rune.RuneSize * 10));
}
}
else
{
if (!isValid(rune))
{
trapCard(rune);
itel.remove();
}
else
{
for (Player player : Wizards.GetPlayers(true))
{
if (isInTrap(rune.RuneLocation, player.getLocation(), rune.RuneSize))
{
trapCard(rune);
for (int i = 0; i < boxLocs.size(); i++)
{
itel.remove();
break;
}
}
}
}
}
}
}
}
int a = i + 1 >= boxLocs.size() ? 0 : i + 1;
returns.addAll(UtilShapes.getLinesDistancedPoints(boxLocs.get(i), boxLocs.get(a), spacing));
returns.add(boxLocs.get(i));
public void initialParticles(Location trapLocation, double trapSize)
{
for (Location loc : getBox(trapLocation, trapSize, 0.3))
{
for (double y = 0; y < 1; y += 0.2)
{
trapLocation.getWorld().spigot().playEffect(loc, Effect.SMOKE, 0, 0, 0, 0, 0, 0, 1, 30);
}
}
}
}
return returns;
}
private ArrayList<Location> getBox(Location trapLocation, double trapSize, double spacing)
{
ArrayList<Location> boxLocs = getBoxCorners(trapLocation, trapSize);
ArrayList<Location> returns = new ArrayList<Location>();
private ArrayList<Location> getBoxCorners(Location center, double boxSize)
{
ArrayList<Location> boxPoints = new ArrayList<Location>();
for (int i = 0; i < boxLocs.size(); i++)
{
boxPoints.add(center.clone().add(-boxSize, 0, -boxSize));
boxPoints.add(center.clone().add(boxSize, 0, -boxSize));
boxPoints.add(center.clone().add(boxSize, 0, boxSize));
boxPoints.add(center.clone().add(-boxSize, 0, boxSize));
int a = i + 1 >= boxLocs.size() ? 0 : i + 1;
returns.addAll(UtilShapes.getLinesDistancedPoints(boxLocs.get(i), boxLocs.get(a), spacing));
returns.add(boxLocs.get(i));
return boxPoints;
}
}
return returns;
}
private boolean isInTrap(Location trapLocation, Location loc, double trapSize)
{
if (loc.getX() >= trapLocation.getX() - trapSize && loc.getX() <= trapLocation.getX() + trapSize)
{
if (loc.getZ() >= trapLocation.getZ() - trapSize && loc.getZ() <= trapLocation.getZ() + trapSize)
{
if (loc.getY() >= trapLocation.getY() - 0.1 && loc.getY() <= trapLocation.getY() + 0.9)
{
return true;
}
}
}
return false;
}
private ArrayList<Location> getBoxCorners(Location center, double boxSize)
{
ArrayList<Location> boxPoints = new ArrayList<Location>();
private boolean isValid(TrapRune rune)
{
return !UtilBlock.solid(rune.RuneLocation.getBlock())
|| UtilBlock.solid(rune.RuneLocation.getBlock().getRelative(BlockFace.DOWN));
/*
for (double x = -rune.RuneSize; x <= rune.RuneSize; x++)
{
for (double z = -rune.RuneSize; z <= rune.RuneSize; z++)
{
boxPoints.add(center.clone().add(-boxSize, 0, -boxSize));
boxPoints.add(center.clone().add(boxSize, 0, -boxSize));
boxPoints.add(center.clone().add(boxSize, 0, boxSize));
boxPoints.add(center.clone().add(-boxSize, 0, boxSize));
Block b = rune.RuneLocation.clone().add(x, 0, z).getBlock();
if (UtilBlock.solid(b) || !UtilBlock.solid(b.getRelative(BlockFace.DOWN)))
{
return false;
}
return boxPoints;
}
}
}*/
}
private boolean isInTrap(Location trapLocation, Location loc, double trapSize)
{
if (loc.getX() >= trapLocation.getX() - trapSize && loc.getX() <= trapLocation.getX() + trapSize)
{
if (loc.getZ() >= trapLocation.getZ() - trapSize && loc.getZ() <= trapLocation.getZ() + trapSize)
{
if (loc.getY() >= trapLocation.getY() - 0.1 && loc.getY() <= trapLocation.getY() + 0.9)
{
return true;
}
}
}
return false;
}
public void trapCard(TrapRune rune)
{
rune.RuneLocation.getWorld().playSound(rune.RuneLocation, Sound.WITHER_SHOOT, 5, (float) rune.RuneSize * 2);
private boolean isValid(TrapRune rune)
{
return !UtilBlock.solid(rune.RuneLocation.getBlock())
|| UtilBlock.solid(rune.RuneLocation.getBlock().getRelative(BlockFace.DOWN));
/*
for (double x = -rune.RuneSize; x <= rune.RuneSize; x++)
{
for (double z = -rune.RuneSize; z <= rune.RuneSize; z++)
{
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), rune.RuneLocation.clone().add(0,
0.3, 0), (float) rune.RuneSize * 1.2F, "Trap Rune");
Block b = rune.RuneLocation.clone().add(x, 0, z).getBlock();
if (UtilBlock.solid(b) || !UtilBlock.solid(b.getRelative(BlockFace.DOWN)))
{
return false;
}
explosion.setPlayer(rune.RuneCaster, true);
}
}*/
}
explosion.setDropItems(false);
public void trapCard(TrapRune rune)
{
rune.RuneLocation.getWorld().playSound(rune.RuneLocation, Sound.WITHER_SHOOT, 5, (float) rune.RuneSize * 2);
explosion.explode();
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager()
.GetExplosion(), rune.RuneLocation.clone().add(0, 0.3, 0), (float) rune.RuneSize * 1.2F, "Trap Rune");
for (Location loc : getBox(rune.RuneLocation, rune.RuneSize, 0.3))
{
for (double y = 0; y < 1; y += 0.2)
{
rune.RuneLocation.getWorld().spigot().playEffect(loc, Effect.FLAME, 0, 0, 0, 0, 0, 0, 1, 30);
}
}
}
explosion.setPlayer(rune.RuneCaster, true);
@Override
public void castSpell(Player p)
{
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, (getSpellLevel(p) * 4) + 4);
explosion.setBlockExplosionSize((float) rune.RuneSize * 2F);
if (list.size() > 1)
{
Location loc = list.get(0).getLocation().add(0.5, 0, 0.5);
explosion.setFallingBlockExplosion(true);
float trapSize = Math.max(1, getSpellLevel(p) * 0.8F);
explosion.setDropItems(false);
TrapRune rune = new TrapRune();
rune.RuneCaster = p;
rune.RuneSize = trapSize;
rune.RuneLocation = loc;
explosion.explode();
if (!isValid(rune))
{
p.sendMessage(C.cGreen + "Cannot draw rune on wall");
return;
}
for (Location loc : getBox(rune.RuneLocation, rune.RuneSize, 0.3))
{
for (double y = 0; y < 1; y += 0.2)
{
rune.RuneLocation.getWorld().spigot().playEffect(loc, Effect.SMOKE, 0, 0, 0, 0, 0, 0, 1, 30);
}
}
}
initialParticles(loc, trapSize);
_runes.add(rune);
charge(p);
}
}
@Override
public void castSpell(Player p)
{
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, (getSpellLevel(p) * 4) + 4);
if (list.size() > 1)
{
Location loc = list.get(0).getLocation().add(0.5, 0, 0.5);
float trapSize = Math.max(1, getSpellLevel(p) * 0.8F);
TrapRune rune = new TrapRune();
rune.RuneCaster = p;
rune.RuneSize = trapSize;
rune.RuneLocation = loc;
if (!isValid(rune))
{
p.sendMessage(C.cGreen + "Cannot draw rune on wall");
return;
}
initialParticles(loc, trapSize);
_runes.add(rune);
charge(p);
}
}
}

View File

@ -12,6 +12,7 @@ import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -50,37 +51,37 @@ public class SpellWebShot extends Spell implements SpellClick, IThrown
if (Wizards.IsAlive(player))
{
// Boost
UtilAction.velocity(player, 1.2, 0.2, 1.2, true);
org.bukkit.entity.Item ent = player.getWorld().dropItem(
player.getLocation().add(0, 0.5, 0),
ItemStackFactory.Instance.CreateStack(Material.WEB, (byte) 0, 1,
"Web " + player.getName() + " " + System.currentTimeMillis()));
Vector random = new Vector(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5);
random.normalize();
random.multiply(0.2);
UtilAction.velocity(ent, player.getLocation().getDirection().multiply(-1).add(random), 1 + Math.random() * 0.4,
false, 0, 0.2, 10, false);
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.5, false, 0, 0.2, 10, false);
Wizards.getArcadeManager().GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2d);
player.getWorld().playSound(player.getLocation(), Sound.CLICK, 1.2F, 0.8F);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null)
if (target != data.GetThrower())
{
data.GetThrown().remove();
if (target != null)
{
data.GetThrown().remove();
// Damage Event
Wizards.getArcadeManager().GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 2, false, false, false,
UtilEnt.getName(data.GetThrower()), "Web Shot");
// Damage Event
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 2, false, false, false,
UtilEnt.getName(data.GetThrower()), "Web Shot");
}
Web(data);
}
Web(data);
}
@Override

View File

@ -1,62 +1,111 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.hologram.Hologram;
import mineplex.core.hologram.Hologram.HologramTarget;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class SpellWizardsCompass extends Spell implements SpellClick
{
@Override
public void castSpell(Player p)
{
double dist = 9999;
Player closestPlayer = null;
@Override
public void castSpell(Player p)
{
Location loc = p.getEyeLocation().subtract(0, 1, 0);
ArrayList<Player> players = Wizards.GetPlayers(true);
for (Player player : Wizards.GetPlayers(true))
{
double newDist = player.getLocation().distance(p.getLocation());
int counter = 0;
if (newDist > 10 && (closestPlayer == null || newDist < dist))
{
final int[][] ints = new int[27][];
closestPlayer = player;
dist = newDist;
int c = 0;
}
}
for (int x = -1; x <= 1; x++)
{
if (closestPlayer != null)
{
int particlesPlayed = 0;
for (int y = -1; y <= 1; y++)
{
for (Location loc : UtilShapes.getLinesDistancedPoints(
p.getEyeLocation().subtract(p.getEyeLocation().getDirection().normalize().multiply(-0.3)).subtract(0, .5, 0),
closestPlayer.getEyeLocation(), 0.3))
{
for (int z = -1; z <= 1; z++)
{
ints[c++] = new int[]
{
x, y, z
};
}
}
}
if (particlesPlayed++ > 13)
{
break;
}
boolean foundSomeone = false;
loc.getWorld().spigot().playEffect(loc, Effect.HAPPY_VILLAGER, 0, 0, 0.1F, 0.1F, 0.1F, 0, 4, 25);
for (Player enemy : players)
{
if (UtilMath.offset(p, enemy) <= 10)
{
continue;
}
}
foundSomeone = true;
charge(p);
}
else
{
final int count = counter++;
p.sendMessage(C.cRed + "All players are less than 10 blocks from you!");
final Vector traj = UtilAlg.getTrajectory(p.getLocation(), enemy.getEyeLocation()).multiply(0.1);
}
final Hologram hologram = new Hologram(Wizards.getArcadeManager().getHologramManager(), loc.clone().add(0, 0.3, 0)
.add(traj.clone().normalize().multiply(7)), enemy.getName());
}
hologram.setHologramTarget(HologramTarget.WHITELIST);
hologram.addPlayer(p);
hologram.start();
final Location location = loc.clone();
new BukkitRunnable()
{
int i = 0;
public void run()
{
for (int a = 0; a < 2; a++)
{
// Colored redstone dust
UtilParticle.PlayParticle(ParticleType.RED_DUST, location.add(traj), ints[count][0], ints[count][1],
ints[count][2], 1, 0);
i++;
}
if (i > (7 * 10))
{
hologram.stop();
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
}
if (!foundSomeone)
{
p.sendMessage(C.cRed + "All players are less than 10 blocks from you!");
}
else
{
p.playSound(p.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
charge(p);
}
}
}

View File

@ -1,62 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.explosion.CustomExplosion;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public class ExplosiveRune
{
private Location _explosiveLocation;
private Player _explosiveOwner;
private float _explosiveSize;
private int _ticksTillExplode = 60;
private DamageManager _damageManager;
public boolean onTick()
{
_ticksTillExplode--;
if (_ticksTillExplode <= 0)
{
CustomExplosion explosion = new CustomExplosion(_damageManager, _explosiveLocation, _explosiveSize, "Explosive Rune");
explosion.setPlayer(_explosiveOwner, true);
explosion.setDropItems(false);
explosion.explode();
drawBoxParticles();
return true;
}
return false;
}
public ExplosiveRune(DamageManager damageManager, Location loc, Player player, float size)
{
_explosiveLocation = loc;
_explosiveOwner = player;
_explosiveSize = size;
_damageManager = damageManager;
drawBoxParticles();
}
public Location getLocation()
{
return _explosiveLocation;
}
private void drawBoxParticles()
{
for (Location loc : UtilShapes.getDistancedCircle(_explosiveLocation, 0.3, _explosiveSize * 1.3D))
{
UtilParticle.PlayParticle(ParticleType.FLAME, loc, 0, 0, 0, 0, 1);
}
}
}