Numerous fixes to Wizards

This commit is contained in:
libraryaddict 2015-01-24 23:14:23 +13:00
parent 3ff0592d2d
commit 3525243f9d
8 changed files with 53 additions and 32 deletions

View File

@ -233,7 +233,7 @@ public enum SpellType // ❤
0, // Cooldown change per level 0, // Cooldown change per level
5, // Item amount in loot 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 0, // Cooldown change per level
5, // Item amount in loot 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", C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level x 0.8",

View File

@ -48,10 +48,11 @@ public class Wizard
public long getCooldown(SpellType type) public long getCooldown(SpellType type)
{ {
if (_cooldowns.containsKey(type)) if (_cooldowns.containsKey(type) && _cooldowns.get(type) >= System.currentTimeMillis())
{ {
return _cooldowns.get(type); return _cooldowns.get(type);
} }
return 0; return 0;
} }

View File

@ -115,7 +115,15 @@ public class WizardBattles extends SoloGame
{ {
super(manager, GameType.WizardBattles, new Kit[0], new String[] 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[] setKits(new Kit[]
@ -595,22 +603,25 @@ public class WizardBattles extends SoloGame
if (spellLevel > 0) if (spellLevel > 0)
{ {
if (wizard.getCooldown(spell) < System.currentTimeMillis()) if (wizard.getCooldown(spell) == 0)
{ {
if (wizard.getMana() >= spell.getManaCost(wizard)) if (wizard.getMana() >= spell.getManaCost(wizard))
{ {
Spell sp = _spells.get(spell); Spell sp = _spells.get(spell);
if (obj instanceof Block && sp instanceof SpellClickBlock) if (obj instanceof Block && sp instanceof SpellClickBlock)
{ {
((SpellClickBlock) sp).castSpell(player, (Block) obj); ((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); ((SpellClickEntity) sp).castSpell(player, (Entity) obj);
} }
else if (sp instanceof SpellClick)
if (wizard.getCooldown(spell) == 0 && sp instanceof SpellClick)
{ {
((SpellClick) sp).castSpell(player); ((SpellClick) sp).castSpell(player);
} }
@ -639,7 +650,7 @@ public class WizardBattles extends SoloGame
@EventHandler @EventHandler
public void onChat(PlayerChatEvent event) 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")) if (event.getMessage().equalsIgnoreCase("spells"))
{ {
@ -927,12 +938,7 @@ public class WizardBattles extends SoloGame
if (item.getType() == Material.BLAZE_ROD) if (item.getType() == Material.BLAZE_ROD)
{ {
if (event.getClickedBlock() == null) onCastSpell(p, event.getClickedBlock());
{
onCastSpell(p, event.getClickedBlock());
}
} }
} }
} }

View File

@ -38,13 +38,15 @@ public class WizardSpellMenu extends MiniPlugin
Player p = event.getPlayer(); Player p = event.getPlayer();
if (event.getAction().name().contains("RIGHT") if (event.getAction().name().contains("RIGHT"))
&& p.getInventory().getHeldItemSlot() < 5
&& (event.getAction() != Action.RIGHT_CLICK_BLOCK || event.getClickedBlock().getState() instanceof InventoryHolder))
{ {
if (p.getInventory().getHeldItemSlot() < 5)
_wizardShop.attemptShopOpen(p); {
if (event.getClickedBlock() == null || !(event.getClickedBlock() instanceof InventoryHolder))
{
_wizardShop.attemptShopOpen(p);
}
}
} }
} }
} }

View File

@ -41,28 +41,24 @@ public class SpellLance extends Spell implements SpellClick
if (l != null) if (l != null)
{ {
ArrayList<Location> locs = UtilShapes.getLinesDistancedPoints(player.getLocation(), l, 1.5); ArrayList<Location> locs = UtilShapes.getLinesDistancedPoints(player.getLocation(), l, 1.5);
Iterator<Location> itel = locs.iterator(); Iterator<Location> itel = locs.iterator();
while (itel.hasNext()) while (itel.hasNext())
{ {
Location loc = itel.next(); Location loc = itel.next();
if (loc.distance(player.getLocation()) <= 1.5) if (loc.distance(player.getLocation()) <= 1.5)
{ {
itel.remove(); itel.remove();
} }
} }
for (Location loc : locs)
{
if (loc.distance(player.getLocation()) <= 1.5)
{
continue;
}
}
if (!locs.isEmpty()) if (!locs.isEmpty())
{ {
charge(player); charge(player);
explode(locs.remove(0), player); explode(locs.remove(0), player);
if (!locs.isEmpty()) if (!locs.isEmpty())
{ {
_locations.add(new HashMap.SimpleEntry(locs, player)); _locations.add(new HashMap.SimpleEntry(locs, player));
@ -81,6 +77,7 @@ public class SpellLance extends Spell implements SpellClick
{ {
Entry<ArrayList<Location>, Player> next = itel.next(); Entry<ArrayList<Location>, Player> next = itel.next();
explode(next.getKey().remove(0), next.getValue()); explode(next.getKey().remove(0), next.getValue());
if (next.getKey().isEmpty()) if (next.getKey().isEmpty())
{ {
itel.remove(); itel.remove();

View File

@ -22,7 +22,7 @@ public class SpellLaunch extends Spell implements SpellClickEntity
Wizards.getArcadeManager().GetCondition().Factory() Wizards.getArcadeManager().GetCondition().Factory()
.Falling("Launch", (LivingEntity) entity, player, 10, false, false); .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() Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().GetPlugin(), new Runnable()
{ {
@ -30,6 +30,7 @@ public class SpellLaunch extends Spell implements SpellClickEntity
{ {
((LivingEntity) entity).setVelocity(vector); ((LivingEntity) entity).setVelocity(vector);
entity.getWorld().playSound(((LivingEntity) entity).getLocation(), Sound.BAT_TAKEOFF, 2, 0); entity.getWorld().playSound(((LivingEntity) entity).getLocation(), Sound.BAT_TAKEOFF, 2, 0);
entity.setFallDistance(-1F);
} }
}); });

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilShapes; 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.SpellClickBlock; import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClickBlock;
import org.bukkit.Effect; import org.bukkit.Effect;
@ -17,7 +18,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable; import org.bukkit.scheduler.BukkitRunnable;
public class SpellRumble extends Spell implements SpellClickBlock public class SpellRumble extends Spell implements SpellClickBlock, SpellClick
{ {
final private BlockFace[] _radial = final private BlockFace[] _radial =
@ -26,6 +27,18 @@ public class SpellRumble extends Spell implements SpellClickBlock
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST 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 @Override
public void castSpell(final Player player, final Block target) public void castSpell(final Player player, final Block target)
{ {

View File

@ -58,6 +58,7 @@ public class LaunchRune
Vector vector = entity.getLocation().getDirection().normalize().multiply(0.1); Vector vector = entity.getLocation().getDirection().normalize().multiply(0.1);
vector.setY(_launchHeight); vector.setY(_launchHeight);
entity.setVelocity(vector); entity.setVelocity(vector);
entity.setFallDistance(-1F);
launched = true; launched = true;
@ -99,7 +100,7 @@ public class LaunchRune
_caster = caster; _caster = caster;
_runeLocation = loc; _runeLocation = loc;
_runeSize = size; _runeSize = size;
_launchHeight = 0.5F + (spellLevel * 0.5F); _launchHeight = 1F + (spellLevel * 0.15F);
displayCircle(1); displayCircle(1);
} }