Wizards changes

This commit is contained in:
libraryaddict 2015-04-11 12:11:50 +12:00
parent 23abf92722
commit fc7c6e5831
25 changed files with 1616 additions and 1437 deletions

View File

@ -21,11 +21,13 @@ public enum SpellType // ❤
-4, // Cooldown change per level
10, // Item amount in loot
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1",
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level x 4) + 5.5",
"",
"Summons exploding anvils over everyone near you!"),
"Summons exploding anvils over everyone near you!",
"This also includes the caster!"),
Fireball(SpellElement.ATTACK, // Spell element
"Fireball", // Spell name
@ -38,7 +40,7 @@ public enum SpellType // ❤
-2, // Cooldown change per level
10, // Item amount in loot
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level x 0.25) + 0.8",
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level x 2) + 2.5",
"",
@ -139,7 +141,7 @@ public enum SpellType // ❤
"You gain a third of the absorbed mana!"),*/
IcePrison(SpellElement.ATTACK, // Spell element
IcePrison(SpellElement.MISC, // Spell element
"Ice Prison", // Spell name
new ItemStack(Material.ICE), // Spell icon
SpellIcePrison.class, // Spell class
@ -169,6 +171,8 @@ public enum SpellType // ❤
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "1 heart",
C.cGold + C.Bold + "Shards: " + C.Bold + C.cWhite + "Spell Level + 1",
"",
@ -177,7 +181,7 @@ public enum SpellType // ❤
"Each shard from the same spell will deal",
"more damage for every shard that hit!"),
"an extra heart for every shard that hit!"),
Implode(SpellElement.MISC, // Spell element
"Implode", // Spell name
@ -213,11 +217,15 @@ public enum SpellType // ❤
0, // Cooldown change per level
10, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "3",
"",
"Summon a mighty lightning strike",
"to hit the target you point out!"),
"to hit the target you point out!",
"The lightning also contains fire!"),
MagicMissile(SpellElement.ATTACK, // Spell element
"Magic Missile", // Spell name
@ -230,9 +238,9 @@ public enum SpellType // ❤
0, // Cooldown change per level
15, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 2",
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 3",
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 15",
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 10) + 20",
"",
@ -244,22 +252,22 @@ public enum SpellType // ❤
"Napalm", // Spell name
new ItemStack(Material.FIREBALL), // Spell icon
SpellNapalm.class, // Spell class
3, // Spell max level
5, // Spell max level
60, // Mana cost
60, // Spell cooldown
5, // Mana cost change per level
-10, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "(Spell Level x 4) + 8",
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "(Spell Level x 10) + 4",
"",
"Create fire into being where your",
"Creates a ball of fire that grows",
"vision falls, a wall of fire!",
"the longer it lives. At a large size",
"* Fire resistance not included."),
"it even even burn away nearby blocks!"),
RainbowBeam(SpellElement.ATTACK, // Spell element
"Rainbow Beam", // Spell name
@ -272,7 +280,7 @@ public enum SpellType // ❤
1, // Cooldown change per level
10, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2*",
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2.5 *",
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "80",
@ -282,12 +290,12 @@ public enum SpellType // ❤
"magical girl of love and hope!",
"Damage lowers after 30 blocks!"),
"* Damage lowers after 30 blocks!"),
RainbowPath(SpellElement.MISC, // Spell element
"Rainbow Path", // Spell name
RainbowRoad(SpellElement.MISC, // Spell element
"Rainbow Road", // Spell name
new ItemStack(Material.STAINED_GLASS, 1, (short) 4), // Spell icon
SpellRainbowPath.class, // Spell class
SpellRainbowRoad.class, // Spell class
3, // Spell max level
50, // Mana cost
20, // Spell cooldown
@ -299,7 +307,7 @@ public enum SpellType // ❤
"",
"Summon into being a mighty path",
"Summon into being a mighty road",
"of rainbows for thee to walk on!"),
@ -311,11 +319,15 @@ public enum SpellType // ❤
30, // Mana cost
5, // Spell cooldown
0, // Mana cost change per level
0, // Cooldown change per level
-1, // Cooldown change per level
10, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
C.cGold + C.Bold + "Explosion Damage:",
C.Bold + C.cWhite + "((Spell Level / 4) + 1) x (1 - (Distance / 2))",
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 10",
C.cGold + C.Bold + "Slowness Level: " + C.Bold + C.cWhite + "Spell Level",
@ -324,9 +336,9 @@ public enum SpellType // ❤
"Creates an targeted earthquake",
"in the direction you point",
"in the direction you face!",
"from the block you left click!",
"Explodes with damage at the end!",
"Effected players lose their footing!"),
@ -347,7 +359,9 @@ public enum SpellType // ❤
"Shoot an arrow that penetrates!",
"Further the distance, higher the damage!"),
"Further the distance, higher the damage!",
"Garanteed at least 2 hearts damage!"),
SpeedBoost(SpellElement.SUPPORT, // Spell element
"Speed Boost", // Spell name
@ -421,6 +435,8 @@ public enum SpellType // ❤
-5, // Cooldown change per level
3, // Item amount in loot
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "1 heart",
C.cGold + C.Bold + "Webs: " + C.Bold + C.cWhite + "Spell Level x 2",
"",

View File

@ -1,106 +1,114 @@
package nautilus.game.arcade.game.games.wizards;
import java.util.Set;
import mineplex.core.common.util.NautHashMap;
public class Wizard
{
private NautHashMap<SpellType, Long> _cooldowns = new NautHashMap<SpellType, Long>();
private NautHashMap<SpellType, Integer> _knownSpells = new NautHashMap<SpellType, Integer>();
private SpellType[] _assignedWands = new SpellType[5];
private float _mana;
private float _manaPerTick = 2.5F / 20F;
private float _maxMana;
private int _soulStars;
private float _cooldownModifier = 1;
private NautHashMap<SpellType, Long> _cooldowns = new NautHashMap<SpellType, Long>();
private NautHashMap<SpellType, Integer> _knownSpells = new NautHashMap<SpellType, Integer>();
private SpellType[] _assignedWands = new SpellType[5];
private float _mana = 150;
private float _manaPerTick = 2.5F / 20F;
private float _maxMana;
private int _soulStars;
private float _cooldownModifier = 1;
public float getCooldownModifier()
{
return _cooldownModifier;
}
public float getCooldownModifier()
{
return _cooldownModifier;
}
public void decreaseCooldown()
{
_cooldownModifier -= 0.1;
}
public void decreaseCooldown()
{
_cooldownModifier -= 0.1;
}
public void addSoulStar()
{
_soulStars++;
}
public void addSoulStar()
{
_soulStars++;
}
public Wizard(float maxMana)
{
learnSpell(SpellType.MagicMissile);
learnSpell(SpellType.WizardsCompass);
_maxMana = maxMana;
}
public Wizard(float maxMana)
{
learnSpell(SpellType.MagicMissile);
learnSpell(SpellType.WizardsCompass);
public SpellType getSpell(int slot)
{
return _assignedWands[slot];
}
_maxMana = maxMana;
}
public void setSpell(int slot, SpellType spell)
{
_assignedWands[slot] = spell;
}
public SpellType getSpell(int slot)
{
return _assignedWands[slot];
}
public long getCooldown(SpellType type)
{
if (_cooldowns.containsKey(type) && _cooldowns.get(type) >= System.currentTimeMillis())
{
return _cooldowns.get(type);
}
public void setSpell(int slot, SpellType spell)
{
_assignedWands[slot] = spell;
}
return 0;
}
public long getCooldown(SpellType type)
{
if (_cooldowns.containsKey(type) && _cooldowns.get(type) >= System.currentTimeMillis())
{
return _cooldowns.get(type);
}
public float getMana()
{
return _mana;
}
return 0;
}
public float getManaPerTick()
{
return _manaPerTick + ((_soulStars * 0.1F) / 20);
}
public float getMana()
{
return _mana;
}
public float getMaxMana()
{
return _maxMana;
}
public float getManaPerTick()
{
return _manaPerTick + ((_soulStars * 0.2F) / 20);
}
public int getSpellLevel(SpellType type)
{
if (_knownSpells.containsKey(type))
{
return _knownSpells.get(type);
}
return 0;
}
public float getMaxMana()
{
return _maxMana;
}
public void learnSpell(SpellType type)
{
_knownSpells.put(type, getSpellLevel(type) + 1);
}
public int getSpellLevel(SpellType type)
{
if (_knownSpells.containsKey(type))
{
return _knownSpells.get(type);
}
return 0;
}
public void setMana(float newMana)
{
_mana = newMana;
}
public void learnSpell(SpellType type)
{
_knownSpells.put(type, getSpellLevel(type) + 1);
}
public void setUsedSpell(SpellType spell)
{
int cooldown = spell.getSpellCooldown(this);
if (cooldown > 0)
{
_cooldowns.put(spell, System.currentTimeMillis() + (1000L * cooldown));
}
}
public void setMana(float newMana)
{
_mana = newMana;
}
public void setManaPerTick(float manaPerTick)
{
_manaPerTick = manaPerTick;
}
public void setUsedSpell(SpellType spell)
{
int cooldown = spell.getSpellCooldown(this);
if (cooldown > 0)
{
_cooldowns.put(spell, System.currentTimeMillis() + (1000L * cooldown));
}
}
public void setManaPerTick(float manaPerTick)
{
_manaPerTick = manaPerTick;
}
public Set<SpellType> getKnownSpells()
{
return _knownSpells.keySet();
}
}

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

@ -22,6 +22,7 @@ public class SpellFireball extends Spell implements SpellClick
public void onHit(ProjectileHitEvent event)
{
Projectile projectile = event.getEntity();
if (projectile.hasMetadata("FireballSpell"))
{
projectile.remove();
@ -37,7 +38,6 @@ public class SpellFireball extends Spell implements SpellClick
explosion.setDropItems(false);
explosion.explode();
}
}
@ -60,7 +60,7 @@ public class SpellFireball extends Spell implements SpellClick
fireball.setYield(0);
fireball.setMetadata("FireballSpell", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
fireball.setMetadata("FireballYield", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(),
(getSpellLevel(p) * 0.25F) + 0.8F));
(getSpellLevel(p) * 0.3F) + 1F));
p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F);
charge(p);

View File

@ -17,87 +17,114 @@ 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 SpellClickBlock
{
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
private HashMap<Block, Long> _wallExpires = new HashMap<Block, Long>();
@EventHandler
public void onUpdate(UpdateEvent event)
{
Iterator<Entry<Block, Long>> itel = _wallExpires.entrySet().iterator();
@EventHandler
public void onBlockBreak(BlockBreakEvent event)
{
Block block = event.getBlock();
while (itel.hasNext())
{
Entry<Block, Long> entry = itel.next();
if (_wallExpires.containsKey(block))
{
event.setCancelled(true);
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
block.setType(Material.AIR);
}
}
if (entry.getValue() < System.currentTimeMillis())
{
itel.remove();
@EventHandler
public void onBlockMelt(BlockFadeEvent event)
{
Block block = event.getBlock();
if (entry.getKey().getType() == Material.ICE)
{
entry.getKey().setType(Material.AIR);
}
}
}
}
if (_wallExpires.containsKey(block))
{
event.setCancelled(true);
block.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);
@EventHandler
public void onUpdate(UpdateEvent event)
{
Iterator<Entry<Block, Long>> itel = _wallExpires.entrySet().iterator();
new BukkitRunnable()
{
Block block = starter;
int currentRun;
while (itel.hasNext())
{
Entry<Block, Long> entry = itel.next();
@Override
public void run()
{
if (entry.getValue() < System.currentTimeMillis())
{
itel.remove();
currentRun++;
if (entry.getKey().getType() == Material.ICE)
{
entry.getKey().setType(Material.AIR);
}
}
}
}
BlockFace[] faces = UtilShapes.getCornerBlockFaces(block, facing);
@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);
if (block.getType() == Material.AIR)
{
block.setTypeIdAndData(Material.ICE.getId(), (byte) 0, false);
_wallExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
new BukkitRunnable()
{
Block block = starter;
int currentRun;
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
@Override
public void run()
{
for (BlockFace face : faces)
{
for (int i = 1; i < wallWidth; i++)
{
currentRun++;
Block b = block.getRelative(face.getModX() * i, 0, face.getModZ() * i);
BlockFace[] faces = UtilShapes.getCornerBlockFaces(block, facing);
if (!UtilBlock.airFoliage(b))
break;
if (block.getType() == Material.AIR)
{
block.setTypeIdAndData(Material.ICE.getId(), (byte) 0, false);
_wallExpires.put(block, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
b.setTypeIdAndData(Material.ICE.getId(), (byte) 0, false);
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());
_wallExpires.put(b, System.currentTimeMillis() + ((20 + UtilMath.r(10)) * 1000L));
}
}
for (BlockFace face : faces)
{
for (int i = 1; i < wallWidth; i++)
{
block = block.getRelative(BlockFace.UP);
if (currentRun >= wallHeight)
{
cancel();
}
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 5);
Block b = block.getRelative(face.getModX() * i, 0, face.getModZ() * i);
charge(player);
}
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);
}
}

View File

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

View File

@ -4,16 +4,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
@ -24,11 +14,48 @@ 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)
{
@ -70,7 +97,8 @@ public class SpellIcePrison extends Spell implements SpellClick, IThrown
}
}
loc.getWorld().playSound(loc, Sound.ANVIL_LAND, 1.7F, 0.8F);
// Effect
loc.getWorld().playSound(loc, Sound.SILVERFISH_HIT, 2f, 1f);
}
@Override
@ -106,7 +134,7 @@ public class SpellIcePrison extends Spell implements SpellClick, IThrown
if (Wizards.IsAlive(player))
{
org.bukkit.entity.Item ent = player.getWorld().dropItem(
player.getLocation().add(0, 0.5, 0),
player.getEyeLocation(),
ItemStackFactory.Instance.CreateStack(Material.PACKED_ICE, (byte) 0, 1, "Ice Prison" + player.getName() + " "
+ System.currentTimeMillis()));

View File

@ -9,8 +9,9 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
@ -20,7 +21,7 @@ import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
@ -29,18 +30,18 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector;
public class SpellIceShards extends Spell implements SpellClick, IThrown
{
private HashMap<ArrayList<Entity>, Integer> _hitShards = new HashMap<ArrayList<Entity>, Integer>();
private HashMap<ArrayList, Long> _shardsExpire = new HashMap<ArrayList, Long>();
private HashMap<ArrayList<Entity>, HashMap<String, Integer>> _hitShards = new HashMap<ArrayList<Entity>, HashMap<String, Integer>>();
@Override
public void castSpell(final Player player)
{
final ArrayList<Entity> firedShards = new ArrayList<Entity>();
_shardsExpire.put(firedShards, System.currentTimeMillis() + 60000);
_hitShards.put(firedShards, new HashMap<String, Integer>());
shoot(player, firedShards);
@ -56,7 +57,7 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
shoot(player, firedShards);
}
}, i * 4);
}, i * 5);
}
charge(player);
@ -95,7 +96,7 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
// Boost
org.bukkit.entity.Item ent = player.getWorld().dropItem(
player.getLocation().add(0, 0.5, 0),
player.getEyeLocation(),
ItemStackFactory.Instance.CreateStack(Material.GHAST_TEAR, (byte) 0, 1, "Ice Shard " + player.getName() + " "
+ System.currentTimeMillis()));
@ -112,16 +113,23 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null)
if (target != null && target instanceof Player)
{
String name = ((Player) target).getName();
int timesHit = 0;
for (ArrayList<Entity> arrayList : _hitShards.keySet())
for (Entry<ArrayList<Entity>, HashMap<String, Integer>> entry : _hitShards.entrySet())
{
if (arrayList.contains(data.GetThrown()))
if (entry.getKey().contains(data.GetThrown()))
{
timesHit = _hitShards.get(arrayList);
_hitShards.put(arrayList, timesHit + 1);
HashMap<String, Integer> map = entry.getValue();
if (map.containsKey(name))
{
timesHit = map.get(name);
}
map.put(name, timesHit + 1);
break;
}
@ -130,13 +138,13 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
// Damage Event
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 2 + (timesHit * 2), false, false,
false, UtilEnt.getName(data.GetThrower()), "Ice Shard");
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 4 + (timesHit * 2), true, true,
false, "Ice Shard", null);
if (timesHit > 0)
{
UtilPlayer.message(data.GetThrower(), "Ice Shards" + ": " + F.elem(timesHit + " Consecutive Hits") + C.cGray
+ " (" + F.skill("+" + (2 + (timesHit * 2)) + " Damage") + C.cGray + ")");
+ " (" + F.skill("+" + timesHit + " Damage") + C.cGray + ")");
}
}
@ -146,7 +154,10 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
private void handleShard(ProjectileUser data)
{
data.GetThrown().remove();
data.GetThrown().getWorld().playEffect(data.GetThrown().getLocation(), Effect.STEP_SOUND, Material.ICE);
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);
}
@Override

View File

@ -14,7 +14,6 @@ import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -95,6 +94,11 @@ public class SpellImplode extends Spell implements SpellClick
Block block = bItel.next();
if (block.getType() == Material.AIR)
{
continue;
}
for (int i = 0; i < 6; i++)
{
BlockFace face = BlockFace.values()[i];
@ -124,7 +128,7 @@ public class SpellImplode extends Spell implements SpellClick
{
cancel();
}
else if (timesRan++ >= 20)
else if (timesRan++ >= 28)
{
Iterator<Block> itel = effectedBlocks.iterator();

View File

@ -1,5 +1,6 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.UtilBlock;
@ -10,6 +11,7 @@ import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LightningStrike;
@ -47,6 +49,28 @@ public class SpellLightningStrike extends Spell implements SpellClick
LightningStrike lightning = p.getWorld().strikeLightning(loc);
lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
Block b = loc.getWorld().getHighestBlockAt(loc);
b = b.getRelative(BlockFace.DOWN);
ArrayList<Block> toExplode = new ArrayList<Block>();
for (int i = 0; i < 6; i++)
{
Block block = b.getRelative(BlockFace.values()[i]);
if (block.getType() != Material.AIR && block.getType() != Material.BEDROCK)
{
toExplode.add(block);
}
else if (block.getType() == Material.AIR)
{
block.setType(Material.FIRE);
}
}
Wizards.getArcadeManager().GetExplosion().BlockExplosion(toExplode, b.getLocation(), false);
}
}, 8);
@ -61,6 +85,7 @@ public class SpellLightningStrike extends Spell implements SpellClick
if (event.getDamager() instanceof LightningStrike && event.getEntity() instanceof LivingEntity)
{
LightningStrike lightning = (LightningStrike) event.getDamager();
if (lightning.hasMetadata("Damager"))
{
event.setCancelled(true);
@ -69,11 +94,13 @@ public class SpellLightningStrike extends Spell implements SpellClick
{
lightning.setMetadata("IgnoreDamage", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), null));
event.getEntity().setFireTicks(80);
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent((LivingEntity) event.getEntity(),
(Player) lightning.getMetadata("Damager").get(0).value(), null, DamageCause.LIGHTNING,
event.getDamage(), false, true, false, "Lightning Strike", "Lightning Strike");
(Player) lightning.getMetadata("Damager").get(0).value(), null, DamageCause.LIGHTNING, 6,
false, true, false, "Lightning Strike", null);
}
}
}

View File

@ -7,7 +7,6 @@ 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;
@ -20,147 +19,146 @@ 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);
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) * 2);
new BukkitRunnable()
{
private int dingsDone;
new BukkitRunnable()
{
private int dingsDone;
private void burst()
{
for (Entity cur : missileLocation.getWorld().getEntities())
{
private void burst()
{
for (Entity cur : missileLocation.getWorld().getEntities())
{
if (cur == player || !(cur instanceof LivingEntity)
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue;
if (cur == player || !(cur instanceof LivingEntity) || (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue;
LivingEntity entity = (LivingEntity) cur;
LivingEntity entity = (LivingEntity) cur;
Location eLoc = entity.getLocation();
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 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");
}
}
}
}
if (entity != player && (!(entity instanceof Player) || Wizards.IsAlive(entity)))
{
Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, damage,
true, true, false, "Magic Missile", null);
}
}
}
}
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();
}
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;
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))
{
// 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();
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 (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 (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());
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);
}
direction.add(newDirection.normalize().multiply(0.01)).normalize().multiply(0.3);
}
missileLocation.add(direction);
missileLocation.add(direction);
for (Entity cur : missileLocation.getWorld().getEntities())
{
for (Entity cur : missileLocation.getWorld().getEntities())
{
if (cur == player || !(cur instanceof LivingEntity)
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue;
if (cur == player || !(cur instanceof LivingEntity)
|| (cur instanceof Player && UtilPlayer.isSpectator(cur)))
continue;
LivingEntity ent = (LivingEntity) cur;
LivingEntity ent = (LivingEntity) cur;
Location eLoc = ent.getLocation();
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 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;
}
if (UtilBlock.solid(missileLocation.getBlock()))
{
burst();
return;
}
dingsDone++;
}
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);
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);
}
charge(player);
}
}

View File

@ -1,67 +1,200 @@
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;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
public class SpellNapalm extends Spell implements SpellClick
{
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.SAND, Material.GLASS);
}
@Override
public void castSpell(Player player)
public void castSpell(final Player player)
{
final int length = 8 + (4 * getSpellLevel(player));
final Vector vector = player.getLocation().getDirection().normalize().multiply(0.5);
final Location loc = player.getLocation().add(vector.clone().multiply(2));
final Location playerLoc = player.getLocation();
final int length = 4 + (10 * getSpellLevel(player));
final Vector vector = player.getLocation().getDirection().normalize().multiply(0.3);
final Location playerLoc = player.getLocation().add(0, 2, 0);
final Location napalmLoc = playerLoc.clone().add(playerLoc.getDirection().normalize().multiply(2));
new BukkitRunnable()
{
int blocksTravelled;
ArrayList<Block> litOnFire = new ArrayList<Block>();
double blocksTravelled;
double size = 1;
double lastTick;
public void run()
{
for (int i = 0; i < 4; i++)
{
loc.add(vector);
Random r = new Random();
if (!UtilBlock.airFoliage(loc.getBlock()))
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)
{
cancel();
break;
x = r.nextFloat();
y = r.nextFloat();
z = r.nextFloat();
}
for (int x = -1; x <= 1; x++)
{
for (int y = -1; y <= 1; y++)
{
for (int z = -1; z <= 1; z++)
{
if (loc.getBlockY() + y < 256 && loc.getBlockY() + y > 0)
{
Block block = loc.getBlock().getRelative(x, y, z);
UtilParticle.PlayParticle(ParticleType.RED_DUST,
if (UtilMath.offset(playerLoc, block.getLocation()) < 2)
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);
}
for (Entity entity : napalmLoc.getWorld().getEntities())
{
if (!UtilPlayer.isSpectator(entity))
{
double heat = (size * 1.1) - entity.getLocation().distance(napalmLoc);
if (heat > 0)
{
if (heat > 1)
{
if (entity instanceof LivingEntity)
{
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent((LivingEntity) entity, player, null, DamageCause.CUSTOM, heat / 2,
false, true, true, "Napalm", null);
}
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 (heat > 0)
{
if (block.getType() != Material.AIR)
{
continue;
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 * 2 > size)
{
litOnFire.add(block);
continue;
}
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 (strength / 6 <= heat)
{
if (_glazedBlocks.containsKey(block.getType()))
{
block.setType(_glazedBlocks.get(block.getType()));
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F,
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
}
}
}
if (!UtilAlg.HasSight(loc, block.getLocation().add(0.5, 0.5, 0.5)))
if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER)
{
continue;
if (heat > 1)
{
block.setType(Material.AIR);
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F, 0);
}
}
if (block.getType() == Material.AIR)
@ -70,14 +203,17 @@ public class SpellNapalm extends Spell implements SpellClick
{
Block b = block.getRelative(BlockFace.values()[a]);
if (b.getType().isFlammable())
if (b.getType() != Material.AIR)
{
block.setType(Material.FIRE);
block.getWorld().playSound(block.getLocation(), Sound.FIRE_IGNITE, 1,
1 + ((new Random().nextFloat() - 0.5F) / 3F));
block.getWorld().playSound(block.getLocation(), Sound.DIG_WOOL, 1.3F,
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
break;
}
}
litOnFire.add(block);
}
}
}
@ -85,7 +221,13 @@ public class SpellNapalm extends Spell implements SpellClick
}
}
blocksTravelled += 2;
blocksTravelled += 0.3;
size = Math.min(8, size + 0.06);
if (lastTick++ % 6 == 0)
{
napalmLoc.getWorld().playSound(napalmLoc, Sound.CAT_HISS, (float) Math.min(2.2, size * 0.5), 0F);
}
if (blocksTravelled >= length)
{

View File

@ -35,7 +35,7 @@ public class SpellRainbowBeam extends Spell implements SpellClick
p.getEyeLocation().getDirection().normalize()
.multiply(0.3 + p.getEyeLocation().distance(((LivingEntity) entityTarget).getEyeLocation())));
double damage = (getSpellLevel(p) * 2) + 4F;
double damage = (getSpellLevel(p) * 2) + 5;
double dist = loc.distance(p.getLocation()) - (80 * .2D);
// If target is more than 20% away
@ -50,7 +50,7 @@ public class SpellRainbowBeam extends Spell implements SpellClick
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent((LivingEntity) entityTarget, p, null, DamageCause.CUSTOM, damage, true, true, false,
"Rainbow Beam", "Rainbow Beam");
"Rainbow Beam", null);
p.playSound(entityTarget.getLocation(), Sound.LEVEL_UP, (getSpellLevel(p) * 2) + 6, 1);

View File

@ -1,17 +1,16 @@
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.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
import org.bukkit.Effect;
import org.bukkit.Location;
@ -24,7 +23,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class SpellRainbowPath extends Spell implements SpellClick, SpellClickBlock
public class SpellRainbowRoad extends Spell implements SpellClick
{
final BlockFace[] radial =
{
@ -61,17 +60,6 @@ public class SpellRainbowPath extends Spell implements SpellClick, SpellClickBlo
@Override
public void castSpell(Player p)
{
Vector vector = p.getEyeLocation().getDirection().normalize().setY(-1);
vector.setX(Math.round(vector.getX()));
vector.setZ(Math.round(vector.getZ()));
castSpell(p, p.getLocation().add(vector).getBlock());
}
@Override
public void castSpell(Player p, final Block target)
{
final BlockFace face = radial[Math.round(p.getLocation().getYaw() / 45f) & 0x7];
@ -79,15 +67,14 @@ public class SpellRainbowPath extends Spell implements SpellClick, SpellClickBlo
final Vector vector = new Vector(face.getModX(), -yMod, face.getModZ());
p.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, Material.WOOL.getId(),
_rainbow[UtilMath.r(_rainbow.length)]);
p.getWorld().playSound(p.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
final Location loc = p.getLocation().getBlock().getLocation().add(0.5, -0.5, 0.5);
final int maxDist = 10 * getSpellLevel(p);
final int maxDist = 3 + (10 * getSpellLevel(p));
makeRoad(loc, face, 0);
new BukkitRunnable()
{
Location loc = target.getLocation().add(0.5, 0.5, 0.5);
int blocks;
int colorProgress;
@ -100,37 +87,57 @@ public class SpellRainbowPath extends Spell implements SpellClick, SpellClickBlo
return;
}
colorProgress = makeRoad(loc, face, colorProgress);
loc.add(vector);
Block block = loc.getBlock();
BlockFace[] faces = UtilShapes.getSideBlockFaces(block, face);
Block[] bs = new Block[]
{
block, block.getRelative(faces[0]), block.getRelative(faces[1])
};
for (Block b : bs)
{
if (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));
}
block.getWorld().playSound(block.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
}
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 5, 1);
}.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 (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

@ -1,23 +1,16 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Collection;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.wizards.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
import org.bukkit.Bukkit;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -87,7 +80,7 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
{
ArrayList<Block> bs = new ArrayList<Block>();
BlockFace[] faces = UtilShapes.getSideBlockFaces(_currentBlock, moveDirection);
BlockFace[] faces = UtilShapes.getSideBlockFaces(moveDirection);
bs.add(_currentBlock);
@ -126,6 +119,7 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
if (!toExplode.contains(b))
{
toExplode.add(b);
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
}
}
}
@ -133,6 +127,43 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
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.CUSTOM,
(1 + (spellLevel / 5D)) * (2 - dist), true, true, false, "Rumble Explosion",
null);
}
}
}
}
cancel();
@ -147,28 +178,30 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
return;
}
_currentBlock = _currentBlock.getRelative(moveDirection);
boolean found = false;
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
{
_currentBlock = _currentBlock.getRelative(BlockFace.UP);
if (UtilBlock.solid(_currentBlock.getRelative(BlockFace.UP)))
for (int y : new int[]
{
endRun();
return;
0, 1, -1, -2
})
{
if (_currentBlock.getY() + y <= 0)
{
continue;
}
}
else if (!UtilBlock.solid(_currentBlock) && _currentBlock.getY() > 0)
{
Block b = _currentBlock.getRelative(moveDirection).getRelative(0, y, 0);
_currentBlock = _currentBlock.getRelative(BlockFace.DOWN);
if (UtilBlock.solid(b) && !UtilBlock.solid(b.getRelative(0, 1, 0)))
{
found = true;
_currentBlock = b;
break;
}
}
if (!UtilBlock.solid(_currentBlock))
if (!found)
{
endRun();
return;
@ -176,13 +209,15 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
ArrayList<Block> effectedBlocks = new ArrayList<Block>();
BlockFace[] faces = UtilShapes.getSideBlockFaces(_currentBlock, moveDirection);
BlockFace[] faces = UtilShapes.getSideBlockFaces(moveDirection);
effectedBlocks.add(_currentBlock);
playBlockEffect(_currentBlock);
for (int i = 1; i <= Math.min(4, Math.floor(_distTravelled / (8D - spellLevel))) + 1; i++)
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++)
{
@ -196,6 +231,15 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
}
}
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)
@ -229,14 +273,14 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
if (height >= 0 && height <= 2)
{
Wizards.Manager.GetDamage().NewDamageEvent((LivingEntity) entity, player, null,
DamageCause.CUSTOM, damage, true, true, false, "Rumble", "Rumble");
DamageCause.CUSTOM, damage, true, true, false, "Rumble", null);
if (entity instanceof Player)
{
Wizards.getArcadeManager()
.GetCondition()
.Factory()
.Slow("Rumble", (LivingEntity) entity, player, 60, spellLevel, false, false,
.Slow("Rumble", (LivingEntity) entity, player, 3, spellLevel, false, false,
false, false);
}
}
@ -262,7 +306,14 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
private void playBlockEffect(Block block)
{
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getTypeId());/*
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();
@ -279,23 +330,23 @@ public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
for (Player player : players)
{
UtilPlayer.sendPacket(player, fallingSpawn);
UtilPlayer.sendPacket(player, fallingSpawn);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
public void run()
{
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(new int[]
{
entityId
});
public void run()
{
PacketPlayOutEntityDestroy destroyPacket = new PacketPlayOutEntityDestroy(new int[]
{
entityId
});
for (Player player : players)
{
UtilPlayer.sendPacket(player, destroyPacket);
}
}
for (Player player : players)
{
UtilPlayer.sendPacket(player, destroyPacket);
}
}
}, 15);*/
}
}

View File

@ -2,31 +2,40 @@ package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import java.util.Iterator;
import org.bukkit.Location;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.metadata.FixedMetadataValue;
import 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>();
private HashMap<Arrow, Location[]> _spectralArrows = new HashMap<Arrow, Location[]>();
@Override
public void castSpell(Player player)
{
Arrow arrow = player.shootArrow();
Arrow arrow = player.launchProjectile(Arrow.class);
arrow.setVelocity(arrow.getVelocity().multiply(2.5));
arrow.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), getSpellLevel(player)));
_spectralArrows.put(arrow, player.getLocation());
((CraftArrow) arrow).getHandle().fromPlayer = 0;
_spectralArrows.put(arrow, new Location[]
{
player.getLocation(), player.getLocation()
});
charge(player);
}
@ -38,13 +47,18 @@ public class SpellSpectralArrow extends Spell implements SpellClick
{
return;
}
Iterator<Arrow> itel = _spectralArrows.keySet().iterator();
Iterator<Entry<Arrow, Location[]>> itel = _spectralArrows.entrySet().iterator();
while (itel.hasNext())
{
Arrow entity = itel.next();
Entry<Arrow, Location[]> entry = itel.next();
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, entity.getLocation(), 0, 0, 0, 0, 1);
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();
}
}
@ -72,13 +86,15 @@ public class SpellSpectralArrow extends Spell implements SpellClick
@EventHandler
public void onDamage(CustomDamageEvent event)
{
Location loc = _spectralArrows.remove(event.GetDamagerEntity(true));
Location[] loc = _spectralArrows.remove(event.GetProjectile());
if (loc != null)
{
int spellLevel = event.GetDamagerEntity(true).getMetadata("SpellLevel").get(0).asInt();
int spellLevel = event.GetProjectile().getMetadata("SpellLevel").get(0).asInt();
event.AddMod("Negate Damage", "Negate Damage", -event.GetDamage(), false);
event.AddMod("Spectral Arrow", "Spectral Arrow", loc.distance(event.GetDamageeEntity().getLocation()) / (7D - spellLevel), true);
event.AddMod("Spectral Arrow", "Spectral Arrow",
Math.max(4, loc[0].distance(event.GetDamageeEntity().getLocation()) / (7D - spellLevel)), true);
}
}

View File

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

View File

@ -6,22 +6,14 @@ import java.util.List;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.updater.UpdateType;
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 nautilus.game.arcade.game.games.wizards.spells.subclasses.TrapRune;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
@ -39,151 +31,10 @@ public class SpellTrapRune extends Spell implements SpellClick
{
TrapRune rune = itel.next();
if (!rune.RuneCaster.isOnline() || UtilPlayer.isSpectator(rune.RuneCaster))
if (rune.onRuneTick())
{
itel.remove();
}
else if (rune.TicksLived++ > 2000)
{
itel.remove();
}
else
{
if (rune.TicksLived <= 100)
{
if (rune.TicksLived % 15 == 0)
{
initialParticles(rune.RuneLocation, rune.RuneSize);
}
if (rune.TicksLived == 100)
{
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, rune.RuneLocation, 0, rune.RuneSize / 4, 0,
rune.RuneSize / 4, (int) (rune.RuneSize * 10));
}
}
else
{
if (!isValid(rune))
{
trapCard(rune);
itel.remove();
}
else
{
for (Player player : Wizards.GetPlayers(true))
{
if (isInTrap(rune.RuneLocation, player.getLocation(), rune.RuneSize))
{
trapCard(rune);
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.SMOKE, 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(), Wizards.getArcadeManager()
.GetExplosion(), rune.RuneLocation.clone().add(0, 0.3, 0), (float) rune.RuneSize * 1.2F, "Trap Rune");
explosion.setPlayer(rune.RuneCaster, true);
explosion.setBlockExplosionSize((float) rune.RuneSize * 2F);
explosion.setFallingBlockExplosion(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.SMOKE, 0, 0, 0, 0, 0, 0, 1, 30);
}
}
}
@ -199,18 +50,14 @@ public class SpellTrapRune extends Spell implements SpellClick
float trapSize = Math.max(1, getSpellLevel(p) * 0.8F);
TrapRune rune = new TrapRune();
rune.RuneCaster = p;
rune.RuneSize = trapSize;
rune.RuneLocation = loc;
if (!isValid(rune))
TrapRune rune = new TrapRune(Wizards, p, loc, trapSize);
if (!rune.isValid())
{
p.sendMessage(C.cGreen + "Cannot draw rune on wall");
return;
}
initialParticles(loc, trapSize);
rune.initialParticles();
_runes.add(rune);
charge(p);

View File

@ -17,7 +17,6 @@ import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector;
public class SpellWebShot extends Spell implements SpellClick, IThrown
{
@ -53,7 +52,7 @@ public class SpellWebShot extends Spell implements SpellClick, IThrown
// Boost
org.bukkit.entity.Item ent = player.getWorld().dropItem(
player.getLocation().add(0, 0.5, 0),
player.getEyeLocation(),
ItemStackFactory.Instance.CreateStack(Material.WEB, (byte) 0, 1,
"Web " + player.getName() + " " + System.currentTimeMillis()));
@ -77,7 +76,7 @@ public class SpellWebShot extends Spell implements SpellClick, IThrown
Wizards.getArcadeManager()
.GetDamage()
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 2, false, false, false,
UtilEnt.getName(data.GetThrower()), "Web Shot");
"Web Shot", null);
}
Web(data);

View File

@ -1,6 +1,10 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
@ -27,11 +31,7 @@ public class SpellWizardsCompass extends Spell implements SpellClick
Location loc = p.getEyeLocation().subtract(0, 1, 0);
ArrayList<Player> players = Wizards.GetPlayers(true);
int counter = 0;
final int[][] ints = new int[27][];
int c = 0;
final ArrayList<Integer[]> colors = new ArrayList<Integer[]>();
for (int x = -1; x <= 1; x++)
{
@ -41,14 +41,16 @@ public class SpellWizardsCompass extends Spell implements SpellClick
for (int z = -1; z <= 1; z++)
{
ints[c++] = new int[]
colors.add(new Integer[]
{
x, y, z
};
});
}
}
}
Collections.shuffle(colors);
boolean foundSomeone = false;
for (Player enemy : players)
@ -60,8 +62,6 @@ public class SpellWizardsCompass extends Spell implements SpellClick
foundSomeone = true;
final int count = counter++;
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)
@ -73,22 +73,50 @@ public class SpellWizardsCompass extends Spell implements SpellClick
hologram.start();
final Location location = loc.clone();
final Integer[] ints = colors.remove(0);
new BukkitRunnable()
{
int i = 0;
int dist;
int tick;
HashMap<Location, Integer> locations = new HashMap<Location, Integer>();
public void run()
{
for (int a = 0; a < 2; a++)
tick++;
Iterator<Entry<Location, Integer>> itel = locations.entrySet().iterator();
while (itel.hasNext())
{
// Colored redstone dust
UtilParticle.PlayParticle(ParticleType.RED_DUST, location.add(traj), ints[count][0], ints[count][1],
ints[count][2], 1, 0);
i++;
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 (i > (7 * 10))
if (dist <= 7 * 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();

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,184 @@
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.Sound;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
public class TrapRune
{
// TODO Methods and potentially move code into here
public Location RuneLocation;
public float RuneSize;
public Player RuneCaster;
public int TicksLived;
private Location _runeLocation;
private float _runeSize;
private Player _runeCaster;
private int _ticksLived;
private Wizards _wizards;
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, float runeSize)
{
_wizards = wizards;
_runeCaster = player;
_runeLocation = location;
_runeSize = runeSize;
}
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.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);
}
}
}
}