From 3525243f9d8229c79169be44432d99821403fd99 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Sat, 24 Jan 2015 23:14:23 +1300 Subject: [PATCH] Numerous fixes to Wizards --- .../arcade/game/games/wizards/SpellType.java | 4 +-- .../arcade/game/games/wizards/Wizard.java | 3 +- .../game/games/wizards/WizardBattles.java | 28 +++++++++++-------- .../game/games/wizards/WizardSpellMenu.java | 14 ++++++---- .../game/games/wizards/spells/SpellLance.java | 15 ++++------ .../games/wizards/spells/SpellLaunch.java | 3 +- .../games/wizards/spells/SpellRumble.java | 15 +++++++++- .../wizards/spells/subclasses/LaunchRune.java | 3 +- 8 files changed, 53 insertions(+), 32 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellType.java index 4fcdafa7b..bb8ddedcc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/SpellType.java @@ -233,7 +233,7 @@ public enum SpellType // ❤ 0, // Cooldown change per level 5, // Item amount in loot - C.cGold + C.Bold + "Launch Height: " + C.Bold + C.cWhite + "Spell Level x 5 blocks", + C.cGold + C.Bold + "Launch Height: " + C.Bold + C.cWhite + "(Spell Level x 3) + 5 blocks", "", @@ -252,7 +252,7 @@ public enum SpellType // ❤ 0, // Cooldown change per level 5, // Item amount in loot - C.cGold + C.Bold + "Launch Height: " + C.Bold + C.cWhite + "Spell Level x 5 blocks", + C.cGold + C.Bold + "Launch Height: " + C.Bold + C.cWhite + "(Spell Level x 2) + 5 blocks", C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level x 0.8", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizard.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizard.java index badf20ea4..3cae1c5c6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizard.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/Wizard.java @@ -48,10 +48,11 @@ public class Wizard public long getCooldown(SpellType type) { - if (_cooldowns.containsKey(type)) + if (_cooldowns.containsKey(type) && _cooldowns.get(type) >= System.currentTimeMillis()) { return _cooldowns.get(type); } + return 0; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardBattles.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardBattles.java index 3c429dcf6..9851ecca0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardBattles.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardBattles.java @@ -115,7 +115,15 @@ public class WizardBattles extends SoloGame { super(manager, GameType.WizardBattles, new Kit[0], new String[] { - "Wizard Battles" + + "Find loot and spells in chests", + + "Right click wands to assign spells", + + "Left click with wands to cast magic", + + "The last wizard alive wins!" + }); setKits(new Kit[] @@ -595,22 +603,25 @@ public class WizardBattles extends SoloGame if (spellLevel > 0) { - if (wizard.getCooldown(spell) < System.currentTimeMillis()) + if (wizard.getCooldown(spell) == 0) { if (wizard.getMana() >= spell.getManaCost(wizard)) { Spell sp = _spells.get(spell); + if (obj instanceof Block && sp instanceof SpellClickBlock) { ((SpellClickBlock) sp).castSpell(player, (Block) obj); } - else if (obj instanceof Entity && sp instanceof SpellClickEntity) + + if (wizard.getCooldown(spell) == 0 && obj instanceof Entity && sp instanceof SpellClickEntity) { ((SpellClickEntity) sp).castSpell(player, (Entity) obj); } - else if (sp instanceof SpellClick) + + if (wizard.getCooldown(spell) == 0 && sp instanceof SpellClick) { ((SpellClick) sp).castSpell(player); } @@ -639,7 +650,7 @@ public class WizardBattles extends SoloGame @EventHandler public void onChat(PlayerChatEvent event) { - if (Rank.ADMIN.Has(Manager.GetClients().Get(event.getPlayer()).GetRank())) + if (Rank.DEVELOPER.Has(Manager.GetClients().Get(event.getPlayer()).GetRank())) { if (event.getMessage().equalsIgnoreCase("spells")) { @@ -927,12 +938,7 @@ public class WizardBattles extends SoloGame if (item.getType() == Material.BLAZE_ROD) { - if (event.getClickedBlock() == null) - { - - onCastSpell(p, event.getClickedBlock()); - - } + onCastSpell(p, event.getClickedBlock()); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java index 54700bb90..1067316c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/WizardSpellMenu.java @@ -38,13 +38,15 @@ public class WizardSpellMenu extends MiniPlugin Player p = event.getPlayer(); - if (event.getAction().name().contains("RIGHT") - && p.getInventory().getHeldItemSlot() < 5 - && (event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getClickedBlock().getState() instanceof InventoryHolder)) + if (event.getAction().name().contains("RIGHT")) { - - _wizardShop.attemptShopOpen(p); - + if (p.getInventory().getHeldItemSlot() < 5) + { + if (event.getClickedBlock() == null || !(event.getClickedBlock() instanceof InventoryHolder)) + { + _wizardShop.attemptShopOpen(p); + } + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellLance.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellLance.java index 37931cbf6..a6150c9b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellLance.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellLance.java @@ -41,28 +41,24 @@ public class SpellLance extends Spell implements SpellClick if (l != null) { ArrayList locs = UtilShapes.getLinesDistancedPoints(player.getLocation(), l, 1.5); + Iterator itel = locs.iterator(); while (itel.hasNext()) { Location loc = itel.next(); + if (loc.distance(player.getLocation()) <= 1.5) { itel.remove(); } } - for (Location loc : locs) - { - if (loc.distance(player.getLocation()) <= 1.5) - { - continue; - } - } + if (!locs.isEmpty()) { charge(player); - + explode(locs.remove(0), player); - + if (!locs.isEmpty()) { _locations.add(new HashMap.SimpleEntry(locs, player)); @@ -81,6 +77,7 @@ public class SpellLance extends Spell implements SpellClick { Entry, Player> next = itel.next(); explode(next.getKey().remove(0), next.getValue()); + if (next.getKey().isEmpty()) { itel.remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellLaunch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellLaunch.java index 6d1cd2dd3..d34427ca8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellLaunch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellLaunch.java @@ -22,7 +22,7 @@ public class SpellLaunch extends Spell implements SpellClickEntity Wizards.getArcadeManager().GetCondition().Factory() .Falling("Launch", (LivingEntity) entity, player, 10, false, false); - final Vector vector = new Vector(0, 0.5F + (getSpellLevel(player) * 0.5F), 0); + final Vector vector = new Vector(0, 1F + (getSpellLevel(player) * 0.15F), 0); Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().GetPlugin(), new Runnable() { @@ -30,6 +30,7 @@ public class SpellLaunch extends Spell implements SpellClickEntity { ((LivingEntity) entity).setVelocity(vector); entity.getWorld().playSound(((LivingEntity) entity).getLocation(), Sound.BAT_TAKEOFF, 2, 0); + entity.setFallDistance(-1F); } }); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellRumble.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellRumble.java index 8bba7030d..135f0d8b1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellRumble.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/SpellRumble.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilShapes; 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; @@ -17,7 +18,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.scheduler.BukkitRunnable; -public class SpellRumble extends Spell implements SpellClickBlock +public class SpellRumble extends Spell implements SpellClickBlock, SpellClick { final private BlockFace[] _radial = @@ -26,6 +27,18 @@ public class SpellRumble extends Spell implements SpellClickBlock BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST }; + public void castSpell(Player player) + { + Block block = player.getLocation().add(0, -1, 0).getBlock(); + + if (!UtilBlock.solid(block)) + { + block = block.getRelative(BlockFace.DOWN); + } + + castSpell(player, block); + } + @Override public void castSpell(final Player player, final Block target) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/subclasses/LaunchRune.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/subclasses/LaunchRune.java index 9b2bfcdfe..320d3d063 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/subclasses/LaunchRune.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wizards/spells/subclasses/LaunchRune.java @@ -58,6 +58,7 @@ public class LaunchRune Vector vector = entity.getLocation().getDirection().normalize().multiply(0.1); vector.setY(_launchHeight); entity.setVelocity(vector); + entity.setFallDistance(-1F); launched = true; @@ -99,7 +100,7 @@ public class LaunchRune _caster = caster; _runeLocation = loc; _runeSize = size; - _launchHeight = 0.5F + (spellLevel * 0.5F); + _launchHeight = 1F + (spellLevel * 0.15F); displayCircle(1); }