Changes to wizards
This commit is contained in:
parent
9b4f1a491e
commit
72e61a02df
@ -1,27 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import mineplex.core.shop.item.SingleButton;
|
||||
import nautilus.game.arcade.game.games.wizards.SpellType.SpellElement;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class ElementButton extends SingleButton
|
||||
{
|
||||
|
||||
private SpellElement _element;
|
||||
private SpellMenuPage _spellPage;
|
||||
|
||||
public ElementButton(SpellMenuPage spellPage, SpellElement element)
|
||||
{
|
||||
_element = element;
|
||||
_spellPage = spellPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Clicked(Player player)
|
||||
{
|
||||
_spellPage.getWizards().getWizard(player).selectedPage = _element;
|
||||
_spellPage.BuildPage();
|
||||
}
|
||||
|
||||
}
|
@ -1,44 +1,39 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public abstract class Spell implements Listener
|
||||
{
|
||||
public interface SpellRightClick
|
||||
{
|
||||
public void castSpell(Player player);
|
||||
}
|
||||
|
||||
public interface SpellRightClickEntity
|
||||
{
|
||||
public void castSpell(Player player, Entity entity);
|
||||
}
|
||||
|
||||
public interface SpellRightClickBlock
|
||||
{
|
||||
public void castSpell(Player player, Block block);
|
||||
}
|
||||
|
||||
protected WizardBattles wizards;
|
||||
protected SpellType spell;
|
||||
private SpellType Spell;
|
||||
protected WizardBattles Wizards;
|
||||
|
||||
/**
|
||||
* Charges him for the cost of the spell
|
||||
*/
|
||||
public void charge(Player player)
|
||||
{
|
||||
WizardBattles.Wizard wizard = wizards.getWizard(player);
|
||||
wizard.mana -= spell.getManaCost(wizard.knownSpells.get(spell));
|
||||
wizard.cooldowns.put(spell, System.currentTimeMillis() + (1000L * spell.getSpellCooldown(wizard.knownSpells.get(spell))));
|
||||
wizards.displayBossbar(player);
|
||||
Wizard wizard = Wizards.getWizard(player);
|
||||
int spellLevel = wizard.getSpellLevel(getSpell());
|
||||
wizard.setMana(wizard.getMana() - getSpell().getManaCost(spellLevel));
|
||||
wizard.setUsedSpell(getSpell());
|
||||
Wizards.displayBossbar(player);
|
||||
}
|
||||
|
||||
public SpellType getSpell()
|
||||
{
|
||||
return Spell;
|
||||
}
|
||||
|
||||
protected int getSpellLevel(Player player)
|
||||
{
|
||||
return wizards.getWizard(player).knownSpells.get(spell);
|
||||
return Wizards.getWizard(player).getSpellLevel(getSpell());
|
||||
}
|
||||
|
||||
public void setSpellType(SpellType spell)
|
||||
{
|
||||
Spell = spell;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public class SpellButton extends SingleButton
|
||||
{
|
||||
item = _spell.makeSpell(_spellPage.getWizards(), item);
|
||||
player.setItemInHand(item);
|
||||
player.sendMessage(C.cBlue + "Set spell on wand to " + _spell.getElement().getColor() + _spell.get_spellName());
|
||||
player.sendMessage(C.cBlue + "Set spell on wand to " + _spell.getElement().getColor() + _spell.getSpellName());
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 10, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
@ -7,7 +9,6 @@ import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import nautilus.game.arcade.game.games.wizards.SpellType.SpellElement;
|
||||
import nautilus.game.arcade.game.games.wizards.WizardBattles.Wizard;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -29,10 +30,17 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
|
||||
protected void BuildPage()
|
||||
{
|
||||
Wizard wizard = getWizards().getWizard(Player);
|
||||
|
||||
ArrayList<Integer> usedNumbers = new ArrayList<Integer>();
|
||||
|
||||
for (SpellElement ele : SpellElement.values())
|
||||
{
|
||||
AddButton(ele.getSlot(), new ShopItem(ele.getIcon(), ele.name(), ele.name(), 1, true, true), new ElementButton(this,
|
||||
ele));
|
||||
AddItem(ele.getSlot(), new ShopItem(ele.getIcon(), ele.name(), ele.name(), 1, true, true));
|
||||
|
||||
for (int i = ele.getFirstSlot(); i <= ele.getSecondSlot(); i++)
|
||||
{
|
||||
usedNumbers.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 9; i < 54; i++)
|
||||
@ -40,38 +48,39 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
|
||||
SpellType spell = null;
|
||||
for (SpellType spells : SpellType.values())
|
||||
{
|
||||
if (spells.getElement() == wizard.selectedPage && spells.get_slot() == i)
|
||||
if (spells.getSlot() == i)
|
||||
{
|
||||
spell = spells;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (spell == null)
|
||||
|
||||
if (usedNumbers.contains(i % 9) && spell != null)
|
||||
{
|
||||
RemoveButton(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wizard.knownSpells.containsKey(spell))
|
||||
|
||||
int spellLevel = wizard.getSpellLevel(spell);
|
||||
|
||||
if (spellLevel > 0)
|
||||
{
|
||||
int level = wizard.knownSpells.get(spell);
|
||||
ItemBuilder builder = new ItemBuilder(spell.getSpellItem());
|
||||
builder.setTitle(C.Bold + C.cDPurple + "Spell: " + spell.getElement().getColor() + spell.get_spellName());
|
||||
builder.addLore(C.Bold + C.cBlue + "Spell Level: " + C.cDAqua + level);
|
||||
builder.addLore(C.Bold + C.cBlue + "Mana Cost: " + C.cDAqua + spell.getManaCost(level));
|
||||
builder.addLore(C.Bold + C.cBlue + "Cooldown: " + C.cDAqua + spell.getSpellCooldown(level) + C.cGray);
|
||||
builder.setTitle(C.cDPurple + C.Bold + "Spell: " + spell.getElement().getColor() + spell.getSpellName());
|
||||
builder.addLore(C.cBlue + C.Bold + "Spell Level: " + C.cDAqua + spellLevel);
|
||||
builder.addLore(C.cBlue + C.Bold + "Mana Cost: " + C.cDAqua + spell.getManaCost(spellLevel));
|
||||
builder.addLore(C.cBlue + C.Bold + "Cooldown: " + C.cDAqua + spell.getSpellCooldown(spellLevel) + C.cGray);
|
||||
builder.addLore("");
|
||||
|
||||
for (String lore : spell.getDesc())
|
||||
{
|
||||
builder.addLore(C.cGreen + lore, 40);
|
||||
}
|
||||
|
||||
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.STAINED_GLASS_PANE, 1, (byte) 7).setTitle(
|
||||
ChatColor.RED + "Unknown Spell").build(), "Unknown Spell", "Unknown Spell", 1, true, true));
|
||||
AddItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 8).setTitle(C.cRed + C.Bold + "Unknown")
|
||||
.build(), "Unknown", "Unknown", 1, true, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.*;
|
||||
@ -13,101 +11,245 @@ import org.bukkit.inventory.ItemStack;
|
||||
public enum SpellType // ❤
|
||||
{
|
||||
|
||||
WizardsCompass(SpellElement.MISC, // Spell element
|
||||
"Wizard's Compass", // Spell name
|
||||
new ItemStack(Material.COMPASS), // Spell icon
|
||||
SpellWizardsCompass.class, // Spell class
|
||||
1, // Spell max level
|
||||
10, // Mana cost
|
||||
4, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
0, // Item amount in loot
|
||||
|
||||
"Displays particles pointing to the closest enemy!"),
|
||||
|
||||
Bridge(SpellElement.MISC, // Spell element
|
||||
"Bridge", // Spell name
|
||||
new ItemStack(Material.FENCE), // Spell icon
|
||||
SpellBridge.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
20, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 10",
|
||||
|
||||
"Right click on the block before the chasm",
|
||||
|
||||
"and a mighty dirt bridge will appear!"),
|
||||
|
||||
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
|
||||
|
||||
C.cGold + C.Bold + "Drained Mana: " + C.Bold + C.cWhite + "Spell Level x 40",
|
||||
|
||||
"Right click other players with this spell",
|
||||
|
||||
"to empty their mana reserves!",
|
||||
|
||||
"You gain a third of the absorbed mana!"),
|
||||
|
||||
Droom(SpellElement.ATTACK, // Spell element
|
||||
"Droom", // Spell name
|
||||
new ItemStack(Material.ANVIL), // Spell icon
|
||||
Droom.class, // Spell class
|
||||
SpellDroom.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
20, // Spell cooldown
|
||||
-3, // Mana cost change per level
|
||||
-4, // Cooldown change per level
|
||||
3, // Chance in ? to find
|
||||
3, // Item amount in loot
|
||||
|
||||
C.Bold + C.cBlue + "Explosion Size: " + C.cAqua + "1 + (Spell Level / 2)",
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "(Spell Level / 2) + 1",
|
||||
|
||||
"Summons exploding anvils over everyone near you!"),
|
||||
|
||||
Lance(SpellElement.ATTACK, // Spell element
|
||||
"Lance", // Spell name
|
||||
new ItemStack(Material.STICK), // Spell icon
|
||||
Lance.class, // Spell class
|
||||
Fireball(SpellElement.ATTACK, // Spell element
|
||||
"Fireball", // Spell name
|
||||
new ItemStack(Material.FIREBALL), // Spell icon
|
||||
SpellFireball.class, // Spell class
|
||||
3, // Spell max level
|
||||
75, // Mana cost
|
||||
60, // Spell cooldown
|
||||
30, // Mana cost
|
||||
20, // Spell cooldown
|
||||
-3, // Mana cost change per level
|
||||
-2, // Cooldown change per level
|
||||
5, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "Spell Level x 0.8",
|
||||
|
||||
"Be a object of fear and awe!",
|
||||
|
||||
"Summon a blazing fireball!"),
|
||||
|
||||
Flash(SpellElement.SUPPORT, // Spell element
|
||||
"Flash", // Spell name
|
||||
new ItemStack(Material.REDSTONE_TORCH_ON), // Spell icon
|
||||
SpellFlash.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
50, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-10, // Cooldown change per level
|
||||
3, // Chance in ? to find
|
||||
-5, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.Bold + C.cBlue + "Lance Size: " + C.cAqua + "Spell Level * 6",
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 10)+ 20",
|
||||
|
||||
"Summons a lance of explosions!"),
|
||||
"Teleport to the block you are looking at!"),
|
||||
|
||||
Heal(SpellElement.SUPPORT, // Spell element
|
||||
"Heal", // Spell name
|
||||
new ItemStack(Material.POTION, 1, (short) 8261), // Spell icon
|
||||
Heal.class, // Spell class
|
||||
SpellHeal.class, // Spell class
|
||||
5, // Spell max level
|
||||
50, // Mana cost
|
||||
5, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
10, // Cooldown change per level
|
||||
5, // Chance in ? to find
|
||||
C.Bold + C.cBlue + "Heals: " + C.cAqua + "2 * Spell Level",
|
||||
5, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Heals: " + C.Bold + C.cWhite + "Spell Level x 2",
|
||||
|
||||
"Low on health and need to retreat?",
|
||||
|
||||
"Use this! Heal yourself up!"),
|
||||
|
||||
Implode(SpellElement.MISC, // Spell element
|
||||
"Implode", // Spell name
|
||||
new ItemStack(Material.TNT), // Spell icon
|
||||
SpellFlash.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
30, // Spell cooldown
|
||||
-2, // Mana cost change per level
|
||||
-3, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "50",
|
||||
|
||||
C.cGold + C.Bold + "Implosion Height: " + C.Bold + C.cWhite + "Spell Level",
|
||||
|
||||
C.cGold + C.Bold + "Implosion Width: " + C.Bold + C.cWhite + "Spell Level x 2",
|
||||
|
||||
"Gathers the blocks at target location",
|
||||
|
||||
"and scatters them about the area"),
|
||||
|
||||
Lance(SpellElement.ATTACK, // Spell element
|
||||
"Lance", // Spell name
|
||||
new ItemStack(Material.STICK), // Spell icon
|
||||
SpellLance.class, // Spell class
|
||||
3, // Spell max level
|
||||
75, // Mana cost
|
||||
60, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-10, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Lance Size: " + C.Bold + C.cWhite + "Spell Level * 6",
|
||||
|
||||
"Summons a lance of explosions!"),
|
||||
|
||||
LightningStrike(SpellElement.ATTACK, // Spell element
|
||||
"Lightning Strike", // Spell name
|
||||
new ItemStack(Material.WOOD_AXE), // Spell icon
|
||||
SpellLightningStrike.class, // Spell class
|
||||
3, // Spell max level
|
||||
80, // Mana cost
|
||||
20, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "Spell Level x 10",
|
||||
|
||||
"Right click on the block before the chasm",
|
||||
|
||||
"and a mighty dirt bridge will appear!"),
|
||||
|
||||
MagicMissile(SpellElement.ATTACK, // Spell element
|
||||
"Magic Missile", // Spell name
|
||||
new ItemStack(Material.STICK), // Spell icon
|
||||
MagicMissile.class, // Spell class
|
||||
SpellMagicMissile.class, // Spell class
|
||||
3, // Spell max level
|
||||
20, // Mana cost
|
||||
10, // Spell cooldown
|
||||
-2, // Mana cost change per level
|
||||
-2, // Cooldown change per level
|
||||
10, // Chance in ? to find
|
||||
C.Bold + C.cBlue + "Damage: " + C.cAqua + "0.5 + (Spell Level / 2)",
|
||||
10, // Item amount in loot
|
||||
|
||||
C.Bold + C.cBlue + "Range: " + C.cAqua + "15 x Spell Level",
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 0.5",
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 15",
|
||||
|
||||
"The basic spell all beginner mages are taught.",
|
||||
|
||||
"This creates a magic missile that is commonly attributed to the magic profession."),
|
||||
|
||||
TeleportRune(SpellElement.RUNES, // Spell element
|
||||
"Teleport Rune", // Spell name
|
||||
new ItemStack(Material.ENDER_PEARL), // Spell icon
|
||||
SpellTeleportRune.class, // Spell class
|
||||
3, // Spell max level
|
||||
70, // Mana cost
|
||||
40, // Spell cooldown
|
||||
-5, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
10, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 25",
|
||||
|
||||
C.cGold + C.Bold + "Size: " + C.Bold + C.cWhite + "Spell Level x 1.5",
|
||||
|
||||
"This draws a teleport rune on the ground",
|
||||
|
||||
"The created rune is usable by anyone and lasts",
|
||||
|
||||
"for 5 seconds after the 2 second warmup period.",
|
||||
|
||||
"The teleport is one way, you cannot return."),
|
||||
|
||||
RainbowBeam(SpellElement.ATTACK, // Spell element
|
||||
"Rainbow Beam", // Spell name
|
||||
new ItemStack(Material.EMERALD), // Spell icon
|
||||
RainbowBeam.class, // Spell class
|
||||
SpellRainbowBeam.class, // Spell class
|
||||
5, // Spell max level
|
||||
5, // Mana cost
|
||||
8, // Spell cooldown
|
||||
3, // Mana cost change per level
|
||||
1, // Cooldown change per level
|
||||
3, // Chance in ? to find
|
||||
3, // Item amount in loot
|
||||
|
||||
C.Bold + C.cBlue + "Damage: " + C.cAqua + "0.75 * Spell Level",
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level x 0.75",
|
||||
|
||||
C.Bold + C.cBlue + "Ramge: " + C.cAqua + "20 x Spell Level",
|
||||
C.cGold + C.Bold + "Ramge: " + C.Bold + C.cWhite + "Spell Level x 20",
|
||||
|
||||
"A beam of rainbows!", "This doesn't do much damage", "But has practically no cooldown!"),
|
||||
"A magical girl beam of rainbows!", "This doesn't do much damage", "But has practically no cooldown!"),
|
||||
|
||||
Rumble(SpellElement.ATTACK, // Spell element
|
||||
"Rumble", // Spell name
|
||||
new ItemStack(Material.DIRT), // Spell icon
|
||||
Rumble.class, // Spell class
|
||||
SpellRumble.class, // Spell class
|
||||
10, // Spell max level
|
||||
30, // Mana cost
|
||||
5, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Chance in ? to find
|
||||
3, // Item amount in loot
|
||||
|
||||
C.Bold + C.cBlue + "Damage: " + C.cAqua + "0.5 + (Spell Level / 2)",
|
||||
C.cGold + C.Bold + "Damage: " + C.Bold + C.cWhite + "(Spell Level / 2) + 0.5",
|
||||
|
||||
C.Bold + C.cBlue + "Range: " + C.cAqua + "10 x Spell Level",
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "Spell Level x 10",
|
||||
|
||||
"Summons a targeted earthquake",
|
||||
|
||||
@ -115,60 +257,89 @@ public enum SpellType // ❤
|
||||
|
||||
"from the block you right click!"),
|
||||
|
||||
StoneWall(SpellElement.SUPPORT, // Spell element
|
||||
SpeedBoost(SpellElement.SUPPORT, // Spell element
|
||||
"Speed Boost", // Spell name
|
||||
new ItemStack(Material.FEATHER), // Spell icon
|
||||
SpellSpeedBoost.class, // Spell class
|
||||
2, // Spell max level
|
||||
20, // Mana cost
|
||||
100, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
0, // Cooldown change per level
|
||||
3, // Item amount in loot
|
||||
|
||||
C.cGold + C.Bold + "Length: " + C.Bold + C.cWhite + "(Spell Level x 30) + 60",
|
||||
|
||||
C.cGold + C.Bold + "Strength: " + C.Bold + C.cWhite + "Spell Level",
|
||||
|
||||
"Gain a speed potion effect to outrun your enemies"),
|
||||
|
||||
StoneWall(SpellElement.MISC, // Spell element
|
||||
"Stone Wall", // Spell name
|
||||
new ItemStack(Material.STONE), // Spell icon
|
||||
StoneWall.class, // Spell class
|
||||
SpellStoneWall.class, // Spell class
|
||||
3, // Spell max level
|
||||
60, // Mana cost
|
||||
10, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
3, // Chance in ? to find
|
||||
3, // Item amount in loot
|
||||
|
||||
C.Bold + C.cBlue + "Height: " + C.cAqua + "1 + Spell Level",
|
||||
C.cGold + C.Bold + "Height: " + C.Bold + C.cWhite + "Spell Level + 1",
|
||||
|
||||
C.Bold + C.cBlue + "Width: " + C.cAqua + "5 x Spell Level",
|
||||
C.cGold + C.Bold + "Width: " + C.Bold + C.cWhite + "Spell Level x 5",
|
||||
|
||||
"Create a wall of stone!", "Width = SpellLevel x 5", "Height = 1 + SpellLevel"),
|
||||
"Create a wall of stone!"),
|
||||
|
||||
TrapRune(SpellElement.ATTACK, // Spell element
|
||||
TrapRune(SpellElement.RUNES, // Spell element
|
||||
"Trap Rune", // Spell name
|
||||
new ItemStack(Material.FIREBALL), // Spell icon
|
||||
TrapRune.class, // Spell class
|
||||
new ItemStack(Material.TRAP_DOOR), // Spell icon
|
||||
SpellTrapRune.class, // Spell class
|
||||
3, // Spell max level
|
||||
50, // Mana cost
|
||||
30, // Spell cooldown
|
||||
0, // Mana cost change per level
|
||||
-5, // Cooldown change per level
|
||||
30, // Chance in ? to find
|
||||
C.Bold + C.cBlue + "Range: " + C.cAqua + "12 + (4 x Spell Level)",
|
||||
30, // Item amount in loot
|
||||
|
||||
C.Bold + C.cBlue + "Rune Size: " + C.cAqua + "Spell Level",
|
||||
C.cGold + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 4) + 12",
|
||||
|
||||
C.Bold + C.cBlue + "Explosion Size: " + C.cAqua + "Spell Level",
|
||||
C.cGold + C.Bold + "Rune Size: " + C.Bold + C.cWhite + "Spell Level",
|
||||
|
||||
C.cGold + C.Bold + "Explosion Size: " + C.Bold + C.cWhite + "Spell Level",
|
||||
|
||||
"Draws a explosion rune on the ground!",
|
||||
|
||||
"The rune takes 5 seconds to prepare",
|
||||
|
||||
"and will damage even you!");
|
||||
"The rune takes 5 seconds to prepare and will damage even you!");
|
||||
|
||||
public enum SpellElement
|
||||
{
|
||||
ATTACK(1, new ItemBuilder(Material.IRON_SWORD).setTitle(ChatColor.RED + "Attack Spells").build(), C.cRed),
|
||||
ATTACK(1, 1, 1, new ItemBuilder(Material.IRON_SWORD).setTitle(ChatColor.RED + "Attack Spells")
|
||||
.addLore(C.cGray + C.Italics + "Spells of destruction").build(), C.cRed),
|
||||
|
||||
DEFENSE(4, new ItemBuilder(Material.IRON_CHESTPLATE).setTitle(ChatColor.GRAY + "Defense Spells").build(), C.cGray),
|
||||
RUNES(3, 3, 3, new ItemBuilder(Material.NETHER_STAR).setTitle(ChatColor.GOLD + "Rune Spells")
|
||||
.addLore(C.cGray + "Spells for creation of runes").build(), C.cGold),
|
||||
|
||||
SUPPORT(7, new ItemBuilder(Material.IRON_BOOTS).setTitle(C.cDGreen + "Support Spells").build(), C.cDGreen);
|
||||
MISC(7, 7, 7, new ItemBuilder(Material.COAL_BLOCK).setTitle(ChatColor.GRAY + "Misc Spells").addLore(
|
||||
|
||||
C.cGray + C.Italics + "Misc spells that don't fit in",
|
||||
|
||||
"These spells generally effect the world itself").build(), C.cGray),
|
||||
|
||||
SUPPORT(5, 5, 5, new ItemBuilder(Material.IRON_BOOTS).setTitle(C.cDGreen + "Support Spells")
|
||||
.addLore(C.cGray + C.Italics + "Spells of assistance").build(), C.cDGreen);
|
||||
|
||||
private String _chatColor;
|
||||
private int _firstSlot;
|
||||
private ItemStack _icon;
|
||||
private int _secondSlot;
|
||||
private int _slot;
|
||||
|
||||
private SpellElement(int slot, ItemStack icon, String color)
|
||||
private SpellElement(int slot, int firstSlot, int secondSlot, ItemStack icon, String color)
|
||||
{
|
||||
_slot = slot;
|
||||
_firstSlot = firstSlot;
|
||||
_secondSlot = secondSlot;
|
||||
_icon = icon;
|
||||
_chatColor = color;
|
||||
}
|
||||
@ -178,11 +349,21 @@ public enum SpellType // ❤
|
||||
return _chatColor;
|
||||
}
|
||||
|
||||
public int getFirstSlot()
|
||||
{
|
||||
return _firstSlot;
|
||||
}
|
||||
|
||||
public ItemStack getIcon()
|
||||
{
|
||||
return _icon;
|
||||
}
|
||||
|
||||
public int getSecondSlot()
|
||||
{
|
||||
return _secondSlot;
|
||||
}
|
||||
|
||||
public int getSlot()
|
||||
{
|
||||
return _slot;
|
||||
@ -197,16 +378,36 @@ public enum SpellType // ❤
|
||||
|
||||
static
|
||||
{
|
||||
for (SpellType s1 : values())
|
||||
for (SpellType spell : values())
|
||||
{
|
||||
s1._slot = 9;
|
||||
for (SpellType s : values())
|
||||
spell._slot = 9 + spell.getElement().getFirstSlot();
|
||||
|
||||
for (SpellType spell2 : values())
|
||||
{
|
||||
if (s != s1 && s.getElement() == s1.getElement() && s._slot >= s1._slot)
|
||||
if (spell != spell2 && spell.getElement() == spell2.getElement() && spell._slot <= spell2._slot)
|
||||
{
|
||||
s1._slot = s._slot + 1;
|
||||
spell._slot = spell2._slot;
|
||||
int divSlot = spell._slot % 9;
|
||||
|
||||
if (divSlot >= 8 || divSlot + 1 > spell.getElement().getSecondSlot())
|
||||
{
|
||||
|
||||
spell._slot = (spell._slot - divSlot) + 9 + spell.getElement().getFirstSlot();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
spell._slot = spell._slot + 1;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (spell._slot > 54)
|
||||
{
|
||||
System.out.print("Assigning " + spell.name() + " to " + spell._slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +415,7 @@ public enum SpellType // ❤
|
||||
{
|
||||
for (SpellType spell : values())
|
||||
{
|
||||
if (spell.get_spellName().equals(spellName))
|
||||
if (spell.getSpellName().equals(spellName))
|
||||
{
|
||||
return spell;
|
||||
}
|
||||
@ -222,10 +423,10 @@ public enum SpellType // ❤
|
||||
return null;
|
||||
}
|
||||
|
||||
private int _chanceInWhat;
|
||||
private int _cooldownChangePerLevel;
|
||||
private String[] _desc;
|
||||
private ItemStack _item;
|
||||
private int _itemAmount;
|
||||
private int _manaChangePerLevel;
|
||||
private int _maxLevel;
|
||||
private int _slot;
|
||||
@ -233,12 +434,10 @@ public enum SpellType // ❤
|
||||
private int _spellCooldown;
|
||||
private int _spellCost;
|
||||
private String _spellName;
|
||||
|
||||
private SpellElement _type;
|
||||
|
||||
private SpellType(SpellElement type, String spellName, ItemStack spellItem, Class<? extends Spell> spell, int maxLevel,
|
||||
int spellCost, int spellCooldown, int manaChangePerLevel, int cooldownChangePerLevel, int oneChanceInWhatToFind,
|
||||
String... desc)
|
||||
int spellCost, int spellCooldown, int manaChangePerLevel, int cooldownChangePerLevel, int itemAmount, String... desc)
|
||||
{
|
||||
_maxLevel = maxLevel;
|
||||
_item = spellItem;
|
||||
@ -250,26 +449,7 @@ public enum SpellType // ❤
|
||||
_spellCooldown = spellCooldown;
|
||||
_cooldownChangePerLevel = cooldownChangePerLevel;
|
||||
_manaChangePerLevel = manaChangePerLevel;
|
||||
}
|
||||
|
||||
public int get_maxLevel()
|
||||
{
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int get_slot()
|
||||
{
|
||||
return _slot;
|
||||
}
|
||||
|
||||
public Class<? extends Spell> get_spellClass()
|
||||
{
|
||||
return _spellClass;
|
||||
}
|
||||
|
||||
public String get_spellName()
|
||||
{
|
||||
return _spellName;
|
||||
_itemAmount = itemAmount;
|
||||
}
|
||||
|
||||
public String[] getDesc()
|
||||
@ -282,11 +462,37 @@ public enum SpellType // ❤
|
||||
return _type;
|
||||
}
|
||||
|
||||
public int getItemAmount()
|
||||
{
|
||||
return _itemAmount;
|
||||
}
|
||||
|
||||
public int getManaCost(int level)
|
||||
{
|
||||
return Math.max(0, (_manaChangePerLevel * level) + _spellCost);
|
||||
}
|
||||
|
||||
public int getMaxLevel()
|
||||
{
|
||||
return _maxLevel;
|
||||
}
|
||||
|
||||
public int getSlot()
|
||||
{
|
||||
return _slot;
|
||||
}
|
||||
|
||||
public ItemStack getSpellBook(WizardBattles wizards)
|
||||
{
|
||||
return makeSpell(wizards, new ItemBuilder(Material.ENCHANTED_BOOK).addLore(C.cAqua + "Click on this to learn a spell")
|
||||
.build());
|
||||
}
|
||||
|
||||
public Class<? extends Spell> getSpellClass()
|
||||
{
|
||||
return _spellClass;
|
||||
}
|
||||
|
||||
public int getSpellCooldown(int level)
|
||||
{
|
||||
return Math.max(0, (_cooldownChangePerLevel * level) + _spellCooldown);
|
||||
@ -297,21 +503,15 @@ public enum SpellType // ❤
|
||||
return _item;
|
||||
}
|
||||
|
||||
public boolean hasChanceToFind()
|
||||
public String getSpellName()
|
||||
{
|
||||
return _chanceInWhat <= 0 || new Random().nextInt(_chanceInWhat) == 0;
|
||||
return _spellName;
|
||||
}
|
||||
|
||||
public ItemStack makeSpell(WizardBattles wizards, ItemStack item)
|
||||
{
|
||||
ItemBuilder builder = new ItemBuilder(item);
|
||||
String s = "";
|
||||
for (char c : ("" + System.nanoTime()).toCharArray())
|
||||
{
|
||||
s += "§" + c;
|
||||
}
|
||||
|
||||
builder.setTitle(C.cDBlue + C.Bold + "Spell: " + _type._chatColor + get_spellName() + s);
|
||||
builder.setTitle(C.cDBlue + C.Bold + "Spell: " + _type._chatColor + getSpellName() + wizards.buildTime());
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,68 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
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 float _mana;
|
||||
private float _manaPerTick = 0.125F;
|
||||
private float _maxMana;
|
||||
|
||||
public Wizard(float maxMana)
|
||||
{
|
||||
learnSpell(SpellType.MagicMissile);
|
||||
learnSpell(SpellType.WizardsCompass);
|
||||
_maxMana = maxMana;
|
||||
}
|
||||
|
||||
public long getCooldown(SpellType type)
|
||||
{
|
||||
if (_cooldowns.containsKey(type))
|
||||
{
|
||||
return _cooldowns.get(type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public float getMana()
|
||||
{
|
||||
return _mana;
|
||||
}
|
||||
|
||||
public float getManaPerTick()
|
||||
{
|
||||
return _manaPerTick;
|
||||
}
|
||||
|
||||
public float getMaxMana()
|
||||
{
|
||||
return _maxMana;
|
||||
}
|
||||
|
||||
public int getSpellLevel(SpellType type)
|
||||
{
|
||||
if (_knownSpells.containsKey(type))
|
||||
{
|
||||
return _knownSpells.get(type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void learnSpell(SpellType type)
|
||||
{
|
||||
_knownSpells.put(type, getSpellLevel(type) + 1);
|
||||
}
|
||||
|
||||
public void setMana(float newMana)
|
||||
{
|
||||
_mana = newMana;
|
||||
}
|
||||
|
||||
public void setUsedSpell(SpellType spell)
|
||||
{
|
||||
_cooldowns.put(spell, System.currentTimeMillis() + (1000L * spell.getSpellCooldown(_knownSpells.get(spell))));
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -12,8 +12,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class WizardSpellMenu extends MiniPlugin
|
||||
{
|
||||
private WizardSpellMenuShop _wizardShop;
|
||||
private WizardBattles _wizards;
|
||||
private WizardSpellMenuShop _wizardShop;
|
||||
|
||||
public WizardSpellMenu(String moduleName, JavaPlugin plugin, WizardBattles wizards)
|
||||
{
|
||||
|
@ -1,12 +1,13 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
package nautilus.game.arcade.game.games.wizards.kit;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.wizards.WizardBattles;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -25,16 +26,24 @@ public class KitWizard extends Kit
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
for (int i = 0; i < 4; i++)
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
ItemBuilder builder = new ItemBuilder(Material.BLAZE_ROD);
|
||||
String s = "";
|
||||
for (char c : ("" + System.nanoTime()).toCharArray())
|
||||
if (i < 3)
|
||||
{
|
||||
s += "§" + c;
|
||||
player.getInventory().addItem(((WizardBattles) Manager.GetGame()).makeUnusedWand());
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().addItem(
|
||||
|
||||
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
|
||||
|
||||
.setTitle(C.cGray + "Empty wand slot" + ((WizardBattles) Manager.GetGame()).buildTime())
|
||||
|
||||
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
|
||||
|
||||
.build());
|
||||
}
|
||||
builder.setTitle(ChatColor.WHITE + "Unused Wand" + s);
|
||||
player.getInventory().addItem(builder.build());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spellinterfaces;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface SpellRightClick
|
||||
{
|
||||
public void castSpell(Player player);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spellinterfaces;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface SpellRightClickBlock
|
||||
{
|
||||
public void castSpell(Player player, Block block);
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spellinterfaces;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public interface SpellRightClickEntity
|
||||
{
|
||||
public void castSpell(Player player, Entity entity);
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
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.SpellRightClickBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class SpellBridge extends Spell implements SpellRightClickBlock
|
||||
{
|
||||
final BlockFace[] radial =
|
||||
{
|
||||
BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST, BlockFace.NORTH,
|
||||
BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST
|
||||
};
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p, final Block target)
|
||||
{
|
||||
final BlockFace facing = radial[Math.round(p.getEyeLocation().getYaw() / 45f) & 0x7];
|
||||
|
||||
p.getWorld().playEffect(target.getLocation(), Effect.STEP_SOUND, Material.DIRT.getId());
|
||||
|
||||
final int maxDist = 10 * getSpellLevel(p);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
Block block = target;
|
||||
int blocks = 0;
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!Wizards.IsLive() || blocks++ >= maxDist)
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
|
||||
block = block.getRelative(facing);
|
||||
Block bs[] = UtilShapes.getSideBlocks(block, facing);
|
||||
|
||||
bs = new Block[]
|
||||
{
|
||||
bs[0], bs[1], block
|
||||
};
|
||||
|
||||
for (Block b : bs)
|
||||
{
|
||||
if (UtilBlock.solid(b))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
b.setType(Material.DIRT);
|
||||
b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getTypeId());
|
||||
}
|
||||
|
||||
}
|
||||
}.runTaskTimer(Wizards.getArcadeManager().GetPlugin(), 5, 1);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.Wizard;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickEntity;
|
||||
|
||||
public class SpellDrain extends Spell implements SpellRightClickEntity
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player, Entity entity)
|
||||
{
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
if (Wizards.IsAlive(entity))
|
||||
{
|
||||
|
||||
Wizard wiz = Wizards.getWizard((Player) entity);
|
||||
float leftoverMana = wiz.getMana();
|
||||
|
||||
if (leftoverMana > 10)
|
||||
{
|
||||
float toDrain = Math.min(getSpellLevel(player) * 40, leftoverMana);
|
||||
leftoverMana = Math.max(0, leftoverMana - getSpellLevel(player) * 40);
|
||||
wiz.setMana(leftoverMana);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.WITHER_SPAWN, 1, 0);
|
||||
|
||||
Wizard wizard = Wizards.getWizard(player);
|
||||
|
||||
wizard.setMana(Math.min(wizard.getMaxMana(), wizard.getMana() + (toDrain / 3)));
|
||||
|
||||
player.sendMessage(C.cGold + "Drained " + (int) (toDrain / 3) + " mana");
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -5,7 +5,7 @@ import java.util.Iterator;
|
||||
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -18,7 +18,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class Droom extends Spell implements SpellRightClick
|
||||
public class SpellDroom extends Spell implements SpellRightClick
|
||||
{
|
||||
private ArrayList<FallingBlock> _fallingBlocks = new ArrayList<FallingBlock>();
|
||||
|
||||
@ -31,7 +31,7 @@ public class Droom extends Spell implements SpellRightClick
|
||||
|
||||
for (Entity entity : player.getNearbyEntities(radius, radius * 3, radius))
|
||||
{
|
||||
if (entity instanceof Player && wizards.IsAlive(entity))
|
||||
if (entity instanceof Player && Wizards.IsAlive(entity))
|
||||
{
|
||||
players.add((Player) entity);
|
||||
}
|
||||
@ -54,9 +54,9 @@ public class Droom extends Spell implements SpellRightClick
|
||||
|
||||
FallingBlock anvil = p.getWorld().spawnFallingBlock(loc.getBlock().getLocation().add(0.5, 0.5, 0.5),
|
||||
Material.ANVIL, (byte) 0);
|
||||
anvil.setMetadata("ExplosionSize", new FixedMetadataValue(wizards.getArcadeManager().GetPlugin(),
|
||||
anvil.setMetadata("ExplosionSize", new FixedMetadataValue(Wizards.getArcadeManager().GetPlugin(),
|
||||
1 + (getSpellLevel(player) / 2F)));
|
||||
anvil.setMetadata("Wizard", new FixedMetadataValue(wizards.getArcadeManager().GetPlugin(), player));
|
||||
anvil.setMetadata("Wizard", new FixedMetadataValue(Wizards.getArcadeManager().GetPlugin(), player));
|
||||
anvil.getWorld().playSound(anvil.getLocation(), Sound.ANVIL_USE, 2, 0);
|
||||
newFallingBlocks.add(anvil);
|
||||
|
||||
@ -75,7 +75,7 @@ public class Droom extends Spell implements SpellRightClick
|
||||
{
|
||||
_fallingBlocks.remove(entity);
|
||||
|
||||
new CustomExplosion(wizards.getArcadeManager().GetDamage(), entity.getLocation(), (float) entity
|
||||
new CustomExplosion(Wizards.getArcadeManager().GetDamage(), entity.getLocation(), (float) entity
|
||||
.getMetadata("ExplosionSize").get(0).asDouble(), (Player) entity.getMetadata("Wizard").get(0).value(), "Droom",
|
||||
true);
|
||||
|
@ -0,0 +1,44 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import mineplex.minecraft.game.core.explosion.CustomExplosion;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
public class SpellFireball extends Spell implements SpellRightClick
|
||||
{
|
||||
|
||||
@EventHandler
|
||||
public void onHit(ProjectileHitEvent event)
|
||||
{
|
||||
Projectile projectile = event.getEntity();
|
||||
if (projectile.hasMetadata("FireballSpell"))
|
||||
{
|
||||
projectile.remove();
|
||||
new CustomExplosion(Wizards.getArcadeManager().GetDamage(), projectile.getLocation(),
|
||||
((org.bukkit.entity.Fireball) projectile).getYield(), (Player) projectile.getMetadata("FireballSpell").get(0)
|
||||
.value(), "Fireball", true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
org.bukkit.entity.Fireball fireball = (org.bukkit.entity.Fireball) p.getWorld().spawnEntity(p.getEyeLocation(),
|
||||
EntityType.FIREBALL);
|
||||
fireball.setVelocity(p.getEyeLocation().getDirection());
|
||||
fireball.setShooter(p);
|
||||
p.getWorld().playSound(p.getLocation(), Sound.BLAZE_BREATH, 0.5F, 5F);
|
||||
fireball.setYield(getSpellLevel(p) * 0.8F);
|
||||
fireball.setMetadata("FireballSpell", new FixedMetadataValue(Wizards.getArcadeManager().GetPlugin(), p));
|
||||
charge(p);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
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.Player;
|
||||
|
||||
public class SpellFlash extends Spell implements SpellRightClick
|
||||
{
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
int maxTeleportDistance = 20 + (10 * getSpellLevel(player));
|
||||
|
||||
List<Block> list = player.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, maxTeleportDistance);
|
||||
|
||||
if (list.size() > 1 && list.get(1).getType() != Material.AIR)
|
||||
{
|
||||
Block b = list.get(0);
|
||||
|
||||
if (b.getLocation().distance(player.getLocation()) > 2)
|
||||
{
|
||||
|
||||
Location loc = b.getLocation().clone().add(0.5, 0.5, 0.5);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
|
||||
|
||||
player.setFallDistance(0);
|
||||
player.teleport(loc);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 1.2F);
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.ENDER_SIGNAL, 9);
|
||||
|
||||
charge(player);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell.SpellRightClickEntity;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickEntity;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Heal extends Spell implements SpellRightClick, SpellRightClickEntity
|
||||
public class SpellHeal extends Spell implements SpellRightClick, SpellRightClickEntity
|
||||
{
|
||||
|
||||
@Override
|
@ -0,0 +1,61 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
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.block.ContainerBlock;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
public class SpellImplode extends Spell implements SpellRightClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 50);
|
||||
if (list.size() > 1)
|
||||
{
|
||||
BlockFace face = list.get(0).getFace(list.get(1));
|
||||
Block b = list.get(0);
|
||||
int maxDist = (int) Math.floor(b.getLocation().distance(p.getLocation().getBlock().getLocation())) / 2;
|
||||
for (int i = 0; i < Math.min(maxDist, getSpellLevel(p) * 2); i++)
|
||||
{
|
||||
if (b.getRelative(face) != null)
|
||||
b = b.getRelative(face);
|
||||
}
|
||||
if (b.getType() == Material.AIR)
|
||||
return;
|
||||
Location a1 = b.getLocation().clone().add(0.5, 0.5, 0.5);
|
||||
b.getWorld().playSound(b.getLocation(), Sound.ENDERDRAGON_GROWL, 1.5F, 1.5F);
|
||||
for (int x = -getSpellLevel(p) * 2; x <= getSpellLevel(p) * 2; x++)
|
||||
{
|
||||
for (int y = -getSpellLevel(p); y <= getSpellLevel(p); y++)
|
||||
{
|
||||
for (int z = -getSpellLevel(p) * 2; z <= getSpellLevel(p) * 2; z++)
|
||||
{
|
||||
Block a = b.getRelative(x, y, z);
|
||||
Location a2 = a.getLocation().clone().add(0.5, 0.5, 0.5);
|
||||
if (a.getLocation().distance(b.getLocation()) <= getSpellLevel(p) * 2
|
||||
&& !(a.getState() instanceof ContainerBlock))
|
||||
{
|
||||
FallingBlock block = a.getWorld().spawnFallingBlock(a.getLocation(), a.getType(), a.getData());
|
||||
a.setType(Material.AIR);
|
||||
block.setVelocity(a1.toVector().subtract(a2.toVector()).normalize());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -18,27 +18,27 @@ 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.Spell.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
public class Lance extends Spell implements SpellRightClick
|
||||
public class SpellLance extends Spell implements SpellRightClick
|
||||
{
|
||||
private ArrayList<Entry<ArrayList<Location>, Player>> _locations = new ArrayList<Entry<ArrayList<Location>, Player>>();
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
// Player p = UtilPlayer.getPlayerInSight(player, 10 * getSpellLevel(player), true);
|
||||
// Player p = UtilPlayer.getPlayerInSight(player, 10 * getSpellLevel(player), true);
|
||||
Location l = null;
|
||||
// if (p == null)
|
||||
// {
|
||||
List<Block> b = player.getLastTwoTargetBlocks(UtilBlock.blockPassSet, 6 * getSpellLevel(player));
|
||||
if (!b.isEmpty())
|
||||
l = b.get(0).getLocation().add(0.5, 0.5, 0.5);
|
||||
/* }
|
||||
else
|
||||
{
|
||||
l = p.getEyeLocation();
|
||||
}*/
|
||||
// if (p == null)
|
||||
// {
|
||||
List<Block> b = player.getLastTwoTargetBlocks(UtilBlock.blockPassSet, 6 * getSpellLevel(player));
|
||||
if (!b.isEmpty())
|
||||
l = b.get(0).getLocation().add(0.5, 0.5, 0.5).add(player.getEyeLocation().getDirection().normalize().multiply(2));
|
||||
/* }
|
||||
else
|
||||
{
|
||||
l = p.getEyeLocation();
|
||||
}*/
|
||||
if (l != null)
|
||||
{
|
||||
ArrayList<Location> locs = UtilShapes.getLinesDistancedPoints(player.getLocation(), l, 1.5);
|
||||
@ -90,6 +90,6 @@ public class Lance extends Spell implements SpellRightClick
|
||||
|
||||
private void explode(Location loc, Player player)
|
||||
{
|
||||
new CustomExplosion(wizards.getArcadeManager().GetDamage(), loc, 1.2F, player, "Lance", false);
|
||||
new CustomExplosion(Wizards.getArcadeManager().GetDamage(), loc, 1.2F, player, "Lance", false);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.LightningStrike;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
public class SpellLightningStrike extends Spell implements SpellRightClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 150);
|
||||
if (list.size() > 1)
|
||||
{
|
||||
LightningStrike lightning = p.getWorld().strikeLightning(
|
||||
p.getWorld().getHighestBlockAt(list.get(0).getLocation()).getLocation());
|
||||
|
||||
lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().GetPlugin(), p));
|
||||
|
||||
charge(p);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event)
|
||||
{
|
||||
if (event.getDamager() instanceof LightningStrike && event.getEntity() instanceof LivingEntity)
|
||||
{
|
||||
if (event.getDamager().hasMetadata("Damager"))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent((LivingEntity) event.getEntity(),
|
||||
(Player) event.getDamager().getMetadata("Damager").get(0).value(), null, DamageCause.LIGHTNING,
|
||||
event.getDamage(), false, true, false, "Lightning Strike", "Lightning Strike");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
@ -15,9 +14,9 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
public class MagicMissile extends Spell implements SpellRightClick
|
||||
public class SpellMagicMissile extends Spell implements SpellRightClick
|
||||
{
|
||||
|
||||
public void castSpell(final Player player)
|
||||
@ -47,9 +46,9 @@ public class MagicMissile extends Spell implements SpellRightClick
|
||||
&& Math.abs((eLoc.getY() + (entity.getEyeHeight() / 1.8)) - loc.getY()) <= entity.getEyeHeight() / 2)
|
||||
{
|
||||
|
||||
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.CUSTOM, damage, true,
|
||||
Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.CUSTOM, damage, true,
|
||||
true, false, "Magic Missile", "Magic Missile");
|
||||
}
|
||||
}
|
||||
@ -62,7 +61,7 @@ public class MagicMissile extends Spell implements SpellRightClick
|
||||
|
||||
public void run()
|
||||
{
|
||||
if (loc.distance(orig) > maxRange || !player.isOnline() || !wizards.Manager.IsAlive(player))
|
||||
if (loc.distance(orig) > maxRange || !player.isOnline() || !Wizards.Manager.IsAlive(player))
|
||||
{
|
||||
burst();
|
||||
}
|
||||
@ -114,7 +113,7 @@ public class MagicMissile extends Spell implements SpellRightClick
|
||||
loc.getWorld().playSound(loc, Sound.ORB_PICKUP, 0.7F, 0);
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(wizards.Manager.GetPlugin(), 0, 0);
|
||||
}.runTaskTimer(Wizards.Manager.GetPlugin(), 0, 0);
|
||||
|
||||
charge(player);
|
||||
}
|
@ -4,16 +4,17 @@ import mineplex.core.common.util.UtilBlock;
|
||||
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.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class RainbowBeam extends Spell implements SpellRightClick
|
||||
public class SpellRainbowBeam extends Spell implements SpellRightClick
|
||||
{
|
||||
|
||||
@Override
|
||||
@ -29,16 +30,17 @@ public class RainbowBeam extends Spell implements SpellRightClick
|
||||
Location loc;
|
||||
if (entityTarget != null)
|
||||
{
|
||||
|
||||
|
||||
loc = p.getEyeLocation().add(
|
||||
p.getEyeLocation().getDirection().normalize()
|
||||
.multiply(0.3 + p.getEyeLocation().distance(((LivingEntity) entityTarget).getEyeLocation())));
|
||||
// The above code makes the beam appear to hit them where you aimed.
|
||||
wizards.getArcadeManager()
|
||||
Wizards.getArcadeManager()
|
||||
.GetDamage()
|
||||
.NewDamageEvent((LivingEntity) entityTarget, p, null, DamageCause.CUSTOM, getSpellLevel(p) * 1.5F, true,
|
||||
true, false, "Rainbow Beam", "Rainbow Beam");
|
||||
|
||||
p.playSound(entityTarget.getLocation(), Sound.LEVEL_UP, 1.5F, 1);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -50,9 +52,10 @@ public class RainbowBeam extends Spell implements SpellRightClick
|
||||
{
|
||||
l.getWorld().spigot().playEffect(l, Effect.POTION_SWIRL, 0, 0, 0, 0, 0, 500, 1, 30);
|
||||
}
|
||||
|
||||
p.playSound(p.getLocation(), Sound.LEVEL_UP, 1.5F, 1);
|
||||
|
||||
charge(p);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.wizards.spells;
|
||||
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.Spell.SpellRightClickBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
@ -15,7 +15,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class Rumble extends Spell implements SpellRightClickBlock
|
||||
public class SpellRumble extends Spell implements SpellRightClickBlock
|
||||
{
|
||||
|
||||
final private BlockFace[] _radial =
|
||||
@ -44,7 +44,7 @@ public class Rumble extends Spell implements SpellRightClickBlock
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!player.isOnline() || !wizards.IsAlive(player))
|
||||
if (!player.isOnline() || !Wizards.IsAlive(player))
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
@ -86,7 +86,7 @@ public class Rumble extends Spell implements SpellRightClickBlock
|
||||
if (entity instanceof LivingEntity && player != entity)
|
||||
{
|
||||
|
||||
if (entity instanceof Player && !wizards.IsAlive(entity))
|
||||
if (entity instanceof Player && !Wizards.IsAlive(entity))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -98,7 +98,7 @@ public class Rumble extends Spell implements SpellRightClickBlock
|
||||
double height = loc.getY() - b.getY();
|
||||
if (height >= 0 && height <= 2)
|
||||
{
|
||||
wizards.Manager.GetDamage().NewDamageEvent((LivingEntity) entity, player, null,
|
||||
Wizards.Manager.GetDamage().NewDamageEvent((LivingEntity) entity, player, null,
|
||||
DamageCause.CUSTOM, damage, false, true, false, "Rumble", "Rumble");
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ public class Rumble extends Spell implements SpellRightClickBlock
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(wizards.getArcadeManager().GetPlugin(), 5, 1);
|
||||
}.runTaskTimer(Wizards.getArcadeManager().GetPlugin(), 5, 1);
|
||||
|
||||
charge(player);
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class SpellSpeedBoost extends Spell implements SpellRightClick
|
||||
{
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
int ticks = (20 * 90) * getSpellLevel(p);
|
||||
int potionLevel = getSpellLevel(p);
|
||||
|
||||
p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, ticks, potionLevel), true);
|
||||
|
||||
charge(p);
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@ package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell.SpellRightClickBlock;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClickBlock;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
@ -11,7 +11,7 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class StoneWall extends Spell implements SpellRightClickBlock
|
||||
public class SpellStoneWall extends Spell implements SpellRightClickBlock
|
||||
{
|
||||
|
||||
@Override
|
||||
@ -59,7 +59,7 @@ public class StoneWall extends Spell implements SpellRightClickBlock
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(wizards.getArcadeManager().GetPlugin(), 0, 5);
|
||||
}.runTaskTimer(Wizards.getArcadeManager().GetPlugin(), 0, 5);
|
||||
|
||||
charge(player);
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.TeleportRune;
|
||||
|
||||
public class SpellTeleportRune extends Spell implements SpellRightClick
|
||||
{
|
||||
private ArrayList<TeleportRune> _teleportRunes = new ArrayList<TeleportRune>();
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<TeleportRune> itel = _teleportRunes.iterator();
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
TeleportRune rune = itel.next();
|
||||
|
||||
if (rune.tickRune())
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void castSpell(Player player)
|
||||
{
|
||||
Block b = player.getTargetBlock(null, 25 * getSpellLevel(player));
|
||||
|
||||
while (b.getType() != Material.AIR && b.getY() < 250)
|
||||
{
|
||||
b = b.getRelative(BlockFace.UP);
|
||||
}
|
||||
|
||||
if (b.getRelative(BlockFace.DOWN).getType() == Material.AIR)
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Unable to place a rune!");
|
||||
return;
|
||||
}
|
||||
|
||||
Location firstTeleport = player.getLocation();
|
||||
Location secondTeleport = b.getLocation().add(0.5, 0, 0.5);
|
||||
|
||||
TeleportRune teleportRune = new TeleportRune(firstTeleport, secondTeleport, getSpellLevel(player));
|
||||
|
||||
_teleportRunes.add(teleportRune);
|
||||
|
||||
charge(player);
|
||||
}
|
||||
}
|
@ -2,8 +2,6 @@ package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -21,43 +19,36 @@ 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.Spell.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
import nautilus.game.arcade.game.games.wizards.spells.subclasses.TrapRune;
|
||||
|
||||
public class TrapRune extends Spell implements SpellRightClick
|
||||
public class SpellTrapRune extends Spell implements SpellRightClick
|
||||
{
|
||||
private ArrayList<Rune> _runes = new ArrayList<Rune>();
|
||||
|
||||
private class Rune
|
||||
{
|
||||
private Location runeLocation;
|
||||
private float runeSize;
|
||||
private Player runeCaster;
|
||||
private int ticksLived;
|
||||
}
|
||||
private ArrayList<TrapRune> _runes = new ArrayList<TrapRune>();
|
||||
|
||||
@EventHandler
|
||||
public void onTick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<Rune> itel = _runes.iterator();
|
||||
Iterator<TrapRune> itel = _runes.iterator();
|
||||
while (itel.hasNext())
|
||||
{
|
||||
Rune rune = itel.next();
|
||||
if (!rune.runeCaster.isOnline() || rune.runeCaster.getGameMode() == GameMode.CREATIVE)
|
||||
TrapRune rune = itel.next();
|
||||
if (!rune.RuneCaster.isOnline() || rune.RuneCaster.getGameMode() == GameMode.CREATIVE)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
else if (rune.ticksLived++ > 2000)
|
||||
else if (rune.TicksLived++ > 2000)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rune.ticksLived <= 100)
|
||||
if (rune.TicksLived <= 100)
|
||||
{
|
||||
if (rune.ticksLived % 15 == 0)
|
||||
initialParticles(rune.runeLocation, rune.runeSize);
|
||||
if (rune.TicksLived % 15 == 0)
|
||||
initialParticles(rune.RuneLocation, rune.RuneSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -68,9 +59,9 @@ public class TrapRune extends Spell implements SpellRightClick
|
||||
}
|
||||
else
|
||||
{
|
||||
for (Player player : wizards.GetPlayers(true))
|
||||
for (Player player : Wizards.GetPlayers(true))
|
||||
{
|
||||
if (isInTrap(rune.runeLocation, player.getLocation(), rune.runeSize))
|
||||
if (isInTrap(rune.RuneLocation, player.getLocation(), rune.RuneSize))
|
||||
{
|
||||
trapCard(rune);
|
||||
itel.remove();
|
||||
@ -114,10 +105,12 @@ public class TrapRune extends Spell implements SpellRightClick
|
||||
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;
|
||||
}
|
||||
|
||||
@ -136,14 +129,14 @@ public class TrapRune extends Spell implements SpellRightClick
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isValid(Rune rune)
|
||||
private boolean isValid(TrapRune rune)
|
||||
{
|
||||
for (double x = -rune.runeSize; x <= rune.runeSize; x++)
|
||||
for (double x = -rune.RuneSize; x <= rune.RuneSize; x++)
|
||||
{
|
||||
for (double z = -rune.runeSize; z <= rune.runeSize; z++)
|
||||
for (double z = -rune.RuneSize; z <= rune.RuneSize; z++)
|
||||
{
|
||||
|
||||
Block b = rune.runeLocation.clone().add(x, 0, z).getBlock();
|
||||
Block b = rune.RuneLocation.clone().add(x, 0, z).getBlock();
|
||||
if (UtilBlock.solid(b) || !UtilBlock.solid(b.getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
return false;
|
||||
@ -154,18 +147,18 @@ public class TrapRune extends Spell implements SpellRightClick
|
||||
return true;
|
||||
}
|
||||
|
||||
public void trapCard(Rune rune)
|
||||
public void trapCard(TrapRune rune)
|
||||
{
|
||||
rune.runeLocation.getWorld().playSound(rune.runeLocation, Sound.WITHER_SHOOT, 5, (float) rune.runeSize * 2);
|
||||
rune.RuneLocation.getWorld().playSound(rune.RuneLocation, Sound.WITHER_SHOOT, 5, (float) rune.RuneSize * 2);
|
||||
|
||||
new CustomExplosion(wizards.getArcadeManager().GetDamage(), rune.runeLocation.clone().add(0, 0.3, 0),
|
||||
(float) rune.runeSize * 1.2F, rune.runeCaster, "Trap Rune", true);
|
||||
new CustomExplosion(Wizards.getArcadeManager().GetDamage(), rune.RuneLocation.clone().add(0, 0.3, 0),
|
||||
(float) rune.RuneSize * 1.2F, rune.RuneCaster, "Trap Rune", true);
|
||||
|
||||
for (Location loc : getBox(rune.runeLocation, rune.runeSize, 0.3))
|
||||
for (Location loc : getBox(rune.RuneLocation, rune.RuneSize, 0.3))
|
||||
{
|
||||
for (double y = 0; y < 1; y += 0.2)
|
||||
{
|
||||
rune.runeLocation.getWorld().spigot().playEffect(loc, Effect.FLAME, 0, 0, 0, 0, 0, 0, 1, 30);
|
||||
rune.RuneLocation.getWorld().spigot().playEffect(loc, Effect.FLAME, 0, 0, 0, 0, 0, 0, 1, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -175,6 +168,7 @@ public class TrapRune extends Spell implements SpellRightClick
|
||||
{
|
||||
Vector vector = p.getEyeLocation().getDirection();
|
||||
vector.normalize().multiply(0.5);
|
||||
|
||||
Vector v = p.getEyeLocation().toVector();
|
||||
int i = 0;
|
||||
Location loc = null;
|
||||
@ -183,6 +177,7 @@ public class TrapRune extends Spell implements SpellRightClick
|
||||
while (i++ < (trapSize * 4) + 12)
|
||||
{
|
||||
v.add(vector);
|
||||
|
||||
Block b = v.toLocation(p.getWorld()).getBlock();
|
||||
|
||||
if (UtilBlock.solid(b))
|
||||
@ -194,6 +189,7 @@ public class TrapRune extends Spell implements SpellRightClick
|
||||
+ Math.pow(v.getZ() - v.getBlockZ(), 2)) + 0.01;
|
||||
b = v.subtract(vector.normalize().multiply(dist)).toLocation(p.getWorld()).getBlock();
|
||||
}
|
||||
|
||||
loc = v.toLocation(p.getWorld());
|
||||
loc.setY(loc.getBlockY());
|
||||
|
||||
@ -203,14 +199,14 @@ public class TrapRune extends Spell implements SpellRightClick
|
||||
if (loc == null)
|
||||
return;
|
||||
|
||||
Rune rune = new Rune();
|
||||
rune.runeCaster = p;
|
||||
rune.runeSize = trapSize;
|
||||
rune.runeLocation = loc;
|
||||
TrapRune rune = new TrapRune();
|
||||
rune.RuneCaster = p;
|
||||
rune.RuneSize = trapSize;
|
||||
rune.RuneLocation = loc;
|
||||
|
||||
if (!isValid(rune))
|
||||
{
|
||||
p.sendMessage(C.cGreen + "Unable to find a flat empty area to draw rune");
|
||||
p.sendMessage(C.cGreen + "Area isn't flat and empty, cannot draw rune.");
|
||||
return;
|
||||
}
|
||||
|
@ -0,0 +1,62 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellRightClick;
|
||||
|
||||
public class SpellWizardsCompass extends Spell implements SpellRightClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void castSpell(Player p)
|
||||
{
|
||||
double dist = 9999;
|
||||
Player closestPlayer = null;
|
||||
|
||||
for (Player player : Wizards.GetPlayers(true))
|
||||
{
|
||||
double newDist = player.getLocation().distance(p.getLocation());
|
||||
|
||||
if (newDist > 10 && (closestPlayer == null || newDist < dist))
|
||||
{
|
||||
|
||||
closestPlayer = player;
|
||||
dist = newDist;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (closestPlayer != null)
|
||||
{
|
||||
int particlesPlayed = 0;
|
||||
|
||||
for (Location loc : UtilShapes.getLinesDistancedPoints(
|
||||
p.getEyeLocation().subtract(p.getEyeLocation().getDirection().normalize().multiply(-0.3)).subtract(0, .5, 0),
|
||||
closestPlayer.getEyeLocation(), 0.3))
|
||||
{
|
||||
|
||||
if (particlesPlayed++ > 13)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
loc.getWorld().spigot().playEffect(loc, Effect.HAPPY_VILLAGER, 0, 0, 0.1F, 0.1F, 0.1F, 0, 4, 25);
|
||||
|
||||
}
|
||||
|
||||
charge(p);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
p.sendMessage(C.cRed + "All players are less than 10 blocks from you!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
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.UtilShapes;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
public class TeleportRune
|
||||
{
|
||||
private Location _firstLoc, _secondLoc;
|
||||
private int _ticksLived;
|
||||
private double _runeSize;
|
||||
|
||||
public TeleportRune(Location firstLocation, Location secondLocation, int runeLevel)
|
||||
{
|
||||
_firstLoc = firstLocation;
|
||||
_secondLoc = secondLocation;
|
||||
_runeSize = 1.5D * runeLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true on remove
|
||||
*/
|
||||
public boolean tickRune()
|
||||
{
|
||||
if (_ticksLived >= 150)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (_ticksLived % 5 == 0)
|
||||
{
|
||||
resendRunes();
|
||||
}
|
||||
|
||||
if (_ticksLived % 40 == 0 && _ticksLived < 150)
|
||||
{
|
||||
_firstLoc.getWorld().playSound(_firstLoc, Sound.PORTAL, (float) Math.min(3, _runeSize), 0F);
|
||||
_firstLoc.getWorld().playSound(_secondLoc, Sound.PORTAL, (float) Math.min(3, _runeSize), 0F);
|
||||
}
|
||||
|
||||
if (_ticksLived > 0)
|
||||
{
|
||||
for (LivingEntity entity : _firstLoc.getWorld().getEntitiesByClass(LivingEntity.class))
|
||||
{
|
||||
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 true;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package nautilus.game.arcade.game.games.wizards.spells.subclasses;
|
||||
|
||||
import org.bukkit.Location;
|
||||
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;
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user