Wizards: More changes as per demand.

This commit is contained in:
libraryaddict 2015-04-16 05:51:08 +12:00
parent 073c7d16c2
commit 8803941bd8
13 changed files with 274 additions and 252 deletions

View File

@ -96,7 +96,7 @@ public class UtilParticle
PORTAL("portal"), PORTAL("portal"),
/** /**
* Can be colored if count is 0, color is RGB and depends on the offset of xyz * 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"), RED_DUST("reddust"),

View File

@ -41,6 +41,7 @@ public class SpellButton implements IButton
_spellPage.getWizards().drawUtilTextBottom(player); _spellPage.getWizards().drawUtilTextBottom(player);
_spellPage.getWizards().changeWandsTitles(player); _spellPage.getWizards().changeWandsTitles(player);
player.closeInventory(); player.closeInventory();
} }
} }

View File

@ -15,94 +15,103 @@ import org.bukkit.entity.Player;
public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenuShop> public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenuShop>
{ {
private Wizards _wizard; private Wizards _wizard;
public SpellMenuPage(WizardSpellMenu plugin, WizardSpellMenuShop shop, CoreClientManager clientManager, public SpellMenuPage(WizardSpellMenu plugin, WizardSpellMenuShop shop, CoreClientManager clientManager,
DonationManager donationManager, Player player, Wizards wizard) DonationManager donationManager, Player player, Wizards wizard)
{ {
super(plugin, shop, clientManager, donationManager, "Spell Menu", player); super(plugin, shop, clientManager, donationManager, "Spell Menu", player);
_wizard = wizard; _wizard = wizard;
buildPage(); buildPage();
} }
@Override @Override
protected void buildPage() protected void buildPage()
{ {
Wizard wizard = getWizards().getWizard(getPlayer()); Wizard wizard = getWizards().getWizard(getPlayer());
ArrayList<Integer> usedNumbers = new ArrayList<Integer>(); ArrayList<Integer> usedNumbers = new ArrayList<Integer>();
for (SpellElement ele : SpellElement.values()) for (SpellElement ele : SpellElement.values())
{ {
addItem(ele.getSlot(), new ShopItem(ele.getIcon(), ele.name(), ele.name(), 1, true, true)); addItem(ele.getSlot(), new ShopItem(ele.getIcon(), ele.name(), ele.name(), 1, true, true));
for (int i = ele.getFirstSlot(); i <= ele.getSecondSlot(); i++) for (int i = ele.getFirstSlot(); i <= ele.getSecondSlot(); i++)
{ {
usedNumbers.add(i); usedNumbers.add(i);
} }
} }
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)
{ {
spell = spells; spell = spells;
break; break;
} }
} }
if (usedNumbers.contains(i % 9) && spell != null) if (usedNumbers.contains(i % 9) && spell != null)
{ {
int spellLevel = wizard == null ? 1 : wizard.getSpellLevel(spell); int spellLevel = wizard == null ? 1 : wizard.getSpellLevel(spell);
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.addLore("");
builder.addLore(C.cBlue + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
builder.addLore(C.cBlue + C.Bold + "Mana Cost: " + C.cWhite
+ (wizard == null ? spell.getBaseManaCost() : spell.getManaCost(wizard)));
builder.addLore(C.cBlue + C.Bold + "Cooldown: " + C.cWhite
+ (wizard == null ? spell.getBaseCooldown() : spell.getSpellCooldown(wizard)) + " seconds");
builder.addLore("");
for (String lore : spell.getDesc()) builder.setTitle(spell.getElement().getColor() + spell.getSpellName());
{
builder.addLore(C.cGray + lore, 35);
}
if (wizard == null) builder.addLore("");
{ builder.addLore(C.cBlue + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
addItem(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true)); builder.addLore(C.cBlue + C.Bold + "Mana Cost: " + C.cWhite
} + (wizard == null ? spell.getBaseManaCost() : spell.getManaCost(wizard)));
else builder.addLore(C.cBlue + C.Bold + "Cooldown: " + C.cWhite
{ + (wizard == null ? spell.getBaseCooldown() : spell.getSpellCooldown(wizard)) + " seconds");
addButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton( builder.addLore("");
this, spell));
}
}
else
{
addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 8).setTitle(C.cRed + C.Bold + "Unknown")
.build(), "Unknown", "Unknown", 1, true, true));
}
}
else if (!usedNumbers.contains(i % 9))
{
addItem(i, new ShopItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (byte) 15).setTitle(C.cRed + "").build(),
"No Item", "No Item", 1, true, true));
}
}
}
public Wizards getWizards() for (String lore : spell.getDesc())
{ {
return _wizard; builder.addLore(C.cGray + lore, 40);
} }
if (wizard == null)
{
addItem(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true));
}
else
{
builder.addLore("");
builder.addLore(C.cPurple + C.Bold + "LEFT CLICK" + C.cDGreen + " Bind to Wand");
builder.addLore(C.cGreen + C.Bold + "RIGHT CLICK" + C.cBlue + " Quickcast Spell");
addButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton(
this, spell));
}
}
else
{
addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 8).setTitle(C.cRed + C.Bold + "Unknown")
.build(), "Unknown", "Unknown", 1, true, true));
}
}
else if (!usedNumbers.contains(i % 9))
{
addItem(i, new ShopItem(new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (byte) 15).setTitle(C.cRed + "").build(),
"No Item", "No Item", 1, true, true));
}
}
}
public Wizards getWizards()
{
return _wizard;
}
} }

View File

@ -122,25 +122,6 @@ public enum SpellType // ❤
"Use this! Heal yourself up!"), "Use this! Heal yourself up!"),
/*Drain(SpellElement.MISC, // Spell element
"Drain", // Spell name
new ItemStack(Material.BUCKET), // Spell icon
SpellDrain.class, // Spell class
3, // Spell max level
30, // Mana cost
20, // Spell cooldown
-3, // Mana cost change per level
-4, // Cooldown change per level
3, // Item amount in loot
"",
"Right click other players with this spell",
"to empty their mana reserves!", TODO Make this area based and drain completely of mana or a rune and drain passively.
"You gain a third of the absorbed mana!"),*/
IcePrison(SpellElement.MISC, // Spell element IcePrison(SpellElement.MISC, // Spell element
"Ice Prison", // Spell name "Ice Prison", // Spell name
new ItemStack(Material.ICE), // Spell icon new ItemStack(Material.ICE), // Spell icon
@ -178,11 +159,11 @@ public enum SpellType // ❤
"", "",
"Overwhelm your opponent with shards!", "Overwhelm your opponent with shards!",
"Each shard is fired half a second after", "Each shard is fired half a second after",
"the last allowing you to pummel your", "the last allowing you to pummel your",
"enemies senseless!"), "enemies senseless!"),
Implode(SpellElement.MISC, // Spell element Implode(SpellElement.MISC, // Spell element
@ -246,9 +227,8 @@ public enum SpellType // ❤
"", "",
"The basic spell all beginner mages are taught.", "Basic spell all beginner mages are taught," + " this creates a magic 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 Napalm(SpellElement.ATTACK, // Spell element
"Napalm", // Spell name "Napalm", // Spell name
@ -288,11 +268,15 @@ public enum SpellType // ❤
"", "",
"Finally you too can be a", "Firing rainbow beams of love and hope!",
"magical girl of love and hope!", "This spell damages the target instantly!",
"* Damage lowers after 30 blocks!"), "The thing is, to make this fit in with our",
"budget the damage will decrease after",
"30 blocks by 0.2 damage per block!"),
RainbowRoad(SpellElement.MISC, // Spell element RainbowRoad(SpellElement.MISC, // Spell element
"Rainbow Road", // Spell name "Rainbow Road", // Spell name
@ -319,16 +303,14 @@ public enum SpellType // ❤
SpellRumble.class, // Spell class SpellRumble.class, // Spell class
5, // Spell max level 5, // Spell max level
30, // Mana cost 30, // Mana cost
5, // Spell cooldown 15, // Spell cooldown
0, // Mana cost change per level 0, // Mana cost change per level
0, // 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 + 2", C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
C.cGold + C.Bold + "Explosion Damage:", C.cGold + C.Bold + "Explosion Damage: " + C.Bold + C.cWhite + "Spell Level / 4",
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 + "Range: " + C.Bold + C.cWhite + "Spell Level x 10",
@ -645,7 +627,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());
} }
@ -681,7 +667,9 @@ public enum SpellType // ❤
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

@ -314,7 +314,6 @@ public class Wizards extends SoloGame
if (item != null && item.getType() == Material.BLAZE_ROD) if (item != null && item.getType() == Material.BLAZE_ROD)
{ {
ItemMeta meta = item.getItemMeta();
String display; String display;
if (type != null) if (type != null)
@ -332,6 +331,8 @@ public class Wizards extends SoloGame
display = C.cWhite + "Right click to set a spell"; display = C.cWhite + "Right click to set a spell";
} }
ItemMeta meta = item.getItemMeta();
if (!meta.hasDisplayName() || !meta.getDisplayName().equals(display)) if (!meta.hasDisplayName() || !meta.getDisplayName().equals(display))
{ {
meta.setDisplayName(display); meta.setDisplayName(display);
@ -686,15 +687,17 @@ public class Wizards extends SoloGame
Entry<ItemStack, Integer> entry = _randomItems.get(UtilMath.r(_randomItems.size())); Entry<ItemStack, Integer> entry = _randomItems.get(UtilMath.r(_randomItems.size()));
ItemStack item = entry.getKey().clone(); ItemStack item = entry.getKey().clone();
SpellType spellType = getSpell(item);
// Every chest has a spell. // Every chest has a spell.
if (i > 5 && item.getType() != Material.ENCHANTED_BOOK) if (i > 5 && spellType == null)
{ {
continue; continue;
} }
if (!containsSpell) if (!containsSpell)
{ {
containsSpell = item.getType() == Material.ENCHANTED_BOOK; containsSpell = spellType != null;
} }
item.setAmount(item.getAmount() + UtilMath.r(entry.getValue() + 1)); item.setAmount(item.getAmount() + UtilMath.r(entry.getValue() + 1));
@ -710,12 +713,16 @@ public class Wizards extends SoloGame
if (item.hasItemMeta() && item.getItemMeta().hasDisplayName()) if (item.hasItemMeta() && item.getItemMeta().hasDisplayName())
{ {
String title = item.getItemMeta().getDisplayName(); String title = item.getItemMeta().getDisplayName();
title = ChatColor.stripColor(title.substring(title.split(" ")[0].length() + 1));
for (SpellType spell : SpellType.values()) if (title.contains(" "))
{ {
if (spell.getSpellName().equals(title)) title = ChatColor.stripColor(title.substring(title.split(" ")[0].length() + 1));
return spell;
for (SpellType spell : SpellType.values())
{
if (spell.getSpellName().equals(title))
return spell;
}
} }
} }
@ -768,6 +775,7 @@ public class Wizards extends SoloGame
public ItemStack makeUnusedWand() public ItemStack makeUnusedWand()
{ {
ItemBuilder builder = new ItemBuilder(Material.BLAZE_ROD); ItemBuilder builder = new ItemBuilder(Material.BLAZE_ROD);
builder.setTitle(ChatColor.WHITE + "Spell Wand" + buildTime()); builder.setTitle(ChatColor.WHITE + "Spell Wand" + buildTime());
builder.addLore( builder.addLore(
@ -868,21 +876,18 @@ public class Wizards extends SoloGame
if (event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest) if (event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest)
{ {
if (item != null && item.getType() == Material.ENCHANTED_BOOK) SpellType spell = getSpell(item);
if (spell != null)
{ {
onSpellLearn(p, spell);
SpellType spell = getSpell(item); event.setCancelled(true);
event.setCurrentItem(new ItemStack(Material.AIR));
if (spell != null) p.playSound(p.getLocation(), Sound.NOTE_STICKS, 0.7F, 0);
{
onSpellLearn(p, spell);
event.setCancelled(true);
event.setCurrentItem(new ItemStack(Material.AIR));
p.playSound(p.getLocation(), Sound.NOTE_STICKS, 0.7F, 0);
}
} }
} }
if (item.getType() == Material.BLAZE_ROD if (item.getType() == Material.BLAZE_ROD
@ -956,31 +961,26 @@ public class Wizards extends SoloGame
{ {
ItemStack item = event.getEntity().getItemStack(); ItemStack item = event.getEntity().getItemStack();
if (item.getType() == Material.ENCHANTED_BOOK) SpellType spell = getSpell(item);
if (spell != null)
{ {
Hologram holo = new Hologram(getArcadeManager().getHologramManager(),
SpellType spell = getSpell(item); event.getEntity().getLocation().add(0, 1, 0),
if (spell != null) C.cDPurple + C.Bold + "Spellbook",
{
Hologram holo = new Hologram(getArcadeManager().getHologramManager(), spell.getElement().getColor() + spell.getSpellName());
event.getEntity().getLocation().add(0, 1, 0), holo.setFollowEntity(event.getEntity());
C.cDPurple + C.Bold + "Spellbook", holo.setRemoveOnEntityDeath();
spell.getElement().getColor() + spell.getSpellName()); holo.start();
holo.setFollowEntity(event.getEntity()); _droppedWandsBooks.add(event.getEntity());
holo.setRemoveOnEntityDeath();
holo.start();
_droppedWandsBooks.add(event.getEntity());
}
} }
else if (item.getType() == Material.BLAZE_ROD) else if (item.getType() == Material.BLAZE_ROD)
{ {
@ -1230,18 +1230,15 @@ public class Wizards extends SoloGame
} }
} }
else if (item.getType() == Material.ENCHANTED_BOOK) else if (getSpell(item) != null)
{ {
SpellType spell = getSpell(item); SpellType spell = getSpell(item);
if (spell != null) onSpellLearn(p, spell);
{
onSpellLearn(p, spell);
event.setCancelled(true); event.setCancelled(true);
event.getItem().remove(); event.getItem().remove();
}
} }
else if (item.getType() == Material.NETHER_STAR) else if (item.getType() == Material.NETHER_STAR)

View File

@ -6,6 +6,7 @@ import mineplex.core.common.util.UtilPlayer;
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.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -14,27 +15,38 @@ public class SpellGust extends Spell implements SpellClick
{ {
@Override @Override
public void castSpell(Player player) public void castSpell(final Player player)
{ {
Vector vector = player.getLocation().getDirection().setY(0).normalize().multiply(1.5).setY(0.3) final Vector vector = player.getLocation().getDirection().setY(0).normalize().multiply(1.5).setY(0.3)
.multiply(1.2 + (getSpellLevel(player) * 0.4D)); .multiply(1.2 + (getSpellLevel(player) * 0.4D));
HashMap<Player, Double> effected = UtilPlayer.getPlayersInPyramid(player, 45, 10 * getSpellLevel(player)); final HashMap<Player, Double> effected = UtilPlayer.getPlayersInPyramid(player, 45, 10 * getSpellLevel(player));
for (Player target : effected.keySet())
{
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);
}
if (!effected.isEmpty()) if (!effected.isEmpty())
{ {
player.playSound(player.getLocation(), Sound.BAT_TAKEOFF, 1, 0.7F);
charge(player); 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

@ -1,11 +1,16 @@
package nautilus.game.arcade.game.games.wizards.spells; package nautilus.game.arcade.game.games.wizards.spells;
import java.util.HashMap;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser; 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.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
@ -14,23 +19,19 @@ import org.bukkit.Location;
import org.bukkit.Material; 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.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.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class SpellIceShards extends Spell implements SpellClick, IThrown public class SpellIceShards extends Spell implements SpellClick, IThrown
{ {
// private HashMap<ArrayList, Long> _shardsExpire = new HashMap<ArrayList, Long>(); private HashMap<Entity, Location> _lastParticles = new HashMap<Entity, Location>();
// private HashMap<ArrayList<Entity>, HashMap<String, Integer>> _hitShards = new HashMap<ArrayList<Entity>, HashMap<String,
// Integer>>();
@Override @Override
public void castSpell(final Player player) 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); shoot(player);
for (int i = 1; i <= getSpellLevel(player); i++) for (int i = 1; i <= getSpellLevel(player); i++)
@ -51,31 +52,6 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
charge(player); charge(player);
} }
/*@EventHandler
public void onSecond(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
{
return;
}
if (!Wizards.IsLive())
return;
Iterator<Entry<ArrayList, Long>> itel = _shardsExpire.entrySet().iterator();
while (itel.hasNext())
{
Entry<ArrayList, Long> entry = itel.next();
if (entry.getValue() < System.currentTimeMillis())
{
itel.remove();
_hitShards.remove(entry.getKey());
}
}
}*/
private void shoot(Player player) private void shoot(Player player)
{ {
@ -88,13 +64,13 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
ItemStackFactory.Instance.CreateStack(Material.GHAST_TEAR, (byte) 0, 1, "Ice Shard " + player.getName() + " " ItemStackFactory.Instance.CreateStack(Material.GHAST_TEAR, (byte) 0, 1, "Ice Shard " + player.getName() + " "
+ System.currentTimeMillis())); + System.currentTimeMillis()));
// firedShards.add(ent); UtilAction.velocity(ent, player.getLocation().getDirection(), 2, false, 0, 0.2, 10, false);
UtilAction.velocity(ent, player.getLocation().getDirection(), 2.3, false, 0, 0.2, 10, false);
Wizards.getArcadeManager().GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2f); Wizards.getArcadeManager().GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 2f);
player.getWorld().playSound(player.getLocation(), Sound.CLICK, 1.2F, 0.8F); player.getWorld().playSound(player.getLocation(), Sound.CLICK, 1.2F, 0.8F);
_lastParticles.put(ent, ent.getLocation());
} }
} }
@ -103,25 +79,6 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
{ {
if (target != null && target instanceof Player) if (target != null && target instanceof Player)
{ {
/*String name = ((Player) target).getName();
int timesHit = 0;
for (Entry<ArrayList<Entity>, HashMap<String, Integer>> entry : _hitShards.entrySet())
{
if (entry.getKey().contains(data.GetThrown()))
{
HashMap<String, Integer> map = entry.getValue();
if (map.containsKey(name))
{
timesHit = map.get(name);
}
map.put(name, timesHit + 1);
break;
}
}*/
// Damage Event // Damage Event
Wizards.getArcadeManager() Wizards.getArcadeManager()
@ -129,11 +86,6 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
.NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 4 /*+ (timesHit * 2)*/, true, true, .NewDamageEvent(target, data.GetThrower(), null, DamageCause.PROJECTILE, 4 /*+ (timesHit * 2)*/, true, true,
false, "Ice Shard", "Ice Shard"); false, "Ice Shard", "Ice Shard");
/*if (timesHit > 0)
{
UtilPlayer.message(data.GetThrower(), "Ice Shards" + ": " + F.elem(timesHit + " Consecutive Hits") + C.cGray
+ " (" + F.skill("+" + timesHit + " Damage") + C.cGray + ")");
}*/
} }
handleShard(data); handleShard(data);
@ -151,6 +103,27 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
{ {
loc.getBlock().setType(Material.AIR); loc.getBlock().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.SNOW_BLOCK, 0), loc, 0, 0, 0, 0, 1);
}
_lastParticles.put(entity, entity.getLocation());
}
} }
@Override @Override

View File

@ -128,7 +128,7 @@ public class SpellImplode extends Spell implements SpellClick
{ {
cancel(); cancel();
} }
else if (timesRan++ >= 28) else if (timesRan++ >= 20)
{ {
Iterator<Block> itel = effectedBlocks.iterator(); Iterator<Block> itel = effectedBlocks.iterator();

View File

@ -97,7 +97,7 @@ public class SpellLightningStrike extends Spell implements SpellClick
} }
} }
}, 8); }, 20);
charge(p); charge(p);
} }

View File

@ -1,9 +1,13 @@
package nautilus.game.arcade.game.games.wizards.spells; 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.UtilBlock;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer; 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.Spell;
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
@ -31,6 +35,7 @@ public class SpellMagicMissile extends Spell implements SpellClick
new BukkitRunnable() new BukkitRunnable()
{ {
private int dingsDone; private int dingsDone;
private Location previousLocation = missileLocation;
private void burst() private void burst()
{ {
@ -54,14 +59,33 @@ public class SpellMagicMissile extends Spell implements SpellClick
if (entity != player && (!(entity instanceof Player) || Wizards.IsAlive(entity))) if (entity != player && (!(entity instanceof Player) || Wizards.IsAlive(entity)))
{ {
Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.MAGIC, damage, Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.MAGIC, damage, true,
true, true, false, "Magic Missile", "Magic Missile"); true, false, "Magic Missile", "Magic Missile");
} }
} }
} }
} }
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, missileLocation, 0.5F, 0.5F, 0.5F, 0, 40); 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); missileLocation.getWorld().playSound(missileLocation, Sound.BAT_TAKEOFF, 1.2F, 1);
cancel(); cancel();
} }
@ -150,10 +174,12 @@ public class SpellMagicMissile extends Spell implements SpellClick
return; return;
} }
playParticle(missileLocation, previousLocation);
previousLocation = missileLocation.clone();
dingsDone++; dingsDone++;
} }
UtilParticle.PlayParticle(ParticleType.MAGIC_CRIT, missileLocation, 0, 0, 0, 0, 1);
missileLocation.getWorld().playSound(missileLocation, Sound.ORB_PICKUP, 0.7F, 0); missileLocation.getWorld().playSound(missileLocation, Sound.ORB_PICKUP, 0.7F, 0);
} }
} }
@ -161,4 +187,27 @@ public class SpellMagicMissile extends Spell implements SpellClick
charge(player); 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

@ -46,7 +46,7 @@ public class SpellNapalm extends Spell implements SpellClick
{ {
final int length = 5 + (10 * getSpellLevel(player)); final int length = 5 + (10 * getSpellLevel(player));
final Vector vector = player.getLocation().getDirection().normalize().multiply(0.12); final Vector vector = player.getLocation().getDirection().normalize().multiply(0.15);
final Location playerLoc = player.getLocation().add(0, 2, 0); final Location playerLoc = player.getLocation().add(0, 2, 0);
final Location napalmLoc = playerLoc.clone().add(playerLoc.getDirection().normalize().multiply(2)); final Location napalmLoc = playerLoc.clone().add(playerLoc.getDirection().normalize().multiply(2));
@ -232,7 +232,7 @@ public class SpellNapalm extends Spell implements SpellClick
size = Math.min(8, size + 0.06); size = Math.min(8, size + 0.06);
} }
blocksTravelled += 0.12; blocksTravelled += 0.15;
if (lastTick++ % 8 == 0) if (lastTick++ % 8 == 0)
{ {

View File

@ -28,8 +28,11 @@ public class SpellSpectralArrow extends Spell implements SpellClick
public void castSpell(Player player) public void castSpell(Player player)
{ {
Arrow arrow = player.launchProjectile(Arrow.class); Arrow arrow = player.launchProjectile(Arrow.class);
arrow.setVelocity(arrow.getVelocity().multiply(3));
arrow.setVelocity(arrow.getVelocity().multiply(2.3));
arrow.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), getSpellLevel(player))); arrow.setMetadata("SpellLevel", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), getSpellLevel(player)));
((CraftArrow) arrow).getHandle().fromPlayer = 0; ((CraftArrow) arrow).getHandle().fromPlayer = 0;
_spectralArrows.put(arrow, new Location[] _spectralArrows.put(arrow, new Location[]

View File

@ -29,7 +29,6 @@ public class SpellWizardsCompass extends Spell implements SpellClick
public void castSpell(Player p) public void castSpell(Player p)
{ {
Location loc = p.getEyeLocation().subtract(0, 1, 0); Location loc = p.getEyeLocation().subtract(0, 1, 0);
ArrayList<Player> players = Wizards.GetPlayers(true);
final ArrayList<Integer[]> colors = new ArrayList<Integer[]>(); final ArrayList<Integer[]> colors = new ArrayList<Integer[]>();
@ -51,21 +50,19 @@ public class SpellWizardsCompass extends Spell implements SpellClick
Collections.shuffle(colors); Collections.shuffle(colors);
boolean foundSomeone = false; for (Player enemy : Wizards.GetPlayers(true))
for (Player enemy : players)
{ {
if (UtilMath.offset(p, enemy) <= 10) if (enemy == p)
{ {
continue; continue;
} }
foundSomeone = true; final double playerDist = Math.min(7, UtilMath.offset(enemy, p));
final Vector traj = UtilAlg.getTrajectory(p.getLocation(), enemy.getEyeLocation()).multiply(0.1); 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) final Hologram hologram = new Hologram(Wizards.getArcadeManager().getHologramManager(), loc.clone().add(0, 0.3, 0)
.add(traj.clone().normalize().multiply(7)), enemy.getName()); .add(traj.clone().normalize().multiply(playerDist)), enemy.getName());
hologram.setHologramTarget(HologramTarget.WHITELIST); hologram.setHologramTarget(HologramTarget.WHITELIST);
hologram.addPlayer(p); hologram.addPlayer(p);
@ -103,7 +100,7 @@ public class SpellWizardsCompass extends Spell implements SpellClick
} }
} }
if (dist <= 7 * 10) if (dist <= playerDist * 10)
{ {
for (int a = 0; a < 2; a++) for (int a = 0; a < 2; a++)
{ {
@ -125,15 +122,8 @@ public class SpellWizardsCompass extends Spell implements SpellClick
}.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0); }.runTaskTimer(Wizards.getArcadeManager().getPlugin(), 0, 0);
} }
if (!foundSomeone) p.playSound(p.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
{
p.sendMessage(C.cRed + "All players are less than 10 blocks from you!");
}
else
{
p.playSound(p.getLocation(), Sound.ZOMBIE_UNFECT, 1.5F, 1);
charge(p); charge(p);
}
} }
} }