Wither Assault update

This commit is contained in:
Chiss 2014-11-15 19:31:56 +11:00
parent 2cf76ae5b4
commit ca4eec20ed
23 changed files with 726 additions and 162 deletions

View File

@ -188,5 +188,41 @@ public class UtilAlg
return cross(vec, getRight(vec)); return cross(vec, getRight(vec));
} }
public static Location getAverageLocation(ArrayList<Location> locs)
{
if (locs.isEmpty())
return null;
Vector vec = new Vector(0,0,0);
double amount = 0;
for (Location loc : locs)
{
vec.add(loc.toVector());
amount++;
}
vec.multiply(1d/amount);
return vec.toLocation(locs.get(0).getWorld());
}
public static Vector getAverageBump(Location source, ArrayList<Location> locs)
{
if (locs.isEmpty())
return null;
Vector vec = new Vector(0,0,0);
double amount = 0;
for (Location loc : locs)
{
vec.add(UtilAlg.getTrajectory(loc, source));
amount++;
}
vec.multiply(1d/amount);
return vec;
}
} }

View File

@ -25,19 +25,19 @@ public class MorphGeno extends MorphGadget
public MorphGeno(GadgetManager manager) public MorphGeno(GadgetManager manager)
{ {
super(manager, "Farewell Genocide604", new String[] super(manager, "Genocide604", new String[]
{ {
"Say goodbye to Genocide604 by burping", "Say goodbye to Genocide604 by burping",
"and eating a lot.", "and eating a lot.",
" ", " ",
C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Burp", C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Burp",
" ", " ",
C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "This is a temporary item!", C.cRed + C.Bold + "WARNING: " + ChatColor.RESET + "This is a temporary item!",
}, },
10, 10,
Material.SKULL_ITEM, (byte)3); Material.SKULL_ITEM, (byte)3);
_profile = new ProfileLoader(UUIDFetcher.getUUIDOf("SFox").toString(), "SFox").loadProfile(); _profile = new ProfileLoader(UUIDFetcher.getUUIDOf("Genocide604").toString(), "Genocide604").loadProfile();
} }
@Override @Override

View File

@ -123,7 +123,7 @@ public class Hub extends JavaPlugin implements IRelation
energy.setEnabled(false); energy.setEnabled(false);
ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress); ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress);
SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress); SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, disguiseManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress);
ClassManager classManager = new ClassManager(this, clientManager, donationManager, skillManager, itemFactory, webServerAddress); ClassManager classManager = new ClassManager(this, clientManager, donationManager, skillManager, itemFactory, webServerAddress);
ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory); ClassShopManager shopManager = new ClassShopManager(this, classManager, skillManager, itemFactory);

View File

@ -0,0 +1,185 @@
package mineplex.minecraft.game.classcombat.Skill.Assassin;
import java.util.HashMap;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.minecraft.game.classcombat.Skill.SkillActive;
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
public class Illusion extends SkillActive
{
private HashMap<Player, Skeleton> _active = new HashMap<Player, Skeleton>();
public Illusion(SkillFactory skills, String name, ClassType classType, SkillType skillType,
int cost, int levels,
int energy, int energyMod,
long recharge, long rechargeMod, boolean rechargeInform,
Material[] itemArray,
Action[] actionArray)
{
super(skills, name, classType, skillType,
cost, levels,
energy, energyMod,
recharge, rechargeMod, rechargeInform,
itemArray,
actionArray);
SetDesc(new String[]
{
"Block to go invisible, and create an",
"illusion of yourself that runs towards",
"your target location.",
"",
"Invisibility ends if you release Block",
"or your Illusion is killed.",
"",
"Lasts up to #2#2 seconds.",
});
}
@Override
public String GetEnergyString()
{
return "Energy: #30#-5 and #10#-2 per Second";
}
@Override
public boolean CustomCheck(Player player, int level)
{
if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9)
{
UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water."));
return false;
}
return true;
}
@Override
public void Skill(Player player, int level)
{
//Spawn
ClassCombatCreatureAllowSpawnEvent enableEvent = new ClassCombatCreatureAllowSpawnEvent(true);
UtilServer.getServer().getPluginManager().callEvent(enableEvent);
Skeleton skel = player.getWorld().spawn(player.getLocation(), Skeleton.class);
skel.teleport(player.getLocation());
UtilEnt.Vegetate(skel);
UtilEnt.silence(skel, true);
ClassCombatCreatureAllowSpawnEvent disableEvent = new ClassCombatCreatureAllowSpawnEvent(false);
UtilServer.getServer().getPluginManager().callEvent(disableEvent);
skel.getEquipment().setHelmet(player.getInventory().getHelmet());
skel.getEquipment().setChestplate(player.getInventory().getChestplate());
skel.getEquipment().setLeggings(player.getInventory().getLeggings());
skel.getEquipment().setBoots(player.getInventory().getBoots());
skel.getEquipment().setItemInHand(Math.random() > 0.5 ? player.getItemInHand() : new ItemStack(Material.IRON_AXE));
//Disguise
DisguisePlayer disguise = new DisguisePlayer(skel, ((CraftPlayer)player).getHandle().getProfile());
Factory.Disguise().disguise(disguise);
//Invis
Factory.Condition().Factory().Cloak(GetName(), player, player, 2 + 2*level, false, true);
_active.put(player, skel);
//Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void Energy(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : GetUsers())
{
if (!_active.containsKey(cur))
continue;
Skeleton skel = _active.get(cur);
if (Factory.Condition().GetActiveCondition(cur, ConditionType.CLOAK) == null ||
!cur.isBlocking() ||
!Factory.Energy().Use(cur, GetName(), 0.5 - (getLevel(cur) * 0.1), true, true) ||
skel == null ||
!skel.isValid())
{
end(cur);
continue;
}
else
{
if (UtilEnt.isGrounded(skel) &&
(!UtilBlock.airFoliage(skel.getLocation().add(skel.getLocation().getDirection()).getBlock()) ||
!UtilBlock.airFoliage(skel.getLocation().add(skel.getLocation().getDirection().multiply(2)).getBlock())))
{
UtilAction.velocity(skel, 0.6, 0.4, 1, false);
}
UtilEnt.CreatureMoveFast(skel, cur.getTargetBlock(null, 0).getLocation().add(0, 2, 0), 1.8f);
}
}
}
@EventHandler
public void illusionDeath(EntityDeathEvent event)
{
if (_active.containsValue(event.getEntity()))
{
event.getDrops().clear();
event.getEntity().remove();
}
}
private void end(Player cur)
{
Factory.Condition().EndCondition(cur, null, GetName());
Skeleton skel = _active.remove(cur);
if (skel == null)
return;
//Ploop
UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, skel.getLocation().add(0, 1, 0), 0.3f, 0.3f, 0.3f, 0.06f, 30);
for (int i=0 ; i<2 ; i++)
skel.getWorld().playSound(skel.getLocation(), Sound.FIZZ, 2f, 0.4f);
skel.remove();
}
@Override
public void Reset(Player player)
{
end(player);
}
}

View File

@ -9,6 +9,7 @@ import java.util.List;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.blockrestore.BlockRestore; import mineplex.core.blockrestore.BlockRestore;
import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.repository.GameSalesPackageToken; import mineplex.core.donation.repository.GameSalesPackageToken;
import mineplex.core.energy.Energy; import mineplex.core.energy.Energy;
import mineplex.core.movement.Movement; import mineplex.core.movement.Movement;
@ -44,6 +45,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
private CombatManager _combatManager; private CombatManager _combatManager;
private ConditionManager _conditionManager; private ConditionManager _conditionManager;
private ProjectileManager _projectileManager; private ProjectileManager _projectileManager;
private DisguiseManager _disguiseManager;
private BlockRestore _blockRestore; private BlockRestore _blockRestore;
private Fire _fire; private Fire _fire;
private Movement _movement; private Movement _movement;
@ -54,7 +56,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
private HashMap<Integer, ISkill> _skillSalesPackageMap; private HashMap<Integer, ISkill> _skillSalesPackageMap;
public SkillFactory(JavaPlugin plugin, DamageManager damageManager, IRelation relation, public SkillFactory(JavaPlugin plugin, DamageManager damageManager, IRelation relation,
CombatManager combatManager, ConditionManager conditionManager, ProjectileManager projectileManager, CombatManager combatManager, ConditionManager conditionManager, ProjectileManager projectileManager, DisguiseManager disguiseManager,
BlockRestore blockRestore, Fire fire, Movement movement, Teleport teleport, Energy energy, String webAddress) BlockRestore blockRestore, Fire fire, Movement movement, Teleport teleport, Energy energy, String webAddress)
{ {
super("Skill Factory", plugin); super("Skill Factory", plugin);
@ -66,6 +68,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
_conditionManager = conditionManager; _conditionManager = conditionManager;
_projectileManager = projectileManager; _projectileManager = projectileManager;
_blockRestore = blockRestore; _blockRestore = blockRestore;
_disguiseManager = disguiseManager;
_fire = fire; _fire = fire;
_movement = movement; _movement = movement;
_teleport = teleport; _teleport = teleport;
@ -164,6 +167,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
0, 0, true, 0, 0, true,
new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
//
// AddSkill(new Illusion(this, "Illusion", ClassType.Assassin, SkillType.Sword,
// 1, 4,
// 30, -5,
// 0, 0, true,
// new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD},
// new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
//Axe //Axe
AddSkill(new Blink(this, "Blink", ClassType.Assassin, SkillType.Axe, AddSkill(new Blink(this, "Blink", ClassType.Assassin, SkillType.Axe,
@ -700,6 +710,11 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
return _blockRestore; return _blockRestore;
} }
public DisguiseManager Disguise()
{
return _disguiseManager;
}
public Fire Fire() public Fire Fire()
{ {
return _fire; return _fire;

View File

@ -0,0 +1,31 @@
package mineplex.minecraft.game.classcombat.event;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class ClassCombatCreatureAllowSpawnEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
private boolean _allow;
public ClassCombatCreatureAllowSpawnEvent(boolean allow)
{
_allow = allow;
}
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
public boolean getAllowed()
{
return _allow;
}
}

View File

@ -226,7 +226,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
ItemFactory itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, energy, ItemFactory itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, energy,
_fire, _projectileManager, webAddress); _fire, _projectileManager, webAddress);
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(), _skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(),
_conditionManager, _projectileManager, _blockRestore, _fire, new Movement(plugin), teleport, _conditionManager, _projectileManager, _disguiseManager, _blockRestore, _fire, new Movement(plugin), teleport,
energy, webAddress); energy, webAddress);
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, itemFactory, _classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, itemFactory,
webAddress); webAddress);

View File

@ -43,7 +43,7 @@ public class CompassAddon extends MiniPlugin
@EventHandler @EventHandler
public void Update(UpdateEvent event) public void Update(UpdateEvent event)
{ {
if (event.getType() != UpdateType.SEC) if (event.getType() != UpdateType.FASTER)
return; return;
if (Manager.GetGame() == null) if (Manager.GetGame() == null)

View File

@ -38,6 +38,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
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.classcombat.event.ClassCombatCreatureAllowSpawnEvent;
import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.DeathMessageType;
import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -1254,4 +1255,21 @@ public abstract class Game implements Listener
{ {
return Manager; return Manager;
} }
@EventHandler
public void classCombatCreatureAllow(ClassCombatCreatureAllowSpawnEvent event)
{
CreatureAllowOverride = event.getAllowed();
}
public boolean isInsideMap(Location loc)
{
return !(
loc.getX() >= WorldData.MaxX ||
loc.getX() <= WorldData.MinX ||
loc.getZ() >= WorldData.MaxZ ||
loc.getZ() <= WorldData.MinZ ||
loc.getY() >= WorldData.MaxY ||
loc.getY() <= WorldData.MinY);
}
} }

View File

@ -54,8 +54,6 @@ public class Christmas extends SoloGame
private ArrayList<Location> _barrier = new ArrayList<Location>(); private ArrayList<Location> _barrier = new ArrayList<Location>();
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
private long _gameTime = 900000; private long _gameTime = 900000;
public Christmas(ArcadeManager manager) public Christmas(ArcadeManager manager)

View File

@ -1,32 +1,38 @@
package nautilus.game.arcade.game.games.wither; package nautilus.game.arcade.game.games.wither;
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 java.util.Set; import java.util.Set;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.data.BlockData; import mineplex.core.data.BlockData;
import mineplex.core.recharge.Recharge; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
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;
import nautilus.game.arcade.events.PlayerDeathOutEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.wither.kit.*; import nautilus.game.arcade.game.games.wither.kit.*;
@ -39,23 +45,15 @@ public class WitherGame extends TeamGame implements IBlockRestorer
private GameTeam _runners; private GameTeam _runners;
private GameTeam _withers; private GameTeam _withers;
private double _witherFactor = 3; private double _witherFactor = 2.5;
private long _gameTime = 240000; private int _yLimit = 0;
private int _pointGoal = 50;
private int _points = 0;
private int _witherY = 60; private long _gameTime = 300000;
private Location _spawnA;
private Location _spawnB;
private Location _safeA;
private Location _safeB;
private Location _boatA;
private Location _boatB;
private int _livesPerPlayer = 3;
private HashMap<Player, Integer> _lives = new HashMap<Player, Integer>();
private HashSet<BlockData> _blocks = new HashSet<BlockData>(); private HashSet<BlockData> _blocks = new HashSet<BlockData>();
public WitherGame(ArcadeManager manager) public WitherGame(ArcadeManager manager)
@ -64,43 +62,50 @@ public class WitherGame extends TeamGame implements IBlockRestorer
new Kit[] new Kit[]
{ {
new KitHumanRunner(manager), //new KitHumanRunner(manager),
new KitHumanBlinder(manager), new KitHumanArcher(manager),
new KitHumanRepairman(manager), new KitHumanBuilder(manager),
new NullKit(manager), new NullKit(manager),
new KitWither(manager), new NullKit(manager),
new KitWitherMinion(manager),
//new KitWitherWeb(manager),
//new KitWitherWeb(manager),
}, },
new String[] new String[]
{ {
C.cGreen + "Humans" + C.cWhite + " Escape to the Beacon",
C.cGreen + "Humans" + C.cWhite + " Win by reaching Beacon 100 times", C.cGreen + "Humans" + C.cWhite + " Find Armor Upgrades to help surive!",
C.cGreen + "Humans" + C.cWhite + " 5 Lives per Player",
C.cGreen + "Humans" + C.cWhite + " Win by surviving for 5 minutes",
" ", " ",
C.cRed + "Withers" + C.cWhite + " Stop Humans from reaching the Beacon", C.cRed + "Withers" + C.cWhite + " Moves very slowly when near ground",
C.cRed + "Withers" + C.cWhite + " Win after 4 Minutes", C.cRed + "Withers" + C.cWhite + " Kill all the Humans within 5 Minutes",
}); });
this.DeathOut = false; this.DeathOut = true;
this.DamageTeamSelf = false; this.DamageTeamSelf = false;
this.DamageSelf = false; this.DamageSelf = false;
this.DeathSpectateSecs = 4;
this.HungerSet = 20; this.HungerSet = 20;
this.WorldBoundaryKill = false;
this.CompassEnabled = true;
this.CompassGiveItem = false;
this.KitRegisterState = GameState.Prepare; this.KitRegisterState = GameState.Prepare;
_help = new String[]
{
C.cRed + C.Bold + "This game is in early stages of development!",
};
} }
@Override @Override
public void ParseData() public void ParseData()
{ {
_witherY = WorldData.GetDataLocs("RED").get(0).getBlockY(); _yLimit = WorldData.GetDataLocs("RED").get(0).getBlockY();
_safeA = WorldData.GetDataLocs("YELLOW").get(0);
_safeB = WorldData.GetDataLocs("YELLOW").get(1);
_boatA = WorldData.GetDataLocs("GREEN").get(0);
_boatB = WorldData.GetDataLocs("GREEN").get(1);
_spawnA = WorldData.GetDataLocs("BLUE").get(0);
_spawnB = WorldData.GetDataLocs("BLUE").get(1);
} }
@EventHandler @EventHandler
@ -138,7 +143,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
@EventHandler @EventHandler
public void teamBalance(UpdateEvent event) public void teamBalance(UpdateEvent event)
{ {
if (!IsLive()) if (!InProgress())
return; return;
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
@ -159,6 +164,8 @@ public class WitherGame extends TeamGame implements IBlockRestorer
public void setWither(Player player, boolean forced) public void setWither(Player player, boolean forced)
{ {
_lives.remove(player);
SetPlayerTeam(player, _withers, true); SetPlayerTeam(player, _withers, true);
//Kit //Kit
@ -177,6 +184,58 @@ public class WitherGame extends TeamGame implements IBlockRestorer
player.getWorld().strikeLightningEffect(player.getLocation()); player.getWorld().strikeLightningEffect(player.getLocation());
} }
} }
@EventHandler
public void playerDead(final PlayerDeathOutEvent event)
{
Player player = event.GetPlayer();
if (_lives.containsKey(player))
{
int lives = _lives.get(player);
if (lives <= 1)
return;
_lives.put(player, lives - 1);
UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + "."));
event.setCancelled(true);
}
}
@EventHandler
public void gameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
UtilTextMiddle.display(C.cGreen + "Humans Hiding", "12 Seconds until Assault", 10, 80, 10);
for (Player player : _withers.GetPlayers(true))
{
Manager.GetCondition().Factory().Blind("Game Start", player, null, 12, 0, false, false, false);
}
}
@EventHandler
public void playerLivesDisplay(PlayerKitGiveEvent event)
{
if (!_runners.HasPlayer(event.GetPlayer()))
return;
//Player Lives
if (!_lives.containsKey(event.GetPlayer()))
_lives.put(event.GetPlayer(), _livesPerPlayer);
int lives = _lives.get(event.GetPlayer());
if (lives <= 0)
return;
event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining"));
}
@Override @Override
public void EndCheck() public void EndCheck()
@ -194,16 +253,16 @@ public class WitherGame extends TeamGame implements IBlockRestorer
//Wither Win //Wither Win
if (UtilTime.elapsed(this.GetStateTime(), _gameTime)) if (UtilTime.elapsed(this.GetStateTime(), _gameTime))
winner = _withers; winner = _runners;
//Runner Win //Runner Win
if (_points >= _pointGoal) if (_runners.GetPlayers(true).isEmpty())
winner = _runners; winner = _withers;
//Set Win //Set Win
if (winner != null) if (winner != null)
{ {
AnnounceEnd(_withers); AnnounceEnd(winner);
for (GameTeam team : GetTeamList()) for (GameTeam team : GetTeamList())
{ {
@ -232,6 +291,10 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.FAST)
return; return;
int lives = 0;
for (int i : _lives.values())
lives += i;
//Wipe Last //Wipe Last
Scoreboard.Reset(); Scoreboard.Reset();
@ -245,8 +308,8 @@ public class WitherGame extends TeamGame implements IBlockRestorer
Scoreboard.Write(_withers.GetColor() + "" + _withers.GetPlayers(true).size() + " Players"); Scoreboard.Write(_withers.GetColor() + "" + _withers.GetPlayers(true).size() + " Players");
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Escapes"); Scoreboard.Write(C.cYellow + C.Bold + "Human Lives");
Scoreboard.Write(_points + " / " + _pointGoal); Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer));
Scoreboard.WriteBlank(); Scoreboard.WriteBlank();
Scoreboard.Write(C.cYellow + C.Bold + "Time Left"); Scoreboard.Write(C.cYellow + C.Bold + "Time Left");
@ -255,12 +318,23 @@ public class WitherGame extends TeamGame implements IBlockRestorer
Scoreboard.Draw(); Scoreboard.Draw();
} }
@Override
public GameTeam ChooseTeam(Player player)
{
if (CanJoinTeam(_withers))
return _withers;
return _runners;
}
@Override @Override
public boolean CanJoinTeam(GameTeam team) public boolean CanJoinTeam(GameTeam team)
{ {
if (team.equals(_withers)) if (team.equals(_withers))
{
return team.GetSize() < getRequiredWithers(); return team.GetSize() < getRequiredWithers();
}
return team.GetSize() < GetPlayers(true).size() - getRequiredWithers(); return team.GetSize() < GetPlayers(true).size() - getRequiredWithers();
} }
@ -270,26 +344,74 @@ public class WitherGame extends TeamGame implements IBlockRestorer
} }
@EventHandler @EventHandler
public void witherBump(UpdateEvent event) public void witherMovement(UpdateEvent event)
{ {
if (!IsLive()) if (!IsLive())
return; return;
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.FASTER)
return; return;
for (Player player : _withers.GetPlayers(true)) for (Player player : _withers.GetPlayers(true))
{ {
if (player.getLocation().getY() < _witherY) ArrayList<Location> collisions = new ArrayList<Location>();
{
player.setVelocity(new Vector(0, 0.6, 0)); //Fly Speed
if (player.getLocation().getY() > _yLimit)
if (Recharge.Instance.use(player, "Wither Bump", 5000, false, false)) {
UtilPlayer.message(player, F.main("Game", "Withers cannot descend past this point.")); player.setFlySpeed(0.06f);
} }
else
{
double speed = (_yLimit - player.getLocation().getY()) * 0.075;
player.setFlySpeed(Math.max(0.015f, 0.06f - (float)speed));
}
//Bump
for (Block block : UtilBlock.getInRadius(player.getLocation().add(0, 0.5, 0), 1.5d).keySet())
{
if (!UtilBlock.airFoliage(block))
{
collisions.add(block.getLocation().add(0.5, 0.5, 0.5));
}
}
Vector vec = UtilAlg.getAverageBump(player.getLocation(), collisions);
if (vec == null)
continue;
UtilAction.velocity(player, vec, 0.6, false, 0, 0.4, 10, true);
// if (player.getLocation().getY() < _yLimit + 6)
// UtilAction.velocity(player, new Vector(0, 1, 0), 0.6, false, 0, 0, 10, true);
} }
} }
@Override
public void addBlocks(Set<Block> blocks)
{
Iterator<Block> blockIter = blocks.iterator();
while (blockIter.hasNext())
{
Block block = blockIter.next();
if (block.getType() == Material.BEDROCK || block.getType() == Material.IRON_BLOCK)
blockIter.remove();
else if (!isInsideMap(block.getLocation()))
blockIter.remove();
// else if (UtilAlg.inBoundingBox(block.getLocation(), _safeA, _safeB) || UtilAlg.inBoundingBox(block.getLocation(), _spawnA, _spawnB))
// blockIter.remove();
}
for (Block block : blocks)
_blocks.add(new BlockData(block));
}
@Override @Override
public void restoreBlock(Location loc, double radius) public void restoreBlock(Location loc, double radius)
{ {
@ -309,46 +431,29 @@ public class WitherGame extends TeamGame implements IBlockRestorer
} }
} }
@Override @EventHandler
public void addBlocks(Set<Block> blocks) public void playerQuit(PlayerQuitEvent event)
{ {
Iterator<Block> blockIter = blocks.iterator(); _lives.remove(event.getPlayer());
while (blockIter.hasNext())
{
Block block = blockIter.next();
if (UtilAlg.inBoundingBox(block.getLocation(), _safeA, _safeB) || UtilAlg.inBoundingBox(block.getLocation(), _spawnA, _spawnB))
blockIter.remove();
}
for (Block block : blocks)
_blocks.add(new BlockData(block));
} }
@EventHandler @EventHandler
public void boatEscape(UpdateEvent event) public void livesUpdate(UpdateEvent event)
{ {
if (!IsLive()) if (!IsLive())
return; return;
if (event.getType() != UpdateType.TICK) if (event.getType() != UpdateType.FASTER)
return; return;
for (Player player : _runners.GetPlayers(true)) Iterator<Player> playerIter = _lives.keySet().iterator();
while (playerIter.hasNext())
{ {
if (UtilAlg.inBoundingBox(player.getLocation(), _boatA, _boatB)) Player player = playerIter.next();
{
_points++; if (!player.isOnline() || !_runners.HasPlayer(player))
playerIter.remove();
UtilFirework.playFirework(player.getLocation(), Type.BALL, Color.LIME, true, true);
player.teleport(_runners.GetSpawn());
Announce(C.cGreen + C.Bold + player.getName() + " escaped!");
AddGems(player, 4, "Escapes", true);
}
} }
} }
} }

View File

@ -4,20 +4,21 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkRopedArrow;
import nautilus.game.arcade.kit.perks.PerkWitherArrowBlind; import nautilus.game.arcade.kit.perks.PerkWitherArrowBlind;
public class KitHumanBlinder extends Kit public class KitHumanArcher extends Kit
{ {
public KitHumanBlinder(ArcadeManager manager) public KitHumanArcher(ArcadeManager manager)
{ {
super(manager, "Human Blinder", KitAvailability.Free, super(manager, "Human Archer", KitAvailability.Free,
new String[] new String[]
{ {
@ -26,7 +27,10 @@ public class KitHumanBlinder extends Kit
new Perk[] new Perk[]
{ {
new PerkWitherArrowBlind(4) new PerkRopedArrow("Roped Arrow", 1, 4000),
new PerkWitherArrowBlind(3),
new PerkFletcher(4, 4, true),
}, },
EntityType.ZOMBIE, EntityType.ZOMBIE,
null); null);
@ -38,24 +42,15 @@ public class KitHumanBlinder extends Kit
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 8));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false);
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));
Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 8, false, false);
} }
@Override @Override
public void SpawnCustom(LivingEntity ent) public void SpawnCustom(LivingEntity ent)
{ {
ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
} }
} }

View File

@ -4,7 +4,6 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
@ -12,12 +11,13 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkBlockRestorer; import nautilus.game.arcade.kit.perks.PerkBlockRestorer;
import nautilus.game.arcade.kit.perks.PerkIronShell;
public class KitHumanRepairman extends Kit public class KitHumanBuilder extends Kit
{ {
public KitHumanRepairman(ArcadeManager manager) public KitHumanBuilder(ArcadeManager manager)
{ {
super(manager, "Human Repairman", KitAvailability.Free, super(manager, "Human Builder", KitAvailability.Free,
new String[] new String[]
{ {
@ -26,6 +26,7 @@ public class KitHumanRepairman extends Kit
new Perk[] new Perk[]
{ {
new PerkIronShell(),
new PerkBlockRestorer() new PerkBlockRestorer()
}, },
EntityType.ZOMBIE, EntityType.ZOMBIE,
@ -37,23 +38,16 @@ public class KitHumanRepairman extends Kit
public void GiveItems(Player player) public void GiveItems(Player player)
{ {
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false);
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));
Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 8, false, false);
} }
@Override @Override
public void SpawnCustom(LivingEntity ent) public void SpawnCustom(LivingEntity ent)
{ {
ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
} }
} }

View File

@ -40,21 +40,13 @@ public class KitHumanRunner extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET)); Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false);
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));
Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 8, false, false);
} }
@Override @Override
public void SpawnCustom(LivingEntity ent) public void SpawnCustom(LivingEntity ent)
{ {
ent.getEquipment().setHelmet(new ItemStack(Material.CHAINMAIL_HELMET));
ent.getEquipment().setChestplate(new ItemStack(Material.CHAINMAIL_CHESTPLATE));
ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
} }
} }

View File

@ -0,0 +1,116 @@
package nautilus.game.arcade.game.games.wither.kit;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*;
public class KitWitherMinion extends Kit
{
public KitWitherMinion(ArcadeManager manager)
{
super(manager, "Wither Minion", KitAvailability.Free,
new String[]
{
""
},
new Perk[]
{
new PerkWitherArrows(),
new PerkWitherAttack(),
new PerkWitherMinion()
},
EntityType.WITHER,
null);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Wither Skull"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Skeletal Minions"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.COMPASS, (byte)0, 1,
C.cYellow + C.Bold + "Human Finder X-9000"));
//Disguise
DisguiseWither disguise = new DisguiseWither(player);
if (Manager.GetGame().GetTeam(player) != null)
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
else
disguise.SetName(player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@EventHandler(priority = EventPriority.LOWEST)
public void witherDamageCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player player = event.GetDamageePlayer();
if (player == null)
return;
if (HasKit(player))
event.SetCancelled("Wither Immunity");
}
@EventHandler(priority = EventPriority.LOWEST)
public void witherMeleeCancel(CustomDamageEvent event)
{
if (event.IsCancelled())
return;
Player player = event.GetDamagerPlayer(true);
if (player == null)
return;
if (!HasKit(player))
return;
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
return;
event.SetCancelled("Wither Melee Cancel");
}
@EventHandler
public void witherFlight(UpdateEvent event)
{
for (Player player : UtilServer.getPlayers())
{
if (!HasKit(player))
continue;
if (player.isFlying())
continue;
player.setAllowFlight(true);
player.setFlying(true);
}
}
}

View File

@ -9,7 +9,7 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.disguises.DisguiseBlaze; import mineplex.core.disguise.disguises.DisguiseWither;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -18,13 +18,12 @@ import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.*; import nautilus.game.arcade.kit.perks.*;
import nautilus.game.arcade.kit.perks.data.IBlockRestorer;
public class KitWither extends Kit public class KitWitherWeb extends Kit
{ {
public KitWither(ArcadeManager manager) public KitWitherWeb(ArcadeManager manager)
{ {
super(manager, "Wither", KitAvailability.Free, super(manager, "Wither Trapper", KitAvailability.Free,
new String[] new String[]
{ {
@ -36,9 +35,8 @@ public class KitWither extends Kit
new PerkWitherArrows(), new PerkWitherArrows(),
new PerkWitherAttack(), new PerkWitherAttack(),
new PerkWitherWeb(), new PerkWitherWeb(),
new PerkWitherMinion()
}, },
EntityType.ZOMBIE, EntityType.WITHER,
null); null);
} }
@ -51,12 +49,9 @@ public class KitWither extends Kit
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Web Blast")); C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Web Blast"));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Left-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Skeletal Minions"));
//Disguise //Disguise
DisguiseBlaze disguise = new DisguiseBlaze(player); DisguiseWither disguise = new DisguiseWither(player);
if (Manager.GetGame().GetTeam(player) != null) if (Manager.GetGame().GetTeam(player) != null)
disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.SetName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
@ -113,7 +108,6 @@ public class KitWither extends Kit
player.setAllowFlight(true); player.setAllowFlight(true);
player.setFlying(true); player.setFlying(true);
player.setFlySpeed(0.1f);
} }
} }
} }

View File

@ -0,0 +1,76 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkIronShell extends Perk
{
public PerkIronShell()
{
super("Iron Shell", new String[]
{
C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Iron Shell"
});
}
@EventHandler
public void Activate(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
if (!event.getPlayer().getItemInHand().getType().toString().contains("_SPADE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 60000, true, true))
return;
//Sphere
Block block = player.getLocation().getBlock();
HashMap<Block, Double> blocks = UtilBlock.getInRadius(block.getLocation().add(0.5, 0.5, 0.5), 6d);
for (Block cur : blocks.keySet())
{
if (UtilMath.offset(block.getLocation(), cur.getLocation()) <= 5)
continue;
//Doors
if (cur.getY() < block.getLocation().getY() + 2)
if (cur.getX() == block.getX() || cur.getZ() == block.getZ())
continue;
//None Below
if (cur.getY() < block.getLocation().getY())
continue;
Manager.GetBlockRestore().Add(cur, 42, (byte)0, 12000);
}
//Inform
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
}

View File

@ -96,7 +96,7 @@ public class PerkWitherArrowBlind extends Perk
boolean hit = false; boolean hit = false;
for (Player player : getWitherTeam().GetPlayers(true)) for (Player player : getWitherTeam().GetPlayers(true))
{ {
if (UtilMath.offset(player.getLocation().add(0, 2, 0), arrow.getLocation()) < _proximityHit) if (UtilMath.offset(player.getLocation().add(0, 1, 0), arrow.getLocation()) < _proximityHit)
{ {
Manager.GetCondition().Factory().Blind(GetName(), player, null, 4, 0, false, false, false); Manager.GetCondition().Factory().Blind(GetName(), player, null, 4, 0, false, false, false);

View File

@ -41,17 +41,17 @@ public class PerkWitherArrows extends Perk
if (!player.isBlocking()) if (!player.isBlocking())
{ {
player.setExp((float) Math.min(0.999, player.getExp()+(1f/40f))); player.setExp((float) Math.min(0.999, player.getExp()+(1f/30f)));
} }
else if (player.getExp() > 0) else if (player.getExp() > 0)
{ {
player.setExp((float) Math.max(0, player.getExp()-(1f/40f))); player.setExp((float) Math.max(0, player.getExp()-(1f/30f)));
for (int i=0 ; i<2 ; i++) for (int i=0 ; i<1 ; i++)
{ {
Arrow arrow = player.getWorld().spawnArrow( Arrow arrow = player.getWorld().spawnArrow(
player.getEyeLocation().add(player.getLocation().getDirection()), player.getEyeLocation().add(player.getLocation().getDirection()),
player.getLocation().getDirection(), 2, 12); player.getLocation().getDirection(), 2, 6);
arrow.setShooter(player); arrow.setShooter(player);
@ -64,7 +64,6 @@ public class PerkWitherArrows extends Perk
} }
} }
@EventHandler @EventHandler
public void update(UpdateEvent event) public void update(UpdateEvent event)
{ {
@ -77,10 +76,12 @@ public class PerkWitherArrows extends Perk
{ {
Arrow arrow = arrowIter.next(); Arrow arrow = arrowIter.next();
if (!arrow.isValid() || arrow.getTicksLived() > 60 || arrow.getLocation().getY() < 0) if (!arrow.isValid() || arrow.getTicksLived() > 60 || arrow.getLocation().getY() < 0 || arrow.isOnGround())
{ {
arrow.remove(); arrow.remove();
arrowIter.remove(); arrowIter.remove();
UtilParticle.PlayParticle(ParticleType.LAVA, arrow.getLocation(), 0, 0, 0, 0, 1);
} }
else if (arrow.getTicksLived() > 1) else if (arrow.getTicksLived() > 1)
{ {

View File

@ -145,7 +145,7 @@ public class PerkWitherAttack extends Perk
//Damage Event //Damage Event
Manager.GetDamage().NewDamageEvent(player, (LivingEntity)skull.getShooter(), null, Manager.GetDamage().NewDamageEvent(player, (LivingEntity)skull.getShooter(), null,
DamageCause.CUSTOM, 10 * scale, true, true, false, DamageCause.CUSTOM, 8 * players.get(player) * scale, true, true, false,
UtilEnt.getName((LivingEntity)skull.getShooter()), GetName()); UtilEnt.getName((LivingEntity)skull.getShooter()), GetName());
} }

View File

@ -109,7 +109,7 @@ public class PerkWitherMinion extends Perk
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
public void witherMeleeCancel(CustomDamageEvent event) public void witherFallCancel(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())
return; return;
@ -117,7 +117,7 @@ public class PerkWitherMinion extends Perk
if (event.GetCause() != DamageCause.FALL) if (event.GetCause() != DamageCause.FALL)
return; return;
if (_ents.contains(event.GetDamageeEntity())) if (!_ents.contains(event.GetDamageeEntity()))
return; return;
event.SetCancelled("Minion Fall Damage"); event.SetCancelled("Minion Fall Damage");

View File

@ -391,8 +391,10 @@ public class GameManager implements Listener
Player player = queueIterator.next(); Player player = queueIterator.next();
if (!game.CanJoinTeam(team)) if (!game.CanJoinTeam(team))
{
break; break;
}
queueIterator.remove(); queueIterator.remove();
if (!game.IsPlaying(player)) if (!game.IsPlaying(player))

View File

@ -329,12 +329,18 @@ public class GamePlayerManager implements Listener
Donor donor = Manager.GetDonation().Get(player.getName()); Donor donor = Manager.GetDonation().Get(player.getName());
if (kit.GetAvailability() == KitAvailability.Free || //Free if (kit.GetAvailability() == KitAvailability.Free || //Free
Manager.isYoutuber(player) || //YouTube Manager.isYoutuber(player) || //YouTube
(kit.GetAvailability() == KitAvailability.Achievement &&
Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) || //Achievement (kit.GetAvailability() == KitAvailability.Achievement && //Achievement
Manager.GetAchievement().hasCategory(player, kit.getAchievementRequirement())) ||
donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + kit.GetName()) || //Green donor.OwnsUnknownPackage(Manager.GetGame().GetName() + " " + kit.GetName()) || //Green
Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER) || //STAFF Manager.GetClients().Get(player).GetRank().Has(Rank.HELPER) || //STAFF
donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old) donor.OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA") || //Single Ultra (Old)
Manager.GetServerConfig().Tournament) //Tournament Manager.GetServerConfig().Tournament) //Tournament
{ {
Manager.GetGame().SetKit(player, kit, true); Manager.GetGame().SetKit(player, kit, true);