Meteors now explode everything on contact. Added spellbook for spectators and pregame. Mana cost now obvious when cooling down. Lowered some random item amounts
This commit is contained in:
parent
b4b8b307b0
commit
76e6b7530f
@ -41,6 +41,8 @@ public class CustomExplosion extends Explosion
|
||||
private DamageManager _manager;
|
||||
private String _damageReason;
|
||||
private boolean _dropItems = true;
|
||||
private boolean _damageBlocksEqually;
|
||||
private boolean _createFire;
|
||||
|
||||
public CustomExplosion(DamageManager manager, Location loc, float explosionSize, String deathCause)
|
||||
{
|
||||
@ -50,6 +52,12 @@ public class CustomExplosion extends Explosion
|
||||
_damageReason = deathCause;
|
||||
}
|
||||
|
||||
public CustomExplosion setBlocksDamagedEqually(boolean damageEqually)
|
||||
{
|
||||
_damageBlocksEqually = damageEqually;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CustomExplosion explode()
|
||||
{
|
||||
// Explode the explosion
|
||||
@ -116,8 +124,8 @@ public class CustomExplosion extends Explosion
|
||||
|
||||
if (block.getMaterial() != Material.AIR)
|
||||
{
|
||||
float f3 = this.source != null ? this.source.a(this, this._world, l, i1, j1, block) : block
|
||||
.a(this.source);
|
||||
float f3 = this.source != null ? this.source.a(this, this._world, l, i1, j1, block)
|
||||
: (_damageBlocksEqually ? Blocks.DIRT : block).a(this.source);
|
||||
|
||||
f1 -= (f3 + 0.3F) * f2;
|
||||
}
|
||||
@ -295,7 +303,7 @@ public class CustomExplosion extends Explosion
|
||||
}
|
||||
}
|
||||
|
||||
if (this.a)
|
||||
if (this._createFire)
|
||||
{
|
||||
Iterator iterator = this.blocks.iterator();
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
|
||||
if (usedNumbers.contains(i % 9) && spell != null)
|
||||
{
|
||||
|
||||
int spellLevel = wizard.getSpellLevel(spell);
|
||||
int spellLevel = wizard == null ? 1 : wizard.getSpellLevel(spell);
|
||||
|
||||
if (spellLevel > 0)
|
||||
{
|
||||
@ -65,8 +65,10 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
|
||||
builder.setTitle(spell.getElement().getColor() + spell.getSpellName());
|
||||
builder.addLore("");
|
||||
builder.addLore(C.cBlue + C.Bold + "Spell Level: " + C.cWhite + spellLevel);
|
||||
builder.addLore(C.cBlue + C.Bold + "Mana Cost: " + C.cWhite + spell.getManaCost(wizard));
|
||||
builder.addLore(C.cBlue + C.Bold + "Cooldown: " + C.cWhite + spell.getSpellCooldown(wizard) + " seconds");
|
||||
builder.addLore(C.cBlue + C.Bold + "Mana Cost: " + C.cWhite
|
||||
+ (wizard == null ? spell.getBaseManaCost() : spell.getManaCost(wizard)));
|
||||
builder.addLore(C.cBlue + C.Bold + "Cooldown: " + C.cWhite
|
||||
+ (wizard == null ? spell.getBaseCooldown() : spell.getSpellCooldown(wizard)) + " seconds");
|
||||
builder.addLore("");
|
||||
|
||||
for (String lore : spell.getDesc())
|
||||
@ -74,8 +76,15 @@ public class SpellMenuPage extends ShopPageBase<WizardSpellMenu, WizardSpellMenu
|
||||
builder.addLore(C.cGray + lore, 35);
|
||||
}
|
||||
|
||||
AddButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton(this,
|
||||
spell));
|
||||
if (wizard == null)
|
||||
{
|
||||
AddItem(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton(i, new ShopItem(builder.build(), spell.name(), spell.name(), 1, true, true), new SpellButton(
|
||||
this, spell));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -644,6 +644,14 @@ public enum SpellType // ❤
|
||||
return _itemAmount;
|
||||
}
|
||||
|
||||
public int getBaseManaCost() {
|
||||
return _spellCost;
|
||||
}
|
||||
|
||||
public int getBaseCooldown() {
|
||||
return _spellCooldown;
|
||||
}
|
||||
|
||||
public int getManaCost(Wizard wizard)
|
||||
{
|
||||
return Math.max(0,
|
||||
|
@ -1,12 +1,19 @@
|
||||
package nautilus.game.arcade.game.games.wizards;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
@ -15,6 +22,8 @@ public class WizardSpellMenu extends MiniPlugin
|
||||
{
|
||||
private Wizards _wizards;
|
||||
private WizardSpellMenuShop _wizardShop;
|
||||
private ItemStack _wizardSpells = new ItemBuilder(Material.ENCHANTED_BOOK).setTitle(C.cGold + "Wizard Spells")
|
||||
.addLore(C.cGray + "Right click with this to view the spells").build();
|
||||
|
||||
public WizardSpellMenu(String moduleName, JavaPlugin plugin, Wizards wizards)
|
||||
{
|
||||
@ -25,10 +34,59 @@ public class WizardSpellMenu extends MiniPlugin
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
public void onJoin(PlayerJoinEvent event)
|
||||
{
|
||||
|
||||
if (_wizards.GetState() == GameState.Live && _wizards.IsAlive(event.getPlayer()))
|
||||
if (_wizards.GetState() == GameState.Recruit || _wizards.GetState() == GameState.Live)
|
||||
{
|
||||
event.getPlayer().getInventory().addItem(_wizardSpells);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(final PlayerDeathEvent event)
|
||||
{
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (_wizards.IsLive())
|
||||
{
|
||||
event.getEntity().getInventory().addItem(_wizardSpells);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(GameStateChangeEvent event)
|
||||
{
|
||||
|
||||
if (event.GetState() == GameState.Recruit)
|
||||
{
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
player.getInventory().addItem(_wizardSpells);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.getAction() != Action.PHYSICAL && (!_wizards.IsLive() || !_wizards.IsAlive(event.getPlayer())))
|
||||
{
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
|
||||
if (item != null && item.isSimilar(_wizardSpells))
|
||||
{
|
||||
|
||||
_wizardShop.attemptShopOpen(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
if (_wizards.IsLive() && _wizards.IsAlive(event.getPlayer()))
|
||||
{
|
||||
|
||||
ItemStack item = event.getItem();
|
||||
|
@ -335,11 +335,11 @@ public class Wizards extends SoloGame
|
||||
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(5, Material.CHAINMAIL_BOOTS, 0, 1, 1);
|
||||
addRandomItem(5, Material.CHAINMAIL_CHESTPLATE, 0, 1, 1);
|
||||
addRandomItem(5, Material.CHAINMAIL_HELMET, 0, 1, 1);
|
||||
addRandomItem(5, Material.CHAINMAIL_LEGGINGS, 0, 1, 1);
|
||||
addRandomItem(5, Material.FISHING_ROD, 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.PORK, 0, 1, 2);
|
||||
@ -353,12 +353,12 @@ public class Wizards extends SoloGame
|
||||
addRandomItem(5, Material.PUMPKIN_PIE, 0, 1, 2);
|
||||
addRandomItem(5, Material.APPLE, 0, 1, 2);
|
||||
addRandomItem(5, Material.IRON_INGOT, 0, 1, 2);
|
||||
addRandomItem(5, Material.DIAMOND, 0, 1, 1);
|
||||
addRandomItem(2, Material.DIAMOND, 0, 1, 1);
|
||||
addRandomItem(5, Material.EXP_BOTTLE, 0, 1, 2);
|
||||
addRandomItem(5, Material.IRON_BOOTS, 0, 1, 1);
|
||||
addRandomItem(5, Material.IRON_CHESTPLATE, 0, 1, 1);
|
||||
addRandomItem(5, Material.IRON_HELMET, 0, 1, 1);
|
||||
addRandomItem(5, Material.IRON_LEGGINGS, 0, 1, 1);
|
||||
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);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -427,12 +427,23 @@ public class Wizards extends SoloGame
|
||||
if (usableTime > 0)
|
||||
{
|
||||
|
||||
usableTime = UtilMath.trim(1, usableTime);
|
||||
|
||||
double maxSeconds = Math.max(type.getSpellCooldown(wizard),
|
||||
type.getManaCost(wizard) / (wizard.getManaPerTick() * 20));
|
||||
|
||||
displayProgress(displayCooldown ? C.cRed : C.cBlue, type.getElement().getColor() + type.getSpellName(),
|
||||
1f - (usableTime / maxSeconds),
|
||||
UtilTime.convertString((long) (usableTime * 1000), 1, TimeUnit.FIT), player);
|
||||
displayProgress(displayCooldown ? C.cRed : C.cDPurple,
|
||||
type.getElement().getColor() + type.getSpellName(), 1f - (usableTime / maxSeconds),
|
||||
|
||||
(displayCooldown ?
|
||||
|
||||
UtilTime.convertString((long) (usableTime * 1000), 1, TimeUnit.FIT)
|
||||
|
||||
:
|
||||
|
||||
usableTime + (usableTime < 60 ? "s" : "m") + " for mana"),
|
||||
|
||||
player);
|
||||
|
||||
}
|
||||
else
|
||||
@ -458,7 +469,7 @@ public class Wizards extends SoloGame
|
||||
{
|
||||
if (!colorChange && (float) i / (float) bars >= amount)
|
||||
{
|
||||
progressBar +=progressBar;// C.cRed;
|
||||
progressBar += progressColor;// C.cRed;
|
||||
colorChange = true;
|
||||
}
|
||||
|
||||
@ -689,8 +700,6 @@ public class Wizards extends SoloGame
|
||||
public void onChat(PlayerChatEvent event)
|
||||
{
|
||||
if (Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.DEVELOPER))
|
||||
{
|
||||
if (event.getPlayer().getName().equalsIgnoreCase("libraryaddict"))
|
||||
{
|
||||
if (event.getMessage().equalsIgnoreCase("spells"))
|
||||
{
|
||||
@ -706,6 +715,12 @@ public class Wizards extends SoloGame
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().sendMessage("All spells leveled up once");
|
||||
}
|
||||
|
||||
if (event.getMessage().equalsIgnoreCase("overtime"))
|
||||
{
|
||||
setGameLiveTime(System.currentTimeMillis() - (10 * 60 * 1000));
|
||||
}
|
||||
|
||||
if (event.getMessage().equalsIgnoreCase("hit me"))
|
||||
{
|
||||
summonMeteor(event.getPlayer());
|
||||
@ -719,11 +734,7 @@ public class Wizards extends SoloGame
|
||||
if (event.getMessage().equalsIgnoreCase("end game"))
|
||||
{
|
||||
sendMeteors();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event.getPlayer().sendMessage("Nuh uh");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1336,6 +1347,8 @@ public class Wizards extends SoloGame
|
||||
|
||||
explosion.setDropItems(false);
|
||||
|
||||
explosion.setBlocksDamagedEqually(true);
|
||||
|
||||
explosion.explode();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user