Wizards: Current progress

This commit is contained in:
libraryaddict 2015-04-30 01:32:22 +12:00
parent 2aaa93e58f
commit c2b7001fcc
26 changed files with 780 additions and 646 deletions

View File

@ -4,37 +4,32 @@ import java.util.ArrayList;
import mineplex.core.common.util.UtilMath;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class ChestLoot
{
private int _totalLoot;
private ArrayList<RandomItem> _randomItems = new ArrayList<RandomItem>();
private int _totalLoot;
private boolean _unbreakableLoot;
public ChestLoot(boolean unbreakableLoot)
{
_unbreakableLoot = unbreakableLoot;
}
public ChestLoot()
{
this(false);
}
public ChestLoot(boolean unbreakableLoot)
{
_unbreakableLoot = unbreakableLoot;
}
public void cloneLoot(ChestLoot loot)
{
_totalLoot += loot._totalLoot;
_randomItems.addAll(loot._randomItems);
}
public void registerLoot(RandomItem item)
{
_totalLoot += item.getAmount();
_randomItems.add(item);
}
public ItemStack getLoot()
{
int no = UtilMath.r(_totalLoot);
@ -60,4 +55,30 @@ public class ChestLoot
return null;
}
public void addLoot(ItemStack item, int amount)
{
addLoot(item, amount, item.getAmount(), item.getAmount());
}
public void addLoot(ItemStack item, int amount, int minStackSize, int maxStackSize)
{
addLoot(new RandomItem(item, amount, minStackSize, maxStackSize));
}
public void addLoot(Material material, int amount)
{
addLoot(material, amount, 1, 1);
}
public void addLoot(Material material, int amount, int minStackSize, int maxStackSize)
{
addLoot(new ItemStack(material), amount, minStackSize, maxStackSize);
}
public void addLoot(RandomItem item)
{
_totalLoot += item.getAmount();
_randomItems.add(item);
}
}

View File

@ -11,6 +11,11 @@ public class RandomItem
private ItemStack _item;
private int _min, _max;
public RandomItem(ItemStack item, int amount)
{
this(item, amount, item.getAmount(), item.getAmount());
}
public RandomItem(ItemStack item, int amount, int minStackSize, int maxStackSize)
{
_amount = amount;
@ -19,9 +24,9 @@ public class RandomItem
_max = maxStackSize;
}
public RandomItem(ItemStack item, int amount)
public RandomItem(Material material, int amount)
{
this(item, amount, item.getAmount(), item.getAmount());
this(material, amount, 1, 1);
}
public RandomItem(Material material, int amount, int minStackSize, int maxStackSize)
@ -32,9 +37,9 @@ public class RandomItem
_max = maxStackSize;
}
public RandomItem(Material material, int amount)
public int getAmount()
{
this(material, amount, 1, 1);
return _amount;
}
public ItemStack getItemStack()
@ -43,9 +48,4 @@ public class RandomItem
return _item;
}
public int getAmount()
{
return _amount;
}
}

View File

@ -1844,129 +1844,129 @@ public class SurvivalGames extends SoloGame
private void setupLoot()
{
// Food
_baseLoot.registerLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
_baseLoot.registerLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.CARROT_ITEM, 30, 1, 3));
_baseLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1));
_baseLoot.registerLoot(new RandomItem(Material.WHEAT, 30, 1, 6));
_baseLoot.registerLoot(new RandomItem(Material.APPLE, 30, 1, 4));
_baseLoot.registerLoot(new RandomItem(Material.PORK, 30, 1, 4));
_baseLoot.registerLoot(new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6));
_baseLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 3));
_baseLoot.addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 2));
_baseLoot.addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 2));
_baseLoot.addLoot(new RandomItem(Material.CARROT_ITEM, 30, 1, 3));
_baseLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15, 1, 1));
_baseLoot.addLoot(new RandomItem(Material.WHEAT, 30, 1, 6));
_baseLoot.addLoot(new RandomItem(Material.APPLE, 30, 1, 4));
_baseLoot.addLoot(new RandomItem(Material.PORK, 30, 1, 4));
_baseLoot.addLoot(new RandomItem(Material.ROTTEN_FLESH, 40, 1, 6));
// Weapons
_baseLoot.registerLoot(new RandomItem(Material.WOOD_AXE, 80));
_baseLoot.registerLoot(new RandomItem(Material.WOOD_SWORD, 70));
_baseLoot.registerLoot(new RandomItem(Material.STONE_AXE, 60));
_baseLoot.registerLoot(new RandomItem(Material.STONE_SWORD, 30));
_baseLoot.addLoot(new RandomItem(Material.WOOD_AXE, 80));
_baseLoot.addLoot(new RandomItem(Material.WOOD_SWORD, 70));
_baseLoot.addLoot(new RandomItem(Material.STONE_AXE, 60));
_baseLoot.addLoot(new RandomItem(Material.STONE_SWORD, 30));
// Leather armor
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_BOOTS, 30));
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_CHESTPLATE, 30));
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_HELMET, 30));
_baseLoot.registerLoot(new RandomItem(Material.LEATHER_LEGGINGS, 30));
_baseLoot.addLoot(new RandomItem(Material.LEATHER_BOOTS, 30));
_baseLoot.addLoot(new RandomItem(Material.LEATHER_CHESTPLATE, 30));
_baseLoot.addLoot(new RandomItem(Material.LEATHER_HELMET, 30));
_baseLoot.addLoot(new RandomItem(Material.LEATHER_LEGGINGS, 30));
// Gold armor
_baseLoot.registerLoot(new RandomItem(Material.GOLD_BOOTS, 25));
_baseLoot.registerLoot(new RandomItem(Material.GOLD_CHESTPLATE, 25));
_baseLoot.registerLoot(new RandomItem(Material.GOLD_HELMET, 25));
_baseLoot.registerLoot(new RandomItem(Material.GOLD_LEGGINGS, 25));
_baseLoot.addLoot(new RandomItem(Material.GOLD_BOOTS, 25));
_baseLoot.addLoot(new RandomItem(Material.GOLD_CHESTPLATE, 25));
_baseLoot.addLoot(new RandomItem(Material.GOLD_HELMET, 25));
_baseLoot.addLoot(new RandomItem(Material.GOLD_LEGGINGS, 25));
// Chain armor
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_BOOTS, 20));
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_CHESTPLATE, 20));
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_HELMET, 20));
_baseLoot.registerLoot(new RandomItem(Material.CHAINMAIL_LEGGINGS, 20));
_baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_BOOTS, 20));
_baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_CHESTPLATE, 20));
_baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_HELMET, 20));
_baseLoot.addLoot(new RandomItem(Material.CHAINMAIL_LEGGINGS, 20));
// Throwable
_baseLoot.registerLoot(new RandomItem(Material.FISHING_ROD, 30));
_baseLoot.registerLoot(new RandomItem(Material.BOW, 20));
_baseLoot.registerLoot(new RandomItem(Material.ARROW, 20, 1, 3));
_baseLoot.registerLoot(new RandomItem(Material.SNOW_BALL, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.EGG, 30, 1, 2));
_baseLoot.addLoot(new RandomItem(Material.FISHING_ROD, 30));
_baseLoot.addLoot(new RandomItem(Material.BOW, 20));
_baseLoot.addLoot(new RandomItem(Material.ARROW, 20, 1, 3));
_baseLoot.addLoot(new RandomItem(Material.SNOW_BALL, 30, 1, 2));
_baseLoot.addLoot(new RandomItem(Material.EGG, 30, 1, 2));
// Misc
_baseLoot.registerLoot(new RandomItem(Material.EXP_BOTTLE, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.COMPASS, 20));
_baseLoot.registerLoot(new RandomItem(Material.STICK, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.BOAT, 15));
_baseLoot.registerLoot(new RandomItem(Material.FLINT, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
_baseLoot.registerLoot(new RandomItem(Material.GOLD_INGOT, 20));
_baseLoot.registerLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15));
_spawnLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
_baseLoot.addLoot(new RandomItem(Material.EXP_BOTTLE, 30, 1, 2));
_baseLoot.addLoot(new RandomItem(Material.COMPASS, 20));
_baseLoot.addLoot(new RandomItem(Material.STICK, 30, 1, 2));
_baseLoot.addLoot(new RandomItem(Material.BOAT, 15));
_baseLoot.addLoot(new RandomItem(Material.FLINT, 30, 1, 2));
_baseLoot.addLoot(new RandomItem(Material.FEATHER, 30, 1, 2));
_baseLoot.addLoot(new RandomItem(Material.GOLD_INGOT, 20));
_baseLoot.addLoot(new RandomItem(ItemStackFactory.Instance.CreateStack(Material.TNT, (byte)0, 1, F.item("Throwing TNT")), 15));
_spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 15));
_spawnLoot.cloneLoot(_baseLoot);
// Food
_spawnLoot.registerLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 5));
_spawnLoot.registerLoot(new RandomItem(Material.CAKE, 30));
_spawnLoot.registerLoot(new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1));
_spawnLoot.registerLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 3));
_spawnLoot.registerLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3));
_spawnLoot.registerLoot(new RandomItem(Material.COOKED_FISH, 30, 1, 6));
_spawnLoot.registerLoot(new RandomItem(Material.GRILLED_PORK, 30, 1, 3));
_spawnLoot.registerLoot(new RandomItem(Material.COOKIE, 30));
_spawnLoot.registerLoot(new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3));
_spawnLoot.registerLoot(new RandomItem(Material.APPLE, 30, 2, 6));
_spawnLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 30, 1, 5));
_spawnLoot.addLoot(new RandomItem(Material.CAKE, 30));
_spawnLoot.addLoot(new RandomItem(Material.MUSHROOM_SOUP, 30, 1, 1));
_spawnLoot.addLoot(new RandomItem(Material.COOKED_BEEF, 30, 1, 3));
_spawnLoot.addLoot(new RandomItem(Material.COOKED_CHICKEN, 30, 1, 3));
_spawnLoot.addLoot(new RandomItem(Material.COOKED_FISH, 30, 1, 6));
_spawnLoot.addLoot(new RandomItem(Material.GRILLED_PORK, 30, 1, 3));
_spawnLoot.addLoot(new RandomItem(Material.COOKIE, 30));
_spawnLoot.addLoot(new RandomItem(Material.PUMPKIN_PIE, 30, 1, 3));
_spawnLoot.addLoot(new RandomItem(Material.APPLE, 30, 2, 6));
// Loot for chests in spawn
// Weaponry and ores
_spawnLoot.registerLoot(new RandomItem(Material.STONE_SWORD, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_AXE, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_INGOT, 30, 1, 2));
_spawnLoot.registerLoot(new RandomItem(Material.DIAMOND, 30));
_spawnLoot.addLoot(new RandomItem(Material.STONE_SWORD, 30));
_spawnLoot.addLoot(new RandomItem(Material.IRON_AXE, 30));
_spawnLoot.addLoot(new RandomItem(Material.IRON_INGOT, 30, 1, 2));
_spawnLoot.addLoot(new RandomItem(Material.DIAMOND, 30));
// Iron gear
_spawnLoot.registerLoot(new RandomItem(Material.IRON_BOOTS, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_CHESTPLATE, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_HELMET, 30));
_spawnLoot.registerLoot(new RandomItem(Material.IRON_LEGGINGS, 30));
_spawnLoot.addLoot(new RandomItem(Material.IRON_BOOTS, 30));
_spawnLoot.addLoot(new RandomItem(Material.IRON_CHESTPLATE, 30));
_spawnLoot.addLoot(new RandomItem(Material.IRON_HELMET, 30));
_spawnLoot.addLoot(new RandomItem(Material.IRON_LEGGINGS, 30));
// Supply crate loot
// Diamond gear
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_HELMET, 10));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 6));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 8));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_BOOTS, 10));
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_HELMET, 10));
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_CHESTPLATE, 6));
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_LEGGINGS, 8));
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_BOOTS, 10));
// Iron gear
_crateLoot.registerLoot(new RandomItem(Material.IRON_HELMET, 30));
_crateLoot.registerLoot(new RandomItem(Material.IRON_CHESTPLATE, 24));
_crateLoot.registerLoot(new RandomItem(Material.IRON_LEGGINGS, 27));
_crateLoot.registerLoot(new RandomItem(Material.IRON_BOOTS, 30));
_crateLoot.addLoot(new RandomItem(Material.IRON_HELMET, 30));
_crateLoot.addLoot(new RandomItem(Material.IRON_CHESTPLATE, 24));
_crateLoot.addLoot(new RandomItem(Material.IRON_LEGGINGS, 27));
_crateLoot.addLoot(new RandomItem(Material.IRON_BOOTS, 30));
// Weapons
_crateLoot.registerLoot(new RandomItem(Material.IRON_SWORD, 24));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_SWORD, 8));
_crateLoot.registerLoot(new RandomItem(Material.DIAMOND_AXE, 16));
_crateLoot.addLoot(new RandomItem(Material.IRON_SWORD, 24));
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_SWORD, 8));
_crateLoot.addLoot(new RandomItem(Material.DIAMOND_AXE, 16));
// Cooked furnace
_cookedFurnace.registerLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2));
_cookedFurnace.registerLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2));
_cookedFurnace.registerLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2));
_cookedFurnace.registerLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2));
_cookedFurnace.registerLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1));
_cookedFurnace.registerLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1));
_cookedFurnace.registerLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1));
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_BEEF, 3, 1, 2));
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_CHICKEN, 3, 1, 2));
_cookedFurnace.addLoot(new RandomItem(Material.COOKED_FISH, 3, 1, 2));
_cookedFurnace.addLoot(new RandomItem(Material.GRILLED_PORK, 3, 1, 2));
_cookedFurnace.addLoot(new RandomItem(Material.BAKED_POTATO, 3, 1, 1));
_cookedFurnace.addLoot(new RandomItem(Material.PUMPKIN_PIE, 3, 1, 1));
_cookedFurnace.addLoot(new RandomItem(Material.IRON_INGOT, 1, 1, 1));
// Raw furnace
_rawFurnace.registerLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3));
_rawFurnace.registerLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3));
_rawFurnace.registerLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3));
_rawFurnace.registerLoot(new RandomItem(Material.PORK, 1, 1, 3));
_rawFurnace.registerLoot(new RandomItem(Material.POTATO_ITEM, 1, 1, 3));
_rawFurnace.addLoot(new RandomItem(Material.RAW_BEEF, 1, 1, 3));
_rawFurnace.addLoot(new RandomItem(Material.RAW_CHICKEN, 1, 1, 3));
_rawFurnace.addLoot(new RandomItem(Material.RAW_FISH, 1, 1, 3));
_rawFurnace.addLoot(new RandomItem(Material.PORK, 1, 1, 3));
_rawFurnace.addLoot(new RandomItem(Material.POTATO_ITEM, 1, 1, 3));
// Deathmatch Loot
_deathMatchLoot.registerLoot(new RandomItem(Material.PUMPKIN_PIE, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.BAKED_POTATO, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.CAKE, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.APPLE, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.CARROT_ITEM, 4));
_deathMatchLoot.registerLoot(new RandomItem(Material.WOOD_SWORD, 3));
_deathMatchLoot.registerLoot(new RandomItem(Material.WOOD_AXE, 3));
_deathMatchLoot.registerLoot(new RandomItem(Material.STONE_AXE, 3));
_deathMatchLoot.registerLoot(new RandomItem(Material.STONE_SWORD, 1));
_deathMatchLoot.addLoot(new RandomItem(Material.PUMPKIN_PIE, 4));
_deathMatchLoot.addLoot(new RandomItem(Material.BAKED_POTATO, 4));
_deathMatchLoot.addLoot(new RandomItem(Material.CAKE, 4));
_deathMatchLoot.addLoot(new RandomItem(Material.APPLE, 4));
_deathMatchLoot.addLoot(new RandomItem(Material.CARROT_ITEM, 4));
_deathMatchLoot.addLoot(new RandomItem(Material.WOOD_SWORD, 3));
_deathMatchLoot.addLoot(new RandomItem(Material.WOOD_AXE, 3));
_deathMatchLoot.addLoot(new RandomItem(Material.STONE_AXE, 3));
_deathMatchLoot.addLoot(new RandomItem(Material.STONE_SWORD, 1));
}
@EventHandler

View File

@ -24,6 +24,11 @@ public class SpellButton implements IButton
{
Wizard wizard = _spellPage.getWizards().getWizard(player);
if (player.getInventory().getHeldItemSlot() >= wizard.getWandsOwned())
{
return;
}
if (wizard != null)
{
if (clickType.isLeftClick())

View File

@ -45,6 +45,7 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
for (int i = 0; i < 54; i++)
{
SpellType spell = null;
for (SpellType spells : SpellType.values())
{
if (spells.getSlot() == i)
@ -65,8 +66,19 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
builder.setTitle(spell.getElement().getColor() + C.Bold + spell.getSpellName());
builder.setAmount(spellLevel);
builder.addLore("");
builder.addLore(C.cYellow + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
if (wizard == null)
{
builder.addLore(C.cYellow + C.Bold + "Max Level: " + C.cWhite + spell.getMaxLevel());
}
else
{
builder.addLore(C.cYellow + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
}
builder.addLore(C.cYellow + C.Bold + "Mana Cost: " + C.cWhite
+ (wizard == null ? spell.getBaseManaCost() : spell.getManaCost(wizard)));
builder.addLore(C.cYellow + C.Bold + "Cooldown: " + C.cWhite
@ -84,12 +96,11 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
}
else
{
builder.addLore("");
builder.addLore(C.cGreen + C.Bold + "Left-click" + C.cWhite + " Bind to Wand");
builder.addLore(C.cGreen + C.Bold + "Left-Click" + C.cWhite + " Bind to Wand");
builder.addLore(C.cGreen + C.Bold + "Right-click" + C.cWhite + " Quickcast Spell");
builder.addLore(C.cGreen + C.Bold + "Right-Click" + C.cWhite + " Quickcast Spell");
addButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton(
this, spell));
@ -97,14 +108,14 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
}
else
{
addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 8).setTitle(C.cRed + C.Bold + "Unknown")
addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 6).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));
addItem(i, new ShopItem(new ItemBuilder(Material.INK_SACK, 1, (byte) 9).setTitle(C.cRed + "").build(), "No Item",
"No Item", 1, true, true));
}
}
}

View File

@ -1,8 +1,29 @@
package nautilus.game.arcade.game.games.wizards;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.game.games.wizards.spells.*;
import nautilus.game.arcade.game.games.wizards.spells.SpellAnvilDrop;
import nautilus.game.arcade.game.games.wizards.spells.SpellFireball;
import nautilus.game.arcade.game.games.wizards.spells.SpellFlash;
import nautilus.game.arcade.game.games.wizards.spells.SpellFrostBarrier;
import nautilus.game.arcade.game.games.wizards.spells.SpellGust;
import nautilus.game.arcade.game.games.wizards.spells.SpellHeal;
import nautilus.game.arcade.game.games.wizards.spells.SpellIcePrison;
import nautilus.game.arcade.game.games.wizards.spells.SpellIceShards;
import nautilus.game.arcade.game.games.wizards.spells.SpellImplode;
import nautilus.game.arcade.game.games.wizards.spells.SpellLightningStrike;
import nautilus.game.arcade.game.games.wizards.spells.SpellManaBolt;
import nautilus.game.arcade.game.games.wizards.spells.SpellNapalm;
import nautilus.game.arcade.game.games.wizards.spells.SpellRainbowBeam;
import nautilus.game.arcade.game.games.wizards.spells.SpellRainbowRoad;
import nautilus.game.arcade.game.games.wizards.spells.SpellRumble;
import nautilus.game.arcade.game.games.wizards.spells.SpellSpectralArrow;
import nautilus.game.arcade.game.games.wizards.spells.SpellSpeedBoost;
import nautilus.game.arcade.game.games.wizards.spells.SpellSummonWolves;
import nautilus.game.arcade.game.games.wizards.spells.SpellTrapRune;
import nautilus.game.arcade.game.games.wizards.spells.SpellWebShot;
import nautilus.game.arcade.game.games.wizards.spells.SpellWizardsCompass;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
@ -13,7 +34,7 @@ public enum SpellType // ❤
WandElement.EARTH, // Wand element
"Anvil Drop", // Spell name
new ItemStack(Material.NETHER_BRICK_ITEM), // Spell icon
SpellDroom.class, // Spell class
SpellAnvilDrop.class, // Spell class
3, // Spell max level
40, // Mana cost
15, // Spell cooldown
@ -70,7 +91,7 @@ public enum SpellType // ❤
FrostBarrier(SpellElement.MISC, // Spell element
WandElement.ICE, // Wand element
"Frost Barrier", // Spell name
new ItemStack(Material.MONSTER_EGG), // Spell icon
new ItemStack(Material.CLAY_BALL), // Spell icon
SpellFrostBarrier.class, // Spell class
3, // Spell max level
60, // Mana cost
@ -101,7 +122,7 @@ public enum SpellType // ❤
C.cYellow + C.Bold + "Gust Size: " + C.Bold + C.cWhite + "10 x Spell Level blocks",
C.cYellow + C.Bold + "Gust Strenth: " + C.Bold + C.cWhite + "Spell Level x 30%",
C.cYellow + C.Bold + "Gust Strength: " + C.Bold + C.cWhite + "Spell Level x 30%",
"",
@ -200,7 +221,7 @@ public enum SpellType // ❤
LightningStrike(SpellElement.ATTACK, // Spell element
WandElement.AIR, // Wand element
"Lightning Strike", // Spell name
new ItemStack(Material.SLIME_BALL), // Spell icon
new ItemStack(Material.INK_SACK, 1, (short) 12), // Spell icon
SpellLightningStrike.class, // Spell class
3, // Spell max level
50, // Mana cost
@ -219,11 +240,11 @@ public enum SpellType // ❤
"The lightning also contains fire!"),
MagicMissile(SpellElement.ATTACK, // Spell element
WandElement.NORMAL, // Wand element
"Magic Missile", // Spell name
ManaBolt(SpellElement.ATTACK, // Spell element
WandElement.AIR, // Wand element
"Mana Bolt", // Spell name
new ItemStack(Material.MELON_SEEDS), // Spell icon
SpellMagicMissile.class, // Spell class
SpellManaBolt.class, // Spell class
3, // Spell max level
15, // Mana cost
5, // Spell cooldown
@ -231,13 +252,13 @@ public enum SpellType // ❤
0, // Cooldown change per level
15, // Item amount in loot
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 3",
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "(Spell Level x 10) + 20",
"",
"Basic spell all beginner mages are taught," + " this creates a magic missile commonly attributed towards "
"Basic spell all beginner mages are taught," + " this creates a mana missile commonly attributed towards "
+ "the magic profession and homes in towards the closest target!"),
Napalm(SpellElement.ATTACK, // Spell element
@ -258,14 +279,14 @@ public enum SpellType // ❤
"Creates a ball of fire that grows",
"the longer it lives. At a large size",
"the longer it lives. At an large size",
"it even even burn away nearby blocks!"),
"it even burns away nearby blocks!"),
RainbowBeam(SpellElement.ATTACK, // Spell element
WandElement.FIRE, // Wand element
"Rainbow Beam", // Spell name
new ItemStack(Material.EMERALD), // Spell icon
new ItemStack(Material.INK_SACK, 1, (short) 10), // Spell icon
SpellRainbowBeam.class, // Spell class
5, // Spell max level
5, // Mana cost
@ -274,7 +295,7 @@ public enum SpellType // ❤
1, // Cooldown change per level
10, // Item amount in loot
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2.5",
C.cYellow + C.Bold + "Damage: " + C.Bold + C.cWhite + "Spell Level + 2",
C.cYellow + C.Bold + "Range: " + C.Bold + C.cWhite + "80",
@ -332,7 +353,7 @@ public enum SpellType // ❤
"",
"Creates an targeted earthquake",
"Creates a targeted earthquake",
"in the direction you face!",
@ -343,7 +364,8 @@ public enum SpellType // ❤
SpectralArrow(SpellElement.ATTACK, // Spell element
WandElement.DEATH, // Wand element
"Spectral Arrow", // Spell name
new ItemStack(Material.ENCHANTED_BOOK), // Spell icon
new ItemBuilder(Material.INK_SACK, 1, (short) 13).addEnchantment(UtilInv.getDullEnchantment(), 1).build(), // Spell
// icon
SpellSpectralArrow.class, // Spell class
3, // Spell max level
40, // Mana cost
@ -363,7 +385,7 @@ public enum SpellType // ❤
SpeedBoost(SpellElement.SUPPORT, // Spell element
WandElement.LIFE, // Wand element
"Speed Boost", // Spell name
new ItemStack(Material.BOOK), // Spell icon
new ItemStack(Material.INK_SACK, 1, (short) 2), // Spell icon
SpellSpeedBoost.class, // Spell class
2, // Spell max level
20, // Mana cost
@ -374,7 +396,7 @@ public enum SpellType // ❤
C.cYellow + C.Bold + "Length: " + C.Bold + C.cWhite + "20 seconds",
C.cYellow + C.Bold + "Strength: " + C.Bold + C.cWhite + "Spell Level",
C.cYellow + C.Bold + "Strength: " + C.Bold + C.cWhite + "Spell Level + 1",
"",
@ -462,16 +484,16 @@ public enum SpellType // ❤
public enum SpellElement
{
ATTACK(1, 0, 2, new ItemBuilder(Material.IRON_SWORD).setTitle(C.cRed + "Attack Spells")
ATTACK(1, 0, 2, new ItemBuilder(Material.INK_SACK, 1, (short) 7).setTitle(C.cRed + "Attack Spells")
.addLore(C.cGray + "Spells of destruction").build(), C.cRed),
MISC(7, 6, 8, new ItemBuilder(Material.COAL_BLOCK).setTitle(C.cDGray + "Misc Spells").addLore(
MISC(7, 6, 8, new ItemBuilder(Material.INK_SACK, 1, (short) 11).setTitle(C.cDGray + "Misc Spells").addLore(
C.cGray + "Misc spells that don't fit in",
"These spells generally effect the world itself").build(), C.cGray),
SUPPORT(4, 4, 4, new ItemBuilder(Material.IRON_BOOTS).setTitle(C.cDGreen + "Support Spells")
SUPPORT(4, 4, 4, new ItemBuilder(Material.INK_SACK, 1, (short) 14).setTitle(C.cDGreen + "Support Spells")
.addLore(C.cGray + "Spells of assistance").build(), C.cDGreen);
private String _chatColor;
@ -525,7 +547,7 @@ public enum SpellType // ❤
{
AIR(Material.IRON_HOE),
DEATH(Material.FERMENTED_SPIDER_EYE),
DEATH(Material.STICK),
EARTH(Material.STONE_HOE),
@ -533,9 +555,7 @@ public enum SpellType // ❤
ICE(Material.DIAMOND_HOE),
LIFE(Material.WOOD_HOE),
NORMAL(Material.BLAZE_ROD);
LIFE(Material.WOOD_HOE);
private Material _material;

View File

@ -15,6 +15,17 @@ public class Wizard
private float _maxMana;
private int _soulStars;
private float _cooldownModifier = 1;
private int _wandsOwned;
public void setWandsOwned(int wandsOwned)
{
_wandsOwned = wandsOwned;
}
public int getWandsOwned()
{
return _wandsOwned;
}
public float getCooldownModifier()
{
@ -33,7 +44,7 @@ public class Wizard
public Wizard(float maxMana)
{
learnSpell(SpellType.MagicMissile);
learnSpell(SpellType.ManaBolt);
learnSpell(SpellType.WizardsCompass);
_maxMana = maxMana;
@ -106,12 +117,18 @@ public class Wizard
public void setUsedSpell(SpellType spell)
{
int cooldown = spell.getSpellCooldown(this);
if (cooldown > 0)
{
_cooldowns.put(spell, System.currentTimeMillis() + (1000L * cooldown));
}
}
public NautHashMap<SpellType, Long> getCooldowns()
{
return _cooldowns;
}
public void setManaPerTick(float manaPerTick)
{
_manaPerTick = manaPerTick;

View File

@ -36,10 +36,9 @@ public class WizardSpellMenu extends MiniPlugin
@EventHandler
public void onJoin(PlayerJoinEvent event)
{
if (_wizards.GetState() == GameState.Recruit || _wizards.GetState() == GameState.Live)
{
event.getPlayer().getInventory().addItem(_wizardSpells);
event.getPlayer().getInventory().setItem(0, _wizardSpells);
}
}
@ -52,7 +51,7 @@ public class WizardSpellMenu extends MiniPlugin
{
if (_wizards.IsLive())
{
event.getEntity().getInventory().addItem(_wizardSpells);
event.getEntity().getInventory().setItem(0, _wizardSpells);
}
}
});
@ -61,12 +60,11 @@ public class WizardSpellMenu extends MiniPlugin
@EventHandler
public void onJoin(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Recruit)
{
for (Player player : Bukkit.getOnlinePlayers())
{
player.getInventory().addItem(_wizardSpells);
player.getInventory().setItem(0, _wizardSpells);
}
}
}
@ -74,7 +72,8 @@ public class WizardSpellMenu extends MiniPlugin
@EventHandler
public void onInteract(PlayerInteractEvent event)
{
if (event.getAction() != Action.PHYSICAL && (!_wizards.IsLive() || !_wizards.IsAlive(event.getPlayer())))
if (event.getAction() != Action.PHYSICAL && event.getAction().name().contains("RIGHT")
&& (!_wizards.IsLive() || !_wizards.IsAlive(event.getPlayer())))
{
ItemStack item = event.getItem();
@ -88,13 +87,10 @@ public class WizardSpellMenu extends MiniPlugin
if (_wizards.IsLive() && _wizards.IsAlive(event.getPlayer()))
{
Player p = event.getPlayer();
ItemStack item = event.getItem();
if (item != null && item.getType() != Material.STAINED_GLASS_PANE)
if (p.getInventory().getHeldItemSlot() < _wizards.getWizard(p).getWandsOwned())
{
Player p = event.getPlayer();
if (event.getAction().name().contains("RIGHT"))
{
if (p.getInventory().getHeldItemSlot() < 5)

View File

@ -30,6 +30,7 @@ import mineplex.core.common.util.UtilTime.TimeUnit;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.hologram.Hologram;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.loot.ChestLoot;
import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo;
import mineplex.core.updater.UpdateType;
@ -76,6 +77,7 @@ import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.enchantment.EnchantItemEvent;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ItemSpawnEvent;
@ -92,6 +94,7 @@ import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.AnvilInventory;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
@ -110,6 +113,7 @@ public class Wizards extends SoloGame
private float _endgameSize = 1.5F;
private float _fireballSpeed = 0.05F;
private long _lastEndgameStrike;
private long _lastGhastMoan;
private int _lastGamePace;
/**
* @0 for meteors
@ -117,10 +121,7 @@ public class Wizards extends SoloGame
*/
private int _endGameEvent;
private int _nextEndgameStrike = 6000;
/**
* The entry is so I can randomize the amounts of the items found
*/
private ArrayList<Entry<ItemStack, Integer>> _randomItems = new ArrayList<Entry<ItemStack, Integer>>();
private ChestLoot _chestLoot = new ChestLoot();
private NautHashMap<SpellType, Spell> _spells = new NautHashMap<SpellType, Spell>();
private WizardSpellMenu _wizard;
private NautHashMap<String, Wizard> _wizards = new NautHashMap<String, Wizard>();
@ -298,33 +299,18 @@ public class Wizards extends SoloGame
};
}
private void addRandomItem(int amount, Material itemType, int newDurability, int minAmount, int maxAmount)
@EventHandler
public void onFireballDamage(EntityDamageByEntityEvent event)
{
HashMap.SimpleEntry entry = new HashMap.SimpleEntry(new ItemStack(itemType, minAmount, (short) newDurability), maxAmount
- minAmount);
for (int i = 0; i < amount; i++)
if (event.getDamager() instanceof Fireball)
{
_randomItems.add(entry);
}
}
private void addRandomItem(int amount, ItemStack item, int minAmount, int maxAmount)
{
item.setAmount(minAmount);
HashMap.SimpleEntry entry = new HashMap.SimpleEntry(item, maxAmount - minAmount);
for (int i = 0; i < amount; i++)
{
_randomItems.add(entry);
event.setCancelled(true);
}
}
@EventHandler
public void onDamage(CustomDamageEvent event)
{
event.SetDamageToLevel(false);
if (!event.IgnoreArmor())
{
double percentProtected = 0;
@ -343,19 +329,19 @@ public class Wizards extends SoloGame
if (name.contains("LEATHER"))
{
percent = 6;
percent = 8;
}
else if (name.contains("GOLDEN") || name.contains("CHAINMAIL"))
{
percent = 9;
percent = 12;
}
else if (name.contains("IRON"))
{
percent = 12;
percent = 15;
}
else if (name.contains("DIAMOND"))
{
percent = 15;
percent = 20;
}
if (name.contains("BOOTS"))
@ -398,10 +384,57 @@ public class Wizards extends SoloGame
return s;
}
@EventHandler
public void spellCooldown(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
if (!IsLive())
{
return;
}
for (Player player : GetPlayers(true))
{
int heldSlot = player.getInventory().getHeldItemSlot();
Wizard wizard = getWizard(player);
for (int i = 0; i < 5; i++)
{
if (i == heldSlot)
continue;
ItemStack item = player.getInventory().getItem(i);
if (item != null)
{
SpellType spell = wizard.getSpell(i);
if (spell != null)
{
int timeLeft = (int) Math.ceil(getUsableTime(wizard, spell).getKey());
timeLeft = Math.max(0, Math.min(63, timeLeft)) + 1;
if (timeLeft != item.getAmount())
{
item.setAmount(timeLeft);
player.getInventory().setItem(i, item);
}
}
}
}
}
}
public void castSpell(Player player, Wizard wizard, SpellType spell, Object interacted)
{
int spellLevel = wizard.getSpellLevel(spell);
if (spellLevel > 0)
{
@ -449,29 +482,44 @@ public class Wizards extends SoloGame
public void changeWandsType(Player player, int oldSlot, int newSlot)
{
PlayerInventory inv = player.getInventory();
Wizard wizard = getWizard(player);
if (oldSlot >= 0 && oldSlot < 5)
{
SpellType spell = getWizard(player).getSpell(oldSlot);
SpellType spell = wizard.getSpell(oldSlot);
if (spell != null)
{
int timeLeft = (int) Math.ceil(getUsableTime(wizard, spell).getKey());
timeLeft = Math.max(0, Math.min(63, timeLeft)) + 1;
ItemStack item = inv.getItem(oldSlot);
item.setType(spell.getSpellItem().getType());
item.setDurability(spell.getSpellItem().getDurability());
item.setAmount(timeLeft);
inv.setItem(oldSlot, item);
}
}
if (newSlot >= 0 && newSlot < 5)
{
SpellType spell = getWizard(player).getSpell(newSlot);
SpellType spell = wizard.getSpell(newSlot);
if (spell != null)
{
ItemStack item = inv.getItem(newSlot);
item.setDurability((short) 0);
item.setType(spell.getWandType().getMaterial());
item.setAmount(1);
inv.setItem(newSlot, item);
}
}
@ -484,11 +532,10 @@ public class Wizards extends SoloGame
for (int slot = 0; slot < 5; slot++)
{
ItemStack item = inv.getItem(slot);
SpellType type = wizard.getSpell(slot);
if (item != null && item.getType() != Material.STAINED_GLASS_PANE)
if (slot < wizard.getWandsOwned())
{
ItemStack item = inv.getItem(slot);
SpellType type = wizard.getSpell(slot);
String display;
if (type != null)
@ -596,46 +643,41 @@ public class Wizards extends SoloGame
{
for (SpellType spellType : SpellType.values())
{
for (int i = 0; i < spellType.getItemAmount(); i++)
{
_randomItems.add(new HashMap.SimpleEntry(spellType.getSpellBook(this), 0));
}
_chestLoot.addLoot(spellType.getSpellBook(this), spellType.getItemAmount());
}
for (int i = 0; i < 4; i++)
{
_randomItems.add(new HashMap.SimpleEntry(makeUnusedWand(), 0));
}
_chestLoot.addLoot(
new ItemBuilder(makeBlankWand()).setTitle(C.cWhite + "Spell Wand" + buildTime())
.addEnchantment(UtilInv.getDullEnchantment(), 1).build(), 4);
addRandomItem(15, Material.CARROT_ITEM, 0, 1, 2);
addRandomItem(15, Material.COOKED_BEEF, 0, 1, 2);
addRandomItem(15, Material.BREAD, 0, 1, 2);
addRandomItem(15, new ItemBuilder(Material.COOKED_CHICKEN).setTitle(C.cWhite + "Cheese").build(), 1, 2);
addRandomItem(5, Material.WHEAT, 0, 1, 2);
addRandomItem(5, Material.STICK, 0, 1, 2);
addRandomItem(5, Material.WOOD, 0, 1, 10);
addRandomItem(5, Material.BOAT, 0, 1, 2);
addRandomItem(5, Material.FLINT, 0, 1, 2);
addRandomItem(5, Material.FEATHER, 0, 1, 2);
addRandomItem(5, Material.GOLD_INGOT, 0, 1, 2);
addRandomItem(5, Material.LEATHER_BOOTS, 0, 1, 1);
addRandomItem(5, Material.LEATHER_CHESTPLATE, 0, 1, 1);
addRandomItem(5, Material.LEATHER_HELMET, 0, 1, 1);
addRandomItem(5, Material.LEATHER_LEGGINGS, 0, 1, 1);
addRandomItem(3, Material.CHAINMAIL_BOOTS, 0, 1, 1);
addRandomItem(3, Material.CHAINMAIL_CHESTPLATE, 0, 1, 1);
addRandomItem(3, Material.CHAINMAIL_HELMET, 0, 1, 1);
addRandomItem(3, Material.CHAINMAIL_LEGGINGS, 0, 1, 1);
addRandomItem(3, Material.FISHING_ROD, 0, 1, 1);
// addRandomItem(5, Material.BOW, 0, 1, 1);
// addRandomItem(5, Material.ARROW, 0, 1, 5);
addRandomItem(5, Material.IRON_INGOT, 0, 1, 2);
addRandomItem(3, Material.DIAMOND, 0, 1, 1);
addRandomItem(5, Material.EXP_BOTTLE, 0, 1, 2);
addRandomItem(1, Material.IRON_BOOTS, 0, 1, 1);
addRandomItem(1, Material.IRON_CHESTPLATE, 0, 1, 1);
addRandomItem(1, Material.IRON_HELMET, 0, 1, 1);
addRandomItem(1, Material.IRON_LEGGINGS, 0, 1, 1);
_chestLoot.addLoot(Material.CARROT_ITEM, 15, 1, 2);
_chestLoot.addLoot(Material.COOKED_BEEF, 15, 1, 2);
_chestLoot.addLoot(Material.BREAD, 15, 1, 2);
_chestLoot.addLoot(new ItemBuilder(Material.COOKED_CHICKEN).setTitle(C.cWhite + "Cheese").build(), 15, 1, 2);
_chestLoot.addLoot(Material.WHEAT, 5, 1, 2);
_chestLoot.addLoot(Material.WOOD, 5, 1, 10);
_chestLoot.addLoot(Material.BOAT, 5, 1, 2);
_chestLoot.addLoot(Material.FISHING_ROD, 3, 1, 1);
_chestLoot.addLoot(Material.GOLD_INGOT, 5, 1, 2);
_chestLoot.addLoot(Material.IRON_INGOT, 5, 1, 2);
_chestLoot.addLoot(Material.DIAMOND, 3, 1, 1);
_chestLoot.addLoot(Material.LEATHER_BOOTS, 6, 1, 1);
_chestLoot.addLoot(Material.LEATHER_LEGGINGS, 6, 1, 1);
_chestLoot.addLoot(Material.LEATHER_CHESTPLATE, 6, 1, 1);
_chestLoot.addLoot(Material.LEATHER_HELMET, 6, 1, 1);
_chestLoot.addLoot(Material.CHAINMAIL_BOOTS, 5, 1, 1);
_chestLoot.addLoot(Material.CHAINMAIL_CHESTPLATE, 5, 1, 1);
_chestLoot.addLoot(Material.CHAINMAIL_HELMET, 5, 1, 1);
_chestLoot.addLoot(Material.CHAINMAIL_LEGGINGS, 5, 1, 1);
_chestLoot.addLoot(Material.IRON_BOOTS, 2, 1, 1);
_chestLoot.addLoot(Material.IRON_CHESTPLATE, 2, 1, 1);
_chestLoot.addLoot(Material.IRON_HELMET, 2, 1, 1);
_chestLoot.addLoot(Material.IRON_LEGGINGS, 2, 1, 1);
}
@EventHandler
@ -718,27 +760,12 @@ public class Wizards extends SoloGame
if (type != null)
{
Entry<Double, Boolean> entry = getUsableTime(wizard, type);
double usableTime = 0;// Time in seconds till usable
if (wizard.getMana() < type.getManaCost(wizard))
{
usableTime = (type.getManaCost(wizard) - wizard.getMana()) / (20 * wizard.getManaPerTick());
}
double cooldown = wizard.getCooldown(type) != 0 ? (double) (wizard.getCooldown(type) - System
.currentTimeMillis()) / 1000D : 0;
boolean displayCooldown = false;
if (cooldown > 0 && cooldown > usableTime)
{
usableTime = cooldown;
displayCooldown = true;
}
double usableTime = entry.getKey();// Time in seconds till usable
if (usableTime > 0)
{
usableTime = UtilMath.trim(1, usableTime);
double maxSeconds = Math.max(type.getSpellCooldown(wizard),
@ -746,7 +773,7 @@ public class Wizards extends SoloGame
displayProgress(C.cRed, C.cRed + type.getSpellName(), 1f - (usableTime / maxSeconds),
(displayCooldown ?
(entry.getValue() ?
UtilTime.convertString((long) (usableTime * 1000), 1, TimeUnit.FIT)
@ -770,19 +797,71 @@ public class Wizards extends SoloGame
}
}
private Entry<Double, Boolean> getUsableTime(Wizard wizard, SpellType type)
{
double usableTime = 0;
if (wizard.getMana() < type.getManaCost(wizard))
{
usableTime = (type.getManaCost(wizard) - wizard.getMana()) / (20 * wizard.getManaPerTick());
}
double cooldown = wizard.getCooldown(type) != 0 ? (double) (wizard.getCooldown(type) - System.currentTimeMillis()) / 1000D
: 0;
boolean displayCooldown = false;
if (cooldown > 0 && cooldown > usableTime)
{
usableTime = cooldown;
displayCooldown = true;
}
return new HashMap.SimpleEntry(usableTime, displayCooldown);
}
private ArrayList<ItemStack> getItems(Player player)
{
ArrayList<ItemStack> items = new ArrayList<ItemStack>();
PlayerInventory inv = player.getInventory();
for (int i = 5; i < inv.getSize(); i++)
{
ItemStack item = inv.getItem(i);
if (item != null && item.getType() != Material.AIR)
{
items.add(item.clone());
}
}
for (ItemStack item : inv.getArmorContents())
{
if (item != null && item.getType() != Material.AIR)
{
items.add(item.clone());
}
}
ItemStack cursorItem = player.getItemOnCursor();
if (cursorItem != null && cursorItem.getType() != Material.AIR)
items.add(cursorItem.clone());
return items;
}
private void dropSpells(Player player)
{
HashSet<SpellType> spells = new HashSet<SpellType>();
ArrayList<ItemStack> itemsToDrop = new ArrayList<ItemStack>();
Wizard wizard = getWizard(player);
int wandsHeld = 0;
for (int i = 0; i < 5; i++)
{
SpellType type = wizard.getSpell(i);
if (type != null && type != SpellType.MagicMissile)
if (type != null && type != SpellType.ManaBolt)
{
spells.add(type);
}
@ -790,41 +869,29 @@ public class Wizards extends SoloGame
for (SpellType spell : wizard.getKnownSpells())
{
if (spell != SpellType.MagicMissile && UtilMath.random.nextInt(5) == 0)
if (spell != SpellType.ManaBolt && UtilMath.random.nextInt(5) == 0)
{
spells.add(spell);
}
}
for (ItemStack item : UtilInv.getItems(player))
for (ItemStack item : getItems(player))
{
switch (item.getType())
{
case WOOD_HOE:
case STONE_HOE:
case GOLD_HOE:
case IRON_HOE:
case DIAMOND_HOE:
case BLAZE_ROD:
case STICK:
wandsHeld++;
break;
case STAINED_GLASS_PANE:
break;
default:
player.getWorld().dropItemNaturally(player.getLocation(), item);
break;
}
player.getWorld().dropItemNaturally(player.getLocation(), item);
}
for (SpellType type : spells)
{
itemsToDrop.add(type.getSpellBook(this));
ItemStack item = type.getSpellBook(this);
UtilInv.addDullEnchantment(item);
itemsToDrop.add(item);
}
if (wandsHeld > 3 || UtilMath.random.nextBoolean())
if (wizard.getWandsOwned() > 3 || UtilMath.random.nextBoolean())
{
itemsToDrop.add(makeUnusedWand());
itemsToDrop.add(makeBlankWand());
}
itemsToDrop.add(new ItemBuilder(Material.NETHER_STAR).setTitle(buildTime()).build());
@ -850,9 +917,9 @@ public class Wizards extends SoloGame
private void fillWithLoot(Block block)
{
BlockState state = block.getState();
if (state instanceof InventoryHolder)
{
InventoryHolder holder = (InventoryHolder) state;
Inventory inv = holder.getInventory();
boolean containsSpell = false;
@ -860,8 +927,7 @@ public class Wizards extends SoloGame
for (int i = 0; i < 5 || !containsSpell; i++)
{
Entry<ItemStack, Integer> entry = _randomItems.get(UtilMath.r(_randomItems.size()));
ItemStack item = entry.getKey().clone();
ItemStack item = _chestLoot.getLoot();
SpellType spellType = getSpell(item);
@ -871,12 +937,12 @@ public class Wizards extends SoloGame
continue;
}
if (!containsSpell)
if (spellType != null)
{
containsSpell = spellType != null;
containsSpell = true;
UtilInv.addDullEnchantment(item);
}
item.setAmount(item.getAmount() + UtilMath.r(entry.getValue() + 1));
inv.setItem(UtilMath.r(inv.getSize()), item);
}
@ -948,17 +1014,15 @@ public class Wizards extends SoloGame
returnToHub(event.getPlayer());
}
public ItemStack makeUnusedWand()
public ItemStack makeBlankWand()
{
ItemBuilder builder = new ItemBuilder(Material.BLAZE_ROD);
builder.setTitle(ChatColor.WHITE + "Spell Wand" + buildTime());
builder.setTitle(C.cWhite + "Right click to set a spell" + buildTime());
builder.addLore(
builder.addLore(C.cGreen + C.Bold + "Left-Click" + C.cWhite + " Bind to Wand");
C.cPurple + C.Bold + "LEFT CLICK" + C.cDGreen + " Cast spell",
C.cGreen + C.Bold + "RIGHT CLICK" + C.cBlue + " Open Spellbook");
builder.addLore(C.cGreen + C.Bold + "Right-Click" + C.cWhite + " Quickcast Spell");
return builder.build();
}
@ -1111,20 +1175,9 @@ public class Wizards extends SoloGame
{
Player p = event.getEntity();
if (IsAlive(p))
if (IsLive() && IsAlive(p))
{
dropSpells(p);
/*Iterator<ItemStack> itel = event.getDrops().iterator();
while (itel.hasNext())
{
ItemStack item = itel.next();
if (item.getType() == Material.BLAZE_ROD || item.getType() == Material.STAINED_GLASS_PANE)
{
itel.remove();
}
}*/
}
_wizards.remove(p.getName());
@ -1151,6 +1204,8 @@ public class Wizards extends SoloGame
holo.setRemoveOnEntityDeath();
holo.setViewDistance(16);
holo.start();
_droppedWandsBooks.add(event.getEntity());
@ -1158,6 +1213,7 @@ public class Wizards extends SoloGame
}
else if (item.getType() == Material.BLAZE_ROD)
{
item.removeEnchantment(UtilInv.getDullEnchantment());
Hologram holo = new Hologram(getArcadeManager().getHologramManager(),
@ -1169,6 +1225,8 @@ public class Wizards extends SoloGame
holo.setRemoveOnEntityDeath();
holo.setViewDistance(16);
holo.start();
_droppedWandsBooks.add(event.getEntity());
@ -1209,6 +1267,29 @@ public class Wizards extends SoloGame
{
if (event.GetState() == GameState.Live)
{
for (Player player : GetPlayers(true))
{
Kit kit = GetKit(player);
if (kit instanceof KitMage)
{
Wizard wizard = getWizard(player);
for (int a = 0; a < 2; a++)
{
for (int i = 0; i < 100; i++)
{
SpellType spell = SpellType.values()[UtilMath.r(SpellType.values().length)];
if (wizard.getSpellLevel(spell) == 0 && UtilMath.r(10) < spell.getItemAmount())
{
onSpellLearn(player, spell);
break;
}
}
}
}
}
for (SpellType spells : SpellType.values())
{
try
@ -1251,12 +1332,15 @@ public class Wizards extends SoloGame
private boolean onGainWand(Player p)
{
int slot = p.getInventory().first(Material.STAINED_GLASS_PANE);
Wizard wizard = getWizard(p);
int slot = wizard.getWandsOwned();
if (slot >= 0 && slot < 5)
{
p.getInventory().setItem(slot,
new ItemBuilder(makeUnusedWand()).setTitle(C.cWhite + "Right click to set a spell").build());
wizard.setWandsOwned(wizard.getWandsOwned() + 1);
p.getInventory().setItem(slot, makeBlankWand());
p.updateInventory();
@ -1264,8 +1348,6 @@ public class Wizards extends SoloGame
}
else
{
Wizard wizard = getWizard(p);
wizard.addMana(100);
p.sendMessage(C.cGold + "Wizards" + C.cDGray + "> " + C.cGray + "Wand converted into mana");
}
@ -1304,42 +1386,41 @@ public class Wizards extends SoloGame
}
}
@EventHandler
public void onLive(GameStateChangeEvent event)
public void setupWizard(Player player)
{
if (event.GetState() == GameState.Live)
Kit kit = GetKit(player);
Wizard wizard = new Wizard(kit instanceof KitWitchDoctor ? 150 : 100);
_wizards.put(player.getName(), wizard);
if (kit instanceof KitMystic)
{
for (Player player : GetPlayers(true))
wizard.setManaPerTick(wizard.getManaPerTick() * 1.1F);
}
wizard.setWandsOwned(kit instanceof KitSorcerer ? 3 : 2);
for (int i = 0; i < 5; i++)
{
if (i < wizard.getWandsOwned())
{
Kit kit = GetKit(player);
Wizard wizard = new Wizard(kit instanceof KitWitchDoctor ? 150 : 100);
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeBlankWand());
}
else
{
player.getInventory().addItem(
_wizards.put(player.getName(), wizard);
new ItemBuilder(Material.INK_SACK, 1, (short) 5)
if (kit instanceof KitMage)
{
for (int a = 0; a < 2; a++)
{
for (int i = 0; i < 100; i++)
{
SpellType spell = SpellType.values()[UtilMath.r(SpellType.values().length)];
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
if (wizard.getSpellLevel(spell) == 0 && UtilMath.r(10) < spell.getItemAmount())
{
onSpellLearn(player, spell);
break;
}
}
}
}
else if (kit instanceof KitMystic)
{
wizard.setManaPerTick(wizard.getManaPerTick() * 1.1F);
}
.addLore(C.cGray + C.Italics + "Wands can be found in chests and dead players")
changeWandsTitles(player);
.build());
}
}
changeWandsTitles(player);
}
@EventHandler
@ -1385,7 +1466,6 @@ public class Wizards extends SoloGame
if (item.getType() == Material.BLAZE_ROD)
{
if (onGainWand(p))
{
event.setCancelled(true);
@ -1425,7 +1505,7 @@ public class Wizards extends SoloGame
{
Player p = event.getPlayer();
if (_wizards.containsKey(p.getName()))
if (IsLive() && _wizards.containsKey(p.getName()))
{
dropSpells(p);
}
@ -1501,19 +1581,33 @@ public class Wizards extends SoloGame
if (result != null)
{
if (result.getType().name().contains("_SWORD") || result.getType().name().contains("_AXE"))
Material mat = result.getType();
if (mat.name().contains("_SWORD") || mat.name().contains("_AXE"))
{
event.getInventory().setResult(new ItemStack(Material.AIR));
UtilPlayer.message(event.getViewers().get(0), C.cRed + "You may not craft weapons");
}
else if (result.getType() == Material.STICK || result.getType() == Material.FERMENTED_SPIDER_EYE
|| result.getType().name().contains("_HOE"))
else if (mat == Material.STICK || mat.name().contains("_HOE"))
{
event.getInventory().setResult(new ItemStack(Material.AIR));
UtilPlayer.message(event.getViewers().get(0), C.cRed + "You may not craft this item");
}
else
{
for (SpellType spell : SpellType.values())
{
if (mat == spell.getSpellItem().getType())
{
event.getInventory().setResult(new ItemStack(Material.AIR));
UtilPlayer.message(event.getViewers().get(0), C.cRed + "You may not craft this item");
break;
}
}
}
}
}
@ -1588,7 +1682,6 @@ public class Wizards extends SoloGame
if (_endgameMessageCounter <= 6)
{
if (event.getType() != UpdateType.SEC)
{
return;
@ -1633,6 +1726,12 @@ public class Wizards extends SoloGame
}
}
if (_endgameMessageCounter == 6)
{
WorldTimeSet = 0;
WorldData.World.setTime(15000);
}
_endgameMessageCounter++;
}
else
@ -1642,9 +1741,13 @@ public class Wizards extends SoloGame
return;
}
if (_nextEndgameStrike > 150)
{
_nextEndgameStrike -= 2;
}
if (UtilTime.elapsed(_lastEndgameStrike, _nextEndgameStrike))
{
_nextEndgameStrike -= 20;
_lastEndgameStrike = System.currentTimeMillis();
if (_endGameEvent == 0)
@ -1656,6 +1759,33 @@ public class Wizards extends SoloGame
makeLightning();
}
}
if (_lastGhastMoan < System.currentTimeMillis())
{
Sound sound = null;
switch (UtilMath.r(3))
{
case 0:
sound = Sound.GHAST_MOAN;
break;
case 1:
sound = Sound.CAT_HIT;
break;
case 2:
sound = Sound.GHAST_SCREAM;
break;
default:
break;
}
for (Player player : GetPlayers(false))
{
player.playSound(player.getLocation(), sound, 0.7F, 0 + (UtilMath.random.nextFloat() / 10));
}
_lastGhastMoan = System.currentTimeMillis() + 5000 + (UtilMath.r(8) * 1000);
}
}
}
@ -1663,7 +1793,7 @@ public class Wizards extends SoloGame
{
int chance = UtilMath.r(50) + 3;
int accuracy = Math.max((int) (chance - (_accuracy * chance)), 1);
_accuracy += 0.003;
_accuracy += 0.0001;
ArrayList<Player> players = GetPlayers(true);
@ -1695,23 +1825,6 @@ public class Wizards extends SoloGame
return;
}
/*else
{
if (_fireballQueue.isEmpty())
{
_fireballQueue = GetPlayers(true);
}
if (_fireballItel == null || !_fireballItel.hasNext())
{
_fireballItel = _fireballQueue.iterator();
}
loc = _fireballItel.next().getLocation();
loc.add(UtilMath.r(10) - 5, 0, UtilMath.r(10) - 5);
}*/
loc.getWorld().spigot().strikeLightningEffect(loc, true);
loc.getWorld().playSound(loc, Sound.AMBIENCE_THUNDER, 5F, 0.8F + UtilMath.random.nextFloat());
loc.getWorld().playSound(loc, Sound.EXPLODE, 2F, 0.9F + (UtilMath.random.nextFloat() / 3));
@ -1746,10 +1859,29 @@ public class Wizards extends SoloGame
}
}
@EventHandler
public void preventEnchanting(EnchantItemEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void preventAnvil(InventoryClickEvent event)
{
if (event.getView().getTopInventory() != null && event.getView().getTopInventory() instanceof AnvilInventory)
{
event.setCancelled(true);
}
}
private void makeMeteor()
{
_fireballSpeed += 0.01;
_endgameSize += 0.08;
_fireballSpeed += 0.002;
if (_endgameSize < 10)
{
_endgameSize += 0.04;
}
Location loc = getEndgameLocation();
@ -1758,29 +1890,6 @@ public class Wizards extends SoloGame
return;
}
/*if (UtilMath.r(3) != 0)
{
loc = new Location(WorldData.World, WorldData.MinX + UtilMath.r(WorldData.MaxX - WorldData.MinX), 0, WorldData.MinZ
+ UtilMath.r(WorldData.MaxZ - WorldData.MinZ));
loc = loc.getWorld().getHighestBlockAt(loc).getLocation();
}
else
{
if (_fireballQueue.isEmpty())
{
_fireballQueue = GetPlayers(true);
}
if (_fireballItel == null || !_fireballItel.hasNext())
{
_fireballItel = _fireballQueue.iterator();
}
loc = _fireballItel.next().getLocation();
}*/
summonMeteor(loc, 1.5F * _endgameSize);
}
@ -1811,7 +1920,7 @@ public class Wizards extends SoloGame
if (i++ % 6 == 0)
{
fireball.getWorld().playSound(fireball.getLocation(), Sound.CAT_HISS, 1.4F, 0F);
fireball.getWorld().playSound(fireball.getLocation(), Sound.CAT_HISS, 1.3F, 0F);
}
}
else
@ -1836,7 +1945,7 @@ public class Wizards extends SoloGame
}
@EventHandler
public void summonMeteors(UpdateEvent event)
public void instantDeath(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
@ -1870,7 +1979,7 @@ public class Wizards extends SoloGame
if (itel.hasNext())
{
getArcadeManager().GetDamage().NewDamageEvent(player, null, null, DamageCause.ENTITY_EXPLOSION, 9999, false,
true, true, "Meteor", "Meteor");
true, true, "Magic", "Magic");
}
}
}
@ -1879,33 +1988,37 @@ public class Wizards extends SoloGame
@EventHandler
public void updateMana(UpdateEvent event)
{
if ((event.getType() == UpdateType.TICK) && GetState() == GameState.Live)
if (event.getType() != UpdateType.TICK)
{
Iterator<Entry<String, Wizard>> itel = _wizards.entrySet().iterator();
while (itel.hasNext())
{
Entry<String, Wizard> entry = itel.next();
Player player = Bukkit.getPlayerExact(entry.getKey());
Wizard wizard = getWizard(player);
float newMana = wizard.getMana();
if (newMana < wizard.getMaxMana())
{
newMana = Math.min(newMana + wizard.getManaPerTick(), wizard.getMaxMana());
wizard.setMana(newMana);
}
float percentage = Math.min(1, wizard.getMana() / wizard.getMaxMana());
String text = (int) Math.floor(wizard.getMana()) + "/" + (int) wizard.getMaxMana() + " mana "
+ UtilTime.convert((int) (wizard.getManaPerTick() * 20000), 1, TimeUnit.SECONDS) + "mps";
UtilTextTop.displayTextBar(player, percentage, text);
drawUtilTextBottom(player);
}
return;
}
if (!IsLive())
{
return;
}
for (Player player : GetPlayers(true))
{
Wizard wizard = getWizard(player);
float newMana = wizard.getMana();
if (newMana < wizard.getMaxMana())
{
newMana = Math.min(newMana + wizard.getManaPerTick(), wizard.getMaxMana());
wizard.setMana(newMana);
}
float percentage = Math.min(1, wizard.getMana() / wizard.getMaxMana());
String text = (int) Math.floor(wizard.getMana()) + "/" + (int) wizard.getMaxMana() + " mana "
+ UtilTime.convert((int) (wizard.getManaPerTick() * 20000), 1, TimeUnit.SECONDS) + "mps";
UtilTextTop.displayTextBar(player, percentage, text);
drawUtilTextBottom(player);
}
}
}

View File

@ -1,7 +1,5 @@
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.Wizards;
import nautilus.game.arcade.kit.Kit;
@ -15,35 +13,17 @@ import org.bukkit.inventory.ItemStack;
public class KitMage extends Kit
{
public KitMage(ArcadeManager manager)
{
super(manager, "Mage", KitAvailability.Free, new String[]
{
"Start with two extra spells"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD));
}
public KitMage(ArcadeManager manager)
{
super(manager, "Mage", KitAvailability.Free, new String[]
{
"Start with two extra spells"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.BLAZE_ROD));
}
@Override
public void GiveItems(Player player)
{
for (int i = 0; i < 5; i++)
{
if (i < 2)
{
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
}
else
{
player.getInventory().addItem(
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
.build());
}
}
}
@Override
public void GiveItems(Player player)
{
((Wizards) this.Manager.GetGame()).setupWizard(player);
}
}

View File

@ -1,7 +1,5 @@
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.Wizards;
import nautilus.game.arcade.kit.Kit;
@ -15,35 +13,17 @@ import org.bukkit.inventory.ItemStack;
public class KitMystic extends Kit
{
public KitMystic(ArcadeManager manager)
{
super(manager, "Mystic", KitAvailability.Free, new String[]
{
"Mana regeneration increased by 10%"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.WOOD_HOE));
}
public KitMystic(ArcadeManager manager)
{
super(manager, "Mystic", KitAvailability.Free, new String[]
{
"Mana regeneration increased by 10%"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.WOOD_HOE));
}
@Override
public void GiveItems(Player player)
{
for (int i = 0; i < 5; i++)
{
if (i < 2)
{
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
}
else
{
player.getInventory().addItem(
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
.build());
}
}
}
@Override
public void GiveItems(Player player)
{
((Wizards) this.Manager.GetGame()).setupWizard(player);
}
}

View File

@ -1,7 +1,5 @@
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.Wizards;
import nautilus.game.arcade.kit.Kit;
@ -15,35 +13,17 @@ import org.bukkit.inventory.ItemStack;
public class KitSorcerer extends Kit
{
public KitSorcerer(ArcadeManager manager)
{
super(manager, "Sorcerer", KitAvailability.Free, new String[]
{
"Start out with an extra wand"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.STONE_HOE));
}
public KitSorcerer(ArcadeManager manager)
{
super(manager, "Sorcerer", KitAvailability.Free, new String[]
{
"Start out with an extra wand"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.STONE_HOE));
}
@Override
public void GiveItems(Player player)
{
for (int i = 0; i < 5; i++)
{
if (i < 3)
{
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
}
else
{
player.getInventory().addItem(
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
.build());
}
}
}
@Override
public void GiveItems(Player player)
{
((Wizards) this.Manager.GetGame()).setupWizard(player);
}
}

View File

@ -1,8 +1,6 @@
package nautilus.game.arcade.game.games.wizards.kit;
import mineplex.core.achievement.Achievement;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.wizards.Wizards;
import nautilus.game.arcade.kit.Kit;
@ -16,40 +14,22 @@ import org.bukkit.inventory.ItemStack;
public class KitWitchDoctor extends Kit
{
public KitWitchDoctor(ArcadeManager manager)
{
super(manager, "Witch Doctor", KitAvailability.Free, new String[]
{
"Max mana increased to 150"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.IRON_HOE));
public KitWitchDoctor(ArcadeManager manager)
{
super(manager, "Witch Doctor", KitAvailability.Free, new String[]
{
"Max mana increased to 150"
}, new Perk[0], EntityType.WITCH, new ItemStack(Material.IRON_HOE));
this.setAchievementRequirements(new Achievement[]
{
Achievement.BACON_BRAWL_WINS
});
}
this.setAchievementRequirements(new Achievement[]
{
Achievement.BACON_BRAWL_WINS
});
}
@Override
public void GiveItems(Player player)
{
for (int i = 0; i < 5; i++)
{
if (i < 2)
{
player.getInventory().addItem(((Wizards) Manager.GetGame()).makeUnusedWand());
}
else
{
player.getInventory().addItem(
new ItemBuilder(Material.STAINED_GLASS_PANE, 1, (short) 8)
.setTitle(C.cGray + "Empty wand slot" + ((Wizards) Manager.GetGame()).buildTime())
.addLore(C.cGray + C.Italics + "Wands can be found in chests and on dead players")
.build());
}
}
}
@Override
public void GiveItems(Player player)
{
((Wizards) this.Manager.GetGame()).setupWizard(player);
}
}

View File

@ -20,7 +20,7 @@ import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.metadata.FixedMetadataValue;
public class SpellDroom extends Spell implements SpellClick
public class SpellAnvilDrop extends Spell implements SpellClick
{
private ArrayList<FallingBlock> _fallingBlocks = new ArrayList<FallingBlock>();
@ -44,7 +44,7 @@ public class SpellDroom extends Spell implements SpellClick
for (Player p : players)
{
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, p.getLocation(), 0, 0, 0, 0, 1);
Location loc = p.getLocation().clone().add(0, 15 + (getSpellLevel(player) * 3), 0);
int lowered = 0;
@ -83,18 +83,18 @@ public class SpellDroom extends Spell implements SpellClick
private void handleAnvil(Entity entity)
{
_fallingBlocks.remove(entity);
int spellLevel = entity.getMetadata("SpellLevel").get(0).asInt();
CustomExplosion explosion = new CustomExplosion(Wizards.getArcadeManager().GetDamage(), Wizards.getArcadeManager()
.GetExplosion(), entity.getLocation(), 1 + (spellLevel / 2F), "Droom");
.GetExplosion(), entity.getLocation(), 1 + (spellLevel / 2F), "Anvil Drop");
explosion.setPlayer((Player) entity.getMetadata("Wizard").get(0).value(), true);
explosion.setFallingBlockExplosion(true);
explosion.setDropItems(false);
explosion.setMaxDamage(6 + (spellLevel * 4));
explosion.explode();

View File

@ -38,7 +38,7 @@ public class SpellFireball extends Spell implements SpellClick
explosion.setDropItems(false);
explosion.setMaxDamage((spellLevel * 2) + 6);
explosion.setMaxDamage(spellLevel + 6);
explosion.explode();
}

View File

@ -44,8 +44,8 @@ public class SpellFlash extends Spell implements SpellClick
curRange = 0;
// Destination
Location loc = player.getLocation()
.add(player.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0)));
Location loc = player.getEyeLocation().add(new Vector(0, 0.2, 0))
.add(player.getLocation().getDirection().multiply(curRange)).add(new Vector(0, 0.4, 0));
if (curRange > 0)
{

View File

@ -30,7 +30,7 @@ public class SpellFrostBarrier extends Spell implements SpellClick, SpellClickBl
@Override
public void castSpell(Player player)
{
Location loc = player.getLocation().add(player.getLocation().getDirection().normalize().multiply(1.5));
Location loc = player.getLocation().add(player.getLocation().getDirection().setY(0).normalize().multiply(1.5));
castSpell(player, loc.getBlock().getRelative(BlockFace.DOWN));
}

View File

@ -2,42 +2,27 @@ package nautilus.game.arcade.game.games.wizards.spells;
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.SpellClickEntity;
import org.bukkit.Effect;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
public class SpellHeal extends Spell implements SpellClick, SpellClickEntity
public class SpellHeal extends Spell implements SpellClick
{
@Override
public void castSpell(Player p)
{
castSpell(p, p);
}
@Override
public void castSpell(Player p)
{
if (p.getHealth() < p.getMaxHealth())
{
double health = p.getHealth() + (3 + getSpellLevel(p));
@Override
public void castSpell(Player p, Entity target)
{
if (!(target instanceof LivingEntity))
return;
if (health > p.getMaxHealth())
health = p.getMaxHealth();
LivingEntity entity = (LivingEntity) target;
p.setHealth(health);
if (entity.getHealth() < entity.getMaxHealth())
{
double health = entity.getHealth() + (3 + getSpellLevel(p));
p.getWorld().spigot().playEffect(p.getEyeLocation(), Effect.HEART, 0, 0, 0.8F, 0.4F, 0.8F, 0, 6, 30);
if (health > entity.getMaxHealth())
health = entity.getMaxHealth();
entity.setHealth(health);
entity.getWorld().spigot().playEffect(entity.getEyeLocation(), Effect.HEART, 0, 0, 0.8F, 0.4F, 0.8F, 0, 6, 30);
charge(p);
}
}
charge(p);
}
}
}

View File

@ -99,9 +99,20 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
UtilParticle.PlayParticle(ParticleType.BLOCK_CRACK.getParticle(Material.PACKED_ICE, 0), loc, 0.3F, 0.3F, 0.3F, 0, 12);
loc.getWorld().playSound(loc, Sound.GLASS, 1.2F, 1);
if (loc.getBlock().getType() == Material.FIRE)
for (int x = -1; x <= 1; x++)
{
loc.getBlock().setType(Material.AIR);
for (int y = -1; y <= 1; y++)
{
for (int z = -1; z <= 1; z++)
{
Block block = loc.clone().add(x, y, z).getBlock();
if (block.getType() == Material.FIRE)
{
block.setType(Material.AIR);
}
}
}
}
_lastParticles.remove(data.GetThrown());
@ -119,7 +130,7 @@ public class SpellIceShards extends Spell implements SpellClick, IThrown
{
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);
UtilParticle.PlayParticle(ParticleType.BLOCK_CRACK.getParticle(Material.PACKED_ICE, 0), loc, 0, 0, 0, 0, 1);
}
_lastParticles.put(entity, entity.getLocation());

View File

@ -1,7 +1,6 @@
package nautilus.game.arcade.game.games.wizards.spells;
import java.util.ArrayList;
import java.util.List;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
@ -22,6 +21,7 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
public class SpellLightningStrike extends Spell implements SpellClick
{
@ -29,78 +29,95 @@ public class SpellLightningStrike extends Spell implements SpellClick
@Override
public void castSpell(final Player p)
{
List<Block> list = p.getLastTwoTargetBlocks(UtilBlock.blockAirFoliageSet, 150);
if (list.size() > 1)
double curRange = 0;
while (curRange <= 150)
{
final Location loc = list.get(0).getLocation().add(0.5, 0, 0.5);
Location newTarget = p.getEyeLocation().add(new Vector(0, 0.2, 0))
.add(p.getLocation().getDirection().multiply(curRange));
while (UtilBlock.solid(loc.getBlock().getRelative(BlockFace.UP)))
if (!UtilBlock.airFoliage(newTarget.getBlock())
|| !UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))
break;
// Progress Forwards
curRange += 0.2;
}
if (curRange < 2)
{
return;
}
// Destination
final Location loc = p.getLocation().add(p.getLocation().getDirection().multiply(curRange).add(new Vector(0, 0.4, 0)));
while (UtilBlock.solid(loc.getBlock().getRelative(BlockFace.UP)))
{
loc.add(0, 1, 0);
}
UtilParticle.PlayParticle(ParticleType.ANGRY_VILLAGER, loc.clone().add(0, 1.3, 0), 0.5F, 0.3F, 0.5F, 0, 7);
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
@Override
public void run()
{
loc.add(0, 1, 0);
}
LightningStrike lightning = p.getWorld().strikeLightning(loc);
UtilParticle.PlayParticle(ParticleType.ANGRY_VILLAGER, loc.clone().add(0, 1.3, 0), 0.5F, 0.3F, 0.5F, 0, 7);
lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
Bukkit.getScheduler().scheduleSyncDelayedTask(Wizards.getArcadeManager().getPlugin(), new Runnable()
{
Block b = loc.getWorld().getHighestBlockAt(loc);
@Override
public void run()
b = b.getRelative(BlockFace.DOWN);
ArrayList<Block> toExplode = new ArrayList<Block>();
ArrayList<Block> toFire = new ArrayList<Block>();
for (int x = -1; x <= 1; x++)
{
LightningStrike lightning = p.getWorld().strikeLightning(loc);
lightning.setMetadata("Damager", new FixedMetadataValue(Wizards.getArcadeManager().getPlugin(), p));
Block b = loc.getWorld().getHighestBlockAt(loc);
b = b.getRelative(BlockFace.DOWN);
ArrayList<Block> toExplode = new ArrayList<Block>();
ArrayList<Block> toFire = new ArrayList<Block>();
for (int x = -1; x <= 1; x++)
for (int y = -1; y <= 1; y++)
{
for (int y = -1; y <= 1; y++)
for (int z = -1; z <= 1; z++)
{
for (int z = -1; z <= 1; z++)
if (x == 0 || (Math.abs(x) != Math.abs(z) || UtilMath.r(3) == 0))
{
if (x == 0 || (Math.abs(x) != Math.abs(z) || UtilMath.r(3) == 0))
{
Block block = b.getRelative(x, y, z);
Block block = b.getRelative(x, y, z);
if ((y == 0 || (x == 0 && z == 0)) && block.getType() != Material.AIR
&& block.getType() != Material.BEDROCK)
{
if (y == 0 || UtilMath.random.nextBoolean())
{
toExplode.add(block);
toFire.add(block);
}
}
else if (block.getType() == Material.AIR)
if ((y == 0 || (x == 0 && z == 0)) && block.getType() != Material.AIR
&& block.getType() != Material.BEDROCK)
{
if (y == 0 || UtilMath.random.nextBoolean())
{
toExplode.add(block);
toFire.add(block);
}
}
else if (block.getType() == Material.AIR)
{
toFire.add(block);
}
}
}
}
Wizards.getArcadeManager().GetExplosion().BlockExplosion(toExplode, b.getLocation(), false);
for (Block block : toFire)
{
if (UtilMath.random.nextBoolean())
{
block.setType(Material.FIRE);
}
}
}
}, 20);
Wizards.getArcadeManager().GetExplosion().BlockExplosion(toExplode, b.getLocation(), false);
charge(p);
}
for (Block block : toFire)
{
if (UtilMath.random.nextBoolean())
{
block.setType(Material.FIRE);
}
}
}
}, 20);
charge(p);
}
@EventHandler

View File

@ -20,7 +20,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
public class SpellMagicMissile extends Spell implements SpellClick
public class SpellManaBolt extends Spell implements SpellClick
{
public void castSpell(final Player player)
@ -60,7 +60,7 @@ public class SpellMagicMissile extends Spell implements SpellClick
if (entity != player && (!(entity instanceof Player) || Wizards.IsAlive(entity)))
{
Wizards.Manager.GetDamage().NewDamageEvent(entity, player, null, DamageCause.MAGIC, damage, true,
true, false, "Magic Missile", "Magic Missile");
true, false, "Mana Bolt", "Mana Bolt");
}
}
}

View File

@ -39,6 +39,8 @@ public class SpellNapalm extends Spell implements SpellClick
_glazedBlocks.put(Material.SMOOTH_BRICK, Material.NETHER_BRICK);
_glazedBlocks.put(Material.LOG, Material.NETHERRACK);
_glazedBlocks.put(Material.LOG_2, Material.NETHERRACK);
_glazedBlocks.put(Material.SMOOTH_BRICK, Material.COBBLESTONE);
_glazedBlocks.put(Material.CLAY, Material.STAINED_CLAY);
}
@Override
@ -55,6 +57,7 @@ public class SpellNapalm extends Spell implements SpellClick
{
ArrayList<Block> litOnFire = new ArrayList<Block>();
HashMap<Block, Double> tempIgnore = new HashMap<Block, Double>();
double blocksTravelled;
double size = 1;
double lastTick;
@ -160,6 +163,15 @@ public class SpellNapalm extends Spell implements SpellClick
double heat = bSize - UtilMath.offset(block.getLocation().add(0.5, 0.5, 0.5), napalmLoc);
if (tempIgnore.containsKey(block))
{
if (tempIgnore.remove(block) > heat)
{
litOnFire.add(block);
continue;
}
}
if (heat > 0)
{
if (block.getType() != Material.AIR)
@ -167,12 +179,6 @@ public class SpellNapalm extends Spell implements SpellClick
float strength = net.minecraft.server.v1_7_R4.Block.getById(block.getTypeId()).a(
(net.minecraft.server.v1_7_R4.Entity) null) * 0.7F;
if (strength * 2 > size)
{
litOnFire.add(block);
continue;
}
if (strength <= heat)
{
block.setType(Material.AIR);
@ -180,16 +186,26 @@ public class SpellNapalm extends Spell implements SpellClick
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F,
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
}
else if (strength / 10 <= heat)
else if (0.2 <= heat)
{
if (_glazedBlocks.containsKey(block.getType()))
{
block.setType(_glazedBlocks.get(block.getType()));
if (block.getType() == Material.STAINED_CLAY)
{
block.setData((byte) 8);
}
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F,
0.6F + ((new Random().nextFloat() - 0.5F) / 3F));
}
}
else if (strength * 2 > size)
{
tempIgnore.put(block, heat);
continue;
}
}
if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER)
@ -199,10 +215,11 @@ public class SpellNapalm extends Spell implements SpellClick
block.setType(Material.AIR);
block.getWorld().playSound(block.getLocation(), Sound.FIZZ, 1.3F, 0);
litOnFire.add(block);
}
}
if (block.getType() == Material.AIR)
else if (block.getType() == Material.AIR)
{
if (UtilMath.random.nextBoolean())
{
@ -236,7 +253,7 @@ public class SpellNapalm extends Spell implements SpellClick
if (lastTick++ % 8 == 0)
{
napalmLoc.getWorld().playSound(napalmLoc, Sound.CAT_HISS, (float) Math.min(2.2, size * 0.4), 0F);
napalmLoc.getWorld().playSound(napalmLoc, Sound.CAT_HISS, Math.min(0.8F + (float) (size * 0.09F), 1.8f), 0F);
}
if (blocksTravelled >= length)

View File

@ -35,7 +35,7 @@ public class SpellRainbowBeam extends Spell implements SpellClick
p.getEyeLocation().getDirection().normalize()
.multiply(0.3 + p.getEyeLocation().distance(((LivingEntity) entityTarget).getEyeLocation())));
double damage = (getSpellLevel(p) * 2) + 5;
double damage = (getSpellLevel(p) * 2) + 4;
double dist = loc.distance(p.getLocation()) - (80 * .2D);
// If target is more than 20% away

View File

@ -98,7 +98,6 @@ public class SpellRainbowRoad extends Spell implements SpellClick
private int makeRoad(Location loc, BlockFace face, int colorProgress)
{
Block block = loc.getBlock();
BlockFace[] faces = UtilShapes.getSideBlockFaces(face);
@ -118,6 +117,11 @@ public class SpellRainbowRoad extends Spell implements SpellClick
for (Block b : bs)
{
if (!Wizards.isInsideMap(b.getLocation()))
{
continue;
}
if (!_wallExpires.containsKey(block) && UtilBlock.solid(b))
{
continue;

View File

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

View File

@ -6,7 +6,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;