Modifications for SnD test

This commit is contained in:
libraryaddict 2014-12-03 23:32:18 +13:00
parent 2e7d101850
commit 6d7a71d043
14 changed files with 270 additions and 88 deletions

View File

@ -41,6 +41,11 @@ public class UtilInv
itemStack.addEnchantment(_enchantment, 1); itemStack.addEnchantment(_enchantment, 1);
} }
public static void removeDullEnchantment(ItemStack itemStack)
{
itemStack.removeEnchantment(_enchantment);
}
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static boolean insert(Player player, ItemStack stack) public static boolean insert(Player player, ItemStack stack)
{ {

View File

@ -9,11 +9,12 @@ import org.bukkit.ChatColor;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event; import org.bukkit.event.Event;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class CustomDamageEvent extends Event public class CustomDamageEvent extends Event implements Cancellable
{ {
private static final HandlerList handlers = new HandlerList(); private static final HandlerList handlers = new HandlerList();
@ -269,4 +270,22 @@ public class CustomDamageEvent extends Event
{ {
return _damageToLevel; return _damageToLevel;
} }
@Override
public boolean isCancelled()
{
return IsCancelled();
}
@Override
@Deprecated
/**
* Don't call this method. Use SetCancelled(String) instead.
*
* You will be made the butt of jokes if you use this method.
*/
public void setCancelled(boolean isCancelled)
{
SetCancelled("No reason given because SOMEONE IS AN IDIOT");
}
} }

View File

@ -8,12 +8,12 @@ import org.bukkit.entity.Player;
public class EvolveButton extends SingleButton public class EvolveButton extends SingleButton
{ {
private SearchAndDestroy _arcadeManager; private SearchAndDestroy _search;
private Kit _kit; private Kit _kit;
public EvolveButton(SearchAndDestroy arcadeManager, Kit kit) public EvolveButton(SearchAndDestroy arcadeManager, Kit kit)
{ {
_arcadeManager = arcadeManager; _search = arcadeManager;
_kit = kit; _kit = kit;
} }
@ -24,7 +24,8 @@ public class EvolveButton extends SingleButton
if (((CraftPlayer) player).getHandle().spectating) if (((CraftPlayer) player).getHandle().spectating)
return; return;
_arcadeManager.SetKit(player, _kit, true); _search.SetKit(player, _kit, true);
_search.onEvolve(player);
player.closeInventory(); player.closeInventory();
} }
} }

View File

@ -6,8 +6,11 @@ import mineplex.core.MiniPlugin;
import nautilus.game.arcade.game.Game.GameState; import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.searchanddestroy.KitManager.UpgradeKit; import nautilus.game.arcade.game.games.searchanddestroy.KitManager.UpgradeKit;
import org.bukkit.Material;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerChatEvent; import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class KitEvolve extends MiniPlugin public class KitEvolve extends MiniPlugin
@ -26,11 +29,15 @@ public class KitEvolve extends MiniPlugin
} }
@EventHandler @EventHandler
public void onInteract(PlayerChatEvent event) public void onInteract(PlayerInteractEvent event)
{ {
if (_arcadeManager.GetState() == GameState.Live) if (_arcadeManager.GetState() == GameState.Live && event.getAction().name().contains("RIGHT"))
{ {
_kitEvolve.attemptShopOpen(event.getPlayer()); ItemStack item = event.getItem();
if (item != null && item.getType() == Material.BOOK)
{
_kitEvolve.attemptShopOpen(event.getPlayer());
}
} }
} }

View File

@ -42,7 +42,7 @@ public class KitEvolvePage extends ShopPageBase<KitEvolve, KitEvolveShop>
break; break;
} }
} }
boolean canEvolve = true; boolean canEvolve = _search.canEvolve(Player);
AddItem(kit.kitSlot, makeItem(kit.kit)); AddItem(kit.kitSlot, makeItem(kit.kit));
for (int slot : kit.path) for (int slot : kit.path)
{ {

View File

@ -68,7 +68,7 @@ public class KitManager
UpgradeKit sword1 = new UpgradeKit(null, new KitTrooper(man), children1, 4); UpgradeKit sword1 = new UpgradeKit(null, new KitTrooper(man), children1, 4);
_kits.add(sword1); _kits.add(sword1);
UpgradeKit sword2 = new UpgradeKit(sword1, new KitTrooper(man), children2, 20, 12); UpgradeKit sword2 = new UpgradeKit(sword1, new KitAssault(man), children2, 20, 12);
_kits.add(sword2); _kits.add(sword2);
UpgradeKit sword3 = new UpgradeKit(sword1, new KitTrooper(man), children3, 24, 14); UpgradeKit sword3 = new UpgradeKit(sword1, new KitTrooper(man), children3, 24, 14);
_kits.add(sword3); _kits.add(sword3);

View File

@ -2,14 +2,18 @@ package nautilus.game.arcade.game.games.searchanddestroy;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo; import mineplex.core.packethandler.PacketInfo;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
@ -32,17 +36,21 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.TNTPrimed;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerChatEvent;
import org.bukkit.event.player.PlayerInteractEntityEvent; import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
public class SearchAndDestroy extends TeamGame public class SearchAndDestroy extends TeamGame
{ {
private KitEvolve _evolve; private KitEvolve _evolve;
private HashMap<String, Integer> _kills = new HashMap<String, Integer>();
private KitManager _kitManager = new KitManager(this); private KitManager _kitManager = new KitManager(this);
private IPacketHandler _teamBombPackets = new IPacketHandler() private IPacketHandler _teamBombPackets = new IPacketHandler()
{ {
@ -90,7 +98,9 @@ public class SearchAndDestroy extends TeamGame
{ {
"A test game of", "Search and Destroy" "A test game of", "Search and Destroy"
}); });
setKits(_kitManager.get_kits()); setKits(_kitManager.get_kits());
_evolve = new KitEvolve(manager.GetPlugin(), this, _kitManager.getUpgradeKits()); _evolve = new KitEvolve(manager.GetPlugin(), this, _kitManager.getUpgradeKits());
InventoryClick = true; InventoryClick = true;
WorldTimeSet = -1; WorldTimeSet = -1;
@ -100,6 +110,7 @@ public class SearchAndDestroy extends TeamGame
AnnounceJoinQuit = false; AnnounceJoinQuit = false;
DisableKillCommand = false; DisableKillCommand = false;
AllowParticles = false; AllowParticles = false;
DamageSelf = false;
} }
public ArrayList<TeamBomb> getBombs() public ArrayList<TeamBomb> getBombs()
@ -107,6 +118,16 @@ public class SearchAndDestroy extends TeamGame
return _teamBombs; return _teamBombs;
} }
public boolean canEvolve(Player player)
{
return _kills.containsKey(player.getName()) && _kills.get(player.getName()) >= 2;
}
public void onEvolve(Player player)
{
_kills.put(player.getName(), _kills.get(player.getName()) - 2);
}
@EventHandler @EventHandler
public void onBombsPacketListener(GameStateChangeEvent event) public void onBombsPacketListener(GameStateChangeEvent event)
{ {
@ -178,17 +199,17 @@ public class SearchAndDestroy extends TeamGame
} }
} }
// TODO The code below may need changing // TODO The code below may need changing
if (getBombs().size() == 1) /* if (getBombs().size() == 1)
{ {
GameTeam winning = getBombs().get(0).getTeam(); GameTeam winning = getBombs().get(0).getTeam();
Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.GetName() + " Team's" + ChatColor.RESET Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.GetName() + " Team's" + ChatColor.RESET
+ ChatColor.GOLD + " bomb exploded! " + winning.GetColor() + winning.GetName() + ChatColor.GOLD + " bomb exploded! " + winning.GetColor() + winning.GetName()
+ ChatColor.RESET + ChatColor.GOLD + " wins!"); + ChatColor.RESET + ChatColor.GOLD + " wins!");
} }
else else
{ {
Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.GetName() + " Team was defeated!"); Bukkit.broadcastMessage(bombOwner.GetColor() + bombOwner.GetName() + " Team was defeated!");
} }*/
} }
if (timeLeft > 0) if (timeLeft > 0)
{ {
@ -239,6 +260,130 @@ public class SearchAndDestroy extends TeamGame
} }
} }
@EventHandler
public void onGameState(GameStateChangeEvent event)
{
if (event.GetState() == GameState.Dead || event.GetState() == GameState.Live || event.GetState() == GameState.Prepare)
{
drawScoreboard();
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onDeath(CombatDeathEvent event)
{
if (GetState() != GameState.Live)
{
return;
}
if (event.GetLog().GetKiller() == null)
return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null)
return;
this._kills.put(player.getName(), (_kills.containsKey(player.getName()) ? _kills.get(player.getName()) : 0) + 1);
}
private boolean _flickerOn;
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
for (Player player : this.GetPlayers(true))
{
if (canEvolve(player))
{
int slot = player.getInventory().first(Material.BOOK);
if (slot >= 0)
{
ItemStack item = player.getInventory().getItem(slot);
String message = C.Bold + "Ready to evolve kits!";
_flickerOn = !_flickerOn;
if (_flickerOn)
{
UtilInv.addDullEnchantment(item);
message = C.cDGreen + message;
}
else
{
UtilInv.removeDullEnchantment(item);
message = C.cBlue + message;
}
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(message);
item.setItemMeta(meta);
}
}
}
}
private void drawScoreboard()
{
GetScoreboard().Reset();
ArrayList<GameTeam> aliveTeams = new ArrayList<GameTeam>();
for (GameTeam team : GetTeamList())
{
if (team.IsTeamAlive())
{
aliveTeams.add(team);
}
}
Iterator<GameTeam> itel = aliveTeams.iterator();
ArrayList<TeamBomb> bombs = new ArrayList<TeamBomb>(this._teamBombs);
while (itel.hasNext())
{
GameTeam team = itel.next();
if (!team.IsTeamAlive())
continue;
GetScoreboard().Write(team.GetColor() + C.Bold + team.GetName() + " Team");
GetScoreboard().Write(team.GetPlayers(true).size() + " alive");
// TODO Check bombs armed. Draw.
// Something about max scoreboard size.. So its 3 plus 3-4 for bombs.
// Max scoreboard of 15? So 2-3 teams it shows bombs. Else.
// Could also shrink scoreboard even more if too many teams.
if (itel.hasNext())
{
GetScoreboard().WriteBlank();
}
}
GetScoreboard().Draw();
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST || this.GetState() != GameState.Live)
{
return;
}
drawScoreboard();
}
@EventHandler
public void onChat(PlayerChatEvent event)
{
_kills.put(event.getPlayer().getName(), Integer.parseInt(event.getMessage()));
}
@EventHandler @EventHandler
public void onGameEnd(GameStateChangeEvent event) public void onGameEnd(GameStateChangeEvent event)
{ {

View File

@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.searchanddestroy.kits.bow;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman; import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
@ -28,24 +27,25 @@ public class KitPinner extends KitHuman
"Your arrows enchanted with gravity magic.", "Victims find it hard to lift", "Their bodies are sluggish" "Your arrows enchanted with gravity magic.", "Victims find it hard to lift", "Their bodies are sluggish"
}, new Perk[] }, new Perk[]
{ {
new PerkQuickshot("Quickshot", 2, 8000), new PerkQuickshot("Quickshot", 2, 8000), new PerkPinned()
new PerkPinned() }, EntityType.SKELETON, new ItemStack(Material.OBSIDIAN));
},
EntityType.SKELETON, new ItemStack(Material.OBSIDIAN));
} }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
PlayerInventory inv = player.getInventory(); PlayerInventory inv = player.getInventory();
inv.setItem(4, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); inv.setArmorContents(new ItemStack[]
inv.addItem(new ItemBuilder(Material.BOW).setTitle(C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Quickshot").setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); {
new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET)
});
inv.addItem(new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build());
inv.addItem(new ItemBuilder(Material.BOW).setTitle(C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Quickshot")
.setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
inv.setItem(8, new ItemBuilder(Material.BOOK).setTitle(ChatColor.WHITE + "Evolve kit").addLore("Right click to use")
.build());
inv.setItem(9, new ItemStack(Material.ARROW, 1)); inv.setItem(9, new ItemStack(Material.ARROW, 1));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
} }
} }

View File

@ -42,14 +42,16 @@ public class KitPunch extends KitHuman
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
PlayerInventory inv = player.getInventory(); PlayerInventory inv = player.getInventory();
inv.setItem(4, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); inv.setArmorContents(new ItemStack[]
{
new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET)
});
inv.addItem(new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build());
inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
inv.setItem(8, new ItemBuilder(Material.BOOK).setTitle(ChatColor.WHITE + "Evolve kit").addLore("Right click to use")
.build());
inv.setItem(9, new ItemStack(Material.ARROW, 1)); inv.setItem(9, new ItemStack(Material.ARROW, 1));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
} }
} }

View File

@ -27,24 +27,24 @@ public class KitSharpshooter extends KitHuman
"Max of +6. Missing an arrow resets the count to 0." "Max of +6. Missing an arrow resets the count to 0."
}, new Perk[] }, new Perk[]
{ {
new PerkKnockbackArrow(2.5D), new PerkKnockbackArrow(2.5D), new PerkSharpshooter()
new PerkSharpshooter() }, EntityType.SKELETON, new ItemStack(Material.FLINT));
},
EntityType.SKELETON, new ItemStack(Material.FLINT));
} }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
PlayerInventory inv = player.getInventory(); PlayerInventory inv = player.getInventory();
inv.setItem(4, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); inv.setArmorContents(new ItemStack[]
{
new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET)
});
inv.addItem(new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build());
inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
inv.setItem(8, new ItemBuilder(Material.BOOK).setTitle(ChatColor.WHITE + "Evolve kit").addLore("Right click to use")
.build());
inv.setItem(9, new ItemStack(Material.ARROW, 1)); inv.setItem(9, new ItemStack(Material.ARROW, 1));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
}
}
} }

View File

@ -36,24 +36,25 @@ public class KitSniper extends KitHuman
"Arrows do 0.1 damage per block travelled.", "Shoot from afar to score major damage!" "Arrows do 0.1 damage per block travelled.", "Shoot from afar to score major damage!"
}, new Perk[] }, new Perk[]
{ {
new PerkKnockbackArrow(2.5D), new PerkKnockbackArrow(2.5D), new PerkSniper()
new PerkSniper() }, EntityType.SKELETON, new ItemStack(Material.ARROW));
},
EntityType.SKELETON, new ItemStack(Material.ARROW));
} }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
PlayerInventory inv = player.getInventory(); PlayerInventory inv = player.getInventory();
inv.setItem(4, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); inv.setArmorContents(new ItemStack[]
{
new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET)
});
inv.addItem(new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build());
inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
inv.setItem(8, new ItemBuilder(Material.BOOK).setTitle(ChatColor.WHITE + "Evolve kit").addLore("Right click to use")
.build());
inv.setItem(9, new ItemStack(Material.ARROW, 1)); inv.setItem(9, new ItemStack(Material.ARROW, 1));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
} }
} }

View File

@ -26,27 +26,28 @@ public class KitThunderstorm extends KitHuman
{ {
"Chargeup your bow to release a barrage of arrows." + "The longer you charge your bow" "Chargeup your bow to release a barrage of arrows." + "The longer you charge your bow"
+ "The more arrows are added to the barrage." + "The more arrows are added to the barrage."
} }, new Perk[]
, new Perk[]
{ {
new PerkQuickshot("Quickshot", 2, 8000), new PerkQuickshot("Quickshot", 2, 8000), new PerkBarrage(10, 400, false, false, true)
new PerkBarrage(10, 400, false, false, true) }, EntityType.SKELETON, new ItemStack(Material.ARROW, 16));
},
EntityType.SKELETON, new ItemStack(Material.ARROW, 16));
} }
@Override @Override
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
PlayerInventory inv = player.getInventory(); PlayerInventory inv = player.getInventory();
inv.setItem(4, new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build()); inv.addItem(new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build());
inv.addItem(new ItemBuilder(Material.BOW).setTitle(C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Quickshot").setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build()); inv.addItem(new ItemBuilder(Material.BOW).setTitle(C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Quickshot")
.setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
inv.setArmorContents(new ItemStack[]
{
new ItemStack(Material.CHAINMAIL_BOOTS), new ItemStack(Material.CHAINMAIL_LEGGINGS),
new ItemStack(Material.CHAINMAIL_CHESTPLATE), new ItemStack(Material.CHAINMAIL_HELMET)
});
inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
inv.setItem(8, new ItemBuilder(Material.BOOK).setTitle(ChatColor.WHITE + "Evolve kit").addLore("Right click to use")
.build());
inv.setItem(9, new ItemStack(Material.ARROW, 1)); inv.setItem(9, new ItemStack(Material.ARROW, 1));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_BOOTS));
} }
} }

View File

@ -27,17 +27,17 @@ public class PerkPinned extends Perk
}); });
} }
private NautHashMap<LivingEntity, Integer> _secondsPinned = new NautHashMap<LivingEntity, Integer>(); private NautHashMap<LivingEntity, Integer> _ticksPinned = new NautHashMap<LivingEntity, Integer>();
@EventHandler @EventHandler
public void onSecond(UpdateEvent event) public void onSecond(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FASTER) if (event.getType() != UpdateType.FASTEST)
{ {
return; return;
} }
Iterator<LivingEntity> itel = _secondsPinned.keySet().iterator(); Iterator<LivingEntity> itel = _ticksPinned.keySet().iterator();
while (itel.hasNext()) while (itel.hasNext())
{ {
LivingEntity entity = itel.next(); LivingEntity entity = itel.next();
@ -46,14 +46,14 @@ public class PerkPinned extends Perk
itel.remove(); itel.remove();
continue; continue;
} }
entity.setVelocity(entity.getVelocity().add(new Vector(0, -1, 0))); entity.setVelocity(entity.getVelocity().add(new Vector(0, -0.2, 0)));
if (_secondsPinned.get(entity) <= 1) if (_ticksPinned.get(entity) <= 1)
{ {
itel.remove(); itel.remove();
} }
else else
{ {
_secondsPinned.put(entity, _secondsPinned.get(entity) - 1); _ticksPinned.put(entity, _ticksPinned.get(entity) - 1);
} }
} }
} }
@ -67,9 +67,9 @@ public class PerkPinned extends Perk
if (player != null && this.Kit.HasKit(player)) if (player != null && this.Kit.HasKit(player))
{ {
LivingEntity entity = event.GetDamageeEntity(); LivingEntity entity = event.GetDamageeEntity();
entity.setVelocity(entity.getVelocity().add(new Vector(0, -1, 0))); entity.setVelocity(entity.getVelocity().add(new Vector(0, -0.4, 0)));
entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, 1), true); entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, 1), true);
_secondsPinned.put(entity, 8); _ticksPinned.put(entity, 40);
} }
} }
} }

View File

@ -32,7 +32,7 @@ public class PerkRangedBleeding extends Perk
return; return;
} }
Iterator<LivingEntity> itel = _secondsBleeding.keySet().iterator(); Iterator<LivingEntity> itel = _timeBleeding.keySet().iterator();
while (itel.hasNext()) while (itel.hasNext())
{ {
LivingEntity entity = itel.next(); LivingEntity entity = itel.next();
@ -41,20 +41,21 @@ public class PerkRangedBleeding extends Perk
itel.remove(); itel.remove();
continue; continue;
} }
Manager.GetDamage().NewDamageEvent(entity, null, null, DamageCause.CUSTOM, 2, false, true, true, "Bleed", Manager.GetDamage().NewDamageEvent(entity, null, null, DamageCause.CUSTOM, 1, false, true, true, "Bleed",
"Stitcher Bleeding"); "Stitcher Bleeding");
if (_secondsBleeding.get(entity) <= 1) // TODO Bleed particles?
if (_timeBleeding.get(entity) <= 1)
{ {
itel.remove(); itel.remove();
} }
else else
{ {
_secondsBleeding.put(entity, _secondsBleeding.get(entity) - 1); _timeBleeding.put(entity, _timeBleeding.get(entity) - 1);
} }
} }
} }
private NautHashMap<LivingEntity, Integer> _secondsBleeding = new NautHashMap<LivingEntity, Integer>(); private NautHashMap<LivingEntity, Integer> _timeBleeding = new NautHashMap<LivingEntity, Integer>();
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onDamage(CustomDamageEvent event) public void onDamage(CustomDamageEvent event)
@ -65,13 +66,13 @@ public class PerkRangedBleeding extends Perk
if (player != null && Kit.HasKit(player)) if (player != null && Kit.HasKit(player))
{ {
LivingEntity entity = event.GetDamageeEntity(); LivingEntity entity = event.GetDamageeEntity();
if (!_secondsBleeding.containsKey(entity)) if (!_timeBleeding.containsKey(entity))
{ {
_secondsBleeding.put(entity, 4); _timeBleeding.put(entity, 4);
} }
else else
{ {
_secondsBleeding.put(entity, _secondsBleeding.get(entity) + 4); _timeBleeding.put(entity, _timeBleeding.get(entity) + 4);
} }
} }
} }