Merge pull request #15 in MIN/mineplex from Wizards to master

* commit 'fbafeca1503c782aedf328c9561352595bcf2a46': (27 commits)
  Wizards: Remove block burn flag true
  Wizards: Re-sorted spells
  Wizards: Temporary resource pack
  ResourcePackCode: Fixed the return to hub sender displaying the wrong message. Bad downloads are now sent back to hub.
  Wizards: Current progress
  ResourcePack: Add constructors to GameType for resource pack urls, sorted the enum's by name
  Wizards: Latest changes by Chiss
  Wizards: Added new food Cheese, removed other foods and raised spawn chance of remaining
  Wizards: Changed spell icons for resource pack
  Wizards: Spell levels are now viewable on items in chest as item amount
  Wizards: More changes as per demand.
  Wizards Napalm: Make glazed blocks more common, raise damage
  CustomExplosion: Fixed loop, added max damage
  UtilBlock: Added a method that may or may not tell you the blocks destroyed in an explosion
  Wizards: Balancing
  UtilParticle: Added lore for future reference on colored particles.
  UtilShapes: Fixed getting BlockFace's being bugged and weird sometimes, added another method to get diagonal faces between two diagonals
  CustomExplosion: Added option to limit falling blocks that spawn, removed 'Reason' to prevent CustomDamageEvent from using a mod instead of initialDamage (wtf?)
  Wizards changes
  IcePathData: Compare Material instead of integers
  ...
This commit is contained in:
libraryaddict 2015-04-30 22:45:53 -05:00
commit ec5d25b04b
65 changed files with 6352 additions and 4661 deletions

View File

@ -4,11 +4,16 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import net.minecraft.server.v1_7_R4.Blocks;
import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R4.WorldServer;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class UtilBlock public class UtilBlock
@ -304,7 +309,13 @@ public class UtilBlock
return blockList; return blockList;
} }
public static HashMap<Block, Double> getInRadius(Block block, double dR) public static HashMap<Block, Double> getInRadius(Block block, double dR)
{
return getInRadius(block, dR, false);
}
public static HashMap<Block, Double> getInRadius(Block block, double dR, boolean hollow)
{ {
HashMap<Block, Double> blockList = new HashMap<Block, Double>(); HashMap<Block, Double> blockList = new HashMap<Block, Double>();
int iR = (int)dR + 1; int iR = (int)dR + 1;
@ -317,9 +328,11 @@ public class UtilBlock
double offset = UtilMath.offset(block.getLocation(), curBlock.getLocation()); double offset = UtilMath.offset(block.getLocation(), curBlock.getLocation());
if (offset <= dR) if (offset <= dR && !(hollow && offset < dR - 1))
{
blockList.put(curBlock, 1 - (offset / dR)); blockList.put(curBlock, 1 - (offset / dR));
} }
}
return blockList; return blockList;
} }
@ -369,6 +382,74 @@ public class UtilBlock
return block.getRelative(BlockFace.UP); return block.getRelative(BlockFace.UP);
} }
/**
*
* @param location of explosion
* @param strength of explosion
* @param damageBlocksEqually - Treat all blocks as durability of dirt
* @param ensureDestruction - Ensure that the closest blocks are destroyed at least
* @return
*/
public static ArrayList<Block> getExplosionBlocks(Location location, float strength, boolean damageBlocksEqually)
{
ArrayList<Block> toExplode = new ArrayList<Block>();
WorldServer world = ((CraftWorld) location.getWorld()).getHandle();
for (int i = 0; i < 16; i++)
{
for (int j = 0; j < 16; j++)
{
for (int k = 0; k < 16; k++)
{
if ((i == 0) || (i == 16 - 1) || (j == 0) || (j == 16 - 1) || (k == 0) || (k == 16 - 1))
{
double d3 = i / (16 - 1.0F) * 2.0F - 1.0F;
double d4 = j / (16 - 1.0F) * 2.0F - 1.0F;
double d5 = k / (16 - 1.0F) * 2.0F - 1.0F;
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
d3 /= d6;
d4 /= d6;
d5 /= d6;
float f1 = strength * (0.7F + UtilMath.random.nextFloat() * 0.6F);
double d0 = location.getX();
double d1 = location.getY();
double d2 = location.getZ();
for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F)
{
int l = MathHelper.floor(d0);
int i1 = MathHelper.floor(d1);
int j1 = MathHelper.floor(d2);
Block block = location.getWorld().getBlockAt(l, i1, j1);
if (block.getType() != Material.AIR)
{
float f3 = (damageBlocksEqually ? Blocks.DIRT : world.getType(block.getX(), block.getY(),
block.getZ())).a((net.minecraft.server.v1_7_R4.Entity) null);
f1 -= (f3 + 0.3F) * f2;
}
if ((f1 > 0.0F) && (i1 < 256) && (i1 >= 0))
{
toExplode.add(block);
}
d0 += d3 * f2;
d1 += d4 * f2;
d2 += d5 * f2;
}
}
}
}
}
return toExplode;
}
public static ArrayList<Block> getSurrounding(Block block, boolean diagonals) public static ArrayList<Block> getSurrounding(Block block, boolean diagonals)
{ {
ArrayList<Block> blocks = new ArrayList<Block>(); ArrayList<Block> blocks = new ArrayList<Block>();

View File

@ -5,47 +5,116 @@ import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles; import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.Material;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class UtilParticle public class UtilParticle
{ {
public enum ParticleType public enum ParticleType
{ {
HUGE_EXPLOSION("hugeexplosion"),
LARGE_EXPLODE("largeexplode"),
FIREWORKS_SPARK("fireworksSpark"),
BUBBLE("bubble"),
SUSPEND("suspended"),
DEPTH_SUSPEND("depthSuspend"),
TOWN_AURA("townaura"),
CRIT("crit"),
MAGIC_CRIT("magicCrit"),
MOB_SPELL("mobSpell"),
MOB_SPELL_AMBIENT("mobSpellAmbient"),
SPELL("spell"),
INSTANT_SPELL("instantSpell"),
WITCH_MAGIC("witchMagic"),
NOTE("note"),
PORTAL("portal"),
ENCHANTMENT_TABLE("enchantmenttable"),
EXPLODE("explode"),
FLAME("flame"),
LAVA("lava"),
FOOTSTEP("footstep"),
SPLASH("splash"),
LARGE_SMOKE("largesmoke"),
CLOUD("cloud"),
RED_DUST("reddust"),
SNOWBALL_POOF("snowballpoof"),
DRIP_WATER("dripWater"),
DRIP_LAVA("dripLava"),
DROPLET("droplet"),
SNOW_SHOVEL("snowshovel"),
SLIME("slime"),
HEART("heart"),
ANGRY_VILLAGER("angryVillager"), ANGRY_VILLAGER("angryVillager"),
HAPPY_VILLAGER("happyVillager");
BLOCK_CRACK("blockcrack_1_0")
{
@Override
public String getParticle(Material type, int data)
{
return "blockcrack_" + type.getId() + "_" + data;
}
},
BLOCK_DUST("blockdust_1_0")
{
@Override
public String getParticle(Material type, int data)
{
return "blockdust_" + type.getId() + "_" + data;
}
},
BUBBLE("bubble"),
CLOUD("cloud"),
CRIT("crit"),
DEPTH_SUSPEND("depthSuspend"),
DRIP_LAVA("dripLava"),
DRIP_WATER("dripWater"),
DROPLET("droplet"),
ENCHANTMENT_TABLE("enchantmenttable"),
EXPLODE("explode"),
FIREWORKS_SPARK("fireworksSpark"),
FLAME("flame"),
FOOTSTEP("footstep"),
HAPPY_VILLAGER("happyVillager"),
HEART("heart"),
HUGE_EXPLOSION("hugeexplosion"),
ICON_CRACK("iconcrack_1_0")
{
@Override
public String getParticle(Material type, int data)
{
return "iconcrack_" + type.getId() + "_" + data;
}
},
INSTANT_SPELL("instantSpell"),
LARGE_EXPLODE("largeexplode"),
LARGE_SMOKE("largesmoke"),
LAVA("lava"),
MAGIC_CRIT("magicCrit"),
/**
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
*/
MOB_SPELL("mobSpell"),
/**
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
*/
MOB_SPELL_AMBIENT("mobSpellAmbient"),
NOTE("note"),
PORTAL("portal"),
/**
* Can be colored if count is 0, color is RGB and depends on the offset of xyz. Offset y if 0 will default to 1, counter by making it 0.0001
*/
RED_DUST("reddust"),
SLIME("slime"),
SNOW_SHOVEL("snowshovel"),
SNOWBALL_POOF("snowballpoof"),
SPELL("spell"),
SPLASH("splash"),
SUSPEND("suspended"),
TOWN_AURA("townaura"),
WITCH_MAGIC("witchMagic");
public String particleName; public String particleName;
@ -53,10 +122,17 @@ public class UtilParticle
{ {
this.particleName = particleName; this.particleName = particleName;
} }
public String getParticle(Material type, int data)
{
return particleName;
}
} }
public static void PlayParticle(Player player, ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY,
float offsetZ, float speed, int count)
{ {
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(); PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles();
for (Field field : packet.getClass().getDeclaredFields()) for (Field field : packet.getClass().getDeclaredFields())
@ -68,7 +144,7 @@ public class UtilParticle
switch (fieldName) switch (fieldName)
{ {
case "a": case "a":
field.set(packet, type.particleName); //Particle name field.set(packet, particleName); // Particle name
break; break;
case "b": case "b":
field.setFloat(packet, (float) location.getX()); // Block X field.setFloat(packet, (float) location.getX()); // Block X
@ -99,21 +175,43 @@ public class UtilParticle
catch (Exception e) catch (Exception e)
{ {
System.out.println(e.getMessage()); System.out.println(e.getMessage());
return;
} }
} }
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet); return packet;
} }
public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count) public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ,
float speed, int count)
{ {
PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count);
}
public static void PlayParticle(Player player, ParticleType type, Location location, float offsetX, float offsetY,
float offsetZ, float speed, int count)
{
PlayParticle(player, type.particleName, location, offsetX, offsetY, offsetZ, speed, count);
}
public static void PlayParticle(Player player, String particleName, Location location, float offsetX, float offsetY,
float offsetZ, float speed, int count)
{
PacketPlayOutWorldParticles packet = getPacket(particleName, location, offsetX, offsetY, offsetZ, speed, count);
UtilPlayer.sendPacket(player, packet);
}
public static void PlayParticle(String particleName, Location location, float offsetX, float offsetY, float offsetZ,
float speed, int count)
{
PacketPlayOutWorldParticles packet = getPacket(particleName, location, offsetX, offsetY, offsetZ, speed, count);
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
{ {
// Dont send to players who cannot see it! // Dont send to players who cannot see it!
if (type != ParticleType.FIREWORKS_SPARK && if (!particleName.equals(ParticleType.FIREWORKS_SPARK.particleName)
type != ParticleType.LARGE_EXPLODE && && !particleName.equals(ParticleType.LARGE_EXPLODE.particleName)
type != ParticleType.HUGE_EXPLOSION) && !particleName.equals(ParticleType.HUGE_EXPLOSION.particleName))
{ {
if (UtilMath.offset(player.getLocation(), location) > 24) if (UtilMath.offset(player.getLocation(), location) > 24)
{ {
@ -121,7 +219,7 @@ public class UtilParticle
} }
} }
PlayParticle(player, type, location, offsetX, offsetY, offsetZ, speed, count); UtilPlayer.sendPacket(player, packet);
} }
} }
} }

View File

@ -94,7 +94,7 @@ public class UtilShapes
public static Block[] getCornerBlocks(Block b, BlockFace facing) public static Block[] getCornerBlocks(Block b, BlockFace facing)
{ {
BlockFace[] faces = getSideBlockFaces(b, facing); BlockFace[] faces = getSideBlockFaces(facing);
return new Block[] return new Block[]
{ {
b.getRelative(faces[0]), b.getRelative(faces[1]) b.getRelative(faces[0]), b.getRelative(faces[1])
@ -151,35 +151,91 @@ public class UtilShapes
/** /**
* Returns a north/west/east/south block, never a diagonal. * Returns a north/west/east/south block, never a diagonal.
*/ */
public static BlockFace[] getSideBlockFaces(Block b, BlockFace facing) public static BlockFace[] getSideBlockFaces(BlockFace facing)
{ {
BlockFace left = null; return getSideBlockFaces(facing, true);
BlockFace right = null; }
for (int i = 0; i < 4; i++)
public static BlockFace[] getSideBlockFaces(BlockFace facing, boolean allowDiagonal)
{ {
int modifierUp = (diagonalFaces[i] == facing ? 2 : squareFaces[i] == facing ? 1 : 0);
if (modifierUp != 0) int[][] facesXZ;
allowDiagonal = !allowDiagonal && (facing.getModX() != 0 && facing.getModZ() != 0);
facesXZ = new int[][]
{ {
int high = i + modifierUp;
if (high >= squareFaces.length) new int[]
high = high - squareFaces.length;
int low = i - 1;
if (low < 0)
low = squareFaces.length + low;
left = squareFaces[low];
right = squareFaces[high];
return new BlockFace[]
{ {
left, right allowDiagonal ? facing.getModX() : facing.getModZ(), allowDiagonal ? 0 : -facing.getModX()
},
new int[]
{
allowDiagonal ? 0 : -facing.getModZ(), allowDiagonal ? facing.getModZ() : facing.getModX()
}
};
BlockFace[] faces = new BlockFace[2];
for (int i = 0; i < 2; i++)
{
int[] f = facesXZ[i];
for (BlockFace face : BlockFace.values())
{
if (face.getModY() == 0)
{
if (f[0] == face.getModX() && f[1] == face.getModZ())
{
faces[i] = face;
break;
}
}
}
}
if (allowDiagonal && (facing == BlockFace.NORTH_EAST || facing == BlockFace.SOUTH_WEST))
{
faces = new BlockFace[]
{
faces[1], faces[0]
}; };
} }
return faces;
} }
return null;
public static ArrayList<Block> getDiagonalBlocks(Block block, BlockFace facing, int blockWidth)
{
ArrayList<Block> blocks = new ArrayList<Block>();
if (facing.getModX() == 0 || facing.getModZ() == 0)
{
return blocks;
}
BlockFace[] faces = getSideBlockFaces(facing);
for (BlockFace face : faces)
{
Location loc = block.getLocation().add(0.5 + (facing.getModX() / 2D), 0, 0.5 + (facing.getModZ() / 2D));
blocks.add(loc.add(face.getModX() / 2D, 0, face.getModZ() / 2D).getBlock());
for (int i = 1; i < blockWidth; i++)
{
blocks.add(loc.add(face.getModX(), 0, face.getModZ()).getBlock());
}
}
return blocks;
} }
public static Block[] getSideBlocks(Block b, BlockFace facing) public static Block[] getSideBlocks(Block b, BlockFace facing)
{ {
BlockFace[] faces = getSideBlockFaces(b, facing); BlockFace[] faces = getSideBlockFaces(facing);
return new Block[] return new Block[]
{ {
b.getRelative(faces[0]), b.getRelative(faces[1]) b.getRelative(faces[0]), b.getRelative(faces[1])

View File

@ -25,7 +25,6 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.FallingBlock; import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -303,6 +302,11 @@ public class Explosion extends MiniPlugin
} }
public void BlockExplosion(Collection<Block> blockSet, Location mid, boolean onlyAbove) public void BlockExplosion(Collection<Block> blockSet, Location mid, boolean onlyAbove)
{
BlockExplosion(blockSet, mid, onlyAbove, true);
}
public void BlockExplosion(Collection<Block> blockSet, Location mid, boolean onlyAbove, boolean removeBlock)
{ {
if (blockSet.isEmpty()) if (blockSet.isEmpty())
return; return;
@ -320,8 +324,11 @@ public class Explosion extends MiniPlugin
blocks.put(cur, new AbstractMap.SimpleEntry<Integer, Byte>(cur.getTypeId(), cur.getData())); blocks.put(cur, new AbstractMap.SimpleEntry<Integer, Byte>(cur.getTypeId(), cur.getData()));
if (removeBlock)
{
cur.setType(Material.AIR); cur.setType(Material.AIR);
} }
}
//DELAY //DELAY
final Location fLoc = mid; final Location fLoc = mid;

View File

@ -4,37 +4,32 @@ import java.util.ArrayList;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.inventory.meta.ItemMeta;
public class ChestLoot public class ChestLoot
{ {
private int _totalLoot;
private ArrayList<RandomItem> _randomItems = new ArrayList<RandomItem>(); private ArrayList<RandomItem> _randomItems = new ArrayList<RandomItem>();
private int _totalLoot;
private boolean _unbreakableLoot; private boolean _unbreakableLoot;
public ChestLoot(boolean unbreakableLoot)
{
_unbreakableLoot = unbreakableLoot;
}
public ChestLoot() public ChestLoot()
{ {
this(false); this(false);
} }
public ChestLoot(boolean unbreakableLoot)
{
_unbreakableLoot = unbreakableLoot;
}
public void cloneLoot(ChestLoot loot) public void cloneLoot(ChestLoot loot)
{ {
_totalLoot += loot._totalLoot; _totalLoot += loot._totalLoot;
_randomItems.addAll(loot._randomItems); _randomItems.addAll(loot._randomItems);
} }
public void registerLoot(RandomItem item)
{
_totalLoot += item.getAmount();
_randomItems.add(item);
}
public ItemStack getLoot() public ItemStack getLoot()
{ {
int no = UtilMath.r(_totalLoot); int no = UtilMath.r(_totalLoot);
@ -60,4 +55,30 @@ public class ChestLoot
return null; return null;
} }
public void addLoot(ItemStack item, int amount)
{
addLoot(item, amount, item.getAmount(), item.getAmount());
}
public void addLoot(ItemStack item, int amount, int minStackSize, int maxStackSize)
{
addLoot(new RandomItem(item, amount, minStackSize, maxStackSize));
}
public void addLoot(Material material, int amount)
{
addLoot(material, amount, 1, 1);
}
public void addLoot(Material material, int amount, int minStackSize, int maxStackSize)
{
addLoot(new ItemStack(material), amount, minStackSize, maxStackSize);
}
public void addLoot(RandomItem item)
{
_totalLoot += item.getAmount();
_randomItems.add(item);
}
} }

View File

@ -11,6 +11,11 @@ public class RandomItem
private ItemStack _item; private ItemStack _item;
private int _min, _max; private int _min, _max;
public RandomItem(ItemStack item, int amount)
{
this(item, amount, item.getAmount(), item.getAmount());
}
public RandomItem(ItemStack item, int amount, int minStackSize, int maxStackSize) public RandomItem(ItemStack item, int amount, int minStackSize, int maxStackSize)
{ {
_amount = amount; _amount = amount;
@ -19,9 +24,9 @@ public class RandomItem
_max = maxStackSize; _max = maxStackSize;
} }
public RandomItem(ItemStack item, int amount) public RandomItem(Material material, int amount)
{ {
this(item, amount, item.getAmount(), item.getAmount()); this(material, amount, 1, 1);
} }
public RandomItem(Material material, int amount, int minStackSize, int maxStackSize) public RandomItem(Material material, int amount, int minStackSize, int maxStackSize)
@ -32,9 +37,9 @@ public class RandomItem
_max = maxStackSize; _max = maxStackSize;
} }
public RandomItem(Material material, int amount) public int getAmount()
{ {
this(material, amount, 1, 1); return _amount;
} }
public ItemStack getItemStack() public ItemStack getItemStack()
@ -43,9 +48,4 @@ public class RandomItem
return _item; return _item;
} }
public int getAmount()
{
return _amount;
}
} }

View File

@ -0,0 +1,41 @@
package mineplex.core.resourcepack;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
import mineplex.serverdata.commands.CommandCallback;
import mineplex.serverdata.commands.ServerCommand;
import mineplex.serverdata.commands.ServerCommandManager;
public class ResPackManager implements CommandCallback
{
private ResUnloadCheck _packUnloadCheck;
public ResPackManager(ResUnloadCheck packUnloadCheck)
{
_packUnloadCheck = packUnloadCheck;
ServerCommandManager.getInstance().registerCommandType("RedisUnloadResPack", RedisUnloadResPack.class, this);
}
@Override
public void run(ServerCommand command)
{
if (command instanceof RedisUnloadResPack)
{
RedisUnloadResPack redisCommand = (RedisUnloadResPack) command;
Player player = Bukkit.getPlayerExact(redisCommand.getPlayer());
if (player != null)
{
if (_packUnloadCheck.canSendUnload(player))
{
player.setResourcePack("http://www.chivebox.com/file/c/empty.zip");
}
}
}
}
}

View File

@ -0,0 +1,9 @@
package mineplex.core.resourcepack;
import org.bukkit.entity.Player;
public interface ResUnloadCheck
{
public boolean canSendUnload(Player player);
}

View File

@ -0,0 +1,19 @@
package mineplex.core.resourcepack.redis;
import mineplex.serverdata.commands.ServerCommand;
public class RedisUnloadResPack extends ServerCommand
{
private String _player;
public RedisUnloadResPack(String player)
{
_player = player;
}
public String getPlayer()
{
return _player;
}
}

View File

@ -36,6 +36,8 @@ import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish; import mineplex.core.punish.Punish;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.resourcepack.ResUnloadCheck;
import mineplex.core.resourcepack.ResPackManager;
import mineplex.core.serverConfig.ServerConfiguration; import mineplex.core.serverConfig.ServerConfiguration;
import mineplex.core.spawn.Spawn; import mineplex.core.spawn.Spawn;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
@ -127,6 +129,13 @@ public class Hub extends JavaPlugin implements IRelation
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion()); new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
new CustomTagFix(this, packetHandler); new CustomTagFix(this, packetHandler);
new TablistFix(this); new TablistFix(this);
new ResPackManager(new ResUnloadCheck()
{
public boolean canSendUnload(Player player)
{
return true;
}
});
//new Replay(this, packetHandler); //new Replay(this, packetHandler);
new PersonalServerManager(this, clientManager); new PersonalServerManager(this, clientManager);

View File

@ -1,6 +1,8 @@
package mineplex.minecraft.game.core.explosion; package mineplex.minecraft.game.core.explosion;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -45,8 +47,15 @@ public class CustomExplosion extends Explosion
private boolean _createFire; private boolean _createFire;
private boolean _ignoreRate = true; private boolean _ignoreRate = true;
private float _blockExplosionSize; private float _blockExplosionSize;
private boolean _fallingBlockExplosion;
private mineplex.core.explosion.Explosion _explosion;
private float _damage;
private boolean _useCustomDamage;
private int _maxFallingBlocks = -1;
private float _maxDamage = 1000;
public CustomExplosion(DamageManager manager, Location loc, float explosionSize, String deathCause) public CustomExplosion(DamageManager manager, mineplex.core.explosion.Explosion explosion, Location loc, float explosionSize,
String deathCause)
{ {
super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize); super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize);
@ -54,6 +63,25 @@ public class CustomExplosion extends Explosion
_manager = manager; _manager = manager;
_damageReason = deathCause; _damageReason = deathCause;
_blockExplosionSize = explosionSize; _blockExplosionSize = explosionSize;
_explosion = explosion;
}
/**
* Center of explosion does this much damage
*/
public CustomExplosion setExplosionDamage(float damage)
{
_damage = damage;
_useCustomDamage = true;
return this;
}
public CustomExplosion setMaxDamage(float maxDamage)
{
_maxDamage = maxDamage;
return this;
} }
public CustomExplosion setBlockExplosionSize(float explosionSize) public CustomExplosion setBlockExplosionSize(float explosionSize)
@ -70,6 +98,20 @@ public class CustomExplosion extends Explosion
return this; return this;
} }
public CustomExplosion setFallingBlockExplosion(boolean fallingBlockExplosion)
{
_fallingBlockExplosion = fallingBlockExplosion;
return this;
}
public CustomExplosion setFallingBlockExplosionAmount(int maxFallingBlocks)
{
_maxFallingBlocks = maxFallingBlocks;
return this;
}
public CustomExplosion setDamageBlocks(boolean damageBlocks) public CustomExplosion setDamageBlocks(boolean damageBlocks)
{ {
b = damageBlocks; b = damageBlocks;
@ -204,9 +246,21 @@ public class CustomExplosion extends Explosion
d0 /= d8; d0 /= d8;
d1 /= d8; d1 /= d8;
d2 /= d8; d2 /= d8;
// Performs a raytrace that determines the percentage of solid blocks between the two
double d9 = this._world.a(vec3d, entity.boundingBox); double d9 = this._world.a(vec3d, entity.boundingBox);
double d10 = (1.0D - d7) * d9; double d10 = (1.0D - d7) * d9;
int damage = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * this.size + 1.0D); float damage;
if (_useCustomDamage)
{
damage = Math.max(0, (int) ((_damage * d9) * (d8 / size)));
}
else
{
damage = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * this.size + 1.0D);
damage = Math.min(damage, _maxDamage);
}
if (entity.getBukkitEntity() instanceof LivingEntity) if (entity.getBukkitEntity() instanceof LivingEntity)
{ {
@ -282,6 +336,27 @@ public class CustomExplosion extends Explosion
return; return;
} }
if (_fallingBlockExplosion)
{
Collection<org.bukkit.block.Block> blocks = event.GetBlocks();
if (blocks.size() > _maxFallingBlocks)
{
blocks = new ArrayList<org.bukkit.block.Block>(blocks);
Collections.shuffle((ArrayList) blocks);
int toRemove = blocks.size() - _maxFallingBlocks;
for (int i = 0; i < toRemove; i++)
{
blocks.remove(0);
}
}
_explosion.BlockExplosion(blocks, new Location(_world.getWorld(), posX, posY, posZ), false, false);
}
Iterator iterator = this.blocks.iterator(); Iterator iterator = this.blocks.iterator();
while (iterator.hasNext()) while (iterator.hasNext())

View File

@ -3,12 +3,15 @@ package nautilus.game.arcade;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -30,6 +33,8 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import com.google.common.base.Objects;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.achievement.AchievementManager; import mineplex.core.achievement.AchievementManager;
@ -39,11 +44,12 @@ import mineplex.core.chat.Chat;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.cosmetic.CosmeticManager; import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.creature.Creature; import mineplex.core.creature.Creature;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
@ -55,12 +61,19 @@ import mineplex.core.hologram.HologramManager;
import mineplex.core.inventory.InventoryManager; import mineplex.core.inventory.InventoryManager;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.movement.Movement; import mineplex.core.movement.Movement;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketHandler; import mineplex.core.packethandler.PacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.packethandler.PacketPlayResourcePackStatus;
import mineplex.core.packethandler.PacketPlayResourcePackStatus.EnumResourcePackStatus;
import mineplex.core.party.PartyManager; import mineplex.core.party.PartyManager;
import mineplex.core.pet.PetManager; import mineplex.core.pet.PetManager;
import mineplex.core.portal.Portal; import mineplex.core.portal.Portal;
import mineplex.core.preferences.PreferencesManager; import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.resourcepack.ResUnloadCheck;
import mineplex.core.resourcepack.ResPackManager;
import mineplex.core.resourcepack.redis.RedisUnloadResPack;
import mineplex.core.reward.RewardRarity; import mineplex.core.reward.RewardRarity;
import mineplex.core.reward.rewards.PetReward; import mineplex.core.reward.rewards.PetReward;
import mineplex.core.stats.StatsManager; import mineplex.core.stats.StatsManager;
@ -68,7 +81,6 @@ import mineplex.core.status.ServerStatusManager;
import mineplex.core.task.TaskManager; import mineplex.core.task.TaskManager;
import mineplex.core.teleport.Teleport; import mineplex.core.teleport.Teleport;
import mineplex.core.timing.TimingManager; import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Class.ClassManager;
import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager; import mineplex.minecraft.game.classcombat.Condition.SkillConditionManager;
@ -169,6 +181,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
private PacketHandler _packetHandler; private PacketHandler _packetHandler;
private IPacketHandler _resourcePacketHandler;
private String _resourcePackUrl;
private boolean _resourcePackRequired;
private NautHashMap<String, EnumResourcePackStatus> _resourcePackUsers = new NautHashMap<String, EnumResourcePackStatus>();
private NautHashMap<String, Long> _resourcePackNoResponse = new NautHashMap<String, Long>();
// Observers // Observers
private HashSet<Player> _specList = new HashSet<Player>(); private HashSet<Player> _specList = new HashSet<Player>();
@ -301,6 +318,76 @@ public class ArcadeManager extends MiniPlugin implements IRelation
} }
}, 80L); }, 80L);
} }
_resourcePacketHandler = new IPacketHandler()
{
@Override
public void handle(PacketInfo packetInfo)
{
if (_resourcePackUrl != null && packetInfo.getPacket() instanceof PacketPlayResourcePackStatus)
{
final Player player = packetInfo.getPlayer();
final EnumResourcePackStatus response = ((PacketPlayResourcePackStatus) packetInfo.getPacket())
.getResourcePackStatus();
Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
{
@Override
public void run()
{
if (_resourcePackRequired)
{
if (response == EnumResourcePackStatus.ACCEPTED)
{
_resourcePackNoResponse.remove(player.getName());
}
else if (response == EnumResourcePackStatus.DECLINED)
{
_resourcePackNoResponse.remove(player.getName());
returnHubNoResPack(player, "Failed to download resource pack!");
}
else if (response == EnumResourcePackStatus.FAILED_DOWNLOAD)
{
_resourcePackNoResponse.remove(player.getName());
returnHubNoResPack(player, "Failed to download resource pack!");
return;
}
}
if (response == EnumResourcePackStatus.ACCEPTED || response == EnumResourcePackStatus.LOADED)
{
_resourcePackUsers.put(player.getName(), response);
}
else
{
_resourcePackUsers.remove(player.getName());
}
}
});
}
}
};
new ResPackManager(new ResUnloadCheck()
{
public boolean canSendUnload(Player player)
{
if (_resourcePackUsers.containsKey(player.getName()))
{
return false;
}
return true;
}
});
getPacketHandler().addPacketHandler(_resourcePacketHandler);
} }
@Override @Override
@ -1225,4 +1312,129 @@ public class ArcadeManager extends MiniPlugin implements IRelation
return UtilPlayer.isSpectator((Player)player); return UtilPlayer.isSpectator((Player)player);
return false; return false;
} }
@EventHandler
public void onSecond(UpdateEvent event)
{
Iterator<Entry<String, Long>> itel = _resourcePackNoResponse.entrySet().iterator();
while (itel.hasNext())
{
Entry<String, Long> entry = itel.next();
if (UtilTime.elapsed(entry.getValue(), 10000))
{
Player player = Bukkit.getPlayerExact(entry.getKey());
if (player != null)
{
// Send it again, enforce it!
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
player.setResourcePack(_resourcePackUrl);
}
else
{
itel.remove();
}
}
}
}
@EventHandler
public void ResourcePackQuit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
EnumResourcePackStatus status = _resourcePackUsers.get(player.getName());
if (status == EnumResourcePackStatus.ACCEPTED || status == EnumResourcePackStatus.LOADED)
{
new RedisUnloadResPack(player.getName()).publish();
_resourcePackUsers.remove(player.getName());
}
}
@EventHandler
public void outdatedVersion(GameStateChangeEvent event)
{
if (!_resourcePackRequired)
return;
for (Player player : UtilServer.getPlayers())
{
if (!UtilPlayer.is1_8(player))
returnHubNoResPack(player, "You need to be using 1.8 to play " + GetGame().GetName() + "!");
}
}
private void returnHubNoResPack(Player player, String message)
{
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cGold + C.Bold + message);
UtilPlayer.message(player, " ");
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
GetPortal().sendPlayerToServer(player, "Lobby");
}
@EventHandler
public void ResourcePackJoin(PlayerJoinEvent event)
{
Player player = event.getPlayer();
if (!UtilPlayer.is1_8(player) && _resourcePackRequired)
{
returnHubNoResPack(player, "You need to be using 1.8 to play " + GetGame().GetName() + "!");
return;
}
if (_resourcePackUrl != null)
{
if (_resourcePackRequired)
{
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
}
_resourcePackUsers.put(player.getName(), null);
player.setResourcePack(_resourcePackUrl);
}
}
public void setResourcePack(String resourcePack, boolean forceResourcePack)
{
if (!Objects.equal(resourcePack, _resourcePackUrl) || forceResourcePack != _resourcePackRequired)
{
_resourcePackNoResponse.clear();
_resourcePackUsers.clear();
_resourcePackUrl = resourcePack == null || resourcePack.isEmpty() ? null : resourcePack;
_resourcePackRequired = forceResourcePack;
if (_resourcePackUrl == null || _resourcePackUrl.isEmpty())
{
_resourcePackRequired = false;
for (Player player : Bukkit.getOnlinePlayers())
{
player.setResourcePack("http://www.chivebox.com/file/c/empty.zip");
}
}
else
{
for (Player player : Bukkit.getOnlinePlayers())
{
if (_resourcePackRequired)
{
_resourcePackNoResponse.put(player.getName(), System.currentTimeMillis());
}
_resourcePackUsers.put(player.getName(), null);
player.setResourcePack(_resourcePackUrl);
}
}
}
}
} }

View File

@ -8,11 +8,10 @@ public enum GameType
BaconBrawl("Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1), BaconBrawl("Bacon Brawl", Material.PORK, (byte)0, GameCategory.ARCADE, 1),
Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.ARCADE, 2), Barbarians("A Barbarians Life", Material.WOOD_AXE, (byte)0, GameCategory.ARCADE, 2),
Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3), Bridge("The Bridges", Material.IRON_PICKAXE, (byte)0, GameCategory.SURVIVAL, 3),
CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4), CastleSiege("Castle Siege", Material.DIAMOND_CHESTPLATE, (byte)0, GameCategory.CLASSICS, 4),
ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5),
ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6), ChampionsDominate("Champions Domination", "Champions", Material.BEACON, (byte)0, GameCategory.CHAMPIONS, 6),
ChampionsMOBA("Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7), ChampionsMOBA("Champions MOBA", "Champions", Material.SKULL_ITEM, (byte)0, GameCategory.CHAMPIONS, 7),
ChampionsTDM("Champions TDM", "Champions", Material.GOLD_SWORD, (byte)0, GameCategory.CHAMPIONS, 5),
Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8), Christmas("Christmas Chaos", Material.SNOW_BALL, (byte)0, GameCategory.CLASSICS, 8),
DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9), DeathTag("Death Tag", Material.SKULL_ITEM, (byte)0, GameCategory.ARCADE, 9),
DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10), DragonEscape("Dragon Escape", Material.DRAGON_EGG, (byte)0, GameCategory.ARCADE, 10),
@ -27,12 +26,10 @@ public enum GameType
Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19), Halloween("Halloween Horror", Material.PUMPKIN, (byte)0, GameCategory.CLASSICS, 19),
HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20), HideSeek("Block Hunt", Material.GRASS, (byte)0, GameCategory.CLASSICS, 20),
Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21), Horse("Horseback", Material.IRON_BARDING, (byte)0, GameCategory.ARCADE, 21),
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22),
SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 23),
Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24), Micro("Micro Battle", Material.LAVA_BUCKET, (byte)0, GameCategory.ARCADE, 24),
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25), MineStrike("MineStrike", Material.TNT, (byte)0, GameCategory.CLASSICS, 25),
MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.ARCADE, 26), MineWare("MineWare", Material.PAPER, (byte)0, GameCategory.ARCADE, 26),
MilkCow("Milk the Cow", Material.MILK_BUCKET, (byte)0, GameCategory.ARCADE, 27),
Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28), Paintball("Super Paintball", Material.ENDER_PEARL, (byte)0, GameCategory.ARCADE, 28),
Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29), Quiver("One in the Quiver", Material.ARROW, (byte)0, GameCategory.ARCADE, 29),
QuiverTeams("One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.ARCADE, 30), QuiverTeams("One in the Quiver Teams", Material.ARROW, (byte)0, GameCategory.ARCADE, 30),
@ -40,22 +37,23 @@ public enum GameType
SearchAndDestroy("Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32), SearchAndDestroy("Search and Destroy", Material.TNT, (byte)0, GameCategory.SURVIVAL, 32),
Sheep("Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33), Sheep("Sheep Quest", Material.WOOL, (byte)4, GameCategory.ARCADE, 33),
Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34), Smash("Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 34),
SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 35),
SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 36), SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 36),
SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs", Material.SKULL_ITEM, (byte)4, GameCategory.CLASSICS, 35),
Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37), Snake("Snake", Material.WOOL, (byte)0, GameCategory.ARCADE, 37),
SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38), SneakyAssassins("Sneaky Assassins", Material.INK_SACK, (byte)0, GameCategory.ARCADE, 38),
SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.ARCADE, 39), SnowFight("Snow Fight", Material.SNOW_BALL, (byte)0, GameCategory.ARCADE, 39),
Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40), Spleef("Super Spleef", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 40),
SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 41), SpleefTeams("Super Spleef Teams", Material.IRON_SPADE, (byte)0, GameCategory.ARCADE, 41),
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43), SquidShooter("Squid Shooter", Material.FIREWORK_CHARGE, (byte)0, GameCategory.ARCADE, 43),
Stacker("Super Stacker", Material.BOWL, (byte)0, GameCategory.ARCADE, 42),
SurvivalGames("Survival Games", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 22),
SurvivalGamesTeams("Survival Games Teams", Material.IRON_SWORD, (byte)0, GameCategory.SURVIVAL, 23),
Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44), Tug("Tug of Wool", Material.WHEAT, (byte)0, GameCategory.ARCADE, 44),
TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45), TurfWars("Turf Wars", Material.STAINED_CLAY, (byte)14, GameCategory.ARCADE, 45),
UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46), UHC("Ultra Hardcore", Material.GOLDEN_APPLE, (byte)0, GameCategory.SURVIVAL, 46),
WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47), WitherAssault("Wither Assault", Material.SKULL_ITEM, (byte)1, GameCategory.ARCADE, 47),
Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48), Wizards("Wizards", Material.BLAZE_ROD, (byte)0, GameCategory.SURVIVAL, 48, "https://www.dropbox.com/s/qrtc9c91ktvmf3q/WizPack.zip?dl=1", true),
ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49), ZombieSurvival("Zombie Survival", Material.SKULL_ITEM, (byte)2, GameCategory.SURVIVAL, 49),
Build("Master Builders", Material.BRICK, (byte)0, GameCategory.CLASSICS, 50), Build("Master Builders", Material.BRICK, (byte)0, GameCategory.CLASSICS, 50),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999); Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999);
@ -65,6 +63,8 @@ public enum GameType
Material _mat; Material _mat;
byte _data; byte _data;
GameCategory _gameCategory; GameCategory _gameCategory;
boolean _enforceResourcePack;
String _resourcePack;
private int _gameId; // Unique identifying id for this gamemode (used for statistics) private int _gameId; // Unique identifying id for this gamemode (used for statistics)
public int getGameId() { return _gameId; } public int getGameId() { return _gameId; }
@ -74,7 +74,17 @@ public enum GameType
this(name, name, mat, data, gameCategory, gameId); this(name, name, mat, data, gameCategory, gameId);
} }
GameType(String name, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack)
{
this(name, name, mat, data, gameCategory, gameId, resourcePackUrl, enforceResourcePack);
}
GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId) GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId)
{
this(name, lobbyName, mat, data, gameCategory, gameId, null, false);
}
GameType(String name, String lobbyName, Material mat, byte data, GameCategory gameCategory, int gameId, String resourcePackUrl, boolean enforceResourcePack)
{ {
_name = name; _name = name;
_lobbyName = lobbyName; _lobbyName = lobbyName;
@ -82,6 +92,18 @@ public enum GameType
_data = data; _data = data;
_gameCategory = gameCategory; _gameCategory = gameCategory;
_gameId = gameId; _gameId = gameId;
_resourcePack = resourcePackUrl;
_enforceResourcePack = enforceResourcePack;
}
public boolean isEnforceResourcePack()
{
return _enforceResourcePack;
}
public String getResourcePackUrl()
{
return _resourcePack;
} }
public String GetName() public String GetName()

View File

@ -317,6 +317,8 @@ public abstract class Game implements Listener
); );
} }
Manager.setResourcePack(gameType.getResourcePackUrl(), gameType.isEnforceResourcePack());
System.out.println("Loading " + GetName() + "..."); System.out.println("Loading " + GetName() + "...");
} }

View File

@ -1844,129 +1844,129 @@ public class SurvivalGames extends SoloGame
private void setupLoot() private void setupLoot()
{ {
// Food // Food
_baseLoot.registerLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3)); _baseLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
_baseLoot.registerLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.CARROT_ITEM, 30, 1, 3)); _baseLoot.addLoot(new RandomItem(Material.CARROT_ITEM, 30, 1, 3));
_baseLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1)); _baseLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1));
_baseLoot.registerLoot(new RandomItem(Material.WHEAT, 30, 1, 6)); _baseLoot.addLoot(new RandomItem(Material.WHEAT, 30, 1, 6));
_baseLoot.registerLoot(new RandomItem(Material.APPLE, 30, 1, 4)); _baseLoot.addLoot(new RandomItem(Material.APPLE, 30, 1, 4));
_baseLoot.registerLoot(new RandomItem(Material.PORK, 30, 1, 4)); _baseLoot.addLoot(new RandomItem(Material.PORK, 30, 1, 4));
_baseLoot.registerLoot(new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6)); _baseLoot.addLoot(new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6));
// Weapons // Weapons
_baseLoot.registerLoot(new RandomItem(Material.WOOD_AXE, 80)); _baseLoot.addLoot(new RandomItem(Material.WOOD_AXE, 80));
_baseLoot.registerLoot(new RandomItem(Material.WOOD_SWORD, 70)); _baseLoot.addLoot(new RandomItem(Material.WOOD_SWORD, 70));
_baseLoot.registerLoot(new RandomItem(Material.STONE_AXE, 60)); _baseLoot.addLoot(new RandomItem(Material.STONE_AXE, 60));
_baseLoot.registerLoot(new RandomItem(Material.STONE_SWORD, 30)); _baseLoot.addLoot(new RandomItem(Material.STONE_SWORD, 30));
// Leather armor // Leather armor
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_BOOTS, 30)); _baseLoot.addLoot(new RandomItem(Material.LEATHER_BOOTS, 30));
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_CHESTPLATE, 30)); _baseLoot.addLoot(new RandomItem(Material.LEATHER_CHESTPLATE, 30));
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_HELMET, 30)); _baseLoot.addLoot(new RandomItem(Material.LEATHER_HELMET, 30));
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_LEGGINGS, 30)); _baseLoot.addLoot(new RandomItem(Material.LEATHER_LEGGINGS, 30));
// Gold armor // Gold armor
_baseLoot.registerLoot(new RandomItem(Material.GOLD_BOOTS, 25)); _baseLoot.addLoot(new RandomItem(Material.GOLD_BOOTS, 25));
_baseLoot.registerLoot(new RandomItem(Material.GOLD_CHESTPLATE, 25)); _baseLoot.addLoot(new RandomItem(Material.GOLD_CHESTPLATE, 25));
_baseLoot.registerLoot(new RandomItem(Material.GOLD_HELMET, 25)); _baseLoot.addLoot(new RandomItem(Material.GOLD_HELMET, 25));
_baseLoot.registerLoot(new RandomItem(Material.GOLD_LEGGINGS, 25)); _baseLoot.addLoot(new RandomItem(Material.GOLD_LEGGINGS, 25));
// Chain armor // Chain armor
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_BOOTS, 20)); _baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_BOOTS, 20));
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_CHESTPLATE, 20)); _baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_CHESTPLATE, 20));
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_HELMET, 20)); _baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_HELMET, 20));
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_LEGGINGS, 20)); _baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_LEGGINGS, 20));
// Throwable // Throwable
_baseLoot.registerLoot(new RandomItem(Material.FISHING_ROD, 30)); _baseLoot.addLoot(new RandomItem(Material.FISHING_ROD, 30));
_baseLoot.registerLoot(new RandomItem(Material.BOW, 20)); _baseLoot.addLoot(new RandomItem(Material.BOW, 20));
_baseLoot.registerLoot(new RandomItem(Material.ARROW, 20, 1, 3)); _baseLoot.addLoot(new RandomItem(Material.ARROW, 20, 1, 3));
_baseLoot.registerLoot(new RandomItem(Material.SNOW_BALL, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.SNOW_BALL, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.EGG, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.EGG, 30, 1, 2));
// Misc // Misc
_baseLoot.registerLoot(new RandomItem(Material.EXP_BOTTLE, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.EXP_BOTTLE, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.COMPASS, 20)); _baseLoot.addLoot(new RandomItem(Material.COMPASS, 20));
_baseLoot.registerLoot(new RandomItem(Material.STICK, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.STICK, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.BOAT, 15)); _baseLoot.addLoot(new RandomItem(Material.BOAT, 15));
_baseLoot.registerLoot(new RandomItem(Material.FLINT, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.FLINT, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.FEATHER, 30, 1, 2)); _baseLoot.addLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.GOLD_INGOT, 20)); _baseLoot.addLoot(new RandomItem(Material.GOLD_INGOT, 20));
_baseLoot.registerLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15)); _baseLoot.addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15));
_spawnLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 15)); _spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
_spawnLoot.cloneLoot(_baseLoot); _spawnLoot.cloneLoot(_baseLoot);
// Food // Food
_spawnLoot.registerLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 5)); _spawnLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 5));
_spawnLoot.registerLoot(new RandomItem(Material.CAKE, 30)); _spawnLoot.addLoot(new RandomItem(Material.CAKE, 30));
_spawnLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1)); _spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1));
_spawnLoot.registerLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 3)); _spawnLoot.addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 3));
_spawnLoot.registerLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3)); _spawnLoot.addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3));
_spawnLoot.registerLoot(new RandomItem(Material.COOKED_FISH, 30, 1, 6)); _spawnLoot.addLoot(new RandomItem(Material.COOKED_FISH, 30, 1, 6));
_spawnLoot.registerLoot(new RandomItem(Material.GRILLED_PORK, 30, 1, 3)); _spawnLoot.addLoot(new RandomItem(Material.GRILLED_PORK, 30, 1, 3));
_spawnLoot.registerLoot(new RandomItem(Material.COOKIE, 30)); _spawnLoot.addLoot(new RandomItem(Material.COOKIE, 30));
_spawnLoot.registerLoot(new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3)); _spawnLoot.addLoot(new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3));
_spawnLoot.registerLoot(new RandomItem(Material.APPLE, 30, 2, 6)); _spawnLoot.addLoot(new RandomItem(Material.APPLE, 30, 2, 6));
// Loot for chests in spawn // Loot for chests in spawn
// Weaponry and ores // Weaponry and ores
_spawnLoot.registerLoot(new RandomItem(Material.STONE_SWORD, 30)); _spawnLoot.addLoot(new RandomItem(Material.STONE_SWORD, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_AXE, 30)); _spawnLoot.addLoot(new RandomItem(Material.IRON_AXE, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_INGOT, 30, 1, 2)); _spawnLoot.addLoot(new RandomItem(Material.IRON_INGOT, 30, 1, 2));
_spawnLoot.registerLoot(new RandomItem(Material.DIAMOND, 30)); _spawnLoot.addLoot(new RandomItem(Material.DIAMOND, 30));
// Iron gear // Iron gear
_spawnLoot.registerLoot(new RandomItem(Material.IRON_BOOTS, 30)); _spawnLoot.addLoot(new RandomItem(Material.IRON_BOOTS, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_CHESTPLATE, 30)); _spawnLoot.addLoot(new RandomItem(Material.IRON_CHESTPLATE, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_HELMET, 30)); _spawnLoot.addLoot(new RandomItem(Material.IRON_HELMET, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_LEGGINGS, 30)); _spawnLoot.addLoot(new RandomItem(Material.IRON_LEGGINGS, 30));
// Supply crate loot // Supply crate loot
// Diamond gear // Diamond gear
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_HELMET, 10)); _crateLoot.addLoot(new RandomItem(Material.DIAMOND_HELMET, 10));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 6)); _crateLoot.addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 6));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 8)); _crateLoot.addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 8));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_BOOTS, 10)); _crateLoot.addLoot(new RandomItem(Material.DIAMOND_BOOTS, 10));
// Iron gear // Iron gear
_crateLoot.registerLoot(new RandomItem(Material.IRON_HELMET, 30)); _crateLoot.addLoot(new RandomItem(Material.IRON_HELMET, 30));
_crateLoot.registerLoot(new RandomItem(Material.IRON_CHESTPLATE, 24)); _crateLoot.addLoot(new RandomItem(Material.IRON_CHESTPLATE, 24));
_crateLoot.registerLoot(new RandomItem(Material.IRON_LEGGINGS, 27)); _crateLoot.addLoot(new RandomItem(Material.IRON_LEGGINGS, 27));
_crateLoot.registerLoot(new RandomItem(Material.IRON_BOOTS, 30)); _crateLoot.addLoot(new RandomItem(Material.IRON_BOOTS, 30));
// Weapons // Weapons
_crateLoot.registerLoot(new RandomItem(Material.IRON_SWORD, 24)); _crateLoot.addLoot(new RandomItem(Material.IRON_SWORD, 24));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_SWORD, 8)); _crateLoot.addLoot(new RandomItem(Material.DIAMOND_SWORD, 8));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_AXE, 16)); _crateLoot.addLoot(new RandomItem(Material.DIAMOND_AXE, 16));
// Cooked furnace // Cooked furnace
_cookedFurnace.registerLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2));
_cookedFurnace.registerLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2));
_cookedFurnace.registerLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2));
_cookedFurnace.registerLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2)); _cookedFurnace.addLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2));
_cookedFurnace.registerLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1)); _cookedFurnace.addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1));
_cookedFurnace.registerLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1)); _cookedFurnace.addLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1));
_cookedFurnace.registerLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1)); _cookedFurnace.addLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1));
// Raw furnace // Raw furnace
_rawFurnace.registerLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3)); _rawFurnace.addLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3));
_rawFurnace.registerLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3)); _rawFurnace.addLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3));
_rawFurnace.registerLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3)); _rawFurnace.addLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3));
_rawFurnace.registerLoot(new RandomItem(Material.PORK, 1, 1, 3)); _rawFurnace.addLoot(new RandomItem(Material.PORK, 1, 1, 3));
_rawFurnace.registerLoot(new RandomItem(Material.POTATO_ITEM, 1, 1, 3)); _rawFurnace.addLoot(new RandomItem(Material.POTATO_ITEM, 1, 1, 3));
// Deathmatch Loot // Deathmatch Loot
_deathMatchLoot.registerLoot(new RandomItem(Material.PUMPKIN_PIE, 4)); _deathMatchLoot.addLoot(new RandomItem(Material.PUMPKIN_PIE, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.BAKED_POTATO, 4)); _deathMatchLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.CAKE, 4)); _deathMatchLoot.addLoot(new RandomItem(Material.CAKE, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.APPLE, 4)); _deathMatchLoot.addLoot(new RandomItem(Material.APPLE, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.CARROT_ITEM, 4)); _deathMatchLoot.addLoot(new RandomItem(Material.CARROT_ITEM, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.WOOD_SWORD, 3)); _deathMatchLoot.addLoot(new RandomItem(Material.WOOD_SWORD, 3));
_deathMatchLoot.registerLoot(new RandomItem(Material.WOOD_AXE, 3)); _deathMatchLoot.addLoot(new RandomItem(Material.WOOD_AXE, 3));
_deathMatchLoot.registerLoot(new RandomItem(Material.STONE_AXE, 3)); _deathMatchLoot.addLoot(new RandomItem(Material.STONE_AXE, 3));
_deathMatchLoot.registerLoot(new RandomItem(Material.STONE_SWORD, 1)); _deathMatchLoot.addLoot(new RandomItem(Material.STONE_SWORD, 1));
} }
@EventHandler @EventHandler

View File

@ -24,16 +24,31 @@ public class SpellButton implements IButton
{ {
Wizard wizard = _spellPage.getWizards().getWizard(player); Wizard wizard = _spellPage.getWizards().getWizard(player);
if (player.getInventory().getHeldItemSlot() >= wizard.getWandsOwned())
{
return;
}
if (wizard != null) if (wizard != null)
{
if (clickType.isLeftClick())
{ {
wizard.setSpell(player.getInventory().getHeldItemSlot(), _spell); 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); player.playSound(player.getLocation(), Sound.ORB_PICKUP, 10, 1);
}
else
{
_spellPage.getWizards().castSpell(player, wizard, _spell, null);
}
_spellPage.getWizards().drawUtilTextBottom(player); _spellPage.getWizards().drawUtilTextBottom(player);
_spellPage.getWizards().changeWandsTitles(player); _spellPage.getWizards().changeWandsTitles(player);
_spellPage.getWizards().changeWandsType(player, -1, player.getInventory().getHeldItemSlot());
player.closeInventory();
} }
} }

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.games.wizards; package nautilus.game.arcade.game.games.wizards;
import java.util.ArrayList; import java.util.ArrayList;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
@ -45,6 +44,7 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
for (int i = 0; i < 54; i++) for (int i = 0; i < 54; i++)
{ {
SpellType spell = null; SpellType spell = null;
for (SpellType spells : SpellType.values()) for (SpellType spells : SpellType.values())
{ {
if (spells.getSlot() == i) if (spells.getSlot() == i)
@ -62,18 +62,31 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
if (spellLevel > 0) if (spellLevel > 0)
{ {
ItemBuilder builder = new ItemBuilder(spell.getSpellItem()); ItemBuilder builder = new ItemBuilder(spell.getSpellItem());
builder.setTitle(spell.getElement().getColor() + spell.getSpellName());
builder.setTitle(spell.getElement().getColor() + C.Bold + spell.getSpellName());
builder.setAmount(spellLevel);
builder.addLore(""); builder.addLore("");
builder.addLore(C.cBlue + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
builder.addLore(C.cBlue + C.Bold + "Mana Cost: " + C.cWhite if (wizard == null)
{
builder.addLore(C.cYellow + C.Bold + "Max Level: " + C.cWhite + spell.getMaxLevel());
}
else
{
builder.addLore(C.cYellow + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
}
builder.addLore(C.cYellow + C.Bold + "Mana Cost: " + C.cWhite
+ (wizard == null ? spell.getBaseManaCost() : spell.getManaCost(wizard))); + (wizard == null ? spell.getBaseManaCost() : spell.getManaCost(wizard)));
builder.addLore(C.cBlue + C.Bold + "Cooldown: " + C.cWhite builder.addLore(C.cYellow + C.Bold + "Cooldown: " + C.cWhite
+ (wizard == null ? spell.getBaseCooldown() : spell.getSpellCooldown(wizard)) + " seconds"); + (wizard == null ? spell.getBaseCooldown() : spell.getSpellCooldown(wizard)) + " seconds");
builder.addLore(""); builder.addLore("");
for (String lore : spell.getDesc()) for (String lore : spell.getDesc())
{ {
builder.addLore(C.cGray + lore, 35); builder.addLore(C.cGray + lore, 40);
} }
if (wizard == null) if (wizard == null)
@ -82,20 +95,26 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
} }
else else
{ {
builder.addLore("");
builder.addLore(C.cGreen + C.Bold + "Left-Click" + C.cWhite + " Bind to Wand");
builder.addLore(C.cGreen + C.Bold + "Right-Click" + C.cWhite + " Quickcast Spell");
addButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton( addButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton(
this, spell)); this, spell));
} }
} }
else else
{ {
addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 8).setTitle(C.cRed + C.Bold + "Unknown") addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 6).setTitle(C.cRed + C.Bold + "Unknown")
.build(), "Unknown", "Unknown", 1, true, true)); .build(), "Unknown", "Unknown", 1, true, true));
} }
} }
else if (!usedNumbers.contains(i % 9)) else if (!usedNumbers.contains(i % 9))
{ {
addItem(i, new ShopItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (byte) 15).setTitle(C.cRed + "").build(), addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 9).setTitle(C.cRed + "").build(), "No Item",
"No Item", "No Item", 1, true, true)); "No Item", 1, true, true));
} }
} }
} }
@ -104,5 +123,4 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
{ {
return _wizard; return _wizard;
} }
} }

View File

@ -1,60 +1,25 @@
package nautilus.game.arcade.game.games.wizards; package nautilus.game.arcade.game.games.wizards;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.wizards.spells.SpellBridge; import nautilus.game.arcade.game.games.wizards.spells.*;
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 org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public enum SpellType // public enum SpellType //
{ {
AnvilDrop(SpellElement.ATTACK, // Spell element
Bridge(SpellElement.MISC, // Spell element WandElement.EARTH, // Wand element
"Bridge", // Spell name "Anvil Drop", // Spell name
new ItemStack(Material.FENCE), // Spell icon new ItemStack(Material.NETHER_BRICK_ITEM), // Spell icon
SpellBridge.class, // Spell class SpellAnvilDrop.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
SpellDroom.class, // Spell class
3, // Spell max level 3, // Spell max level
40, // Mana cost 40, // Mana cost
15, // Spell cooldown 15, // Spell cooldown
@ -62,53 +27,18 @@ public enum SpellType // ❤
-4, // Cooldown change per level -4, // Cooldown change per level
10, // Item amount in loot 10, // Item amount in loot
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1", C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level x 2) + 3",
"", "",
"Summons exploding anvils over everyone near you!"), "Summons exploding anvils over everyone near you!",
/*Drain(SpellElement.MISC, // Spell element "This also includes the caster!"),
"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(SpellElement.ATTACK, // Spell element
WandElement.FIRE, // Wand element
"Fireball", // Spell name "Fireball", // Spell name
new ItemStack(Material.FIREBALL), // Spell icon new ItemStack(Material.COAL), // Spell icon
SpellFireball.class, // Spell class SpellFireball.class, // Spell class
3, // Spell max level 3, // Spell max level
30, // Mana cost 30, // Mana cost
@ -117,7 +47,7 @@ public enum SpellType // ❤
-2, // Cooldown change per level -2, // Cooldown change per level
10, // Item amount in loot 10, // Item amount in loot
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level x 0.25) + 0.8", C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 3",
"", "",
@ -126,25 +56,67 @@ public enum SpellType // ❤
"Summon a blazing fireball!"), "Summon a blazing fireball!"),
Flash(SpellElement.SUPPORT, // Spell element Flash(SpellElement.SUPPORT, // Spell element
WandElement.LIFE, // Wand element
"Flash", // Spell name "Flash", // Spell name
new ItemStack(Material.REDSTONE_TORCH_ON), // Spell icon new ItemStack(Material.GOLD_NUGGET), // Spell icon
SpellFlash.class, // Spell class SpellFlash.class, // Spell class
3, // Spell max level 3, // Spell max level
50, // Mana cost 20, // Mana cost
50, // Spell cooldown 50, // Spell cooldown
0, // Mana cost change per level 0, // Mana cost change per level
-5, // Cooldown change per level -5, // Cooldown change per level
3, // Item amount in loot 3, // Item amount in loot
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 10) + 20", C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 10) + 20",
"", "",
"Teleport to the block you are looking at!"), "Teleport to the block you are looking at!"),
FrostBarrier(SpellElement.MISC, // Spell element
WandElement.ICE, // Wand element
"Frost Barrier", // Spell name
new ItemStack(Material.CLAY_BALL), // Spell icon
SpellFrostBarrier.class, // Spell class
3, // Spell max level
10, // Mana cost
20, // Spell cooldown
0, // Mana cost change per level
-5, // Cooldown change per level
3, // Item amount in loot
C.cYellow + C.Bold + "Height: " + C.Bold + C.cWhite + "Spell Level + 1",
C.cYellow + C.Bold + "Width: " + C.Bold + C.cWhite + "(Spell Level x 2) + 4",
"",
"Create a wall of ice!"),
Gust(SpellElement.MISC, // Spell element
WandElement.AIR, // Wand element
"Gust", // Spell name
new ItemStack(Material.SULPHUR), // Spell icon
SpellGust.class, // Spell class
3, // Spell max level
15, // Mana cost
20, // Spell cooldown
0, // Mana cost change per level
0, // Cooldown change per level
5, // Item amount in loot
C.cYellow + C.Bold + "Gust Size: " + C.Bold + C.cWhite + "10 x Spell Level blocks",
C.cYellow + C.Bold + "Gust Strength: " + C.Bold + C.cWhite + "Spell Level x 30%",
"",
"Cast the spell and watch your enemies fly!"),
Heal(SpellElement.SUPPORT, // Spell element Heal(SpellElement.SUPPORT, // Spell element
WandElement.LIFE, // Wand element
"Heal", // Spell name "Heal", // Spell name
new ItemStack(Material.POTION, 1, (short) 8261), // Spell icon new ItemStack(Material.QUARTZ), // Spell icon
SpellHeal.class, // Spell class SpellHeal.class, // Spell class
5, // Spell max level 5, // Spell max level
50, // Mana cost 50, // Mana cost
@ -153,7 +125,7 @@ public enum SpellType // ❤
-1, // Cooldown change per level -1, // Cooldown change per level
5, // Item amount in loot 5, // Item amount in loot
C.cGold + C.Bold + "Heals: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1.5", C.cYellow + C.Bold + "Heals: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1.5",
"", "",
@ -161,30 +133,56 @@ public enum SpellType // ❤
"Use this! Heal yourself up!"), "Use this! Heal yourself up!"),
HealingRune(SpellElement.RUNES, // Spell element IcePrison(SpellElement.MISC, // Spell element
"Rune of Healing", // Spell name WandElement.ICE, // Wand element
new ItemStack(Material.POTION, 1, (short) 8197), // Spell icon "Ice Prison", // Spell name
SpellHealingRune.class, // Spell class new ItemStack(Material.EYE_OF_ENDER), // Spell icon
SpellIcePrison.class, // Spell class
3, // Spell max level 3, // Spell max level
60, // Mana cost 25, // Mana cost
30, // Spell cooldown 20, // Spell cooldown
0, // Mana cost change per level 2, // Mana cost change per level
-5, // Cooldown change per level 0, // Cooldown change per level
3, // Item amount in loot 3, // Item amount in loot
C.cGold + C.Bold + "Size: " + C.Bold + C.cWhite + "(Spell Level x 0.5) + 2", C.cYellow + C.Bold + "Size: " + C.Bold + C.cWhite + "Spell Level + 3",
C.cGold + C.Bold + "Lasts for: " + C.Bold + C.cWhite + "(Spell Level x 3) + 5 seconds",
"", "",
"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
WandElement.ICE, // Wand element
"Ice Shards", // Spell name
new ItemStack(Material.GOLDEN_CARROT), // Spell icon
SpellIceShards.class, // Spell class
5, // Spell max level
30, // Mana cost
20, // Spell cooldown
0, // Mana cost change per level
-2, // Cooldown change per level
3, // Item amount in loot
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "2",
C.cYellow + C.Bold + "Shards: " + C.Bold + C.cWhite + "Spell Level + 1",
"",
"Overwhelm your opponent with shards!",
"Each shard is fired half a second after",
"the last allowing you to pummel your",
"enemies senseless!"),
Implode(SpellElement.MISC, // Spell element Implode(SpellElement.MISC, // Spell element
WandElement.EARTH, // Wand element
"Implode", // Spell name "Implode", // Spell name
new ItemStack(Material.TNT), // Spell icon new ItemStack(Material.GLOWSTONE_DUST), // Spell icon
SpellImplode.class, // Spell class SpellImplode.class, // Spell class
3, // Spell max level 3, // Spell max level
50, // Mana cost 50, // Mana cost
@ -193,11 +191,11 @@ public enum SpellType // ❤
-3, // Cooldown change per level -3, // Cooldown change per level
3, // Item amount in loot 3, // Item amount in loot
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "50", C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "50",
C.cGold + C.Bold + "Implosion Height: " + C.Bold + C.cWhite + "Spell Level", C.cYellow + C.Bold + "Implosion Height: " + C.Bold + C.cWhite + "Spell Level",
C.cGold + C.Bold + "Implosion Width: " + C.Bold + C.cWhite + "Spell Level x 2", C.cYellow + C.Bold + "Implosion Width: " + C.Bold + C.cWhite + "Spell Level x 2",
"", "",
@ -205,70 +203,10 @@ public enum SpellType // ❤
"and scatters them about the area"), "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 LightningStrike(SpellElement.ATTACK, // Spell element
WandElement.AIR, // Wand element
"Lightning Strike", // Spell name "Lightning Strike", // Spell name
new ItemStack(Material.WOOD_AXE), // Spell icon new ItemStack(Material.INK_SACK, 1, (short) 12), // Spell icon
SpellLightningStrike.class, // Spell class SpellLightningStrike.class, // Spell class
3, // Spell max level 3, // Spell max level
50, // Mana cost 50, // Mana cost
@ -277,16 +215,21 @@ public enum SpellType // ❤
0, // Cooldown change per level 0, // Cooldown change per level
10, // Item amount in loot 10, // Item amount in loot
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level x 2) + 2",
"", "",
"Summon a mighty lightning strike", "Summon a mighty lightning strike",
"to hit the target you point out!"), "to hit the target you point out!",
MagicMissile(SpellElement.ATTACK, // Spell element "The lightning also contains fire!"),
"Magic Missile", // Spell name
new ItemStack(Material.STICK), // Spell icon ManaBolt(SpellElement.ATTACK, // Spell element
SpellMagicMissile.class, // Spell class WandElement.AIR, // Wand element
"Mana Bolt", // Spell name
new ItemStack(Material.MELON_SEEDS), // Spell icon
SpellManaBolt.class, // Spell class
3, // Spell max level 3, // Spell max level
15, // Mana cost 15, // Mana cost
5, // Spell cooldown 5, // Spell cooldown
@ -294,19 +237,41 @@ public enum SpellType // ❤
0, // Cooldown change per level 0, // Cooldown change per level
15, // Item amount in loot 15, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 2", C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 15", C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 10) + 20",
"", "",
"The basic spell all beginner mages are taught.", "Basic spell all beginner mages are taught," + " this creates a mana missile commonly attributed towards "
+ "the magic profession and homes in towards the closest target!"),
"This creates a magic missile that is commonly attributed to the magic profession."), Napalm(SpellElement.ATTACK, // Spell element
WandElement.FIRE, // Wand element
"Napalm", // Spell name
new ItemStack(Material.CARROT_STICK), // Spell icon
SpellNapalm.class, // Spell class
5, // Spell max level
60, // Mana cost
60, // Spell cooldown
5, // Mana cost change per level
-10, // Cooldown change per level
1, // Item amount in loot
C.cYellow + C.Bold + "Length: " + C.Bold + C.cWhite + "(Spell Level x 10) + 5",
"",
"Creates a ball of fire that grows",
"the longer it lives. At an large size",
"it even burns away nearby blocks!"),
RainbowBeam(SpellElement.ATTACK, // Spell element RainbowBeam(SpellElement.ATTACK, // Spell element
WandElement.FIRE, // Wand element
"Rainbow Beam", // Spell name "Rainbow Beam", // Spell name
new ItemStack(Material.EMERALD), // Spell icon new ItemStack(Material.INK_SACK, 1, (short) 10), // Spell icon
SpellRainbowBeam.class, // Spell class SpellRainbowBeam.class, // Spell class
5, // Spell max level 5, // Spell max level
5, // Mana cost 5, // Mana cost
@ -315,99 +280,117 @@ public enum SpellType // ❤
1, // Cooldown change per level 1, // Cooldown change per level
10, // Item amount in loot 10, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 3", C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
C.cGold + C.Bold + "Ramge: " + C.Bold + C.cWhite + "Spell Level x 20", C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "80",
"", "",
"Magical girl beam of rainbows!", "Firing rainbow beams of love and hope!",
"This may not do much damage,", "This spell damages the target instantly!",
"but it sure is pretty!"), "The thing is, to make this fit in with our",
Rumble(SpellElement.ATTACK, // Spell element "budget the damage will decrease after",
"Rumble", // Spell name
new ItemStack(Material.DIRT), // Spell icon
SpellRumble.class, // Spell class
5, // Spell max level
30, // Mana cost
5, // Spell cooldown
0, // Mana cost change per level
0, // Cooldown change per level
10, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2", "30 blocks by 0.2 damage per block!"),
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 10", RainbowRoad(SpellElement.MISC, // Spell element
WandElement.AIR, // Wand element
"", "Rainbow Road", // Spell name
new ItemStack(Material.SADDLE), // Spell icon
"Creates an targeted earthquake", SpellRainbowRoad.class, // Spell class
3, // Spell max level
"in the direction you point", 10, // Mana cost
20, // Spell cooldown
"from the block you left click!"),
SpeedBoost(SpellElement.SUPPORT, // Spell element
"Speed Boost", // Spell name
new ItemStack(Material.FEATHER), // Spell icon
SpellSpeedBoost.class, // Spell class
2, // Spell max level
20, // Mana cost
100, // Spell cooldown
0, // Mana cost change per level 0, // Mana cost change per level
0, // Cooldown change per level 0, // Cooldown change per level
3, // Item amount in loot 3, // Item amount in loot
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 30", C.cYellow + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 10",
C.cGold + C.Bold + "Strength: " + C.Bold + C.cWhite + "Spell Level", "",
"Summon into being a mighty road",
"of rainbows for thee to walk on!"),
Rumble(SpellElement.ATTACK, // Spell element
WandElement.EARTH, // Wand element
"Rumble", // Spell name
new ItemStack(Material.PUMPKIN_SEEDS), // Spell icon
SpellRumble.class, // Spell class
5, // Spell max level
30, // Mana cost
15, // Spell cooldown
0, // Mana cost change per level
-1, // Cooldown change per level
10, // Item amount in loot
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
C.cYellow + C.Bold + "Explosion Damage: " + C.Bold + C.cWhite + "Spell Level / 4",
C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 10",
C.cYellow + C.Bold + "Slowness Level: " + C.Bold + C.cWhite + "Spell Level",
"",
"Creates a targeted earthquake",
"in the direction you face!",
"Explodes with damage at the end!",
"Effected players lose their footing!"),
SpectralArrow(SpellElement.ATTACK, // Spell element
WandElement.DEATH, // Wand element
"Spectral Arrow", // Spell name
new ItemBuilder(Material.INK_SACK, 1, (short) 13).addEnchantment(UtilInv.getDullEnchantment(), 1).build(), // Spell
// icon
SpellSpectralArrow.class, // Spell class
3, // Spell max level
40, // Mana cost
15, // Spell cooldown
-5, // Mana cost change per level
-2, // Cooldown change per level
3, // Item amount in loot
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Blocks / (7 - Spell Level)) + 3",
"",
"Shoot an arrow that penetrates!",
"Further the distance, higher the damage!"),
SpeedBoost(SpellElement.SUPPORT, // Spell element
WandElement.LIFE, // Wand element
"Speed Boost", // Spell name
new ItemStack(Material.INK_SACK, 1, (short) 2), // Spell icon
SpellSpeedBoost.class, // Spell class
2, // Spell max level
20, // Mana cost
40, // Spell cooldown
0, // Mana cost change per level
0, // Cooldown change per level
3, // Item amount in loot
C.cYellow + C.Bold + "Length: " + C.Bold + C.cWhite + "20 seconds",
C.cYellow + C.Bold + "Strength: " + C.Bold + C.cWhite + "Spell Level + 1",
"", "",
"Gain a speed potion effect to outrun your enemies"), "Gain a speed potion effect to outrun your enemies"),
Spiderman(SpellElement.MISC, // Spell element SummonWolves(SpellElement.MISC, // Spell element
"Spiderman", // Spell name WandElement.LIFE, // Wand element
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 "Summon Wolves", // Spell name
new ItemStack(Material.MONSTER_EGG, 1, EntityType.WOLF.getTypeId()), // Spell icon new ItemStack(Material.MILK_BUCKET), // Spell icon
SpellSummonWolves.class, // Spell class SpellSummonWolves.class, // Spell class
3, // Spell max level 3, // Spell max level
80, // Mana cost 80, // Mana cost
@ -416,7 +399,7 @@ public enum SpellType // ❤
0, // Cooldown change per level 0, // Cooldown change per level
8, // Item amount in loot 8, // Item amount in loot
C.cGold + C.Bold + "Wolves: " + C.Bold + C.cWhite + "Spell Level + 2", C.cYellow + C.Bold + "Wolves: " + C.Bold + C.cWhite + "Spell Level + 2",
"", "",
@ -424,47 +407,23 @@ public enum SpellType // ❤
"They will fight for you and after 30 seconds, will disappear"), "They will fight for you and after 30 seconds, will disappear"),
TeleportRune(SpellElement.RUNES, // Spell element TrapRune(SpellElement.MISC, // Spell element
"Teleport Rune", // Spell name WandElement.DEATH, // Wand element
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
"Trap Rune", // Spell name "Trap Rune", // Spell name
new ItemStack(Material.TRAP_DOOR), // Spell icon new ItemStack(Material.SHEARS), // Spell icon
SpellTrapRune.class, // Spell class SpellTrapRune.class, // Spell class
3, // Spell max level 3, // Spell max level
50, // Mana cost 25, // Mana cost
30, // Spell cooldown 30, // Spell cooldown
0, // Mana cost change per level 0, // Mana cost change per level
-5, // Cooldown change per level -5, // Cooldown change per level
3, // Item amount in loot 3, // Item amount in loot
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 4) + 12", C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level x 2) + 3",
C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level", C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 4) + 12",
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "Spell Level", C.cYellow + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level",
"", "",
@ -472,9 +431,30 @@ public enum SpellType // ❤
"The rune takes 5 seconds to prepare and will damage even you!"), "The rune takes 5 seconds to prepare and will damage even you!"),
WebShot(SpellElement.MISC, // Spell element
WandElement.DEATH, // Wand element
"Web Shot", // Spell name
new ItemStack(Material.SPIDER_EYE), // Spell icon
SpellWebShot.class, // Spell class
3, // Spell max level
40, // Mana cost
20, // Spell cooldown
-5, // Mana cost change per level
0, // Cooldown change per level
3, // Item amount in loot
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "1 heart",
C.cYellow + C.Bold + "Webs: " + C.Bold + C.cWhite + "Spell Level x 2",
"",
"Shoot webs just like your favorite hero!"),
WizardsCompass(SpellElement.MISC, // Spell element WizardsCompass(SpellElement.MISC, // Spell element
WandElement.LIFE, // Wand element
"Wizard's Compass", // Spell name "Wizard's Compass", // Spell name
new ItemStack(Material.COMPASS), // Spell icon new ItemStack(Material.SUGAR), // Spell icon
SpellWizardsCompass.class, // Spell class SpellWizardsCompass.class, // Spell class
1, // Spell max level 1, // Spell max level
5, // Mana cost 5, // Mana cost
@ -489,19 +469,16 @@ public enum SpellType // ❤
public enum SpellElement public enum SpellElement
{ {
ATTACK(0, 0, 1, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cRed + "Attack Spells") ATTACK(1, 0, 2, new ItemBuilder(Material.INK_SACK, 1, (short) 7).setTitle(C.cRed + "Attack Spells")
.addLore(C.cGray + "Spells of destruction").build(), C.cRed), .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.INK_SACK, 1, (short) 11).setTitle(C.cDGray + "Misc Spells").addLore(
C.cGray + "Misc spells that don't fit in", C.cGray + "Misc spells that don't fit in",
"These spells generally effect the world itself").build(), C.cGray), "These spells generally effect the world itself").build(), C.cGray),
RUNES(3, 3, 3, new ItemBuilder(Material.NETHER_STAR).setTitle(C.cGold + "Rune Spells") SUPPORT(4, 4, 4, new ItemBuilder(Material.INK_SACK, 1, (short) 14).setTitle(C.cDGreen + "Support 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")
.addLore(C.cGray + "Spells of assistance").build(), C.cDGreen); .addLore(C.cGray + "Spells of assistance").build(), C.cDGreen);
private String _chatColor; private String _chatColor;
@ -551,13 +528,59 @@ public enum SpellType // ❤
} }
} }
public enum WandElement
{
AIR(Material.IRON_HOE),
DEATH(Material.STICK),
EARTH(Material.STONE_HOE),
FIRE(Material.GOLD_HOE),
ICE(Material.DIAMOND_HOE),
LIFE(Material.WOOD_HOE);
private Material _material;
private WandElement(Material material)
{
_material = material;
}
public Material getMaterial()
{
return _material;
}
}
static static
{ {
for (SpellType spell : values()) ArrayList<SpellType> spells = new ArrayList<SpellType>(Arrays.asList(SpellType.values()));
{
spell._slot = 9 + spell.getElement().getFirstSlot();
for (SpellType spell2 : values()) Collections.sort(spells, new Comparator<SpellType>()
{
@Override
public int compare(SpellType o1, SpellType o2)
{
int number = new Integer(o2.getItemAmount()).compareTo(o1.getItemAmount());
if (number == 0)
{
return o1.getSpellName().compareToIgnoreCase(o2.getSpellName());
}
return number;
}
});
for (SpellType spell : spells)
{
spell._slot = 18 + spell.getElement().getFirstSlot();
for (SpellType spell2 : spells)
{ {
if (spell != spell2 && spell.getElement() == spell2.getElement() && spell._slot <= spell2._slot) if (spell != spell2 && spell.getElement() == spell2.getElement() && spell._slot <= spell2._slot)
{ {
@ -610,10 +633,13 @@ public enum SpellType // ❤
private int _spellCost; private int _spellCost;
private String _spellName; private String _spellName;
private SpellElement _type; private SpellElement _type;
private WandElement _wandElement;
private SpellType(SpellElement type, String spellName, ItemStack spellItem, Class<? extends Spell> spell, int maxLevel, private SpellType(SpellElement type, WandElement wandElement, String spellName, ItemStack spellItem,
int spellCost, int spellCooldown, int manaChangePerLevel, int cooldownChangePerLevel, int itemAmount, String... desc) Class<? extends Spell> spell, int maxLevel, int spellCost, int spellCooldown, int manaChangePerLevel,
int cooldownChangePerLevel, int itemAmount, String... desc)
{ {
_wandElement = wandElement;
_maxLevel = maxLevel; _maxLevel = maxLevel;
_item = spellItem; _item = spellItem;
_desc = desc; _desc = desc;
@ -627,6 +653,16 @@ public enum SpellType // ❤
_itemAmount = itemAmount; _itemAmount = itemAmount;
} }
public int getBaseCooldown()
{
return _spellCooldown;
}
public int getBaseManaCost()
{
return _spellCost;
}
public String[] getDesc() public String[] getDesc()
{ {
return _desc; return _desc;
@ -642,16 +678,6 @@ public enum SpellType // ❤
return _itemAmount; return _itemAmount;
} }
public int getBaseManaCost()
{
return _spellCost;
}
public int getBaseCooldown()
{
return _spellCooldown;
}
public int getManaCost(Wizard wizard) public int getManaCost(Wizard wizard)
{ {
return Math.max(0, return Math.max(0,
@ -677,7 +703,11 @@ public enum SpellType // ❤
public ItemStack getSpellBook(Wizards wizards) public ItemStack getSpellBook(Wizards wizards)
{ {
return makeSpell(wizards, new ItemBuilder(Material.ENCHANTED_BOOK).addLore(C.cAqua + "Click to level up this spell") return makeSpell(wizards,
new ItemBuilder(_item)
.addLore(C.cAqua + "Click to level up this spell")
.build()); .build());
} }
@ -710,10 +740,17 @@ public enum SpellType // ❤
return _spellName; return _spellName;
} }
public WandElement getWandType()
{
return _wandElement;
}
public ItemStack makeSpell(Wizards wizards, ItemStack item) public ItemStack makeSpell(Wizards wizards, ItemStack item)
{ {
ItemBuilder builder = new ItemBuilder(item); ItemBuilder builder = new ItemBuilder(item);
builder.setTitle(C.cDBlue + C.Bold + "Spell: " + _type._chatColor + getSpellName() + wizards.buildTime()); builder.setTitle(C.cDBlue + C.Bold + "Spell: " + _type._chatColor + getSpellName() + wizards.buildTime());
return builder.build(); return builder.build();
} }
} }

View File

@ -1,5 +1,7 @@
package nautilus.game.arcade.game.games.wizards; package nautilus.game.arcade.game.games.wizards;
import java.util.Set;
import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.NautHashMap;
public class Wizard public class Wizard
@ -13,6 +15,17 @@ public class Wizard
private float _maxMana; private float _maxMana;
private int _soulStars; private int _soulStars;
private float _cooldownModifier = 1; private float _cooldownModifier = 1;
private int _wandsOwned;
public void setWandsOwned(int wandsOwned)
{
_wandsOwned = wandsOwned;
}
public int getWandsOwned()
{
return _wandsOwned;
}
public float getCooldownModifier() public float getCooldownModifier()
{ {
@ -31,8 +44,9 @@ public class Wizard
public Wizard(float maxMana) public Wizard(float maxMana)
{ {
learnSpell(SpellType.MagicMissile); learnSpell(SpellType.ManaBolt);
learnSpell(SpellType.WizardsCompass); learnSpell(SpellType.WizardsCompass);
_maxMana = maxMana; _maxMana = maxMana;
} }
@ -63,7 +77,7 @@ public class Wizard
public float getManaPerTick() public float getManaPerTick()
{ {
return _manaPerTick + ((_soulStars * 0.1F) / 20); return _manaPerTick + ((_soulStars * 0.2F) / 20);
} }
public float getMaxMana() public float getMaxMana()
@ -85,6 +99,16 @@ public class Wizard
_knownSpells.put(type, getSpellLevel(type) + 1); _knownSpells.put(type, getSpellLevel(type) + 1);
} }
public void addMana(float newMana)
{
_mana += newMana;
if (_mana > _maxMana)
{
_mana = _maxMana;
}
}
public void setMana(float newMana) public void setMana(float newMana)
{ {
_mana = newMana; _mana = newMana;
@ -93,14 +117,25 @@ public class Wizard
public void setUsedSpell(SpellType spell) public void setUsedSpell(SpellType spell)
{ {
int cooldown = spell.getSpellCooldown(this); int cooldown = spell.getSpellCooldown(this);
if (cooldown > 0) if (cooldown > 0)
{ {
_cooldowns.put(spell, System.currentTimeMillis() + (1000L * cooldown)); _cooldowns.put(spell, System.currentTimeMillis() + (1000L * cooldown));
} }
} }
public NautHashMap<SpellType, Long> getCooldowns()
{
return _cooldowns;
}
public void setManaPerTick(float manaPerTick) public void setManaPerTick(float manaPerTick)
{ {
_manaPerTick = manaPerTick; _manaPerTick = manaPerTick;
} }
public Set<SpellType> getKnownSpells()
{
return _knownSpells.keySet();
}
} }

View File

@ -36,10 +36,9 @@ public class WizardSpellMenu extends MiniPlugin
@EventHandler @EventHandler
public void onJoin(PlayerJoinEvent event) public void onJoin(PlayerJoinEvent event)
{ {
if (_wizards.GetState() == GameState.Recruit || _wizards.GetState() == GameState.Live) if (_wizards.GetState() == GameState.Recruit || _wizards.GetState() == GameState.Live)
{ {
event.getPlayer().getInventory().addItem(_wizardSpells); event.getPlayer().getInventory().setItem(0, _wizardSpells);
} }
} }
@ -52,7 +51,7 @@ public class WizardSpellMenu extends MiniPlugin
{ {
if (_wizards.IsLive()) if (_wizards.IsLive())
{ {
event.getEntity().getInventory().addItem(_wizardSpells); event.getEntity().getInventory().setItem(0, _wizardSpells);
} }
} }
}); });
@ -61,12 +60,11 @@ public class WizardSpellMenu extends MiniPlugin
@EventHandler @EventHandler
public void onJoin(GameStateChangeEvent event) public void onJoin(GameStateChangeEvent event)
{ {
if (event.GetState() == GameState.Recruit) if (event.GetState() == GameState.Recruit)
{ {
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
{ {
player.getInventory().addItem(_wizardSpells); player.getInventory().setItem(0, _wizardSpells);
} }
} }
} }
@ -74,7 +72,8 @@ public class WizardSpellMenu extends MiniPlugin
@EventHandler @EventHandler
public void onInteract(PlayerInteractEvent event) public void onInteract(PlayerInteractEvent event)
{ {
if (event.getAction() != Action.PHYSICAL && (!_wizards.IsLive() || !_wizards.IsAlive(event.getPlayer()))) if (event.getAction() != Action.PHYSICAL && event.getAction().name().contains("RIGHT")
&& (!_wizards.IsLive() || !_wizards.IsAlive(event.getPlayer())))
{ {
ItemStack item = event.getItem(); ItemStack item = event.getItem();
@ -88,13 +87,10 @@ public class WizardSpellMenu extends MiniPlugin
if (_wizards.IsLive() && _wizards.IsAlive(event.getPlayer())) if (_wizards.IsLive() && _wizards.IsAlive(event.getPlayer()))
{ {
ItemStack item = event.getItem();
if (item != null && item.getType() == Material.BLAZE_ROD)
{
Player p = event.getPlayer(); Player p = event.getPlayer();
if (p.getInventory().getHeldItemSlot() < _wizards.getWizard(p).getWandsOwned())
{
if (event.getAction().name().contains("RIGHT")) if (event.getAction().name().contains("RIGHT"))
{ {
if (p.getInventory().getHeldItemSlot() < 5) if (p.getInventory().getHeldItemSlot() < 5)

View File

@ -1,7 +1,5 @@
package nautilus.game.arcade.game.games.wizards.kit; package nautilus.game.arcade.game.games.wizards.kit;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
@ -26,24 +24,6 @@ public class KitMage extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
for (int i = 0; i < 5; i++) ((Wizards) this.Manager.GetGame()).setupWizard(player);
{
if (i < 2)
{
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
}
else
{
player.getInventory().addItem(
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
.build());
}
}
} }
} }

View File

@ -1,7 +1,5 @@
package nautilus.game.arcade.game.games.wizards.kit; package nautilus.game.arcade.game.games.wizards.kit;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
@ -20,30 +18,12 @@ public class KitMystic extends Kit
super(manager, "Mystic", KitAvailability.Free, new String[] super(manager, "Mystic", KitAvailability.Free, new String[]
{ {
"Mana regeneration increased by 10%" "Mana regeneration increased by 10%"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD)); }, new Perk[0], EntityType.WITCH, new ItemStack(Material.WOOD_HOE));
} }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
for (int i = 0; i < 5; i++) ((Wizards) this.Manager.GetGame()).setupWizard(player);
{
if (i < 2)
{
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
}
else
{
player.getInventory().addItem(
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
.build());
}
}
} }
} }

View File

@ -1,7 +1,5 @@
package nautilus.game.arcade.game.games.wizards.kit; package nautilus.game.arcade.game.games.wizards.kit;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
@ -20,30 +18,12 @@ public class KitSorcerer extends Kit
super(manager, "Sorcerer", KitAvailability.Free, new String[] super(manager, "Sorcerer", KitAvailability.Free, new String[]
{ {
"Start out with an extra wand" "Start out with an extra wand"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD)); }, new Perk[0], EntityType.WITCH, new ItemStack(Material.STONE_HOE));
} }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
for (int i = 0; i < 5; i++) ((Wizards) this.Manager.GetGame()).setupWizard(player);
{
if (i < 3)
{
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
}
else
{
player.getInventory().addItem(
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
.build());
}
}
} }
} }

View File

@ -1,8 +1,6 @@
package nautilus.game.arcade.game.games.wizards.kit; package nautilus.game.arcade.game.games.wizards.kit;
import mineplex.core.achievement.Achievement; import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.wizards.Wizards; import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
@ -21,7 +19,7 @@ public class KitWitchDoctor extends Kit
super(manager, "Witch Doctor", KitAvailability.Free, new String[] super(manager, "Witch Doctor", KitAvailability.Free, new String[]
{ {
"Max mana increased to 150" "Max mana increased to 150"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD)); }, new Perk[0], EntityType.WITCH, new ItemStack(Material.IRON_HOE));
this.setAchievementRequirements(new Achievement[] this.setAchievementRequirements(new Achievement[]
{ {
@ -32,24 +30,6 @@ public class KitWitchDoctor extends Kit
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
for (int i = 0; i < 5; i++) ((Wizards) this.Manager.GetGame()).setupWizard(player);
{
if (i < 2)
{
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
}
else
{
player.getInventory().addItem(
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
.build());
}
}
} }
} }

View File

@ -0,0 +1,138 @@
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;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.metadata.FixedMetadataValue;
public class SpellAnvilDrop extends Spell implements SpellClick
{
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);
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>();
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);
}
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);
anvil.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
getSpellLevel(player)));
anvil.setMetadata("Wizard", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), player));
anvil.getWorld().playSound(anvil.getLocation(), Sound.ANVIL_USE, 1.9F, 0);
newFallingBlocks.add(anvil);
}
}
if (!newFallingBlocks.isEmpty())
{
_fallingBlocks.addAll(newFallingBlocks);
charge(player);
}
}
private void handleAnvil(Entity entity)
{
_fallingBlocks.remove(entity);
int spellLevel = entity.getMetadata("SpellLevel").get(0).asInt();
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager()
.GetExplosion(), entity.getLocation(), 1 + (spellLevel / 2F), "Anvil Drop");
explosion.setPlayer((Player) entity.getMetadata("Wizard").get(0).value(), true);
explosion.setFallingBlockExplosion(true);
explosion.setDropItems(false);
explosion.setMaxDamage(6 + (spellLevel * 4));
explosion.explode();
entity.remove();
}
@EventHandler
public void onDrop(ItemSpawnEvent event)
{
Iterator<FallingBlock> itel = _fallingBlocks.iterator();
FallingBlock b = null;
while (itel.hasNext())
{
FallingBlock block = itel.next();
if (block.isDead())
{
b = block;
break;
}
}
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,102 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
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.SpellClickBlock;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.scheduler.BukkitRunnable;
public class SpellBridge extends Spell implements SpellClickBlock
{
final BlockFace[] radial =
{
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
};
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
@EventHandler
public void onUpdate(UpdateEvent event)
{
Iterator<Entry<Block, Long>> itel = _wallExpires.entrySet().iterator();
while (itel.hasNext())
{
Entry<Block, Long> entry = itel.next();
if (entry.getValue() < System.currentTimeMillis())
{
itel.remove();
if (entry.getKey().getType() == Material.DIRT)
{
entry.getKey().setType(Material.AIR);
}
}
}
}
@Override
public void castSpell(Player p, final Block target)
{
final BlockFace facing = radial[Math.round(p.getEyeLocation().getYaw() / 45f) & 0x7];
p.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, Material.DIRT.getId());
final int maxDist = 10 * getSpellLevel(p);
new BukkitRunnable()
{
Block block = target;
int blocks = 0;
@Override
public void run()
{
if (!Wizards.IsLive() || blocks++ >= maxDist)
{
cancel();
return;
}
block = block.getRelative(facing);
Block bs[] = UtilShapes.getSideBlocks(block, facing);
bs = new Block[]
{
bs[0], bs[1], block
};
for (Block b : bs)
{
if (UtilBlock.solid(b))
{
continue;
}
b.setType(Material.DIRT);
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 1);
charge(p);
}
}

View File

@ -1,35 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.Wizard;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
public class SpellDrain extends Spell implements SpellClickEntity
{
@Override
public void castSpell(Player player, Entity entity)
{
if (entity instanceof Player)
{
if (Wizards.IsAlive(entity))
{
Wizard wiz = Wizards.getWizard((Player) entity);
if (wiz.getMana() > 10)
{
wiz.setMana(0);
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1, 0);
charge(player);
}
}
}
}
}

View File

@ -1,128 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Iterator;
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.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.metadata.FixedMetadataValue;
public class SpellDroom extends Spell implements SpellClick
{
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);
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>();
for (Player p : players)
{
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);
}
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);
anvil.setMetadata("ExplosionSize", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
1 + (getSpellLevel(player) / 2F)));
anvil.setMetadata("Wizard", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), player));
anvil.getWorld().playSound(anvil.getLocation(), Sound.ANVIL_USE, 1.9F, 0);
newFallingBlocks.add(anvil);
}
}
if (!newFallingBlocks.isEmpty())
{
_fallingBlocks.addAll(newFallingBlocks);
charge(player);
}
}
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");
explosion.setPlayer((Player) entity.getMetadata("Wizard").get(0).value(), true);
explosion.setDropItems(false);
explosion.explode();
entity.remove();
}
@EventHandler
public void onDrop(ItemSpawnEvent event)
{
Iterator<FallingBlock> itel = _fallingBlocks.iterator();
FallingBlock b = null;
while (itel.hasNext())
{
FallingBlock block = itel.next();
if (block.isDead())
{
b = block;
break;
}
}
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

@ -22,19 +22,25 @@ public class SpellFireball extends Spell implements SpellClick
public void onHit(ProjectileHitEvent event) public void onHit(ProjectileHitEvent event)
{ {
Projectile projectile = event.getEntity(); Projectile projectile = event.getEntity();
if (projectile.hasMetadata("FireballSpell")) if (projectile.hasMetadata("FireballSpell"))
{ {
projectile.remove(); projectile.remove();
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), projectile.getLocation(), int spellLevel = projectile.getMetadata("SpellLevel").get(0).asInt();
projectile.getMetadata("FireballYield").get(0).asFloat(), "Fireball");
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager()
.GetExplosion(), projectile.getLocation(), (spellLevel * 0.3F) + 1F, "Fireball");
explosion.setPlayer((Player) projectile.getMetadata("FireballSpell").get(0).value(), true); explosion.setPlayer((Player) projectile.getMetadata("FireballSpell").get(0).value(), true);
explosion.setFallingBlockExplosion(true);
explosion.setDropItems(false); explosion.setDropItems(false);
explosion.explode(); explosion.setMaxDamage(spellLevel + 6);
explosion.explode();
} }
} }
@ -56,11 +62,9 @@ public class SpellFireball extends Spell implements SpellClick
fireball.setShooter(p); fireball.setShooter(p);
fireball.setYield(0); fireball.setYield(0);
fireball.setMetadata("FireballSpell", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p)); fireball.setMetadata("FireballSpell", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
fireball.setMetadata("FireballYield", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), fireball.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), getSpellLevel(p)));
(getSpellLevel(p) * 0.25F) + 0.8F));
p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F); p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F);
charge(p); charge(p);
} }
} }

View File

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

View File

@ -0,0 +1,140 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
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;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
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.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.scheduler.BukkitRunnable;
public class SpellFrostBarrier extends Spell implements SpellClick, SpellClickBlock
{
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
@Override
public void castSpell(Player player)
{
Location loc = player.getLocation().add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5));
castSpell(player, loc.getBlock().getRelative(BlockFace.DOWN));
}
@Override
public void castSpell(Player player, Block block)
{
final Block starter = block.getRelative(BlockFace.UP);
final int wallWidth = 4 + (getSpellLevel(player) * 2);
final BlockFace facing = UtilShapes.getFacing(player.getEyeLocation().getYaw());
final int wallHeight = 1 + getSpellLevel(player);
new BukkitRunnable()
{
Block block = starter;
int currentRun;
@Override
public void run()
{
currentRun++;
BlockFace[] faces = UtilShapes.getCornerBlockFaces(block, facing);
if (block.getType() == Material.AIR)
{
block.setTypeIdAndData(Material.ICE.getId(), (byte) 0, false);
_wallExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
for (BlockFace face : faces)
{
for (int i = 1; i < wallWidth; i++)
{
Block b = block.getRelative(face.getModX() * i, 0, face.getModZ() * i);
if (!UtilBlock.airFoliage(b))
break;
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));
}
}
block = block.getRelative(BlockFace.UP);
if (currentRun >= wallHeight)
{
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 5);
charge(player);
}
@EventHandler
public void onBlockBreak(BlockBreakEvent event)
{
Block block = event.getBlock();
if (_wallExpires.containsKey(block))
{
event.setCancelled(true);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
block.setType(Material.AIR);
}
}
@EventHandler
public void onBlockMelt(BlockFadeEvent event)
{
Block block = event.getBlock();
if (_wallExpires.containsKey(block))
{
event.setCancelled(true);
block.setType(Material.AIR);
}
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
Iterator<Entry<Block, Long>> itel = _wallExpires.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);
}
}
}
}
}

View File

@ -0,0 +1,52 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class SpellGust extends Spell implements SpellClick
{
@Override
public void castSpell(final Player player)
{
final Vector vector = player.getLocation().getDirection().setY(0).normalize().multiply(1.5).setY(0.3)
.multiply(1.2 + (getSpellLevel(player) * 0.4D));
final HashMap<Player, Double> effected = UtilPlayer.getPlayersInPyramid(player, 45, 10 * getSpellLevel(player));
if (!effected.isEmpty())
{
charge(player);
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
public void run()
{
for (Player target : effected.keySet())
{
if (!Wizards.IsAlive(target))
{
continue;
}
Wizards.getArcadeManager().GetCondition().Factory().Falling("Gust", target, player, 10, false, true);
target.setVelocity(vector);
target.getWorld().playSound(target.getLocation(), Sound.BAT_TAKEOFF, 1, 0.7F);
}
player.playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1, 0.7F);
}
});
}
}
}

View File

@ -2,40 +2,25 @@ package nautilus.game.arcade.game.games.wizards.spells;
import nautilus.game.arcade.game.games.wizards.Spell; 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.SpellClick;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class SpellHeal extends Spell implements SpellClick, SpellClickEntity public class SpellHeal extends Spell implements SpellClick
{ {
@Override @Override
public void castSpell(Player p) public void castSpell(Player p)
{ {
castSpell(p, p); if (p.getHealth() < p.getMaxHealth())
}
@Override
public void castSpell(Player p, Entity target)
{ {
if (!(target instanceof LivingEntity)) double health = p.getHealth() + (3 + getSpellLevel(p));
return;
LivingEntity entity = (LivingEntity) target; if (health > p.getMaxHealth())
health = p.getMaxHealth();
if (entity.getHealth() < entity.getMaxHealth()) p.setHealth(health);
{
double health = entity.getHealth() + (3 + getSpellLevel(p));
if (health > entity.getMaxHealth()) p.getWorld().spigot().playEffect(p.getEyeLocation(), Effect.HEART, 0, 0, 0.8F, 0.4F, 0.8F, 0, 6, 30);
health = entity.getMaxHealth();
entity.setHealth(health);
entity.getWorld().spigot().playEffect(entity.getEyeLocation(), Effect.HEART, 0, 0, 0.8F, 0.4F, 0.8F, 0, 6, 30);
charge(p); charge(p);
} }

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,149 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
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;
import org.bukkit.Effect;
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.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.metadata.FixedMetadataValue;
public class SpellIcePrison extends Spell implements SpellClick, IThrown
{
private HashMap<Block, Long> _prisonExpires = new HashMap<Block, Long>();
@EventHandler
public void onBlockBreak(BlockBreakEvent event)
{
Block block = event.getBlock();
if (_prisonExpires.containsKey(block))
{
event.setCancelled(true);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
block.setType(Material.AIR);
}
}
@EventHandler
public void onBlockMelt(BlockFadeEvent event)
{
Block block = event.getBlock();
if (_prisonExpires.containsKey(block))
{
event.setCancelled(true);
block.setType(Material.AIR);
}
}
@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 (_prisonExpires.containsKey(block) || UtilBlock.airFoliage(block))
{
block.setType(Material.ICE);
_prisonExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
}
// Effect
loc.getWorld().playSound(loc, Sound.SILVERFISH_HIT, 2f, 1f);
}
@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.getEyeLocation(),
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, 2f);
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 1.2F, 0.8F);
}
}
}

View File

@ -0,0 +1,152 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilShapes;
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.Location;
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;
public class SpellIceShards extends Spell implements SpellClick, IThrown
{
private HashMap<Entity, Location> _lastParticles = new HashMap<Entity, Location>();
@Override
public void castSpell(final Player player)
{
shoot(player);
for (int i = 1; i <= getSpellLevel(player); i++)
{
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
@Override
public void run()
{
shoot(player);
}
}, i * 5);
}
charge(player);
}
private void shoot(Player player)
{
if (Wizards.IsAlive(player))
{
// Boost
org.bukkit.entity.Item ent = player.getWorld().dropItem(
player.getEyeLocation(),
ItemStackFactory.Instance.CreateStack(Material.GHAST_TEAR, (byte) 0, 1, "Ice Shard " + player.getName() + " "
+ System.currentTimeMillis()));
UtilAction.velocity(ent, player.getLocation().getDirection(), 2, false, 0, 0.2, 10, false);
Wizards.getArcadeManager().GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2f);
player.getWorld().playSound(player.getLocation(), Sound.CLICK, 1.2F, 0.8F);
_lastParticles.put(ent, ent.getLocation());
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null && target instanceof Player)
{
// Damage Event
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 4 /*+ (timesHit * 2)*/, true, true,
false, "Ice Shard", "Ice Shard");
}
handleShard(data);
}
private void handleShard(ProjectileUser data)
{
data.GetThrown().remove();
Location loc = data.GetThrown().getLocation();
UtilParticle.PlayParticle(ParticleType.BLOCK_CRACK.getParticle(Material.PACKED_ICE, 0), loc, 0.3F, 0.3F, 0.3F, 0, 12);
loc.getWorld().playSound(loc, Sound.GLASS, 1.2F, 1);
for (int x = -1; x <= 1; x++)
{
for (int y = -1; y <= 1; y++)
{
for (int z = -1; z <= 1; z++)
{
Block block = loc.clone().add(x, y, z).getBlock();
if (block.getType() == Material.FIRE)
{
block.setType(Material.AIR);
}
}
}
}
_lastParticles.remove(data.GetThrown());
}
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (Entity entity : _lastParticles.keySet())
{
for (Location loc : UtilShapes.getLinesDistancedPoints(_lastParticles.get(entity), entity.getLocation(), 0.3))
{
UtilParticle.PlayParticle(ParticleType.BLOCK_CRACK.getParticle(Material.PACKED_ICE, 0), loc, 0, 0, 0, 0, 1);
}
_lastParticles.put(entity, entity.getLocation());
}
}
@Override
public void Idle(ProjectileUser data)
{
handleShard(data);
}
@Override
public void Expire(ProjectileUser data)
{
handleShard(data);
}
}

View File

@ -1,8 +1,15 @@
package nautilus.game.arcade.game.games.wizards.spells; 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.List;
import java.util.Random;
import mineplex.core.common.util.UtilBlock; 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.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
@ -12,73 +19,142 @@ import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.InventoryHolder; import org.bukkit.inventory.InventoryHolder;
import org.bukkit.scheduler.BukkitRunnable;
public class SpellImplode extends Spell implements SpellClick public class SpellImplode extends Spell implements SpellClick
{ {
@Override @Override
public void castSpell(Player p) public void castSpell(final Player p)
{ {
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 50); List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 50);
if (list.size() > 1) if (list.size() > 1)
{ {
BlockFace face = list.get(0).getFace(list.get(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>();
for (int i = 0; i < Math.min(maxDist, getSpellLevel(p) * 2); i++)
{
if (centerBlock.getRelative(face) != null)
{
centerBlock = centerBlock.getRelative(face);
}
}
Location centerLocation = centerBlock.getLocation().clone().add(0.5, 0.5, 0.5);
int size = (int) (1.5F + (getSpellLevel(p) * 0.7F)); int size = (int) (1.5F + (getSpellLevel(p) * 0.7F));
for (int x = -size * 2; x <= size * 2; x++) for (int x = -size * 2; x <= size * 2; x++)
{ {
for (int y = -size; y <= size; y++) for (int y = -size * 2; y <= size * 2; y++)
{ {
for (int z = -size * 2; z <= size * 2; z++) for (int z = -size * 2; z <= size * 2; z++)
{ {
Block effectedBlock = centerBlock.getRelative(x, y, z); Block effectedBlock = centerBlock.getRelative(x, y, z);
if (effectedBlock.getLocation().distance(centerBlock.getLocation()) <= size * 2 if (effectedBlock.getType() == Material.AIR || effectedBlock.getType() == Material.BEDROCK
&& !(effectedBlock.getState() instanceof InventoryHolder)) || effectedBlocks.contains(effectedBlock))
{
if (effectedBlock.getType() == Material.BEDROCK)
{ {
continue; continue;
} }
FallingBlock block = effectedBlock.getWorld().spawnFallingBlock(effectedBlock.getLocation(), if ((centerLocation.distance(effectedBlock.getLocation().add(0.5, 0.5, 0.5)) + Math.abs(y / 4D))
effectedBlock.getType(), effectedBlock.getData());
block.setVelocity(centerLocation.toVector() <= ((size * 2) + UtilMath.random.nextFloat())
.subtract(effectedBlock.getLocation().add(0.5, 0.5, 0.5).toVector()).normalize());
block.setDropItem(false); && !(effectedBlock.getState() instanceof InventoryHolder))
{
effectedBlock.setType(Material.AIR); effectedBlocks.add(effectedBlock);
} }
} }
} }
} }
Collections.shuffle(effectedBlocks);
new BukkitRunnable()
{
int timesRan;
Iterator<Block> bItel;
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);
}
if (timesRan % 3 == 0)
{
for (int a = 0; a < Math.ceil(effectedBlocks.size() / 3D); a++)
{
if (bItel == null || !bItel.hasNext())
{
bItel = effectedBlocks.iterator();
}
Block block = bItel.next();
if (block.getType() == Material.AIR)
{
continue;
}
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()) for (Player player : Bukkit.getOnlinePlayers())
{ {
player.playSound(player == p ? p.getLocation() : centerBlock.getLocation(), Sound.ENDERDRAGON_GROWL, 1.5F, 1.5F); player.playSound(player == p ? p.getLocation() : centerLocation, Sound.ENDERDRAGON_GROWL, 1.5F, 1.5F);
} }
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
charge(p); 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,40 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickEntity;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class SpellLaunch extends Spell implements SpellClickEntity
{
@Override
public void castSpell(Player player, final Entity entity)
{
if (entity instanceof LivingEntity)
{
Wizards.getArcadeManager().GetCondition().Factory()
.Falling("Launch", (LivingEntity) entity, player, 10, false, false);
final int spellLevel = getSpellLevel(player);
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
public void run()
{
((LivingEntity) entity).setVelocity(new Vector(0, 1F + (spellLevel * 0.15F), 0));
entity.getWorld().playSound(((LivingEntity) entity).getLocation(), Sound.BAT_TAKEOFF, 2, 0);
entity.setFallDistance(-spellLevel * 1.5F);
}
});
charge(player);
}
}
}

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

@ -1,12 +1,17 @@
package nautilus.game.arcade.game.games.wizards.spells; package nautilus.game.arcade.game.games.wizards.spells;
import java.util.List; import java.util.ArrayList;
import mineplex.core.common.util.UtilBlock; 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.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.LightningStrike; import org.bukkit.entity.LightningStrike;
@ -16,30 +21,104 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
public class SpellLightningStrike extends Spell implements SpellClick public class SpellLightningStrike extends Spell implements SpellClick
{ {
@Override @Override
public void castSpell(Player p) public void castSpell(final Player p)
{ {
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 150); double curRange = 0;
if (list.size() > 1)
while (curRange <= 150)
{ {
Location loc = list.get(0).getLocation(); Location newTarget = p.getEyeLocation().add(new Vector(0, 0.2, 0))
.add(p.getLocation().getDirection().multiply(curRange));
if (!UtilBlock.airFoliage(newTarget.getBlock())
|| !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))
break;
// Progress Forwards
curRange += 0.2;
}
if (curRange < 2)
{
return;
}
// Destination
final Location loc = p.getLocation().add(p.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0)));
while (UtilBlock.solid(loc.getBlock().getRelative(BlockFace.UP))) while (UtilBlock.solid(loc.getBlock().getRelative(BlockFace.UP)))
{ {
loc.add(0, 1, 0); loc.add(0, 1, 0);
} }
UtilParticle.PlayParticle(ParticleType.ANGRY_VILLAGER, loc.clone().add(0, 1.3, 0), 0.5F, 0.3F, 0.5F, 0, 7);
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
@Override
public void run()
{
LightningStrike lightning = p.getWorld().strikeLightning(loc); LightningStrike lightning = p.getWorld().strikeLightning(loc);
lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p)); lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
charge(p); Block b = loc.getWorld().getHighestBlockAt(loc);
b = b.getRelative(BlockFace.DOWN);
ArrayList<Block> toExplode = new ArrayList<Block>();
ArrayList<Block> toFire = new ArrayList<Block>();
for (int x = -1; x <= 1; x++)
{
for (int y = -1; y <= 1; y++)
{
for (int z = -1; z <= 1; z++)
{
if (x == 0 || (Math.abs(x) != Math.abs(z) || UtilMath.r(3) == 0))
{
Block block = b.getRelative(x, y, z);
if ((y == 0 || (x == 0 && z == 0)) && block.getType() != Material.AIR
&& block.getType() != Material.BEDROCK)
{
if (y == 0 || UtilMath.random.nextBoolean())
{
toExplode.add(block);
toFire.add(block);
} }
} }
else if (block.getType() == Material.AIR)
{
toFire.add(block);
}
}
}
}
}
Wizards.getArcadeManager().GetExplosion().BlockExplosion(toExplode, b.getLocation(), false);
for (Block block : toFire)
{
if (UtilMath.random.nextBoolean())
{
block.setType(Material.FIRE);
}
}
}
}, 20);
charge(p);
}
@EventHandler @EventHandler
public void onEntityDamage(EntityDamageByEntityEvent event) public void onEntityDamage(EntityDamageByEntityEvent event)
@ -47,6 +126,7 @@ public class SpellLightningStrike extends Spell implements SpellClick
if (event.getDamager() instanceof LightningStrike && event.getEntity() instanceof LivingEntity) if (event.getDamager() instanceof LightningStrike && event.getEntity() instanceof LivingEntity)
{ {
LightningStrike lightning = (LightningStrike) event.getDamager(); LightningStrike lightning = (LightningStrike) event.getDamager();
if (lightning.hasMetadata("Damager")) if (lightning.hasMetadata("Damager"))
{ {
event.setCancelled(true); event.setCancelled(true);
@ -55,11 +135,14 @@ public class SpellLightningStrike extends Spell implements SpellClick
{ {
lightning.setMetadata("IgnoreDamage", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), null)); lightning.setMetadata("IgnoreDamage", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), null));
event.getEntity().setFireTicks(80);
Player player = (Player) lightning.getMetadata("Damager").get(0).value();
Wizards.getArcadeManager() Wizards.getArcadeManager()
.GetDamage() .GetDamage()
.NewDamageEvent((LivingEntity) event.getEntity(), .NewDamageEvent((LivingEntity) event.getEntity(), player, null, DamageCause.LIGHTNING,
(Player) lightning.getMetadata("Damager").get(0).value(), null, DamageCause.LIGHTNING, 4 + (4 * getSpellLevel(player)), false, true, false, "Lightning Strike", "Lightning Strike");
event.getDamage(), false, true, false, "Lightning Strike", "Lightning Strike");
} }
} }
} }

View File

@ -1,166 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
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 nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class SpellMagicMissile extends Spell implements SpellClick
{
public void castSpell(final Player player)
{
final Location missileLocation = player.getEyeLocation();
final Location shotFrom = missileLocation.clone();
final Vector direction = missileLocation.getDirection().normalize().multiply(0.3);
final int maxRange = 15 * getSpellLevel(player);
final int maxDings = maxRange * 3;
final int damage = 4 + getSpellLevel(player);
new BukkitRunnable()
{
private int dingsDone;
private void burst()
{
for (Entity cur : missileLocation.getWorld().getEntities())
{
if (cur == player || !(cur instanceof LivingEntity)
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue;
LivingEntity entity = (LivingEntity) cur;
Location eLoc = entity.getLocation();
// If they are less than 0.5 blocks away
if (eLoc.clone().add(0, missileLocation.getY() - eLoc.getY(), 0).distance(missileLocation) <= 0.7)
{
// If it is in their body height
if (Math.abs((eLoc.getY() + (entity.getEyeHeight() / 1.5)) - missileLocation.getY()) <= entity
.getEyeHeight() / 2)
{
if (entity != player && (!(entity instanceof Player) || Wizards.IsAlive(entity)))
{
Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, damage,
true, true, false, "Magic Missile", "Magic Missile");
}
}
}
}
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, missileLocation, 0.5F, 0.5F, 0.5F, 0, 40);
missileLocation.getWorld().playSound(missileLocation, Sound.BAT_TAKEOFF, 1.2F, 1);
cancel();
}
public void run()
{
if (dingsDone >= maxDings || !player.isOnline() || !Wizards.Manager.IsAlive(player))
{
burst();
}
else
{
for (int i = 0; i < 2; i++)
{
Player closestPlayer = null;
double dist = 0;
// This lot of code makes the magic missile change direction towards the closest player in its path
// Not entirely accurate, it doesn't go only for the people it can hit.
// This makes magic missile pretty cool in my opinion
for (Player closest : Wizards.GetPlayers(true))
{
Location loc = closest.getLocation();
if (closest != player)
{
double dist1 = loc.distance(shotFrom);
// If the player is a valid target
if (dist1 < maxRange + 10)
{
double dist2 = missileLocation.distance(loc);
// If the player is closer to the magic missile than the other dist
if (closestPlayer == null || dist2 < dist)
{
double dist3 = missileLocation.clone().add(direction).distance(loc);
if (dist3 < dist2)
{
// If the magic missile grows closer when it moves
closestPlayer = closest;
dist = dist2;
}
}
}
}
}
if (closestPlayer != null)
{
Vector newDirection = closestPlayer.getLocation().add(0, 1, 0).toVector()
.subtract(missileLocation.toVector());
direction.add(newDirection.normalize().multiply(0.01)).normalize().multiply(0.3);
}
missileLocation.add(direction);
for (Entity cur : missileLocation.getWorld().getEntities())
{
if (cur == player || !(cur instanceof LivingEntity)
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue;
LivingEntity ent = (LivingEntity) cur;
Location eLoc = ent.getLocation();
// If they are less than 0.5 blocks away
if (eLoc.clone().add(0, missileLocation.getY() - eLoc.getY(), 0).distance(missileLocation) <= 0.7)
{
// If it is in their body height
if (Math.abs((eLoc.getY() + (ent.getEyeHeight() / 1.5)) - missileLocation.getY()) <= ent
.getEyeHeight() / 2)
{
burst();
return;
}
}
}
if (UtilBlock.solid(missileLocation.getBlock()))
{
burst();
return;
}
dingsDone++;
}
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, missileLocation, 0, 0, 0, 0, 1);
missileLocation.getWorld().playSound(missileLocation, Sound.ORB_PICKUP, 0.7F, 0);
}
}
}.runTaskTimer(Wizards.Manager.getPlugin(), 0, 0);
charge(player);
}
}

View File

@ -0,0 +1,213 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Random;
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 nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class SpellManaBolt extends Spell implements SpellClick
{
public void castSpell(final Player player)
{
final Location missileLocation = player.getEyeLocation();
final Location shotFrom = missileLocation.clone();
final Vector direction = missileLocation.getDirection().normalize().multiply(0.3);
final int maxRange = 20 + (10 * getSpellLevel(player));
final int maxDings = maxRange * 3;
final int damage = 4 + (getSpellLevel(player) * 2);
new BukkitRunnable()
{
private int dingsDone;
private Location previousLocation = missileLocation;
private void burst()
{
for (Entity cur : missileLocation.getWorld().getEntities())
{
if (cur == player || !(cur instanceof LivingEntity) || (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue;
LivingEntity entity = (LivingEntity) cur;
Location eLoc = entity.getLocation();
// If they are less than 0.5 blocks away
if (eLoc.clone().add(0, missileLocation.getY() - eLoc.getY(), 0).distance(missileLocation) <= 0.7)
{
// If it is in their body height
if (Math.abs((eLoc.getY() + (entity.getEyeHeight() / 1.5)) - missileLocation.getY()) <= entity
.getEyeHeight() / 2)
{
if (entity != player && (!(entity instanceof Player) || Wizards.IsAlive(entity)))
{
Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.MAGIC, damage, true,
true, false, "Mana Bolt", "Mana Bolt");
}
}
}
}
playParticle(missileLocation, previousLocation);
for (int i = 0; i < 120; i++)
{
Vector vector = new Vector(new Random().nextFloat() - 0.5F, new Random().nextFloat() - 0.5F,
new Random().nextFloat() - 0.5F);
if (vector.length() >= 1)
{
i--;
continue;
}
Location loc = missileLocation.clone();
loc.add(vector.multiply(2));
UtilParticle.PlayParticle(ParticleType.RED_DUST, loc, -1, 1, 1, 1, 0);
}
missileLocation.getWorld().playSound(missileLocation, Sound.BAT_TAKEOFF, 1.2F, 1);
cancel();
}
public void run()
{
if (dingsDone >= maxDings || !player.isOnline() || !Wizards.Manager.IsAlive(player))
{
burst();
}
else
{
for (int i = 0; i < 2; i++)
{
Player closestPlayer = null;
double dist = 0;
// This lot of code makes the magic missile change direction towards the closest player in its path
// Not entirely accurate, it doesn't go only for the people it can hit.
// This makes magic missile pretty cool in my opinion
for (Player closest : Wizards.GetPlayers(true))
{
Location loc = closest.getLocation();
if (closest != player)
{
double dist1 = loc.distance(shotFrom);
// If the player is a valid target
if (dist1 < maxRange + 10)
{
double dist2 = missileLocation.distance(loc);
// If the player is closer to the magic missile than the other dist
if (closestPlayer == null || dist2 < dist)
{
double dist3 = missileLocation.clone().add(direction).distance(loc);
if (dist3 < dist2)
{
// If the magic missile grows closer when it moves
closestPlayer = closest;
dist = dist2;
}
}
}
}
}
if (closestPlayer != null)
{
Vector newDirection = closestPlayer.getLocation().add(0, 1, 0).toVector()
.subtract(missileLocation.toVector());
direction.add(newDirection.normalize().multiply(0.01)).normalize().multiply(0.3);
}
missileLocation.add(direction);
for (Entity cur : missileLocation.getWorld().getEntities())
{
if (cur == player || !(cur instanceof LivingEntity)
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue;
LivingEntity ent = (LivingEntity) cur;
Location eLoc = ent.getLocation();
// If they are less than 0.5 blocks away
if (eLoc.clone().add(0, missileLocation.getY() - eLoc.getY(), 0).distance(missileLocation) <= 0.7)
{
// If it is in their body height
if (Math.abs((eLoc.getY() + (ent.getEyeHeight() / 1.5)) - missileLocation.getY()) <= ent
.getEyeHeight() / 2)
{
burst();
return;
}
}
}
if (UtilBlock.solid(missileLocation.getBlock()))
{
burst();
return;
}
playParticle(missileLocation, previousLocation);
previousLocation = missileLocation.clone();
dingsDone++;
}
missileLocation.getWorld().playSound(missileLocation, Sound.ORB_PICKUP, 0.7F, 0);
}
}
}.runTaskTimer(Wizards.Manager.getPlugin(), 0, 0);
charge(player);
}
private void playParticle(Location start, Location end)
{
final ArrayList<Location> locations = UtilShapes.getLinesDistancedPoints(start, end, 0.1);
new BukkitRunnable()
{
int timesRan;
public void run()
{
for (Location loc : locations)
{
UtilParticle.PlayParticle(ParticleType.RED_DUST, loc, -1, 1, 1, 1, 0);
}
if (timesRan++ > 1)
{
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
}
}

View File

@ -0,0 +1,268 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.HashMap;
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 mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
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.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class SpellNapalm extends Spell implements SpellClick
{
private HashMap<Material, Material> _glazedBlocks = new HashMap<Material, Material>();
public SpellNapalm()
{
_glazedBlocks.put(Material.STONE, Material.COBBLESTONE);
_glazedBlocks.put(Material.GRASS, Material.DIRT);
_glazedBlocks.put(Material.FENCE, Material.NETHER_FENCE);
_glazedBlocks.put(Material.WOOD_STAIRS, Material.NETHER_BRICK_STAIRS);
_glazedBlocks.put(Material.SMOOTH_STAIRS, Material.NETHER_BRICK_STAIRS);
_glazedBlocks.put(Material.SAND, Material.GLASS);
_glazedBlocks.put(Material.SMOOTH_BRICK, Material.NETHER_BRICK);
_glazedBlocks.put(Material.LOG, Material.NETHERRACK);
_glazedBlocks.put(Material.LOG_2, Material.NETHERRACK);
_glazedBlocks.put(Material.SMOOTH_BRICK, Material.COBBLESTONE);
_glazedBlocks.put(Material.CLAY, Material.STAINED_CLAY);
}
@Override
public void castSpell(final Player player)
{
final int length = 5 + (10 * getSpellLevel(player));
final Vector vector = player.getLocation().getDirection().normalize().multiply(0.15);
final Location playerLoc = player.getLocation().add(0, 2, 0);
final Location napalmLoc = playerLoc.clone().add(playerLoc.getDirection().normalize().multiply(2));
new BukkitRunnable()
{
ArrayList<Block> litOnFire = new ArrayList<Block>();
HashMap<Block, Double> tempIgnore = new HashMap<Block, Double>();
double blocksTravelled;
double size = 1;
double lastTick;
public void run()
{
Random r = new Random();
napalmLoc.add(vector);
if (!UtilBlock.airFoliage(napalmLoc.getBlock()))
{
cancel();
return;
}
for (int b = 0; b < size * 20; b++)
{
float x = r.nextFloat();
float y = r.nextFloat();
float z = r.nextFloat();
while (Math.sqrt((x * x) + (y * y) + (z * z)) >= 1)
{
x = r.nextFloat();
y = r.nextFloat();
z = r.nextFloat();
}
UtilParticle.PlayParticle(ParticleType.RED_DUST,
napalmLoc.clone().add(
(size * (x - 0.5)) / 5,
(size * (y - 0.5)) / 5,
(size * (z - 0.5)) / 5),
-0.3F,
0.35F + (r.nextFloat() / 8),
0.1F, 1, 0);
}
if (lastTick % 3 == 0)
{
for (Entity entity : napalmLoc.getWorld().getEntities())
{
if (!UtilPlayer.isSpectator(entity))
{
double heat = (size * 1.1) - entity.getLocation().distance(napalmLoc);
if (heat > 0)
{
if (lastTick % 10 == 0 && heat > 0.2)
{
if (entity instanceof LivingEntity)
{
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent((LivingEntity) entity, player, null, DamageCause.FIRE,
heat / 1.5, false, true, true, "Napalm", "Napalm");
}
else
{
entity.remove();
continue;
}
}
if (entity instanceof LivingEntity && !UtilPlayer.isSpectator(entity)
&& entity.getFireTicks() < heat * 40)
{
entity.setFireTicks((int) (heat * 40));
}
}
}
}
int bSize = (int) Math.ceil(size * 0.75);
for (int y = -bSize; y <= bSize; y++)
{
if (napalmLoc.getBlockY() + y < 256 && napalmLoc.getBlockY() + y > 0)
{
for (int x = -bSize; x <= bSize; x++)
{
for (int z = -bSize; z <= bSize; z++)
{
Block block = napalmLoc.clone().add(x, y, z).getBlock();
if (litOnFire.contains(block))
{
continue;
}
if (UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), playerLoc) < 2.5)
{
continue;
}
double heat = bSize - UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), napalmLoc);
if (tempIgnore.containsKey(block))
{
if (tempIgnore.remove(block) > heat)
{
litOnFire.add(block);
continue;
}
}
if (heat > 0)
{
if (block.getType() != Material.AIR)
{
float strength = net.minecraft.server.v1_7_R4.Block.getById(block.getTypeId()).a(
(net.minecraft.server.v1_7_R4.Entity) null) * 0.7F;
if (strength <= heat)
{
block.setType(Material.AIR);
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F,
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
}
else if (0.2 <= heat)
{
if (_glazedBlocks.containsKey(block.getType()))
{
block.setType(_glazedBlocks.get(block.getType()));
if (block.getType() == Material.STAINED_CLAY)
{
block.setData((byte) 8);
}
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F,
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
}
}
else if (strength * 2 > size)
{
tempIgnore.put(block, heat);
continue;
}
}
if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER)
{
if (heat > 1)
{
block.setType(Material.AIR);
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F, 0);
litOnFire.add(block);
}
}
else if (block.getType() == Material.AIR)
{
if (UtilMath.random.nextBoolean())
{
for (int a = 0; a < 6; a++)
{
Block b = block.getRelative(BlockFace.values()[a]);
if (b.getType() != Material.AIR)
{
block.setType(Material.FIRE);
block.getWorld().playSound(block.getLocation(), Sound.DIG_WOOL, 1.3F,
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
break;
}
}
}
litOnFire.add(block);
}
}
}
}
}
}
size = Math.min(8, size + 0.06);
}
blocksTravelled += 0.15;
if (lastTick++ % 8 == 0)
{
napalmLoc.getWorld().playSound(napalmLoc, Sound.CAT_HISS, Math.min(0.8F + (float) (size * 0.09F), 1.8f), 0F);
}
if (blocksTravelled >= length)
{
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 1);
charge(player);
}
}

View File

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

View File

@ -0,0 +1,147 @@
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.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;
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.event.EventHandler;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class SpellRainbowRoad extends Spell implements SpellClick
{
final BlockFace[] radial =
{
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
};
final int[] _rainbow = new int[]
{
1, 2, 3, 4, 5, 6, 9, 10, 11, 13, 14
};
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
@EventHandler
public void onUpdate(UpdateEvent event)
{
Iterator<Entry<Block, Long>> itel = _wallExpires.entrySet().iterator();
while (itel.hasNext())
{
Entry<Block, Long> entry = itel.next();
if (entry.getValue() < System.currentTimeMillis())
{
itel.remove();
if (entry.getKey().getType() == Material.STAINED_GLASS)
{
entry.getKey().setType(Material.AIR);
}
}
}
}
@Override
public void castSpell(Player p)
{
final BlockFace face = radial[Math.round(p.getLocation().getYaw() / 45f) & 0x7];
double yMod = Math.min(Math.max(p.getLocation().getPitch() / 30, -1), 1);
final Vector vector = new Vector(face.getModX(), -yMod, face.getModZ());
final Location loc = p.getLocation().getBlock().getLocation().add(0.5, -0.5, 0.5);
final int maxDist = 3 + (10 * getSpellLevel(p));
makeRoad(loc, face, 0);
new BukkitRunnable()
{
int blocks;
int colorProgress;
@Override
public void run()
{
if (!Wizards.IsLive() || blocks++ >= maxDist)
{
cancel();
return;
}
colorProgress = makeRoad(loc, face, colorProgress);
loc.add(vector);
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 5);
charge(p);
}
private int makeRoad(Location loc, BlockFace face, int colorProgress)
{
Block block = loc.getBlock();
BlockFace[] faces = UtilShapes.getSideBlockFaces(face);
ArrayList<Block> bs = new ArrayList<Block>();
bs.add(block);
for (int i = 0; i < 2; i++)
{
bs.add(block.getRelative(faces[i]));
}
bs.addAll(UtilShapes.getDiagonalBlocks(block, face, 1));
boolean playSound = false;
for (Block b : bs)
{
if (!Wizards.isInsideMap(b.getLocation()))
{
continue;
}
if (!_wallExpires.containsKey(block) && UtilBlock.solid(b))
{
continue;
}
b.setType(Material.STAINED_GLASS);
b.setData((byte) _rainbow[colorProgress++ % _rainbow.length]);
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, Material.WOOL, b.getData());
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
playSound = true;
}
if (playSound)
{
block.getWorld().playSound(block.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
}
return colorProgress;
}
}

View File

@ -3,13 +3,17 @@ package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList; import java.util.ArrayList;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilShapes; import mineplex.core.common.util.UtilShapes;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.wizards.Spell; 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.SpellClick;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.AnimalTamer; import org.bukkit.entity.AnimalTamer;
@ -17,6 +21,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Tameable; import org.bukkit.entity.Tameable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
@ -41,6 +46,15 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
castSpell(player, block); castSpell(player, block);
} }
@EventHandler
public void onDamage(CustomDamageEvent event)
{
if (event.GetReason() != null && event.GetReason().equals("Rumble"))
{
event.AddKnockback("Rumble", 1);
}
}
@Override @Override
public void castSpell(final Player player, final Block target) public void castSpell(final Player player, final Block target)
{ {
@ -53,7 +67,7 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
final int damage = 4 + (spellLevel * 2); final int damage = 4 + (spellLevel * 2);
final int maxDist = 10 * spellLevel; final int maxDist = 10 * spellLevel;
player.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, target.getTypeId()); playBlockEffect(target);
new BukkitRunnable() new BukkitRunnable()
{ {
@ -62,45 +76,11 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
private ArrayList<Integer> _effected = new ArrayList<Integer>(); private ArrayList<Integer> _effected = new ArrayList<Integer>();
private ArrayList<Block> _previousBlocks = new ArrayList<Block>(); private ArrayList<Block> _previousBlocks = new ArrayList<Block>();
@Override private void endRun()
public void run()
{ {
if (!player.isOnline() || !Wizards.IsAlive(player))
{
cancel();
return;
}
_currentBlock = _currentBlock.getRelative(moveDirection);
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
{
_currentBlock = _currentBlock.getRelative(BlockFace.UP);
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
{
cancel();
return;
}
}
else if (!UtilBlock.solid(_currentBlock) && _currentBlock.getY() > 0)
{
_currentBlock = _currentBlock.getRelative(BlockFace.DOWN);
}
if (!UtilBlock.solid(_currentBlock))
{
cancel();
return;
}
ArrayList<Block> bs = new ArrayList<Block>(); ArrayList<Block> bs = new ArrayList<Block>();
BlockFace[] faces = UtilShapes.getSideBlockFaces(_currentBlock, moveDirection); BlockFace[] faces = UtilShapes.getSideBlockFaces(moveDirection);
bs.add(_currentBlock); bs.add(_currentBlock);
@ -117,7 +97,150 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
} }
} }
_previousBlocks.addAll(bs); for (Block block : bs)
{
ArrayList<Block> toExplode = new ArrayList<Block>();
toExplode.add(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);
if (b.getType() != Material.AIR && b.getType() != Material.BEDROCK)
{
if (!toExplode.contains(b))
{
toExplode.add(b);
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
}
}
}
}
Wizards.getArcadeManager().GetExplosion()
.BlockExplosion(toExplode, block.getLocation().add(0.5, 0, 0.5), false);
for (LivingEntity entity : block.getWorld().getEntitiesByClass(LivingEntity.class))
{
if (!UtilPlayer.isSpectator(entity))
{
if (entity instanceof Tameable)
{
AnimalTamer tamer = ((Tameable) entity).getOwner();
if (tamer != null && tamer == player)
{
continue;
}
}
double dist = 999;
for (Block b : toExplode)
{
double currentDist = b.getLocation().add(0.5, 0.5, 0.5).distance(entity.getLocation());
if (dist > currentDist)
{
dist = currentDist;
}
}
if (dist < 2)
{
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent(entity, player, null, DamageCause.ENTITY_EXPLOSION,
(1 + (spellLevel / 5D)) * (2 - dist), true, true, false, "Rumble Explosion",
"Rumble Explosion");
}
}
}
}
cancel();
}
@Override
public void run()
{
if (!player.isOnline() || !Wizards.IsAlive(player))
{
endRun();
return;
}
boolean found = false;
for (int y : new int[]
{
0, 1, -1, -2
})
{
if (_currentBlock.getY() + y <= 0)
{
continue;
}
Block b = _currentBlock.getRelative(moveDirection).getRelative(0, y, 0);
if (UtilBlock.solid(b) && !UtilBlock.solid(b.getRelative(0, 1, 0)))
{
found = true;
_currentBlock = b;
break;
}
}
if (!found)
{
endRun();
return;
}
ArrayList<Block> effectedBlocks = new ArrayList<Block>();
BlockFace[] faces = UtilShapes.getSideBlockFaces(moveDirection);
effectedBlocks.add(_currentBlock);
playBlockEffect(_currentBlock);
int size = (int) (Math.min(4, Math.floor(_distTravelled / (8D - spellLevel))) + 1);
for (int i = 1; i <= size; 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);
}
}
}
for (Block b : UtilShapes.getDiagonalBlocks(_currentBlock, moveDirection, size - 2))
{
if (UtilBlock.solid(b))
{
effectedBlocks.add(b);
playBlockEffect(b);
}
}
_previousBlocks.addAll(effectedBlocks);
for (Block b : _previousBlocks) for (Block b : _previousBlocks)
{ {
@ -147,10 +270,19 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
} }
double height = loc.getY() - b.getY(); double height = loc.getY() - b.getY();
if (height >= 0 && height <= 2) if (height >= 0 && height <= 3)
{ {
Wizards.Manager.GetDamage().NewDamageEvent((LivingEntity) entity, player, null, Wizards.Manager.GetDamage().NewDamageEvent((LivingEntity) entity, player, null,
DamageCause.CUSTOM, damage, false, true, false, "Rumble", "Rumble"); DamageCause.CONTACT, damage, true, true, false, "Rumble", "Rumble");
if (entity instanceof Player)
{
Wizards.getArcadeManager()
.GetCondition()
.Factory()
.Slow("Rumble", (LivingEntity) entity, player, 3, spellLevel, false, false,
false, false);
}
} }
_effected.add(entity.getEntityId()); _effected.add(entity.getEntityId());
@ -159,17 +291,11 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
} }
} }
_previousBlocks = bs; _previousBlocks = effectedBlocks;
for (Block b : bs)
{
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId(), 19); // 19 being particle view
// distance
}
if (_distTravelled++ >= maxDist) if (_distTravelled++ >= maxDist)
{ {
cancel(); endRun();
} }
} }
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 1); }.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 1);
@ -177,4 +303,50 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
charge(player); charge(player);
} }
} }
private void playBlockEffect(Block block)
{
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
Block b = block.getRelative(BlockFace.UP);
if (UtilBlock.airFoliage(b))
{
b.breakNaturally();
}
/*
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,103 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilShapes;
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;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.metadata.FixedMetadataValue;
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.launchProjectile(Arrow.class);
arrow.setVelocity(arrow.getVelocity().multiply(2.3));
arrow.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), getSpellLevel(player)));
((CraftArrow) arrow).getHandle().fromPlayer = 0;
_spectralArrows.put(arrow, new Location[]
{
player.getLocation(), player.getLocation()
});
charge(player);
}
@EventHandler
public void onTick(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
Iterator<Entry<Arrow, Location[]>> itel = _spectralArrows.entrySet().iterator();
while (itel.hasNext())
{
Entry<Arrow, Location[]> entry = itel.next();
for (Location loc : UtilShapes.getLinesDistancedPoints(entry.getValue()[1], entry.getKey().getLocation(), 0.7D))
{
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, loc, 0, 0, 0, 0, 1);
}
entry.getValue()[1] = entry.getKey().getLocation();
}
}
@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.GetProjectile());
if (loc != null)
{
int spellLevel = event.GetProjectile().getMetadata("SpellLevel").get(0).asInt();
event.AddMod("Negate Damage", "Negate Damage", -event.GetDamage(), false);
event.AddMod("Spectral Arrow", "Spectral Arrow", 6 + loc[0].distance(event.GetDamageeEntity().getLocation())
/ (7D - spellLevel), true);
}
}
}

View File

@ -10,10 +10,7 @@ public class SpellSpeedBoost extends Spell implements SpellClick
@Override @Override
public void castSpell(Player p) public void castSpell(Player p)
{ {
int ticks = 30 * getSpellLevel(p) * 20; Wizards.getArcadeManager().GetCondition().Factory().Speed("Speed Boost", p, p, 20, getSpellLevel(p), false, false, false);
int potionLevel = getSpellLevel(p);
Wizards.getArcadeManager().GetCondition().Factory().Speed("Speed Boost", p, p, ticks, potionLevel, false, false, false);
charge(p); charge(p);
} }

View File

@ -1,77 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import mineplex.core.common.util.UtilBlock;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class SpellSpiderman extends Spell implements SpellClick
{
@Override
public void castSpell(final Player player)
{
shoot(player);
for (int i = 1; i < getSpellLevel(player) * 2; i++)
{
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
@Override
public void run()
{
shoot(player);
}
}, i * 10);
}
charge(player);
}
private void shoot(Player player)
{
if (Wizards.IsAlive(player))
{
final FallingBlock block = player.getWorld().spawnFallingBlock(player.getEyeLocation(), Material.WEB, (byte) 0);
block.setVelocity(player.getEyeLocation().getDirection().multiply(2));
block.getWorld().playSound(block.getLocation(), Sound.CLICK, 0.5F, 0);
block.setDropItem(false);
new BukkitRunnable()
{
public void run()
{
if (!Wizards.IsLive())
{
cancel();
}
else if (!block.isValid())
{
cancel();
Block b = block.getLocation().getBlock();
if (UtilBlock.airFoliage(b) && b.getType() != Material.WEB)
{
b.setType(Material.WEB);
}
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
}
}
}

View File

@ -1,103 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
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.SpellClickBlock;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.scheduler.BukkitRunnable;
public class SpellStoneWall extends Spell implements SpellClickBlock
{
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
@EventHandler
public void onUpdate(UpdateEvent event)
{
Iterator<Entry<Block, Long>> itel = _wallExpires.entrySet().iterator();
while (itel.hasNext())
{
Entry<Block, Long> entry = itel.next();
if (entry.getValue() < System.currentTimeMillis())
{
itel.remove();
if (entry.getKey().getType() == Material.STONE)
{
entry.getKey().setType(Material.AIR);
}
}
}
}
@Override
public void castSpell(Player player, Block obj)
{
final Block starter = obj.getRelative(BlockFace.UP);
final int wallWidth = getSpellLevel(player) * 5;
final BlockFace facing = UtilShapes.getFacing(player.getEyeLocation().getYaw());
final int wallHeight = 1 + getSpellLevel(player);
new BukkitRunnable()
{
Block block = starter;
int currentRun;
@Override
public void run()
{
currentRun++;
BlockFace[] faces = UtilShapes.getCornerBlockFaces(block, facing);
if (block.getType() == Material.AIR)
{
block.setTypeIdAndData(Material.STONE.getId(), (byte) 0, false);
_wallExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
for (BlockFace face : faces)
{
for (int i = 1; i < wallWidth; i++)
{
Block b = block.getRelative(face.getModX() * i, 0, face.getModZ() * i);
if (!UtilBlock.airFoliage(b))
break;
b.setTypeIdAndData(Material.STONE.getId(), (byte) 0, false);
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
}
block = block.getRelative(BlockFace.UP);
if (currentRun >= wallHeight)
{
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 5);
charge(player);
}
}

View File

@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Random;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
@ -43,11 +44,12 @@ public class SpellSummonWolves extends Spell implements SpellClick, SpellClickBl
Location loc = block.getLocation().add(0.5, 0, 0.5); Location loc = block.getLocation().add(0.5, 0, 0.5);
for (int i = 0; i < 2 + getSpellLevel(player); i++) for (int i = 0; i < getSpellLevel(player); i++)
{ {
Wizards.CreatureAllowOverride = true; Wizards.CreatureAllowOverride = true;
Wolf wolf = (Wolf) player.getWorld().spawnEntity(loc, EntityType.WOLF); Wolf wolf = (Wolf) player.getWorld().spawnEntity(
loc.clone().add(new Random().nextFloat() - 0.5F, 0, new Random().nextFloat() - 0.5F), EntityType.WOLF);
Wizards.CreatureAllowOverride = false; Wizards.CreatureAllowOverride = false;
@ -57,11 +59,10 @@ public class SpellSummonWolves extends Spell implements SpellClick, SpellClickBl
wolf.setBreed(false); wolf.setBreed(false);
wolf.setCustomName(player.getDisplayName() + "'s Wolf"); wolf.setCustomName(player.getDisplayName() + "'s Wolf");
wolf.setRemoveWhenFarAway(false); wolf.setRemoveWhenFarAway(false);
wolf.setMaxHealth(2); wolf.setMaxHealth(0.5);
wolf.setHealth(2); wolf.setHealth(0.5);
// wolf.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 9001, 0));
this._summonedWolves.put(wolf, System.currentTimeMillis() + (30L * 1000L)); _summonedWolves.put(wolf, System.currentTimeMillis() + (30L * 1000L));
} }
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc, 0.8F, 0, 0.8F, 0, 4); UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, loc, 0.8F, 0, 0.8F, 0, 4);

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,19 +6,14 @@ import java.util.List;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; 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.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import nautilus.game.arcade.game.games.wizards.spells.subclasses.TrapRune; 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.Location;
import org.bukkit.Sound; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -37,138 +32,11 @@ public class SpellTrapRune extends Spell implements SpellClick
while (itel.hasNext()) while (itel.hasNext())
{ {
TrapRune rune = itel.next(); TrapRune rune = itel.next();
if (!rune.RuneCaster.isOnline() || UtilPlayer.isSpectator(rune.RuneCaster))
if (rune.onRuneTick())
{ {
itel.remove(); 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;
}
}
}
}
}
}
}
}
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);
}
}
}
private ArrayList<Location> getBox(Location trapLocation, double trapSize, double spacing)
{
ArrayList<Location> boxLocs = getBoxCorners(trapLocation, trapSize);
ArrayList<Location> returns = new ArrayList<Location>();
for (int i = 0; i < boxLocs.size(); i++)
{
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 returns;
}
private ArrayList<Location> getBoxCorners(Location center, double boxSize)
{
ArrayList<Location> boxPoints = new ArrayList<Location>();
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));
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;
}
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++)
{
Block b = rune.RuneLocation.clone().add(x, 0, z).getBlock();
if (UtilBlock.solid(b) || !UtilBlock.solid(b.getRelative(BlockFace.DOWN)))
{
return false;
}
}
}*/
}
public void trapCard(TrapRune rune)
{
rune.RuneLocation.getWorld().playSound(rune.RuneLocation, Sound.WITHER_SHOOT, 5, (float) rune.RuneSize * 2);
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), rune.RuneLocation.clone().add(0,
0.3, 0), (float) rune.RuneSize * 1.2F, "Trap Rune");
explosion.setPlayer(rune.RuneCaster, true);
explosion.setDropItems(false);
explosion.explode();
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);
} }
} }
} }
@ -182,20 +50,20 @@ public class SpellTrapRune extends Spell implements SpellClick
{ {
Location loc = list.get(0).getLocation().add(0.5, 0, 0.5); Location loc = list.get(0).getLocation().add(0.5, 0, 0.5);
float trapSize = Math.max(1, getSpellLevel(p) * 0.8F); if (loc.getBlock().getRelative(BlockFace.DOWN).getType() == Material.AIR)
{
return;
}
TrapRune rune = new TrapRune(); TrapRune rune = new TrapRune(Wizards, p, loc, getSpellLevel(p));
rune.RuneCaster = p; if (!rune.isValid())
rune.RuneSize = trapSize;
rune.RuneLocation = loc;
if (!isValid(rune))
{ {
p.sendMessage(C.cGreen + "Cannot draw rune on wall"); p.sendMessage(C.cGreen + "Cannot draw rune on wall");
return; return;
} }
initialParticles(loc, trapSize); rune.initialParticles();
_runes.add(rune); _runes.add(rune);
charge(p); charge(p);
} }

View File

@ -0,0 +1,170 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import java.util.Map.Entry;
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 nautilus.game.arcade.game.games.wizards.Spell;
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;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class SpellWebShot extends Spell implements SpellClick, IThrown
{
@Override
public void castSpell(final Player player)
{
shoot(player);
for (int i = 1; i < getSpellLevel(player) * 2; i++)
{
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
@Override
public void run()
{
shoot(player);
}
}, i * 10);
}
charge(player);
}
private void shoot(Player player)
{
if (Wizards.IsAlive(player))
{
org.bukkit.entity.Item ent = player.getWorld().dropItem(
player.getEyeLocation(),
ItemStackFactory.Instance.CreateStack(Material.WEB, (byte) 0, 1,
"Web " + player.getName() + " " + System.currentTimeMillis()));
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, 2f);
player.getWorld().playSound(player.getLocation(), Sound.CLICK, 1.2F, 0.8F);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != data.GetThrower())
{
Location loc = data.GetThrown().getLocation();
if (target != null)
{
Location l = target.getLocation();
l.setY(loc.getY());
if (!UtilBlock.airFoliage(getValidLocation(l)))
{
l = target.getLocation().add(0, UtilMath.random.nextFloat(), 0);
if (UtilBlock.airFoliage(getValidLocation(l)))
{
loc = l;
}
}
else
{
loc = l;
}
// Damage Event
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 2, false, false, false,
"Web Shot", "Web Shot");
}
Web(data, loc);
}
}
private Block getValidLocation(Location loc)
{
double[] doubles = new double[]
{
0, -0.5, 0.5
};
HashMap<Block, Integer> commonBlocks = new HashMap<Block, Integer>();
int most = 0;
for (double x : doubles)
{
for (double y : doubles)
{
for (double z : doubles)
{
Block b = loc.clone().add(x, y, z).getBlock();
if (UtilBlock.airFoliage(b))
{
int amount = (commonBlocks.containsKey(b) ? commonBlocks.get(b) : 0) + 1;
commonBlocks.put(b, amount);
if (amount > most)
{
most = amount;
}
}
}
}
}
for (Entry<Block, Integer> entry : commonBlocks.entrySet())
{
if (entry.getValue() == most)
{
return entry.getKey();
}
}
return loc.getBlock();
}
@Override
public void Idle(ProjectileUser data)
{
Web(data, data.GetThrown().getLocation());
}
@Override
public void Expire(ProjectileUser data)
{
Web(data, data.GetThrown().getLocation());
}
public void Web(ProjectileUser data, Location loc)
{
data.GetThrown().remove();
Block block = getValidLocation(loc);
if (UtilBlock.airFoliage(block))
block.setType(Material.WEB);
}
}

View File

@ -1,13 +1,25 @@
package nautilus.game.arcade.game.games.wizards.spells; package nautilus.game.arcade.game.games.wizards.spells;
import mineplex.core.common.util.C; import java.util.ArrayList;
import mineplex.core.common.util.UtilShapes; import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
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.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class SpellWizardsCompass extends Spell implements SpellClick public class SpellWizardsCompass extends Spell implements SpellClick
{ {
@ -15,48 +27,102 @@ public class SpellWizardsCompass extends Spell implements SpellClick
@Override @Override
public void castSpell(Player p) public void castSpell(Player p)
{ {
double dist = 9999; Location loc = p.getEyeLocation().subtract(0, 1, 0);
Player closestPlayer = null;
for (Player player : Wizards.GetPlayers(true)) final ArrayList<Integer[]> colors = new ArrayList<Integer[]>();
{
double newDist = player.getLocation().distance(p.getLocation());
if (newDist > 10 && (closestPlayer == null || newDist < dist)) for (int x = -1; x <= 1; x++)
{ {
closestPlayer = player; for (int y = -1; y <= 1; y++)
dist = newDist; {
for (int z = -1; z <= 1; z++)
{
colors.add(new Integer[]
{
x, y, z
});
}
} }
} }
if (closestPlayer != null) Collections.shuffle(colors);
{
int particlesPlayed = 0;
for (Location loc : UtilShapes.getLinesDistancedPoints( for (Player enemy : Wizards.GetPlayers(true))
p.getEyeLocation().subtract(p.getEyeLocation().getDirection().normalize().multiply(-0.3)).subtract(0, .5, 0),
closestPlayer.getEyeLocation(), 0.3))
{ {
if (enemy == p)
if (particlesPlayed++ > 13)
{ {
break; continue;
} }
loc.getWorld().spigot().playEffect(loc, Effect.HAPPY_VILLAGER, 0, 0, 0.1F, 0.1F, 0.1F, 0, 4, 25); final double playerDist = Math.min(7, UtilMath.offset(enemy, p));
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(playerDist)), enemy.getName());
hologram.setHologramTarget(HologramTarget.WHITELIST);
hologram.addPlayer(p);
hologram.start();
final Location location = loc.clone();
final Integer[] ints = colors.remove(0);
new BukkitRunnable()
{
int dist;
int tick;
HashMap<Location, Integer> locations = new HashMap<Location, Integer>();
public void run()
{
tick++;
Iterator<Entry<Location, Integer>> itel = locations.entrySet().iterator();
while (itel.hasNext())
{
Entry<Location, Integer> entry = itel.next();
if ((entry.getValue() + tick) % 3 == 0)
{
// Colored redstone dust
UtilParticle.PlayParticle(ParticleType.RED_DUST, entry.getKey(), ints[0], ints[1], ints[2], 1, 0);
} }
if (entry.getValue() < tick)
{
itel.remove();
}
}
if (dist <= playerDist * 10)
{
for (int a = 0; a < 2; a++)
{
// Colored redstone dust
UtilParticle.PlayParticle(ParticleType.RED_DUST, location, ints[0], ints[1], ints[2], 1, 0);
locations.put(location.clone(), tick + 50);
location.add(traj);
dist++;
}
}
else if (locations.isEmpty())
{
hologram.stop();
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
}
p.playSound(p.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
charge(p); charge(p);
} }
else
{
p.sendMessage(C.cRed + "All players are less than 10 blocks from you!");
}
}
} }

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);
}
}
}

View File

@ -1,84 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
import java.util.ArrayList;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilShapes;
import nautilus.game.arcade.game.games.wizards.Wizards;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
public class HealingRune
{
private Location _location;
private int _ticksToLive;
private double _runeSize;
private Wizards _wizards;
public HealingRune(Wizards wizards, Location location, int spellLevel)
{
_location = location;
_ticksToLive = 100 + (spellLevel * 60);
_runeSize = 2 + (spellLevel * .5D);
_wizards = wizards;
}
public boolean onTick()
{
for (Player player : Bukkit.getOnlinePlayers())
{
if (player.getGameMode() == GameMode.CREATIVE)
{
continue;
}
Location loc = player.getLocation().clone();
if (loc.getY() >= _location.getY() && loc.getY() <= _location.getY() + 2)
{
loc.setY(_location.getY());
if (loc.distance(_location) <= _runeSize)
{
_wizards.getArcadeManager().GetCondition().Factory().Regen("Healing Rune", player, null, 50, 0, false, false, true);
}
}
}
double currentY = 0;
ArrayList<Location> locs = UtilShapes.getDistancedCircle(_location, 0.2D, _runeSize);
double addY = 1.5D / locs.size();
int a = UtilMath.r(locs.size());
for (int b = 0; b < 2; b++)
{
for (int i = 0; i < locs.size(); i++)
{
a++;
if (i % 30 == _ticksToLive % 30)
{
Location loc = locs.get(a % locs.size());
UtilParticle.PlayParticle(ParticleType.HEART, loc.clone().add(0, currentY, 0), 0, 0, 0, 0, 1);
}
currentY += addY;
}
}
if (_ticksToLive-- <= 0)
{
return true;
}
return false;
}
}

View File

@ -1,112 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
import java.util.HashMap;
import java.util.UUID;
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 nautilus.game.arcade.game.games.wizards.Wizards;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class LaunchRune
{
private Player _caster;
private Wizards _wizards;
private Location _runeLocation;
private float _runeSize;
private int _ticksTillActive = 60;
private int _spellLevel;
private HashMap<UUID, Long> _launchedEntities = new HashMap<UUID, Long>();
public boolean onTick()
{
_ticksTillActive--;
boolean launched = false;
if (_ticksTillActive <= 0)
{
for (LivingEntity entity : _runeLocation.getWorld().getEntitiesByClass(LivingEntity.class))
{
if (!(entity instanceof Player) || !UtilPlayer.isSpectator(entity))
{
UUID uuid = entity.getUniqueId();
if (!_launchedEntities.containsKey(uuid) || _launchedEntities.get(uuid) < System.currentTimeMillis())
{
Location loc = entity.getLocation();
if (loc.getY() >= _runeLocation.getY() - 0.1 && loc.getY() <= _runeLocation.getY() + 1.3)
{
loc.setY(_runeLocation.getY());
if (loc.distance(_runeLocation) <= _runeSize)
{
_wizards.getArcadeManager().GetCondition().Factory()
.Falling("Launch Rune", entity, _caster, 10, false, false);
Vector vector = entity.getLocation().getDirection().normalize().multiply(0.1);
vector.setY(1F + (_spellLevel * 0.15F));
entity.setVelocity(vector);
entity.setFallDistance(-_spellLevel * 1.5F);
launched = true;
_launchedEntities.put(uuid, System.currentTimeMillis() + (long) (_runeSize * 2500L));
}
}
}
}
}
}
if (launched)
{
_runeLocation.getWorld().playSound(_runeLocation, Sound.BAT_TAKEOFF, 1.2F, 1F);
displayCircle(5);
}
else if (_ticksTillActive % (_ticksTillActive >= 0 ? 20 : 7) == 0)
{
displayCircle(1);
}
return _ticksTillActive < -60 * 20;
}
private void displayCircle(int loops)
{
for (double y = 0; y < loops * 0.2D; y += 0.2D)
{
for (Location loc : UtilShapes.getDistancedCircle(_runeLocation, 0.3D, _runeSize))
{
UtilParticle.PlayParticle(ParticleType.CLOUD, loc, 0, 0, 0, 0, 1);
}
}
}
public LaunchRune(Wizards wizards, Player caster, Location loc, float size, int spellLevel)
{
_wizards = wizards;
_caster = caster;
_runeLocation = loc;
_runeSize = size;
_spellLevel = spellLevel;
displayCircle(1);
}
public Location getLocation()
{
return _runeLocation;
}
}

View File

@ -1,118 +0,0 @@
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
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 org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public class TeleportRune
{
private Location _firstLoc, _secondLoc;
private int _ticksLived = -60;
private double _runeSize;
public TeleportRune(Location firstLocation, Location secondLocation, double runeSize)
{
_firstLoc = firstLocation;
_secondLoc = secondLocation;
_runeSize = runeSize;
}
/**
* Returns true on remove
*/
public boolean tickRune()
{
if (_ticksLived >= 150)
{
return true;
}
if (_ticksLived % 5 == 0)
{
resendRunes();
}
if (_ticksLived >= 0)
{
if (_ticksLived % 40 == 0)
{
_firstLoc.getWorld().playSound(_firstLoc, Sound.PORTAL, 1.5F, 0F);
_firstLoc.getWorld().playSound(_secondLoc, Sound.PORTAL, 1.5F, 0F);
}
for (LivingEntity entity : _firstLoc.getWorld().getEntitiesByClass(LivingEntity.class))
{
if (entity instanceof Player && UtilPlayer.isSpectator(entity))
{
continue;
}
Location loc = entity.getLocation();
if (loc.distance(_firstLoc) <= _runeSize && loc.getBlockY() >= _firstLoc.getBlockY()
&& loc.getBlockY() <= _firstLoc.getBlockY() + 2)
{
for (double y = 0; y < 2; y += 0.5)
{
UtilParticle.PlayParticle(ParticleType.PORTAL, _secondLoc.clone().add(0, y, 0), 1.5F, 1.5F, 1.5F, 0F, 40);
}
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, _secondLoc.clone().add(0, 1, 0), 0, 0, 0, 0, 5);
_secondLoc.getWorld().playSound(_secondLoc, Sound.ENDERMAN_TELEPORT, 3, 0);
Location newLoc = _secondLoc.clone();
newLoc.setDirection(entity.getEyeLocation().getDirection());
entity.setFallDistance(0F);
entity.teleport(newLoc);
}
}
}
_ticksLived++;
return false;
}
private void makeCircle(Location loc, double distance)
{
for (Location l : UtilShapes.getPointsInCircle(loc, (int) Math.ceil(Math.PI * distance * 2), distance))
{
UtilParticle.PlayParticle(_ticksLived >= 0 ? ParticleType.FIREWORKS_SPARK : ParticleType.RED_DUST, l, 0, 0, 0, 0, 1);
}
}
private void redrawRunes(Location runeLoc)
{
runeLoc = runeLoc.clone();
if (_ticksLived >= 0)
{
for (double y = 0; y < 1; y += 0.4)
{
runeLoc.add(0, y, 0);
makeCircle(runeLoc, _runeSize);
makeCircle(runeLoc, (_runeSize / 3) * 2);
}
}
else
{
makeCircle(runeLoc, _runeSize);
}
}
/**
* Resending runes resends the particles.
*/
public void resendRunes()
{
redrawRunes(_firstLoc);
redrawRunes(_secondLoc);
}
}

View File

@ -1,15 +1,188 @@
package nautilus.game.arcade.game.games.wizards.spells.subclasses; package nautilus.game.arcade.game.games.wizards.spells.subclasses;
import java.util.ArrayList;
import mineplex.core.common.util.UtilBlock;
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.explosion.CustomExplosion;
import nautilus.game.arcade.game.games.wizards.Wizards;
import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
public class TrapRune public class TrapRune
{ {
// TODO Methods and potentially move code into here
public Location RuneLocation; private Location _runeLocation;
public float RuneSize; private float _runeSize;
public Player RuneCaster; private Player _runeCaster;
public int TicksLived; private int _ticksLived;
private Wizards _wizards;
private int _spellLevel;
public boolean onRuneTick()
{
if (!_runeCaster.isOnline() || UtilPlayer.isSpectator(_runeCaster))
{
return true;
}
else if (_ticksLived++ > 2000)
{
return true;
}
else
{
if (_ticksLived <= 100)
{
if (_ticksLived % 15 == 0)
{
initialParticles();
}
if (_ticksLived == 100)
{
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, _runeLocation, 0, _runeSize / 4, 0, _runeSize / 4,
(int) (_runeSize * 10));
}
}
else
{
if (!isValid())
{
trapCard();
return true;
}
else
{
for (Player player : _wizards.GetPlayers(true))
{
if (isInTrap(player.getLocation()))
{
trapCard();
return true;
}
}
}
}
}
return false;
}
public TrapRune(Wizards wizards, Player player, Location location, int spellLevel)
{
_wizards = wizards;
_runeCaster = player;
_runeLocation = location;
_spellLevel = spellLevel;
_runeSize = Math.max(1, spellLevel * 0.8F);
}
public void initialParticles()
{
for (Location loc : getBox(0.3))
{
for (double y = 0; y < 1; y += 0.2)
{
_runeLocation.getWorld().spigot().playEffect(loc, Effect.SMALL_SMOKE, 0, 0, 0, 0, 0, 0, 1, 30);
}
}
}
public ArrayList<Location> getBox(double spacing)
{
ArrayList<Location> boxLocs = getBoxCorners();
ArrayList<Location> returns = new ArrayList<Location>();
for (int i = 0; i < boxLocs.size(); i++)
{
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 returns;
}
public ArrayList<Location> getBoxCorners()
{
ArrayList<Location> boxPoints = new ArrayList<Location>();
boxPoints.add(_runeLocation.clone().add(-_runeSize, 0, -_runeSize));
boxPoints.add(_runeLocation.clone().add(_runeSize, 0, -_runeSize));
boxPoints.add(_runeLocation.clone().add(_runeSize, 0, _runeSize));
boxPoints.add(_runeLocation.clone().add(-_runeSize, 0, _runeSize));
return boxPoints;
}
public boolean isInTrap(Location loc)
{
if (loc.getX() >= _runeLocation.getX() - _runeSize && loc.getX() <= _runeLocation.getX() + _runeSize)
{
if (loc.getZ() >= _runeLocation.getZ() - _runeSize && loc.getZ() <= _runeLocation.getZ() + _runeSize)
{
if (loc.getY() >= _runeLocation.getY() - 0.1 && loc.getY() <= _runeLocation.getY() + 0.9)
{
return true;
}
}
}
return false;
}
public boolean isValid()
{
return !UtilBlock.solid(_runeLocation.getBlock())
|| UtilBlock.solid(_runeLocation.getBlock().getRelative(BlockFace.DOWN));
/*
for (double x = -RuneSize; x <= RuneSize; x++)
{
for (double z = -RuneSize; z <= RuneSize; z++)
{
Block b = RuneLocation.clone().add(x, 0, z).getBlock();
if (UtilBlock.solid(b) || !UtilBlock.solid(b.getRelative(BlockFace.DOWN)))
{
return false;
}
}
}*/
}
public void trapCard()
{
_runeLocation.getWorld().playSound(_runeLocation, Sound.WITHER_SHOOT, 5, (float) _runeSize * 2);
CustomExplosion explosion = new CustomExplosion(_wizards.getArcadeManager().GetDamage(), _wizards.getArcadeManager()
.GetExplosion(), _runeLocation.clone().add(0, 0.3, 0), (float) _runeSize * 1.2F, "Trap Rune");
explosion.setPlayer(_runeCaster, true);
explosion.setBlockExplosionSize((float) _runeSize * 2F);
explosion.setFallingBlockExplosion(true);
explosion.setDropItems(false);
explosion.setMaxDamage((_spellLevel * 4) + 6);
explosion.explode();
for (Location loc : getBox(0.3))
{
for (double y = 0; y < 1; y += 0.2)
{
_runeLocation.getWorld().spigot().playEffect(loc, Effect.SMOKE, 0, 0, 0, 0, 0, 0, 1, 30);
}
}
}
}

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -76,10 +77,10 @@ public class IcePathData
loc.add(dir.clone().multiply(0.2)); loc.add(dir.clone().multiply(0.2));
if (loc.getBlock().getTypeId() == 79) if (loc.getBlock().getType() == Material.ICE)
continue; continue;
if (loc.getBlock().getTypeId() == 0 || loc.getBlock().getTypeId() == 78) if (loc.getBlock().getType() == Material.AIR || loc.getBlock().getType() == Material.SNOW)
{ {
if (!_blocks.contains(loc.getBlock())) if (!_blocks.contains(loc.getBlock()))
{ {