From 0e00086b9efc4bd072642f80f3ed5c9aef9b5673 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 28 Jul 2015 00:15:41 -0400 Subject: [PATCH 01/56] Redid evolution! --- .../src/nautilus/game/arcade/game/Game.java | 38 +- .../arcade/game/games/evolution/EvoKit.java | 34 ++ .../arcade/game/games/evolution/EvoScore.java | 15 - .../arcade/game/games/evolution/EvoToken.java | 35 ++ .../game/games/evolution/Evolution.java | 361 +++++++++--------- .../evolution/events/EvolutionBeginEvent.java | 26 ++ .../evolution/events/EvolutionEndEvent.java | 26 ++ .../games/evolution/evolve/EvolveData.java | 176 +++++++++ .../games/evolution/evolve/EvolveManager.java | 24 ++ .../game/games/evolution/kits/KitAgility.java | 18 +- .../game/games/evolution/kits/KitHealth.java | 19 +- .../games/evolution/kits/KitRecharge.java | 8 +- .../game/games/evolution/mobs/KitBlaze.java | 45 +-- .../game/games/evolution/mobs/KitChicken.java | 71 ++-- .../game/games/evolution/mobs/KitCreeper.java | 47 +-- .../games/evolution/mobs/KitEnderman.java | 49 ++- .../game/games/evolution/mobs/KitGolem.java | 43 +-- .../games/evolution/mobs/KitSkeleton.java | 43 +-- .../game/games/evolution/mobs/KitSlime.java | 47 +-- .../game/games/evolution/mobs/KitSnowman.java | 64 ++-- .../game/games/evolution/mobs/KitSpider.java | 44 +-- .../game/games/evolution/mobs/KitWolf.java | 49 +-- .../mobs/perks/PerkBlockTossEVO.java | 233 +++++++++++ .../evolution/mobs/perks/PerkBounceEVO.java | 147 +++++++ .../evolution/mobs/perks/PerkPounceEVO.java | 147 +++++++ .../mobs/perks/PerkSiesmicSlamEVO.java | 160 ++++++++ .../mobs/perks/PerkSulphurBombEVO.java | 125 ++++++ .../evolution/mobs/perks/PerkWebEVO.java | 125 ++++++ .../game/arcade/kit/perks/PerkVampire.java | 2 +- 29 files changed, 1710 insertions(+), 511 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoScore.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionBeginEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index abe4d740c..acd526237 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -232,14 +232,21 @@ public abstract class Game implements Listener public boolean GiveClock = true; public boolean AllowParticles = true; - + + public long PrepareTime = 9000; + public boolean PlaySoundGameStart = true; + + //Gems public double GemMultiplier = 1; public boolean GemHunterEnabled = true; public boolean GemBoosterEnabled = true; public boolean GemDoubleEnabled = true; + + public double GemKillDeathRespawn = .5; + public double GemAssistDeathRespawn = .5; - public long PrepareTime = 9000; - public boolean PlaySoundGameStart = true; + public double GemKillDeathOut = 4; + public double GemAssistDeathOut = 1; //Gameplay Data public HashMap PrivateBlockMap = new HashMap(); @@ -565,18 +572,27 @@ public abstract class Game implements Listener public double GetKillsGems(Player killer, Player killed, boolean assist) { - if (!DeathOut) + if (DeathOut) { - return 0.5; - } - - if (!assist) - { - return 4; + if (!assist) + { + return GemKillDeathOut; + } + else + { + return GemAssistDeathOut; + } } else { - return 1; + if (!assist) + { + return GemKillDeathRespawn; + } + else + { + return GemAssistDeathRespawn; + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java new file mode 100644 index 000000000..59a7b4ea1 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -0,0 +1,34 @@ +package nautilus.game.arcade.game.games.evolution; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public abstract class EvoKit extends Kit +{ + public EvoKit(ArcadeManager manager, String name, String[] kitDesc, Perk[] kitPerks, EntityType type) + { + super(manager, name, KitAvailability.Hide, 0, kitDesc, kitPerks, type, null); + } + + public void upgradeGive(Player player) + { + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + + for (String desc : GetDesc()) + UtilPlayer.message(player, desc); + + UtilPlayer.message(player, C.Line); + } + + @Override + public abstract void GiveItems(Player player); +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoScore.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoScore.java deleted file mode 100644 index dd4fb9d0e..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoScore.java +++ /dev/null @@ -1,15 +0,0 @@ -package nautilus.game.arcade.game.games.evolution; - -import org.bukkit.entity.Player; - -public class EvoScore -{ - public org.bukkit.entity.Player Player; - public int Kills; - - public EvoScore(Player player, int i) - { - Player = player; - Kills = i; - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java new file mode 100644 index 000000000..e20436611 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java @@ -0,0 +1,35 @@ +package nautilus.game.arcade.game.games.evolution; + +import nautilus.game.arcade.kit.Kit; + +import org.bukkit.entity.Player; + +public class EvoToken implements Comparable +{ + public final Player Player; + + public final Kit BuffKit; + + public int Kills = 0; + + public EvoToken(Player player, Kit kit) + { + Player = player; + + BuffKit = kit; + } + + @Override + public int compareTo(EvoToken o) + { + if (Kills == o.Kills) + { + return 0; + } + if (Kills > o.Kills) + { + return -1; + } + return 1; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 3fb7a570f..f5d2a636f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -1,7 +1,33 @@ package nautilus.game.arcade.game.games.evolution; import java.util.ArrayList; -import java.util.HashMap; +import java.util.Collections; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.evolution.kits.KitAgility; +import nautilus.game.arcade.game.games.evolution.kits.KitHealth; +import nautilus.game.arcade.game.games.evolution.kits.KitRecharge; +import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze; +import nautilus.game.arcade.game.games.evolution.mobs.KitChicken; +import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper; +import nautilus.game.arcade.game.games.evolution.mobs.KitEnderman; +import nautilus.game.arcade.game.games.evolution.mobs.KitGolem; +import nautilus.game.arcade.game.games.evolution.mobs.KitSkeleton; +import nautilus.game.arcade.game.games.evolution.mobs.KitSlime; +import nautilus.game.arcade.game.games.evolution.mobs.KitSnowman; +import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; +import nautilus.game.arcade.game.games.evolution.mobs.KitWolf; +import nautilus.game.arcade.kit.Kit; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; @@ -11,94 +37,95 @@ import org.bukkit.event.EventPriority; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilFirework; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.GameType; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.evolution.kits.*; -import nautilus.game.arcade.game.games.evolution.mobs.*; -import nautilus.game.arcade.kit.Kit; - public class Evolution extends SoloGame { - private ArrayList _ranks = new ArrayList(); - private ArrayList _lastScoreboard = new ArrayList(); - - private HashMap _bonusKit = new HashMap(); - - private Objective _scoreObj; + private ArrayList _boosterKits = new ArrayList(); + private ArrayList _mobKits = new ArrayList(); + + private NautHashMap _tokens = new NautHashMap(); + + private Objective _evoObj; public Evolution(ArcadeManager manager) { super(manager, GameType.Evolution, - new Kit[] - { - new KitHealth(manager), - new KitAgility(manager), - new KitRecharge(manager), - - new KitGolem(manager), //Iron - new KitBlaze(manager), //Chainmail - new KitSlime(manager), //Chainmail - new KitCreeper(manager), //None - new KitEnderman(manager), //Chainmail - new KitSkeleton(manager), //Leather - new KitSpider(manager), //Chainmail - new KitSnowman(manager), //Leather - new KitWolf(manager), //Leather - new KitChicken(manager), - - }, - + new Kit[0], new String[] { "You evolve when you get a kill.", "Each evolution has unique skills.", - "", "First to get through 10 evolutions wins!" }); - this.DamageTeamSelf = true; + //Custom kit stuff to make other things easier + _boosterKits.add(new KitHealth(manager)); + _boosterKits.add(new KitAgility(manager)); + _boosterKits.add(new KitRecharge(manager)); - this.HungerSet = 20; + _mobKits.add(new KitGolem(manager)); + _mobKits.add(new KitBlaze(manager)); + _mobKits.add(new KitSlime(manager)); + _mobKits.add(new KitCreeper(manager)); + _mobKits.add(new KitEnderman(manager)); + _mobKits.add(new KitSpider(manager)); + _mobKits.add(new KitSnowman(manager)); + _mobKits.add(new KitWolf(manager)); + _mobKits.add(new KitChicken(manager)); + _mobKits.add(new KitSkeleton(manager)); - this.DeathOut = false; + ArrayList allKits = new ArrayList(); + allKits.addAll(_boosterKits); + allKits.addAll(_mobKits); - this.PrepareFreeze = false; + Kit[] kits = new Kit[allKits.size()]; + + for (int i = 0 ; i < allKits.size() ; i++) + { + kits[i] = allKits.get(i); + } + + setKits(kits); + + DamageTeamSelf = true; + + HungerSet = 20; + + DeathOut = false; + + PrepareFreeze = false; - this.SpawnDistanceRequirement = 16; + SpawnDistanceRequirement = 16; - _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Evolutions", "dummy"); - _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); - } + GemKillDeathRespawn = 2; + GemAssistDeathRespawn = .5; - @EventHandler(priority = EventPriority.MONITOR) - public void RegisterMobKits(GameStateChangeEvent event) - { - if (event.GetState() != GameState.Live) - return; + CompassEnabled = true; + CompassGiveItem = false; + + AutomaticRespawn = false; + DeathSpectateSecs = 4.0; + + VersionRequire1_8 = true; + + _evoObj = Scoreboard.GetScoreboard().registerNewObjective("Evolutions", "dummy"); + _evoObj.setDisplaySlot(DisplaySlot.BELOW_NAME); } //Double Kit @EventHandler(priority = EventPriority.MONITOR) - public void StoreBonusKits(GameStateChangeEvent event) + public void storeTokens(GameStateChangeEvent event) { - if (event.GetState() != GameState.Live) + if (event.GetState() != GameState.Prepare) return; for (Player player : GetPlayers(true)) { - _bonusKit.put(player, GetKit(player)); - UpgradeKit(player, true); + _tokens.put(player.getName(), new EvoToken(player, GetKit(player))); + + upgradeKit(player, false); + + _evoObj.getScore(GetTeam(player).GetColor() + player.getName()).setScore(0); } } @@ -108,158 +135,118 @@ public class Evolution extends SoloGame if (GetKit(player) == null) return false; - if (GetKit(player).equals(kit)) + if (GetKit(player) == (kit)) return true; - //Bonus Kit - if (_bonusKit.containsKey(player)) - if (_bonusKit.get(player).equals(kit)) - return true; - + if (_tokens.get(player.getName()).BuffKit == kit) + return true; + return false; } @EventHandler - public void PlayerKillAward(CombatDeathEvent event) + public void onKill(CombatDeathEvent event) { - Game game = Manager.GetGame(); - if (game == null) return; - - if (!(event.GetEvent().getEntity() instanceof Player)) + if (!IsLive()) + return; + + if (!event.GetLog().GetKiller().IsPlayer()) + return; + + Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + + if (killer == null || !killer.isOnline()) return; - if (event.GetLog().GetKiller() == null) + if (!IsAlive(killer)) + return; + + if (killer == event.GetEvent().getEntity()) return; - final Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); - if (killer == null) - return; - - if (killer.equals(event.GetEvent().getEntity())) - return; - - Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + increaseScore(killer); + _evoObj.getScore(GetTeam(killer).GetColor() + killer.getName()).setScore(getScore(killer)); + + ScoreboardUpdate(new UpdateEvent(UpdateType.FAST)); + + if (getScore(killer) >= 10) { - public void run() - { - UpgradeKit(killer, false); - } - }, 0); + End(); + return; + } + + if (upgradeKit(killer, true)) + return; + + killer.teleport(GetTeam(killer).GetSpawn()); + UtilFirework.playFirework(killer.getEyeLocation(), Type.BALL, Color.GREEN, false, false); } - public void UpgradeKit(Player player, boolean first) - { - if (!Recharge.Instance.use(player, "Evolve", 500, false, false)) - return; - - //Remove Old Recharges - Recharge.Instance.Reset(player); - Recharge.Instance.useForce(player, "Evolve", 500); - - Kit kit = GetKit(player); + //Boolean ending + public boolean upgradeKit(Player player, boolean give) + { + if (!IsAlive(player)) + return false; - for (int i=3 ; i0 ; j--) - { - if (_ranks.get(j).Kills > _ranks.get(j-1).Kills) - { - EvoScore temp = _ranks.get(j); - _ranks.set(j, _ranks.get(j-1)); - _ranks.set(j-1, temp); - } - } - } - } - + private void End() { - SortScores(); + ArrayList tokens = new ArrayList(_tokens.values()); + Collections.sort(tokens); - //Set Places - ArrayList places = new ArrayList(); - for (int i=0 ; i<_ranks.size() ; i++) - places.add(i, _ranks.get(i).Player); + ArrayList players = new ArrayList(); + for (int i = 0 ; i < tokens.size() ; i++) + { + players.add(tokens.get(i).Player); + } + //Award Gems - if (_ranks.size() >= 1) - AddGems(_ranks.get(0).Player, 20, "1st Place", false, false); + if (tokens.size() >= 1) + AddGems(players.get(0), 20, "1st Place", false, false); - if (_ranks.size() >= 2) - AddGems(_ranks.get(1).Player, 15, "2nd Place", false, false); + if (tokens.size() >= 2) + AddGems(players.get(1), 15, "2nd Place", false, false); - if (_ranks.size() >= 3) - AddGems(_ranks.get(2).Player, 10, "3rd Place", false, false); + if (tokens.size() >= 3) + AddGems(players.get(2), 10, "3rd Place", false, false); //Participation for (Player player : GetPlayers(false)) @@ -267,27 +254,27 @@ public class Evolution extends SoloGame AddGems(player, 10, "Participation", false, false); SetState(GameState.End); - AnnounceEnd(places); - } - - @Override - public void EndCheck() - { - + AnnounceEnd(players); } @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) { + if (!IsLive()) + return; + if (event.getType() != UpdateType.FAST) return; Scoreboard.Reset(); + + Scoreboard.WriteBlank(); for (Player player : GetPlayers(true)) { - Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), GetScore(player), true); + Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true); + _evoObj.getScore(GetTeam(player).GetColor() + player.getName()).setScore(getScore(player)); } Scoreboard.Draw(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionBeginEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionBeginEvent.java new file mode 100644 index 000000000..8f8704ed4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionBeginEvent.java @@ -0,0 +1,26 @@ +package nautilus.game.arcade.game.games.evolution.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class EvolutionBeginEvent extends PlayerEvent +{ + private static HandlerList _handlers = new HandlerList(); + + public EvolutionBeginEvent(Player who) + { + super(who); + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java new file mode 100644 index 000000000..05c927223 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java @@ -0,0 +1,26 @@ +package nautilus.game.arcade.game.games.evolution.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class EvolutionEndEvent extends PlayerEvent +{ + private static HandlerList _handlers = new HandlerList(); + + public EvolutionEndEvent(Player who) + { + super(who); + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java new file mode 100644 index 000000000..9251860d3 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -0,0 +1,176 @@ +package nautilus.game.arcade.game.games.evolution.evolve; + +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import net.minecraft.server.v1_7_R4.EntityBlaze; +import net.minecraft.server.v1_7_R4.EntityChicken; +import net.minecraft.server.v1_7_R4.EntityCreeper; +import net.minecraft.server.v1_7_R4.EntityEnderman; +import net.minecraft.server.v1_7_R4.EntityInsentient; +import net.minecraft.server.v1_7_R4.EntityIronGolem; +import net.minecraft.server.v1_7_R4.EntitySkeleton; +import net.minecraft.server.v1_7_R4.EntitySlime; +import net.minecraft.server.v1_7_R4.EntitySnowman; +import net.minecraft.server.v1_7_R4.EntitySpider; +import net.minecraft.server.v1_7_R4.EntityWolf; +import net.minecraft.server.v1_7_R4.EntityZombie; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_7_R4.World; + +import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +public class EvolveData +{ + private long _curtime = System.currentTimeMillis(); + + private final EvolveManager _manager; + + private final Player _player; + + private final EntityType _from; + private final EntityType _to; + + private boolean _switch = true; + + private int _stage; + + private EntityInsentient _eFrom; + private EntityInsentient _eTo; + + public EvolveData(EvolveManager manager, Player player, EntityType from, EntityType to) + { + _manager = manager; + + _player = player; + + _from = from; + _to = to; + } + + //Boolean completed + public boolean tick() + { + teleport(); + + _stage++; + + if (_stage > 12) + return true; + + if (!UtilTime.elapsed(_curtime, 1000 * (6 - (_stage / 2)))) + return false; + + _curtime = System.currentTimeMillis(); + + _switch = !_switch; + + if (_switch) + { + despawn(_eTo); + _eFrom = spawn(_from); + + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, new Location(_eFrom.world.getWorld(), _eFrom.locX, _eFrom.locY, _eFrom.locZ), 0.5F, 0.5F, 0.5F, 0, 5, ViewDist.SHORT, _player); + } + else + { + despawn(_eFrom); + _eTo = spawn(_to); + + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, new Location(_eTo.world.getWorld(), _eTo.locX, _eTo.locY, _eTo.locZ), 0.5F, 0.5F, 0.5F, 0, 5, ViewDist.SHORT, _player); + } + + return false; + } + + private void teleport() + { + Location newLoc = UtilAlg.getTrajectory(_player.getLocation(), newLoc).normalize().toLocation(_player.getWorld()); + + double lead = i * ((2d * Math.PI)/game.GetTeamList().size()); + double sizeMod = 4; + double oX = -Math.sin(lead) * sizeMod; + double oZ = Math.cos(lead) * sizeMod; + + //Location + Location entLoc = spawn.clone().add(oX, 0, oZ); + + _player.teleport(_manager.getLocation()); + + } + + private EntityInsentient spawn(EntityType type) + { + try + { + EntityInsentient entity = getEntity(type).getConstructor(World.class).newInstance(((CraftWorld) _manager.getLocation().getWorld()).getHandle()); + entity.setLocation(_manager.getLocation().getX(), _manager.getLocation().getY(), _manager.getLocation().getZ(), 0.0F, 0.0F); + PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(entity); + entity.setCustomNameVisible(false); + + UtilPlayer.sendPacket(_player, packet); + return entity; + } + catch (Exception ex) + { + ex.printStackTrace(); + return null; + } + } + + private void despawn(EntityInsentient entity) + { + if (entity == null) + return; + + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[] + { + entity.getId() + }); + + UtilPlayer.sendPacket(_player, packet); + } + + private Class getEntity(EntityType type) + { + if (type == EntityType.BLAZE) + return EntityBlaze.class; + + if (type == EntityType.CHICKEN) + return EntityChicken.class; + + if (type == EntityType.CREEPER) + return EntityCreeper.class; + + if (type == EntityType.ENDERMAN) + return EntityEnderman.class; + + if (type == EntityType.IRON_GOLEM) + return EntityIronGolem.class; + + if (type == EntityType.SKELETON) + return EntitySkeleton.class; + + if (type == EntityType.SLIME) + return EntitySlime.class; + + if (type == EntityType.SNOWMAN) + return EntitySnowman.class; + + if (type == EntityType.SPIDER) + return EntitySpider.class; + + if (type == EntityType.WOLF) + return EntityWolf.class; + + return EntityZombie.class; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java new file mode 100644 index 000000000..85cb47c08 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -0,0 +1,24 @@ +package nautilus.game.arcade.game.games.evolution.evolve; + +import nautilus.game.arcade.game.games.evolution.Evolution; + +import org.bukkit.Location; + +public class EvolveManager +{ + private Evolution _host; + + private final Location _evolveLoc; + + public EvolveManager(Evolution evolution, Location evolveLoc) + { + _host = evolution; + _evolveLoc = evolveLoc; + } + + public Location getLocation() + { + return _evolveLoc; + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAgility.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAgility.java index 38e4573bf..a1c9ad09d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAgility.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAgility.java @@ -1,8 +1,7 @@ package nautilus.game.arcade.game.games.evolution.kits; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -10,6 +9,10 @@ import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkSpeed; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + public class KitAgility extends Kit { public KitAgility(ArcadeManager manager) @@ -18,21 +21,20 @@ public class KitAgility extends Kit new String[] { - "You are extremely agile and can double jump!" + "Before you dedicated your life to Evolution,", + "you were an extremely agile circus star!" }, - new Perk[] { new PerkDoubleJump("Double Jump", 0.8, 0.8, false), new PerkSpeed(0), }, - EntityType.ZOMBIE, - null); + EntityType.ZOMBIE, new ItemBuilder(Material.FEATHER).build()); } @Override public void GiveItems(Player player) { - + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java index 39e751c8c..ee59b235d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java @@ -1,8 +1,7 @@ package nautilus.game.arcade.game.games.evolution.kits; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -10,6 +9,10 @@ import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkRegeneration; import nautilus.game.arcade.kit.perks.PerkVampire; +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + public class KitHealth extends Kit { public KitHealth(ArcadeManager manager) @@ -18,21 +21,19 @@ public class KitHealth extends Kit new String[] { - "You have improved survivability." + "You're better at surviving than a cockroach!" }, - new Perk[] { - new PerkRegeneration(0), new PerkVampire(6), + new PerkRegeneration(0) }, - EntityType.ZOMBIE, - null); + EntityType.ZOMBIE, new ItemBuilder(Material.POTION, 1, (short) 8197).build()); } @Override public void GiveItems(Player player) { - + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitRecharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitRecharge.java index cb45410fa..de9ea52f7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitRecharge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitRecharge.java @@ -1,8 +1,11 @@ package nautilus.game.arcade.game.games.evolution.kits; +import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; @@ -17,7 +20,8 @@ public class KitRecharge extends Kit new String[] { - "You are able to use your abilities more often!" + "You focus your mind before every game ", + "allowing you to perform skills more often!" }, new Perk[] @@ -32,6 +36,6 @@ public class KitRecharge extends Kit @Override public void GiveItems(Player player) { - + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java index e0c94df7d..9ea8a0d8a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java @@ -1,50 +1,39 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseBlaze; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkFlamingSword; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseBlaze; -import mineplex.core.itemstack.ItemStackFactory; -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.PerkFlamingSword; - -public class KitBlaze extends Kit +public class KitBlaze extends EvoKit { public KitBlaze(ArcadeManager manager) - { - super(manager, "Blaze", KitAvailability.Hide, - + { + super(manager, "Blaze", new String[] { - "" + F.elem("Hold Block") + " to use " + F.elem("Inferno"), + F.elem("Attacks ignite opponents for 4 seconds") }, - new Perk[] { new PerkFlamingSword() - }, - EntityType.SLIME, - null); - + }, EntityType.BLAZE); } @Override public void GiveItems(Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD)); - - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Hold Block") + " to use " + F.elem("Inferno")); - UtilPlayer.message(player, C.Line); player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 4f, 1f); @@ -52,6 +41,10 @@ public class KitBlaze extends Kit DisguiseBlaze disguise = new DisguiseBlaze(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); + + Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index bafb1cc9d..f4a9ff102 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -1,5 +1,14 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkConstructor; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Egg; @@ -7,68 +16,58 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseChicken; -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.PerkConstructor; -import nautilus.game.arcade.kit.perks.PerkFallDamage; - -public class KitChicken extends Kit +public class KitChicken extends EvoKit { public KitChicken(ArcadeManager manager) { - super(manager, "Chicken", KitAvailability.Hide, - - new String[] + super(manager, "Chicken", new String[] + { + F.elem("Right-Click with Egg") + " to use " + F.elem("Throw Egg") + }, new Perk[] { - "" - }, - - new Perk[] - { - new PerkConstructor("Egg Pouch", 0.8, 8, Material.EGG, "Egg", false), - new PerkFallDamage(-2), - }, - EntityType.SLIME, - null); - + new PerkConstructor("Egg Pouch", 6.0, 3, Material.EGG, "Egg", false) + }, EntityType.CHICKEN); } @Override public void GiveItems(Player player) { - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Right-Click with Eggs") + " to use " + F.elem("Throw Egg")); - UtilPlayer.message(player, C.Line); - player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_IDLE, 4f, 1f); //Disguise DisguiseChicken disguise = new DisguiseChicken(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); + + Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } @EventHandler public void EggHit(CustomDamageEvent event) { - if (event.IsCancelled()) + if (!Manager.GetGame().IsLive()) return; - + + if (!(event.GetDamagerEntity(true) instanceof Player)) + return; + + Player player = event.GetDamagerPlayer(true); + + if (!Manager.IsAlive(player)) + return; + + if (!HasKit(player)) + return; + if (event.GetProjectile() == null) return; if (!(event.GetProjectile() instanceof Egg)) return; - - event.AddMod("Chicken Kit", "Egg", 1, true); + + event.AddMod("Chicken Kit", "Egg", 9, true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java index 1f24ad9bf..e694f97da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java @@ -1,52 +1,39 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseCreeper; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkSulphurBombEVO; +import nautilus.game.arcade.kit.Perk; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseCreeper; -import mineplex.core.itemstack.ItemStackFactory; -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.PerkExplode; -import nautilus.game.arcade.kit.perks.PerkFood; - -public class KitCreeper extends Kit +public class KitCreeper extends EvoKit { public KitCreeper(ArcadeManager manager) { - super(manager, "Creeper", KitAvailability.Hide, - + super(manager, "Creeper", new String[] { - "" + F.elem("Right-Click With Axe") + " to use " + F.elem("Sulphur Bomb") }, - new Perk[] { - new PerkFood(1), - new PerkExplode("Detonate", 1, 6000) - }, - EntityType.SLIME, - null); + new PerkSulphurBombEVO() + }, EntityType.CREEPER); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT)); - - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Attack") + " to use " + F.elem("Detonate")); - UtilPlayer.message(player, C.Line); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE)); player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 4f, 1f); @@ -54,6 +41,10 @@ public class KitCreeper extends Kit DisguiseCreeper disguise = new DisguiseCreeper(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); + + Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java index 2faeb7011..a21f02190 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java @@ -1,52 +1,49 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseEnderman; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkBlockTossEVO; +import nautilus.game.arcade.kit.Perk; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.itemstack.ItemStackFactory; -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.PerkBlink; - -public class KitEnderman extends Kit +public class KitEnderman extends EvoKit { public KitEnderman(ArcadeManager manager) { - super(manager, "Enderman", KitAvailability.Hide, - + super(manager, "Enderman", new String[] { - "" + F.elem("Right-Click Block With Sword") + " to use " + F.elem("Block Toss") }, - new Perk[] { - new PerkBlink("Blink", 12, 4000) - }, - EntityType.SLIME, - null); - + new PerkBlockTossEVO() + }, EntityType.ENDERMAN); } @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Blink")); - UtilPlayer.message(player, C.Line); - player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f); + //Disguise + DisguiseEnderman disguise = new DisguiseEnderman(player); + disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); + disguise.setCustomNameVisible(true); + Manager.GetDisguise().undisguise(player); + Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java index bbf32eb49..1ce3730da 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java @@ -1,39 +1,33 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseIronGolem; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkSiesmicSlamEVO; +import nautilus.game.arcade.kit.Perk; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseIronGolem; -import mineplex.core.itemstack.ItemStackFactory; -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.PerkSlam; - -public class KitGolem extends Kit +public class KitGolem extends EvoKit { public KitGolem(ArcadeManager manager) { - super(manager, "Iron Golem", KitAvailability.Hide, - + super(manager, "Iron Golem", new String[] { - "" + F.elem("Right-Click with Axe") + " to use " + F.elem("Ground Pound") }, new Perk[] { - new PerkSlam("Ground Pound", 1, 1.2, 10000), - }, - EntityType.SLIME, - null); - + new PerkSiesmicSlamEVO(), + }, EntityType.IRON_GOLEM); } @Override @@ -41,17 +35,16 @@ public class KitGolem extends Kit { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE)); - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Ground Pound")); - UtilPlayer.message(player, C.Line); - player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 4f, 1f); //Disguise DisguiseIronGolem disguise = new DisguiseIronGolem(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); + + Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java index dd6a35b17..576b615de 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java @@ -1,52 +1,41 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseSkeleton; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkBarrage; +import nautilus.game.arcade.kit.perks.PerkFletcher; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.itemstack.ItemStackFactory; -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.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkFletcher; - -public class KitSkeleton extends Kit +public class KitSkeleton extends EvoKit { public KitSkeleton(ArcadeManager manager) { - super(manager, "Skeletal Archer", KitAvailability.Hide, - + super(manager, "Skeletal Archer", new String[] { - "" + F.elem("Charge Bow") + " to use " + F.elem("Barrage") }, new Perk[] { new PerkFletcher(3, 2, false), new PerkBarrage(5, 250, true, false) - }, - EntityType.SLIME, - null); - + }, EntityType.SKELETON); } @Override public void GiveItems(Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Charge Bow") + " to use " + F.elem("Barrage")); - UtilPlayer.message(player, C.Line); player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f); @@ -54,6 +43,10 @@ public class KitSkeleton extends Kit DisguiseSkeleton disguise = new DisguiseSkeleton(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); + + Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java index 1861030b1..154addc1a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java @@ -1,41 +1,33 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseSlime; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkBounceEVO; +import nautilus.game.arcade.kit.Perk; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseSlime; -import mineplex.core.itemstack.ItemStackFactory; -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.PerkFallDamage; -import nautilus.game.arcade.kit.perks.PerkLeap; - -public class KitSlime extends Kit +public class KitSlime extends EvoKit { public KitSlime(ArcadeManager manager) { - super(manager, "Slime", KitAvailability.Hide, - + super(manager, "Slime", new String[] { - "" - }, + F.elem("Right-Click with Axe") + " to use " + F.elem("Bounce") + }, new Perk[] { - new PerkLeap("Bounce", 2, 2, 8000), - new PerkFallDamage(-40) - }, - EntityType.SLIME, - null); - + new PerkBounceEVO() + }, EntityType.SLIME); } @Override @@ -43,11 +35,6 @@ public class KitSlime extends Kit { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Bounce")); - UtilPlayer.message(player, C.Line); - player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 4f, 1f); //Disguise @@ -55,6 +42,10 @@ public class KitSlime extends Kit disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); disguise.SetSize(3); + + Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java index 305a2875c..5db2d73af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java @@ -1,5 +1,15 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseSnowman; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkArcticAura; +import nautilus.game.arcade.kit.perks.PerkConstructor; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; @@ -7,68 +17,62 @@ import org.bukkit.entity.Player; import org.bukkit.entity.Snowball; import org.bukkit.event.EventHandler; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseSnowman; -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.PerkConstructor; -import nautilus.game.arcade.kit.perks.PerkFallDamage; - -public class KitSnowman extends Kit +public class KitSnowman extends EvoKit { public KitSnowman(ArcadeManager manager) { - super(manager, "Snowman", KitAvailability.Hide, - + super(manager, "Snowman", new String[] { - "" + F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball"), + F.elem("You freeze enemies around you with slowness") }, - new Perk[] { new PerkConstructor("Snowballer", 0.5, 16, Material.SNOW_BALL, "Snowball", false), - new PerkFallDamage(-2), - }, - EntityType.SLIME, - null); - + new PerkArcticAura(), + }, EntityType.SNOWMAN); } @Override public void GiveItems(Player player) { - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball")); - UtilPlayer.message(player, C.Line); - player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 4f, 1f); //Disguise DisguiseSnowman disguise = new DisguiseSnowman(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); + + Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } @EventHandler public void SnowballHit(CustomDamageEvent event) { - if (event.IsCancelled()) + if (!Manager.GetGame().IsLive()) + return; + + if (!(event.GetDamagerEntity(true) instanceof Player)) + return; + + Player player = event.GetDamagerPlayer(true); + + if (!Manager.IsAlive(player)) + return; + + if (!HasKit(player)) return; if (event.GetProjectile() == null) return; - + if (!(event.GetProjectile() instanceof Snowball)) return; - event.AddMod("Snowman Kit", "Snowball", 3, true); + event.AddMod("Snowman Kit", "Egg", 3, true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java index bed99063c..98b4a4677 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java @@ -1,39 +1,32 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseSpider; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkWebEVO; +import nautilus.game.arcade.kit.Perk; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseSpider; -import mineplex.core.itemstack.ItemStackFactory; -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.PerkWeb; - -public class KitSpider extends Kit +public class KitSpider extends EvoKit { public KitSpider(ArcadeManager manager) { - super(manager, "Spider", KitAvailability.Hide, - + super(manager, "Spider", new String[] { - "" + F.elem("Right-Click Web") + " to use " + F.elem("Web Toss"), }, - new Perk[] { - new PerkWeb(2,8) - }, - EntityType.SLIME, - null); - + new PerkWebEVO() + }, EntityType.SPIDER); } @Override @@ -41,17 +34,16 @@ public class KitSpider extends Kit { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Right-Click with Axe/Web") + " to use " + F.elem("Throw Web")); - UtilPlayer.message(player, C.Line); - player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 4f, 1f); //Disguise DisguiseSpider disguise = new DisguiseSpider(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); + + Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java index a496c2b1f..43e19371b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java @@ -1,41 +1,35 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.F; +import mineplex.core.disguise.disguises.DisguiseWolf; +import mineplex.core.itemstack.ItemBuilder; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkPounceEVO; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkSpeed; + import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.disguise.disguises.DisguiseBat; -import mineplex.core.itemstack.ItemStackFactory; -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.PerkLeap; -import nautilus.game.arcade.kit.perks.PerkSpeed; - -public class KitWolf extends Kit +public class KitWolf extends EvoKit { public KitWolf(ArcadeManager manager) { - super(manager, "Wolf", KitAvailability.Hide, - + super(manager, "Wolf", new String[] { - "" + F.elem("Right-Click with Axe") + " to use " + F.elem("Pounce") }, new Perk[] { - new PerkSpeed(2), - new PerkLeap("Pounce", 1.2, 1, 4000) - }, - EntityType.SLIME, - null); - + new PerkSpeed(1), + new PerkPounceEVO() + }, EntityType.WOLF); } @Override @@ -43,17 +37,16 @@ public class KitWolf extends Kit { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE)); - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!"); - UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Pounce")); - UtilPlayer.message(player, C.Line); - player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 4f, 1f); //Disguise - DisguiseBat disguise = new DisguiseBat(player); + DisguiseWolf disguise = new DisguiseWolf(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); + + Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); + + player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java new file mode 100644 index 000000000..c08759025 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java @@ -0,0 +1,233 @@ +package nautilus.game.arcade.game.games.evolution.mobs.perks; + +import java.util.HashMap; +import java.util.HashSet; + +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.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.data.BlockTossData; +import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; +import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +public class PerkBlockTossEVO extends Perk implements IThrown +{ + private HashMap _hold = new HashMap(); + private HashMap _charge = new HashMap(); + private HashSet _charged = new HashSet(); + private HashMap _falling = new HashMap(); + + public PerkBlockTossEVO() + { + super("Block Toss", new String[] + { + + }); + } + + @SuppressWarnings("deprecation") + @EventHandler + public void Grab(PlayerInteractEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + Player player = event.getPlayer(); + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK)) + return; + + if (!Manager.IsAlive(player)) + return; + + if (!Kit.HasKit(player)) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.IRON_SWORD, (byte) 0)) + return; + + if (_hold.containsKey(player)) + return; + + Block grab = event.getClickedBlock(); + + if (UtilBlock.usable(grab)) + return; + + if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().Contains(grab.getRelative(BlockFace.UP))) + { + UtilPlayer.message(player, F.main("Game", "You may not pick up that block!")); + return; + } + + if (!Recharge.Instance.use(event.getPlayer(), GetName(), 6000, true, false)) + return; + + Recharge.Instance.Get(event.getPlayer()).get(GetName()).DisplayForce = true; + + //Event + PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData()); + UtilServer.getServer().getPluginManager().callEvent(blockEvent); + + //Block to Data + int id = grab.getTypeId(); + byte data = grab.getData(); + + //Remove Block + //Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000); + event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType()); + + _hold.put(player, new BlockTossData(id, data)); + + _charge.put(player, System.currentTimeMillis()); + + //Effect + player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id); + } + + @SuppressWarnings("deprecation") + @EventHandler + public void Throw(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + HashSet throwSet = new HashSet(); + + for (Player cur : _hold.keySet()) + { + //Throw + if (!cur.isBlocking()) + throwSet.add(cur); + + //Charged Tick + if (!_charged.contains(cur)) + if (System.currentTimeMillis() - _charge.get(cur) > 1200) + { + _charged.add(cur); + cur.playEffect(cur.getLocation(), Effect.CLICK1, 0); + } + } + + for (Player cur : throwSet) + { + BlockTossData data = _hold.remove(cur); + + FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data); + + _falling.put(block, cur); + + _charged.remove(cur); + + long charge = System.currentTimeMillis() - _charge.remove(cur); + + //Throw + double mult = 1.4; + if (charge < 1200) + mult = mult * ((double)charge/1200d); + + //Action + UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true); + Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true, + null, 0, 0, null, 0, UpdateType.FASTEST, 1f); + + //Event + PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur); + UtilServer.getServer().getPluginManager().callEvent(blockEvent); + } + } + + @SuppressWarnings("deprecation") + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target == null) + return; + + //Damage Event + Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.PROJECTILE, data.GetThrown().getVelocity().length() * 4, true, true, false, + UtilEnt.getName(data.GetThrower()), GetName()); + + //Block to Item + if (data.GetThrown() instanceof FallingBlock) + { + FallingBlock thrown = (FallingBlock) data.GetThrown(); + + FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0); + + //Remove Old + _falling.remove(thrown); + thrown.remove(); + + //Add New + if (data.GetThrower() instanceof Player) + _falling.put(newThrown, (Player)data.GetThrower()); + } + } + + @Override + public void Idle(ProjectileUser data) + { + + } + + @Override + public void Expire(ProjectileUser data) + { + + } + + + @SuppressWarnings("deprecation") + @EventHandler + public void BlockForm(EntityChangeBlockEvent event) + { + if (!(event.getEntity() instanceof FallingBlock)) + return; + + FallingBlock falling = (FallingBlock)event.getEntity(); + + falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId()); + + _falling.remove(falling); + falling.remove(); + + event.setCancelled(true); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 2.5); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java new file mode 100644 index 000000000..7d01eb70f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -0,0 +1,147 @@ +package nautilus.game.arcade.game.games.evolution.mobs.perks; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +public class PerkBounceEVO extends Perk +{ + private NautHashMap _live = new NautHashMap(); + + public PerkBounceEVO() + { + super("Bounce", new String[] + { + }); + } + + //Literally just the slime slam code ;D + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.IRON_AXE, (byte) 0)) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) + return; + + UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 0, 0.5, 3.0, true); + + //Record + _live.put(player, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void collide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!Manager.GetGame().IsLive()) + return; + + //Collide + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!_live.containsKey(player)) + continue; + + for (Player cur : UtilPlayer.getNearby(player.getLocation(), 2.0)) + { + if (!Manager.IsAlive(cur)) + continue; + + if (cur == player) + continue; + + DoSlam(player, cur); + _live.remove(player); + return; + } + } + } + + @EventHandler + public void end(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!Manager.GetGame().IsLive()) + return; + + //End + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!UtilEnt.isGrounded(player)) + continue; + + if (!_live.containsKey(player)) + continue; + + if (!UtilTime.elapsed(_live.get(player), 1000)) + continue; + + _live.remove(player); + } + } + + public void DoSlam(Player damager, LivingEntity damagee) + { + int damage = 8; + + //Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, + DamageCause.CUSTOM, damage, true, true, false, + damager.getName(), GetName()); + + //Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 2); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java new file mode 100644 index 000000000..9026e1a0d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java @@ -0,0 +1,147 @@ +package nautilus.game.arcade.game.games.evolution.mobs.perks; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +public class PerkPounceEVO extends Perk +{ + private NautHashMap _live = new NautHashMap(); + + public PerkPounceEVO() + { + super("Pounce", new String[] + { + }); + } + + //Literally just the slime slam code ;D + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (UtilBlock.usable(event.getClickedBlock())) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.WOOD_AXE, (byte) 0)) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) + return; + + UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.3, 1.8, true); + + //Record + _live.put(player, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void collide(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!Manager.GetGame().IsLive()) + return; + + //Collide + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!_live.containsKey(player)) + continue; + + for (Player cur : UtilPlayer.getNearby(player.getLocation(), 2.0)) + { + if (!Manager.IsAlive(cur)) + continue; + + if (cur == player) + continue; + + DoSlam(player, cur); + _live.remove(player); + return; + } + } + } + + @EventHandler + public void end(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!Manager.GetGame().IsLive()) + return; + + //End + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!UtilEnt.isGrounded(player)) + continue; + + if (!_live.containsKey(player)) + continue; + + if (!UtilTime.elapsed(_live.get(player), 1000)) + continue; + + _live.remove(player); + } + } + + public void DoSlam(Player damager, LivingEntity damagee) + { + int damage = 6; + + //Damage Event + Manager.GetDamage().NewDamageEvent(damagee, damager, null, + DamageCause.CUSTOM, damage, true, true, false, + damager.getName(), GetName()); + + //Inform + UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); + UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), .5); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java new file mode 100644 index 000000000..6af2e3783 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -0,0 +1,160 @@ +package nautilus.game.arcade.game.games.evolution.mobs.perks; + +import java.util.HashMap; + +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.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +public class PerkSiesmicSlamEVO extends Perk +{ + private HashMap _live = new HashMap(); + + public PerkSiesmicSlamEVO() + { + super("Ground Pound", new String[] + { + + }); + } + + @EventHandler + public void deactivateDeath(PlayerDeathEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!Kit.HasKit(event.getEntity())) + return; + + if (_live.containsKey(event.getEntity())) + { + _live.remove(event.getEntity()); + } + } + + @EventHandler + public void Leap(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.DIAMOND_AXE, (byte) 0)) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 7000, true, false)) + return; + + Recharge.Instance.Get(player).get(GetName()).DisplayForce = true; + + //Action + Vector vec = player.getLocation().getDirection(); + if (vec.getY() < 0) + vec.setY(vec.getY() * -1); + + UtilAction.velocity(player, vec, 1, true, 1, 0, 1, true); + + //Record + _live.put(player, System.currentTimeMillis()); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + } + + @SuppressWarnings("deprecation") + @EventHandler + public void Slam(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) + { + if (!UtilEnt.isGrounded(player)) + continue; + + if (!_live.containsKey(player)) + continue; + + if (!UtilTime.elapsed(_live.get(player), 1000)) + continue; + + _live.remove(player); + + //Action + int damage = 8; + double range = 6; + + HashMap targets = UtilPlayer.getInRadius(player.getLocation(), range); + for (Player cur : targets.keySet()) + { + if (cur == player) + continue; + + if (!Manager.IsAlive((Player) cur)) + continue; + + //Damage Event + Manager.GetDamage().NewDamageEvent(cur, player, null, + DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, true, true, false, + player.getName(), GetName()); + + //Condition + Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); + + //Inform + UtilPlayer.message(cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + ".")); + } + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f); + for (Block cur : UtilBlock.getInRadius(player.getLocation(), range).keySet()) + if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur)) + cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId()); + } + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 2.4); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java new file mode 100644 index 000000000..fb84d9ed0 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -0,0 +1,125 @@ +package nautilus.game.arcade.game.games.evolution.mobs.perks; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; + +public class PerkSulphurBombEVO extends Perk implements IThrown +{ + public PerkSulphurBombEVO() + { + super("Sulphur Bomb", new String[] + { + + }); + } + + @EventHandler + public void fire(PlayerInteractEvent event) + { + if (event.isCancelled()) + return; + + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.DIAMOND_AXE, (byte) 0)) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (!Recharge.Instance.use(player, GetName(), 3000, true, false)) + return; + + Recharge.Instance.Get(player).get(GetName()).DisplayForce = true; + + event.setCancelled(true); + + Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0)); + + UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false); + + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, + null, 1f, 1f, + null, 1, UpdateType.SLOW, + 0.5f); + + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Explode(data); + + if (target == null) + return; + + //Damage Event + Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.PROJECTILE, 5, true, true, false, + UtilEnt.getName(data.GetThrower()), GetName()); + } + + @Override + public void Idle(ProjectileUser data) + { + Explode(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Explode(data); + } + + public void Explode(ProjectileUser data) + { + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.GetThrown().getLocation(), 0, 0, 0, 0, 1, + ViewDist.MAX, UtilServer.getPlayers()); + data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f); + data.GetThrown().remove(); + } + + @EventHandler + public void Knockback(CustomDamageEvent event) + { + if (event.GetReason() == null || !event.GetReason().contains(GetName())) + return; + + event.AddKnockback(GetName(), 1.5); + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java new file mode 100644 index 000000000..896bb0ef5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -0,0 +1,125 @@ +package nautilus.game.arcade.game.games.evolution.mobs.perks; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilServer; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.entity.Item; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +public class PerkWebEVO extends Perk implements IThrown +{ + public PerkWebEVO() + { + super("Web Shot", new String[] + { + + }); + } + + @EventHandler + public void Spawn(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!Kit.HasKit(cur)) + continue; + + if (!Manager.GetGame().IsAlive(cur)) + continue; + + if (!Recharge.Instance.use(cur, GetName(), 3000, false, false)) + continue; + + if (UtilInv.contains(cur, Material.WEB, (byte)0, 8)) + continue; + + //Add + cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WEB)); + } + } + + @EventHandler + public void Throw(PlayerInteractEvent event) + { + if (event.getAction() == Action.PHYSICAL) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!Manager.IsAlive(event.getPlayer())) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.WEB, (byte) 0)) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + event.setCancelled(true); + + UtilInv.remove(player, Material.WEB, (byte)0, 1); + UtilInv.Update(player); + + Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WEB)); + UtilAction.velocity(ent, player.getLocation().getDirection(), 0.8, false, 0, 0.2, 10, false); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + if (target != null) + { + if (target instanceof Player) + { + if (!Manager.GetGame().IsAlive((Player)target)) + { + return; + } + } + } + + Web(data); + } + + @Override + public void Idle(ProjectileUser data) + { + Web(data); + } + + @Override + public void Expire(ProjectileUser data) + { + Web(data); + } + + public void Web(ProjectileUser data) + { + Location loc = data.GetThrown().getLocation(); + data.GetThrown().remove(); + + Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 4000); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVampire.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVampire.java index 69ba0a124..34feae7bc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVampire.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkVampire.java @@ -17,7 +17,7 @@ public class PerkVampire extends Perk { super("Vampire", new String[] { - C.cGray + "You heal " + recover + "HP when you kill someone", + C.cGray + "You heal " + C.cYellow + recover + " Hearts" + C.cGray + " when you kill someone", }); _recover = recover; From c5cf30609733dfdee247784ab69d4732a2c34789 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 28 Jul 2015 08:41:35 -0400 Subject: [PATCH 02/56] Thing --- .../game/games/evolution/Evolution.java | 106 +++++++++++++----- .../events/EvolutionPostEvolveEvent.java | 26 +++++ .../games/evolution/evolve/EvolveData.java | 47 ++++++-- .../games/evolution/evolve/EvolveManager.java | 52 ++++++++- 4 files changed, 192 insertions(+), 39 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionPostEvolveEvent.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index f5d2a636f..3338381e6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -5,15 +5,19 @@ import java.util.Collections; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; -import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; +import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager; import nautilus.game.arcade.game.games.evolution.kits.KitAgility; import nautilus.game.arcade.game.games.evolution.kits.KitHealth; import nautilus.game.arcade.game.games.evolution.kits.KitRecharge; @@ -29,8 +33,6 @@ import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; import nautilus.game.arcade.game.games.evolution.mobs.KitWolf; import nautilus.game.arcade.kit.Kit; -import org.bukkit.Color; -import org.bukkit.FireworkEffect.Type; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -39,6 +41,8 @@ import org.bukkit.scoreboard.Objective; public class Evolution extends SoloGame { + private EvolveManager _evolve; + private ArrayList _boosterKits = new ArrayList(); private ArrayList _mobKits = new ArrayList(); @@ -57,7 +61,7 @@ public class Evolution extends SoloGame "Each evolution has unique skills.", "First to get through 10 evolutions wins!" }); - + //Custom kit stuff to make other things easier _boosterKits.add(new KitHealth(manager)); _boosterKits.add(new KitAgility(manager)); @@ -112,6 +116,11 @@ public class Evolution extends SoloGame _evoObj.setDisplaySlot(DisplaySlot.BELOW_NAME); } + public EvolveManager getEvolve() + { + return _evolve; + } + //Double Kit @EventHandler(priority = EventPriority.MONITOR) public void storeTokens(GameStateChangeEvent event) @@ -128,7 +137,35 @@ public class Evolution extends SoloGame _evoObj.getScore(GetTeam(player).GetColor() + player.getName()).setScore(0); } } + + @EventHandler(priority = EventPriority.MONITOR) + public void endNoEvolve(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + if (WorldData.GetCustomLocs("RED").size() <= 0) + { + Announce(C.cWhite + C.Bold + GetName() + " ended, map not set up properly!"); + SetState(GameState.Dead); + return; + } + + _evolve = new EvolveManager(this, WorldData.GetCustomLocs("RED").get(0)); + } + @EventHandler + public void tickEvolve(UpdateEvent event) + { + if (!IsLive()) + return; + + if (event.getType() != UpdateType.FASTER) + return; + + _evolve.tick(); + } + @Override public boolean HasKit(Player player, Kit kit) { @@ -144,6 +181,38 @@ public class Evolution extends SoloGame return false; } + @EventHandler(priority = EventPriority.MONITOR) + public void onEvolveDamage(CustomDamageEvent event) + { + if (!IsLive()) + return; + + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + if (_evolve.isEvolving(event.GetDamageePlayer())) + event.SetCancelled("Player is evolving!"); + } + + @EventHandler + public void startEvolve(EvolutionBeginEvent event) + { + Manager.GetCondition().Factory().Cloak("Evolution", event.getPlayer(), null, Double.MAX_VALUE, false, false); + } + + @EventHandler + public void stopEvolve(EvolutionEndEvent event) + { + upgradeKit(event.getPlayer(), true); + } + + @EventHandler + public void endEvolve(EvolutionPostEvolveEvent event) + { + Manager.GetCondition().Clean(event.getPlayer()); + event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); + } + @EventHandler public void onKill(CombatDeathEvent event) { @@ -174,36 +243,21 @@ public class Evolution extends SoloGame End(); return; } - - if (upgradeKit(killer, true)) - return; - - killer.teleport(GetTeam(killer).GetSpawn()); - UtilFirework.playFirework(killer.getEyeLocation(), Type.BALL, Color.GREEN, false, false); } //Boolean ending - public boolean upgradeKit(Player player, boolean give) + public void upgradeKit(Player player, boolean give) { if (!IsAlive(player)) - return false; + return; - try - { - EvoKit newKit = _mobKits.get(getScore(player)); - - SetKit(player, newKit, false); + EvoKit newKit = _mobKits.get(getScore(player)); - if (give) - { - newKit.upgradeGive(player); - } - return false; - } - catch (IndexOutOfBoundsException ex) + SetKit(player, newKit, false); + + if (give) { - End(); - return true; + newKit.upgradeGive(player); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionPostEvolveEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionPostEvolveEvent.java new file mode 100644 index 000000000..8a38ddc24 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionPostEvolveEvent.java @@ -0,0 +1,26 @@ +package nautilus.game.arcade.game.games.evolution.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class EvolutionPostEvolveEvent extends PlayerEvent +{ + private static HandlerList _handlers = new HandlerList(); + + public EvolutionPostEvolveEvent(Player who) + { + super(who); + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 9251860d3..f75b4bb03 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -1,11 +1,15 @@ package nautilus.game.arcade.game.games.evolution.evolve; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; +import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; import net.minecraft.server.v1_7_R4.EntityBlaze; import net.minecraft.server.v1_7_R4.EntityChicken; import net.minecraft.server.v1_7_R4.EntityCreeper; @@ -22,11 +26,13 @@ import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R4.World; +import org.bukkit.Bukkit; +import org.bukkit.Color; import org.bukkit.Location; +import org.bukkit.FireworkEffect.Type; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.util.Vector; public class EvolveData { @@ -34,6 +40,8 @@ public class EvolveData private final EvolveManager _manager; + private boolean _active = true; + private final Player _player; private final EntityType _from; @@ -54,17 +62,37 @@ public class EvolveData _from = from; _to = to; + + Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); } //Boolean completed public boolean tick() { teleport(); + + if (!_active) + { + if (!UtilTime.elapsed(_curtime, 4000)) + return false; + + Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); + return true; + } _stage++; if (_stage > 12) - return true; + { + _active = false; + + Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); + + _curtime = System.currentTimeMillis(); + + UtilFirework.playFirework(_manager.getLocation().clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); + return false; + } if (!UtilTime.elapsed(_curtime, 1000 * (6 - (_stage / 2)))) return false; @@ -93,18 +121,13 @@ public class EvolveData private void teleport() { - Location newLoc = UtilAlg.getTrajectory(_player.getLocation(), newLoc).normalize().toLocation(_player.getWorld()); - - double lead = i * ((2d * Math.PI)/game.GetTeamList().size()); - double sizeMod = 4; - double oX = -Math.sin(lead) * sizeMod; - double oZ = Math.cos(lead) * sizeMod; - - //Location - Location entLoc = spawn.clone().add(oX, 0, oZ); + _player.setFlying(true); + _player.setHealth(20.0); - _player.teleport(_manager.getLocation()); + Location newLoc = UtilAlg.getTrajectory(_player.getLocation(), _manager.getLocation()).normalize().toLocation(_player.getWorld()); + newLoc.add(Math.cos((Math.PI / 14) * _player.getTicksLived()) * 4.0, .1, Math.sin((Math.PI / 14) * _player.getTicksLived()) * 4.0); + _player.teleport(_manager.getLocation()); } private EntityInsentient spawn(EntityType type) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index 85cb47c08..de841782a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -1,15 +1,24 @@ package nautilus.game.arcade.game.games.evolution.evolve; +import java.util.Iterator; +import java.util.Map.Entry; + +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; import nautilus.game.arcade.game.games.evolution.Evolution; import org.bukkit.Location; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; public class EvolveManager { - private Evolution _host; + private final Evolution _host; private final Location _evolveLoc; + private NautHashMap _data = new NautHashMap(); + public EvolveManager(Evolution evolution, Location evolveLoc) { _host = evolution; @@ -21,4 +30,45 @@ public class EvolveManager return _evolveLoc; } + public boolean isEvolving(Player player) + { + return _data.containsKey(player.getName()); + } + + public void addEvolve(Player player, EntityType from, EntityType to) + { + if (!_data.containsKey(player.getName())) + return; + + _data.put(player.getName(), new EvolveData(this, player, from, to)); + } + + public void tick() + { + Iterator> iterator = _data.entrySet().iterator(); + while (iterator.hasNext()) + { + Entry entry = iterator.next(); + + Player player = UtilPlayer.searchExact(entry.getKey()); + + if (player == null || !player.isOnline()) + { + iterator.remove(); + continue; + } + + if (!_host.IsAlive(player)) + { + iterator.remove(); + continue; + } + + if (entry.getValue().tick()) + { + iterator.remove(); + continue; + } + } + } } From ab494075846e01a528c6bd8d938750b991724a5a Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 29 Jul 2015 11:52:44 -0600 Subject: [PATCH 03/56] Things --- .../arcade/game/games/evolution/Evolution.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 3338381e6..1647945ca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -33,6 +33,8 @@ import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; import nautilus.game.arcade.game.games.evolution.mobs.KitWolf; import nautilus.game.arcade.kit.Kit; +import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -48,6 +50,8 @@ public class Evolution extends SoloGame private NautHashMap _tokens = new NautHashMap(); + private ArrayList _evoPlatforms = new ArrayList(); + private Objective _evoObj; public Evolution(ArcadeManager manager) @@ -121,6 +125,16 @@ public class Evolution extends SoloGame return _evolve; } + @Override + public void ParseData() + { + for (Location loc : WorldData.GetCustomLocs("Red")) + { + loc.getBlock().setType(Material.AIR); + _evoPlatforms.add(loc); + } + } + //Double Kit @EventHandler(priority = EventPriority.MONITOR) public void storeTokens(GameStateChangeEvent event) @@ -144,14 +158,14 @@ public class Evolution extends SoloGame if (event.GetState() != GameState.Prepare) return; - if (WorldData.GetCustomLocs("RED").size() <= 0) + if (_evoPlatforms.size() <= 0) { Announce(C.cWhite + C.Bold + GetName() + " ended, map not set up properly!"); SetState(GameState.Dead); return; } - _evolve = new EvolveManager(this, WorldData.GetCustomLocs("RED").get(0)); + _evolve = new EvolveManager(this, _evoPlatforms.get(0)); } @EventHandler From a5d73d791a3051bcc396acb0a5b310f32727df41 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 29 Jul 2015 16:14:38 -0600 Subject: [PATCH 04/56] Thing --- .../game/arcade/game/games/evolution/Evolution.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 1647945ca..a5df11fa2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -128,7 +128,7 @@ public class Evolution extends SoloGame @Override public void ParseData() { - for (Location loc : WorldData.GetCustomLocs("Red")) + for (Location loc : WorldData.GetCustomLocs("RED")) { loc.getBlock().setType(Material.AIR); _evoPlatforms.add(loc); @@ -152,10 +152,10 @@ public class Evolution extends SoloGame } } - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.LOWEST) public void endNoEvolve(GameStateChangeEvent event) { - if (event.GetState() != GameState.Prepare) + if (event.GetState() != GameState.Live) return; if (_evoPlatforms.size() <= 0) From f02924987ec59361f8957a798c53bdd6d5a01ba8 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 30 Jul 2015 04:30:19 -0600 Subject: [PATCH 05/56] Did things --- .../arcade/game/games/evolution/EvoKit.java | 9 + .../arcade/game/games/evolution/EvoToken.java | 10 +- .../game/games/evolution/Evolution.java | 112 +++++++--- .../events/EvolutionAbilityUseEvent.java | 41 ++++ .../games/evolution/evolve/EvolveData.java | 200 +++++++++++++----- .../games/evolution/evolve/EvolveManager.java | 14 +- .../game/games/evolution/kits/KitAgility.java | 40 ---- .../game/games/evolution/kits/KitHealth.java | 39 ---- .../game/games/evolution/kits/KitPlayer.java | 30 +++ .../games/evolution/kits/KitRecharge.java | 41 ---- .../game/games/evolution/mobs/KitBlaze.java | 4 +- .../game/games/evolution/mobs/KitChicken.java | 41 ++++ .../games/evolution/mobs/KitSkeleton.java | 38 ++++ .../game/games/evolution/mobs/KitSnowman.java | 43 +++- .../mobs/perks/PerkBlockTossEVO.java | 8 + .../evolution/mobs/perks/PerkBounceEVO.java | 8 + .../mobs/perks/PerkFlamingSwordEVO.java | 141 ++++++++++++ .../evolution/mobs/perks/PerkPounceEVO.java | 8 + .../mobs/perks/PerkSiesmicSlamEVO.java | 8 + .../mobs/perks/PerkSulphurBombEVO.java | 8 + .../evolution/mobs/perks/PerkWebEVO.java | 8 + 21 files changed, 630 insertions(+), 221 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAgility.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitPlayer.java delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitRecharge.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 59a7b4ea1..26172ebb5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -13,11 +13,20 @@ import org.bukkit.entity.Player; public abstract class EvoKit extends Kit { + private EntityType _entity; + public EvoKit(ArcadeManager manager, String name, String[] kitDesc, Perk[] kitPerks, EntityType type) { super(manager, name, KitAvailability.Hide, 0, kitDesc, kitPerks, type, null); + + _entity = type; } + public EntityType getEntity() + { + return _entity; + } + public void upgradeGive(Player player) { UtilPlayer.message(player, C.Line); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java index e20436611..78d9e9e43 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java @@ -1,22 +1,16 @@ package nautilus.game.arcade.game.games.evolution; -import nautilus.game.arcade.kit.Kit; - import org.bukkit.entity.Player; public class EvoToken implements Comparable { public final Player Player; - - public final Kit BuffKit; - + public int Kills = 0; - public EvoToken(Player player, Kit kit) + public EvoToken(Player player) { Player = player; - - BuffKit = kit; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index a5df11fa2..fd0ce1b6a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -6,6 +6,7 @@ import java.util.Collections; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; @@ -14,13 +15,12 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager; -import nautilus.game.arcade.game.games.evolution.kits.KitAgility; -import nautilus.game.arcade.game.games.evolution.kits.KitHealth; -import nautilus.game.arcade.game.games.evolution.kits.KitRecharge; +import nautilus.game.arcade.game.games.evolution.kits.KitPlayer; import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze; import nautilus.game.arcade.game.games.evolution.mobs.KitChicken; import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper; @@ -38,6 +38,8 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.vehicle.VehicleExitEvent; import org.bukkit.scoreboard.DisplaySlot; import org.bukkit.scoreboard.Objective; @@ -45,7 +47,6 @@ public class Evolution extends SoloGame { private EvolveManager _evolve; - private ArrayList _boosterKits = new ArrayList(); private ArrayList _mobKits = new ArrayList(); private NautHashMap _tokens = new NautHashMap(); @@ -58,7 +59,9 @@ public class Evolution extends SoloGame { super(manager, GameType.Evolution, - new Kit[0], + new Kit[] + { + }, new String[] { "You evolve when you get a kill.", @@ -66,11 +69,7 @@ public class Evolution extends SoloGame "First to get through 10 evolutions wins!" }); - //Custom kit stuff to make other things easier - _boosterKits.add(new KitHealth(manager)); - _boosterKits.add(new KitAgility(manager)); - _boosterKits.add(new KitRecharge(manager)); - + //Custom kit stuff to make other things easiet _mobKits.add(new KitGolem(manager)); _mobKits.add(new KitBlaze(manager)); _mobKits.add(new KitSlime(manager)); @@ -82,17 +81,16 @@ public class Evolution extends SoloGame _mobKits.add(new KitChicken(manager)); _mobKits.add(new KitSkeleton(manager)); - ArrayList allKits = new ArrayList(); - allKits.addAll(_boosterKits); - allKits.addAll(_mobKits); + Kit[] kits = new Kit[_mobKits.size() + 1]; - Kit[] kits = new Kit[allKits.size()]; - - for (int i = 0 ; i < allKits.size() ; i++) + for (int i = 0 ; i < _mobKits.size() ; i++) { - kits[i] = allKits.get(i); - } + if (i == 0) + kits[0] = new KitPlayer(manager); + kits[i] = _mobKits.get(i); + } + setKits(kits); DamageTeamSelf = true; @@ -128,7 +126,7 @@ public class Evolution extends SoloGame @Override public void ParseData() { - for (Location loc : WorldData.GetCustomLocs("RED")) + for (Location loc : WorldData.GetDataLocs("RED")) { loc.getBlock().setType(Material.AIR); _evoPlatforms.add(loc); @@ -144,7 +142,7 @@ public class Evolution extends SoloGame for (Player player : GetPlayers(true)) { - _tokens.put(player.getName(), new EvoToken(player, GetKit(player))); + _tokens.put(player.getName(), new EvoToken(player)); upgradeKit(player, false); @@ -174,7 +172,7 @@ public class Evolution extends SoloGame if (!IsLive()) return; - if (event.getType() != UpdateType.FASTER) + if (event.getType() != UpdateType.TICK) return; _evolve.tick(); @@ -188,15 +186,12 @@ public class Evolution extends SoloGame if (GetKit(player) == (kit)) return true; - - if (_tokens.get(player.getName()).BuffKit == kit) - return true; return false; } @EventHandler(priority = EventPriority.MONITOR) - public void onEvolveDamage(CustomDamageEvent event) + public void onEvolveDamageRecieve(CustomDamageEvent event) { if (!IsLive()) return; @@ -208,10 +203,58 @@ public class Evolution extends SoloGame event.SetCancelled("Player is evolving!"); } + @EventHandler(priority = EventPriority.MONITOR) + public void onEvolveDamageDeal(CustomDamageEvent event) + { + if (!IsLive()) + return; + + if (!(event.GetDamagerEntity(true) instanceof Player)) + return; + + if (_evolve.isEvolving(event.GetDamagerPlayer(true))) + event.SetCancelled("Player is evolving!"); + } + + @EventHandler + public void onEvolveMove(PlayerMoveEvent event) + { + if (!IsLive()) + return; + + if (_evolve.isEvolving(event.getPlayer())) + event.getPlayer().teleport(event.getFrom()); + } + + @EventHandler + public void onEvolveAbility(EvolutionAbilityUseEvent event) + { + if (!IsLive()) + return; + + if (_evolve.isEvolving(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler + public void onEvolveDismount(VehicleExitEvent event) + { + if (!IsLive()) + return; + + if (!(event.getExited() instanceof Player)) + return; + + if (_evolve.isEvolving((Player) event.getExited())) + event.setCancelled(true); + } + @EventHandler public void startEvolve(EvolutionBeginEvent event) { Manager.GetCondition().Factory().Cloak("Evolution", event.getPlayer(), null, Double.MAX_VALUE, false, false); + + Recharge.Instance.Get(event.getPlayer()).clear(); } @EventHandler @@ -224,6 +267,8 @@ public class Evolution extends SoloGame public void endEvolve(EvolutionPostEvolveEvent event) { Manager.GetCondition().Clean(event.getPlayer()); + event.getPlayer().setAllowFlight(false); + event.getPlayer().setFlying(false); event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); } @@ -257,6 +302,21 @@ public class Evolution extends SoloGame End(); return; } + + EvoToken token = _tokens.get(killer.getName()); + + try + { + EvoKit from = _mobKits.get(token.Kills - 1); //Account for the score increase + EvoKit to = _mobKits.get(token.Kills); + + _evolve.addEvolve(killer, from, to); + } + catch (IndexOutOfBoundsException ex) + { + End(); + return; + } } //Boolean ending @@ -329,7 +389,7 @@ public class Evolution extends SoloGame @EventHandler public void ScoreboardUpdate(UpdateEvent event) { - if (!IsLive()) + if (GetState() != GameState.Prepare && !IsLive()) return; if (event.getType() != UpdateType.FAST) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java new file mode 100644 index 000000000..bd28edc52 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.games.evolution.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class EvolutionAbilityUseEvent extends PlayerEvent implements Cancellable +{ + private static HandlerList _handlers = new HandlerList(); + + private boolean _cancelled = false; + + public EvolutionAbilityUseEvent(Player who) + { + super(who); + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index f75b4bb03..502b51653 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -1,12 +1,20 @@ package nautilus.game.arcade.game.games.evolution.evolve; +import java.util.ArrayList; +import java.util.Iterator; + +import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextBottom; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.recharge.Recharge; +import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; @@ -28,15 +36,17 @@ import net.minecraft.server.v1_7_R4.World; import org.bukkit.Bukkit; import org.bukkit.Color; -import org.bukkit.Location; import org.bukkit.FireworkEffect.Type; +import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.util.Vector; public class EvolveData { - private long _curtime = System.currentTimeMillis(); + private final long _timestamp = System.currentTimeMillis(); + private long _endTime = System.currentTimeMillis(); private final EvolveManager _manager; @@ -44,90 +54,161 @@ public class EvolveData private final Player _player; - private final EntityType _from; - private final EntityType _to; + private final EvoKit _to; - private boolean _switch = true; - - private int _stage; - - private EntityInsentient _eFrom; + private final EntityInsentient _eFrom; private EntityInsentient _eTo; - public EvolveData(EvolveManager manager, Player player, EntityType from, EntityType to) + private String _evolveTop; + private int _descIndex = 0; + + private ArrayList _rotateLocs = new ArrayList(); + private Iterator _rotateIterator; + private double _radius = 4.0; +// private Bat _ride; + + public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to) { _manager = manager; _player = player; - _from = from; _to = to; + _evolveTop = C.cWhite + "You evolved into " + ("aeiou".indexOf(_to.GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + C.cGreen + C.Bold + _to.GetName(); + + _eFrom = spawn(from.getEntity()); + + setupLocs(); +// spawnBat(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); } + private void setupLocs() + { + for (double i = 0 ; i < 50.0 ; i+= .02) + { + Location loc = _manager.getLocation().clone().add(Math.cos(i) * _radius, 3.0, Math.sin(i) * _radius); + + Vector pyRef = UtilAlg.getTrajectory(loc, _manager.getLocation()); + + loc.setPitch(UtilAlg.GetPitch(pyRef)); + loc.setYaw(UtilAlg.GetYaw(pyRef)); + + _rotateLocs.add(loc); + } + + _rotateIterator = _rotateLocs.iterator(); + + _player.teleport(_rotateIterator.next()); + _player.setAllowFlight(true); + _player.setFlying(true); + } + +// private void spawnBat() +// { +// _manager.Host.CreatureAllowOverride = true; +// _ride = _player.getWorld().spawn(_rotateLocs.get(0), Bat.class); +// +// UtilEnt.Vegetate(_ride); +// UtilEnt.silence(_ride, true); +// UtilEnt.ghost(_ride, false, true); +// +// _manager.Host.CreatureAllowOverride = false; +// +// _ride.setPassenger(_player); +// ((CraftPlayer) _player).getHandle().spectating = true; +// } + //Boolean completed public boolean tick() { teleport(); - if (!_active) - { - if (!UtilTime.elapsed(_curtime, 4000)) - return false; - - Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); - return true; - } - - _stage++; - - if (_stage > 12) - { - _active = false; - - Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); - - _curtime = System.currentTimeMillis(); - - UtilFirework.playFirework(_manager.getLocation().clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); + //Hasn't ended yet + if (_active) + { + //If 2 seconds past + if (UtilTime.elapsed(_timestamp, 2400)) + { + _active = false; + _endTime = System.currentTimeMillis(); + + _eTo = spawn(_to.getEntity()); + despawn(_eFrom); + + UtilFirework.playFirework(_manager.getLocation().clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); + + UtilTextMiddle.display(null, _evolveTop, _player); + + Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); + } + else + { + //Play particles + if (UtilTime.elapsed(_timestamp, 500)) + { + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, new Location(_eFrom.world.getWorld(), _eFrom.locX, _eFrom.locY + 1.0, _eFrom.locZ), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.SHORT, _player); + } + } return false; } - - if (!UtilTime.elapsed(_curtime, 1000 * (6 - (_stage / 2)))) - return false; - - _curtime = System.currentTimeMillis(); - - _switch = !_switch; - - if (_switch) - { - despawn(_eTo); - _eFrom = spawn(_from); - - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, new Location(_eFrom.world.getWorld(), _eFrom.locX, _eFrom.locY, _eFrom.locZ), 0.5F, 0.5F, 0.5F, 0, 5, ViewDist.SHORT, _player); - } else { - despawn(_eFrom); - _eTo = spawn(_to); + //If no desc to display + if (_to.GetDesc().length <= 0) + { + //Don't start displaying desc until after 1 second from evolve + if (!UtilTime.elapsed(_endTime, 4000)) + return false; + + despawn(_eTo); + +// _ride.eject(); +// _ride.remove(); +// +// ((CraftPlayer) _player).getHandle().spectating = false; + + Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); + return true; + } - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, new Location(_eTo.world.getWorld(), _eTo.locX, _eTo.locY, _eTo.locZ), 0.5F, 0.5F, 0.5F, 0, 5, ViewDist.SHORT, _player); + //Don't start displaying until 1 second after evolve + if (!UtilTime.elapsed(_endTime, 1500)) + return false; + + if (_descIndex >= _to.GetDesc().length) + { + if (!Recharge.Instance.usable(_player, "EvolveDesc")) + return false; + + despawn(_eTo); + + Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); + return true; + } + + if (!Recharge.Instance.use(_player, "EvolveDesc", 2200, false, false)) + return false; + + UtilTextBottom.display(_to.GetDesc()[_descIndex], _player); + + _descIndex++; + return false; } - - return false; } private void teleport() - { - _player.setFlying(true); + { + _player.setFireTicks(0); _player.setHealth(20.0); + _player.setAllowFlight(true); + _player.setFlying(true); - Location newLoc = UtilAlg.getTrajectory(_player.getLocation(), _manager.getLocation()).normalize().toLocation(_player.getWorld()); - newLoc.add(Math.cos((Math.PI / 14) * _player.getTicksLived()) * 4.0, .1, Math.sin((Math.PI / 14) * _player.getTicksLived()) * 4.0); - - _player.teleport(_manager.getLocation()); + if (!_rotateIterator.hasNext()) + _rotateIterator = _rotateLocs.iterator(); + + _player.teleport(_rotateIterator.next()); } private EntityInsentient spawn(EntityType type) @@ -139,6 +220,11 @@ public class EvolveData PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(entity); entity.setCustomNameVisible(false); + if (entity instanceof EntitySlime) + { + ((EntitySlime) entity).setSize(4); + } + UtilPlayer.sendPacket(_player, packet); return entity; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index de841782a..a9fe89f2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -5,15 +5,15 @@ import java.util.Map.Entry; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.Evolution; import org.bukkit.Location; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; public class EvolveManager { - private final Evolution _host; + public final Evolution Host; private final Location _evolveLoc; @@ -21,7 +21,7 @@ public class EvolveManager public EvolveManager(Evolution evolution, Location evolveLoc) { - _host = evolution; + Host = evolution; _evolveLoc = evolveLoc; } @@ -31,13 +31,13 @@ public class EvolveManager } public boolean isEvolving(Player player) - { + { return _data.containsKey(player.getName()); } - public void addEvolve(Player player, EntityType from, EntityType to) + public void addEvolve(Player player, EvoKit from, EvoKit to) { - if (!_data.containsKey(player.getName())) + if (_data.containsKey(player.getName())) return; _data.put(player.getName(), new EvolveData(this, player, from, to)); @@ -58,7 +58,7 @@ public class EvolveManager continue; } - if (!_host.IsAlive(player)) + if (!Host.IsAlive(player)) { iterator.remove(); continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAgility.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAgility.java deleted file mode 100644 index a1c9ad09d..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAgility.java +++ /dev/null @@ -1,40 +0,0 @@ -package nautilus.game.arcade.game.games.evolution.kits; - -import mineplex.core.common.util.F; -import mineplex.core.itemstack.ItemBuilder; -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.PerkDoubleJump; -import nautilus.game.arcade.kit.perks.PerkSpeed; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - -public class KitAgility extends Kit -{ - public KitAgility(ArcadeManager manager) - { - super(manager, "Agility", KitAvailability.Free, - - new String[] - { - "Before you dedicated your life to Evolution,", - "you were an extremely agile circus star!" - }, - new Perk[] - { - new PerkDoubleJump("Double Jump", 0.8, 0.8, false), - new PerkSpeed(0), - }, - EntityType.ZOMBIE, new ItemBuilder(Material.FEATHER).build()); - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java deleted file mode 100644 index ee59b235d..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java +++ /dev/null @@ -1,39 +0,0 @@ -package nautilus.game.arcade.game.games.evolution.kits; - -import mineplex.core.common.util.F; -import mineplex.core.itemstack.ItemBuilder; -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.PerkRegeneration; -import nautilus.game.arcade.kit.perks.PerkVampire; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - -public class KitHealth extends Kit -{ - public KitHealth(ArcadeManager manager) - { - super(manager, "Vitality", KitAvailability.Free, - - new String[] - { - "You're better at surviving than a cockroach!" - }, - new Perk[] - { - new PerkVampire(6), - new PerkRegeneration(0) - }, - EntityType.ZOMBIE, new ItemBuilder(Material.POTION, 1, (short) 8197).build()); - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitPlayer.java new file mode 100644 index 000000000..ed1a6ef4c --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitPlayer.java @@ -0,0 +1,30 @@ +package nautilus.game.arcade.game.games.evolution.kits; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class KitPlayer extends Kit +{ + public KitPlayer(ArcadeManager manager) + { + super(manager, "Player", KitAvailability.Free, 0, new String[] + { + "They grow up so fast :')" + }, new Perk[] + { + + }, EntityType.SKELETON, null); + } + + @Override + public void GiveItems(Player player) + { + + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitRecharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitRecharge.java deleted file mode 100644 index de9ea52f7..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitRecharge.java +++ /dev/null @@ -1,41 +0,0 @@ -package nautilus.game.arcade.game.games.evolution.kits; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - -import mineplex.core.common.util.F; -import mineplex.core.itemstack.ItemBuilder; -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.PerkRecharge; - -public class KitRecharge extends Kit -{ - public KitRecharge(ArcadeManager manager) - { - super(manager, "Stamina", KitAvailability.Free, - - new String[] - { - "You focus your mind before every game ", - "allowing you to perform skills more often!" - }, - - new Perk[] - { - new PerkRecharge(0.5), - }, - EntityType.ZOMBIE, - null); - - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); - } -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java index 9ea8a0d8a..a1021185d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java @@ -6,8 +6,8 @@ import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkFlamingSwordEVO; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkFlamingSword; import org.bukkit.Material; import org.bukkit.Sound; @@ -26,7 +26,7 @@ public class KitBlaze extends EvoKit }, new Perk[] { - new PerkFlamingSword() + new PerkFlamingSwordEVO() }, EntityType.BLAZE); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index f4a9ff102..ab5663cc2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -1,20 +1,27 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseChicken; import mineplex.core.itemstack.ItemBuilder; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkConstructor; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.Egg; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; public class KitChicken extends EvoKit { @@ -44,6 +51,40 @@ public class KitChicken extends EvoKit player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } + + @EventHandler + public void onInteract(final PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!HasKit(event.getPlayer())) + return; + + if (!UtilGear.isMat(event.getItem(), Material.EGG)) + return; + + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer()); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + { + event.setCancelled(true); + + Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + UtilInv.Update(event.getPlayer()); + } + }, 10); + return; + } + } @EventHandler public void EggHit(CustomDamageEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java index 576b615de..5b9486db5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java @@ -1,19 +1,24 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSkeleton; import mineplex.core.itemstack.ItemBuilder; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkBarrage; import nautilus.game.arcade.kit.perks.PerkFletcher; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityShootBowEvent; public class KitSkeleton extends EvoKit { @@ -49,4 +54,37 @@ public class KitSkeleton extends EvoKit player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } + + @EventHandler + public void onBowShoot(final EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!Manager.GetGame().IsLive()) + return; + + final Player player = (Player) event.getEntity(); + + if (!HasKit(player)) + return; + + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + { + event.setCancelled(true); + + Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + UtilInv.Update(player); + } + }, 10); + return; + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java index 5db2d73af..2342a1cce 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java @@ -1,21 +1,28 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseSnowman; import mineplex.core.itemstack.ItemBuilder; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkArcticAura; import nautilus.game.arcade.kit.perks.PerkConstructor; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Snowball; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; public class KitSnowman extends EvoKit { @@ -50,6 +57,40 @@ public class KitSnowman extends EvoKit player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); } + @EventHandler + public void onInteract(final PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!HasKit(event.getPlayer())) + return; + + if (!UtilGear.isMat(event.getItem(), Material.SNOW_BALL)) + return; + + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer()); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + { + event.setCancelled(true); + + Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + UtilInv.Update(event.getPlayer()); + } + }, 10); + return; + } + } + @EventHandler public void SnowballHit(CustomDamageEvent event) { @@ -73,6 +114,6 @@ public class KitSnowman extends EvoKit if (!(event.GetProjectile() instanceof Snowball)) return; - event.AddMod("Snowman Kit", "Egg", 3, true); + event.AddMod("Snowman Kit", "Snowball", 3, true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java index c08759025..4aa115b57 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java @@ -18,11 +18,13 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.data.BlockTossData; import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; +import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.block.Block; @@ -68,6 +70,12 @@ public class PerkBlockTossEVO extends Perk implements IThrown if (!Kit.HasKit(player)) return; + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + if (!UtilInv.IsItem(event.getItem(), Material.IRON_SWORD, (byte) 0)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index 7d01eb70f..3114d7118 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -14,8 +14,10 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -55,6 +57,12 @@ public class PerkBounceEVO extends Perk if (!Kit.HasKit(player)) return; + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java new file mode 100644 index 000000000..1475935cd --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java @@ -0,0 +1,141 @@ +package nautilus.game.arcade.game.games.evolution.mobs.perks; + +import java.util.HashMap; + +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.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; +import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; + +public class PerkFlamingSwordEVO extends Perk +{ + private HashMap _active = new HashMap(); + + public PerkFlamingSwordEVO() + { + super("Flaming Sword", new String[] + { + "Attacks ignite opponents for 4 seconds.", + C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Inferno" + }); + } + + @EventHandler(priority = EventPriority.HIGH) + public void IgniteTarget(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!Kit.HasKit(damager)) + return; + + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(damager); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + + Manager.GetCondition().Factory().Ignite("Flaming Sword", event.GetDamageeEntity(), damager, 4, false, false); + } + + @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("_SWORD")) + return; + + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + + if (!Recharge.Instance.use(player, "Inferno", 4000, true, true)) + return; + + _active.put(player, System.currentTimeMillis()); + + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Inferno") + ".")); + } + + @EventHandler + public void Update(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player cur : UtilServer.getPlayers()) + { + if (!_active.containsKey(cur)) + continue; + + if (!cur.isBlocking()) + { + _active.remove(cur); + continue; + } + + if (UtilTime.elapsed(_active.get(cur), 1500)) + { + _active.remove(cur); + continue; + } + + //Fire + Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); + Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno"); + + fire.teleport(cur.getEyeLocation()); + double x = 0.07 - (UtilMath.r(14)/100d); + double y = 0.07 - (UtilMath.r(14)/100d); + double z = 0.07 - (UtilMath.r(14)/100d); + fire.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6)); + + //Effect + cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f); + } + } + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java index 9026e1a0d..1a54a0c53 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java @@ -14,8 +14,10 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -55,6 +57,12 @@ public class PerkPounceEVO extends Perk if (!Kit.HasKit(player)) return; + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java index 6af2e3783..235b0cb37 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -15,8 +15,10 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Bukkit; import org.bukkit.Effect; import org.bukkit.Material; import org.bukkit.Sound; @@ -77,6 +79,12 @@ public class PerkSiesmicSlamEVO extends Perk if (!Kit.HasKit(player)) return; + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + if (!Recharge.Instance.use(player, GetName(), 7000, true, false)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index fb84d9ed0..b20249615 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -17,8 +17,10 @@ import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; @@ -56,6 +58,12 @@ public class PerkSulphurBombEVO extends Perk implements IThrown if (!Kit.HasKit(player)) return; + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + if (!Recharge.Instance.use(player, GetName(), 3000, true, false)) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java index 896bb0ef5..b7b554b2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -9,8 +9,10 @@ import mineplex.core.projectile.ProjectileUser; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -76,6 +78,12 @@ public class PerkWebEVO extends Perk implements IThrown if (!Kit.HasKit(player)) return; + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + event.setCancelled(true); UtilInv.remove(player, Material.WEB, (byte)0, 1); From 53a3a29cd2f83ddd481634b1f0f15a83c5b0843a Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 31 Jul 2015 00:50:32 -0600 Subject: [PATCH 06/56] Extreme revisions. Cheers! --- .../nautilus/game/arcade/ArcadeManager.java | 2 +- .../addons/{ => compass}/CompassAddon.java | 34 ++++--- .../compass/CompassAttemptTargetEvent.java | 49 ++++++++++ .../arcade/game/games/evolution/EvoKit.java | 9 +- .../game/games/evolution/Evolution.java | 71 +++++++------- .../games/evolution/evolve/EvolveData.java | 93 ++++++------------- .../{KitPlayer.java => KitEvolutionist.java} | 10 +- .../game/games/evolution/mobs/KitBlaze.java | 4 + .../game/games/evolution/mobs/KitChicken.java | 5 + .../game/games/evolution/mobs/KitCreeper.java | 6 +- .../games/evolution/mobs/KitEnderman.java | 4 + .../game/games/evolution/mobs/KitGolem.java | 4 + .../games/evolution/mobs/KitSkeleton.java | 5 + .../game/games/evolution/mobs/KitSlime.java | 4 + .../game/games/evolution/mobs/KitSnowman.java | 14 +-- .../game/games/evolution/mobs/KitSpider.java | 9 +- .../game/games/evolution/mobs/KitWolf.java | 5 + .../mobs/perks/PerkBlockTossEVO.java | 6 +- .../evolution/mobs/perks/PerkBounceEVO.java | 2 +- .../mobs/perks/PerkSiesmicSlamEVO.java | 4 +- .../mobs/perks/PerkSulphurBombEVO.java | 4 +- .../evolution/mobs/perks/PerkWebEVO.java | 29 ------ .../gui/spectatorMenu/SpectatorShop.java | 3 +- .../gui/spectatorMenu/page/SpectatorPage.java | 2 +- .../arcade/kit/perks/PerkConstructor.java | 29 +++--- .../kit/perks/event/PerkConstructorEvent.java | 40 ++++++++ 26 files changed, 268 insertions(+), 179 deletions(-) rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/{ => compass}/CompassAddon.java (96%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAttemptTargetEvent.java rename Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/{KitPlayer.java => KitEvolutionist.java} (58%) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/event/PerkConstructorEvent.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 59bb9719d..c53348209 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -98,9 +98,9 @@ import mineplex.minecraft.game.core.IRelation; import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.DamageManager; import mineplex.minecraft.game.core.fire.Fire; -import nautilus.game.arcade.addons.CompassAddon; import nautilus.game.arcade.addons.SoupAddon; import nautilus.game.arcade.addons.TeamArmorAddon; +import nautilus.game.arcade.addons.compass.CompassAddon; import nautilus.game.arcade.command.DisguiseCommand; import nautilus.game.arcade.command.GameCommand; import nautilus.game.arcade.command.WriteCommand; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java similarity index 96% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java index 5d121b2ce..5383b0be6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAddon.java @@ -1,21 +1,7 @@ -package nautilus.game.arcade.addons; +package nautilus.game.arcade.addons.compass; import java.util.HashSet; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerDropItemEvent; -import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.plugin.java.JavaPlugin; - import mineplex.core.MiniPlugin; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -34,6 +20,18 @@ import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.gui.spectatorMenu.SpectatorShop; +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.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.ItemMeta; +import org.bukkit.plugin.java.JavaPlugin; + public class CompassAddon extends MiniPlugin { public ArcadeManager Manager; @@ -87,6 +85,12 @@ public class CompassAddon extends MiniPlugin if (target == null || dist < bestDist) { + CompassAttemptTargetEvent tE = new CompassAttemptTargetEvent(player, other); + Bukkit.getServer().getPluginManager().callEvent(tE); + + if (tE.isCancelled()) + continue; + target = other; targetTeam = otherTeam; bestDist = dist; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAttemptTargetEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAttemptTargetEvent.java new file mode 100644 index 000000000..c6c846b10 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/compass/CompassAttemptTargetEvent.java @@ -0,0 +1,49 @@ +package nautilus.game.arcade.addons.compass; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class CompassAttemptTargetEvent extends PlayerEvent implements Cancellable +{ + private static HandlerList _handlers = new HandlerList(); + private boolean _cancelled = false; + + private Player _target; + + public CompassAttemptTargetEvent(Player player, Player target) + { + super(player); + + _target = target; + } + + public Player getTarget() + { + return _target; + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 26172ebb5..b918a37fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -3,11 +3,13 @@ package nautilus.game.arcade.game.games.evolution; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -29,13 +31,18 @@ public abstract class EvoKit extends Kit public void upgradeGive(Player player) { - UtilPlayer.message(player, C.Line); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 0.1F); + + UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, C.Line); + for (String desc : GetDesc()) UtilPlayer.message(player, desc); UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, ArcadeFormat.Line); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index fd0ce1b6a..f82f29d89 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -10,9 +10,11 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; +import nautilus.game.arcade.addons.compass.CompassAttemptTargetEvent; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; @@ -20,7 +22,7 @@ import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager; -import nautilus.game.arcade.game.games.evolution.kits.KitPlayer; +import nautilus.game.arcade.game.games.evolution.kits.KitEvolutionist; import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze; import nautilus.game.arcade.game.games.evolution.mobs.KitChicken; import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper; @@ -32,6 +34,7 @@ import nautilus.game.arcade.game.games.evolution.mobs.KitSnowman; import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; import nautilus.game.arcade.game.games.evolution.mobs.KitWolf; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent; import org.bukkit.Location; import org.bukkit.Material; @@ -39,9 +42,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.vehicle.VehicleExitEvent; -import org.bukkit.scoreboard.DisplaySlot; -import org.bukkit.scoreboard.Objective; public class Evolution extends SoloGame { @@ -52,16 +52,12 @@ public class Evolution extends SoloGame private NautHashMap _tokens = new NautHashMap(); private ArrayList _evoPlatforms = new ArrayList(); - - private Objective _evoObj; - + public Evolution(ArcadeManager manager) { super(manager, GameType.Evolution, - new Kit[] - { - }, + new Kit[0], new String[] { "You evolve when you get a kill.", @@ -81,18 +77,21 @@ public class Evolution extends SoloGame _mobKits.add(new KitChicken(manager)); _mobKits.add(new KitSkeleton(manager)); - Kit[] kits = new Kit[_mobKits.size() + 1]; + ArrayList kits = new ArrayList(); - for (int i = 0 ; i < _mobKits.size() ; i++) + kits.add(new KitEvolutionist(manager)); + kits.addAll(_mobKits); + + Kit[] aKits = new Kit[kits.size()]; + + for (Kit kit : kits) { - if (i == 0) - kits[0] = new KitPlayer(manager); - - kits[i] = _mobKits.get(i); + aKits[kits.indexOf(kit)] = kit; } - setKits(kits); + setKits(aKits); + DamageFall = false; DamageTeamSelf = true; HungerSet = 20; @@ -113,9 +112,6 @@ public class Evolution extends SoloGame DeathSpectateSecs = 4.0; VersionRequire1_8 = true; - - _evoObj = Scoreboard.GetScoreboard().registerNewObjective("Evolutions", "dummy"); - _evoObj.setDisplaySlot(DisplaySlot.BELOW_NAME); } public EvolveManager getEvolve() @@ -145,8 +141,6 @@ public class Evolution extends SoloGame _tokens.put(player.getName(), new EvoToken(player)); upgradeKit(player, false); - - _evoObj.getScore(GetTeam(player).GetColor() + player.getName()).setScore(0); } } @@ -237,15 +231,22 @@ public class Evolution extends SoloGame } @EventHandler - public void onEvolveDismount(VehicleExitEvent event) + public void onEvolveCompass(CompassAttemptTargetEvent event) { if (!IsLive()) return; - if (!(event.getExited() instanceof Player)) + if (_evolve.isEvolving(event.getTarget())) + event.setCancelled(true); + } + + @EventHandler + public void onEvolveConstruct(PerkConstructorEvent event) + { + if (!IsLive()) return; - if (_evolve.isEvolving((Player) event.getExited())) + if (_evolve.isEvolving(event.getPlayer())) event.setCancelled(true); } @@ -264,12 +265,20 @@ public class Evolution extends SoloGame } @EventHandler - public void endEvolve(EvolutionPostEvolveEvent event) - { - Manager.GetCondition().Clean(event.getPlayer()); - event.getPlayer().setAllowFlight(false); - event.getPlayer().setFlying(false); + public void endEvolve(final EvolutionPostEvolveEvent event) + { event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); + + Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + SetKit(event.getPlayer(), GetKit(event.getPlayer()), false); + } + }, 4); + + Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); } @EventHandler @@ -293,7 +302,6 @@ public class Evolution extends SoloGame return; increaseScore(killer); - _evoObj.getScore(GetTeam(killer).GetColor() + killer.getName()).setScore(getScore(killer)); ScoreboardUpdate(new UpdateEvent(UpdateType.FAST)); @@ -402,7 +410,6 @@ public class Evolution extends SoloGame for (Player player : GetPlayers(true)) { Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true); - _evoObj.getScore(GetTeam(player).GetColor() + player.getName()).setScore(getScore(player)); } Scoreboard.Draw(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 502b51653..a4a7928f0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -10,10 +10,9 @@ import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTextBottom; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; -import mineplex.core.recharge.Recharge; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; @@ -39,6 +38,8 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -60,12 +61,10 @@ public class EvolveData private EntityInsentient _eTo; private String _evolveTop; - private int _descIndex = 0; private ArrayList _rotateLocs = new ArrayList(); private Iterator _rotateIterator; - private double _radius = 4.0; -// private Bat _ride; + private double _radius = 3.4; public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to) { @@ -79,7 +78,6 @@ public class EvolveData _eFrom = spawn(from.getEntity()); setupLocs(); -// spawnBat(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); } @@ -99,27 +97,8 @@ public class EvolveData } _rotateIterator = _rotateLocs.iterator(); - - _player.teleport(_rotateIterator.next()); - _player.setAllowFlight(true); - _player.setFlying(true); } - -// private void spawnBat() -// { -// _manager.Host.CreatureAllowOverride = true; -// _ride = _player.getWorld().spawn(_rotateLocs.get(0), Bat.class); -// -// UtilEnt.Vegetate(_ride); -// UtilEnt.silence(_ride, true); -// UtilEnt.ghost(_ride, false, true); -// -// _manager.Host.CreatureAllowOverride = false; -// -// _ride.setPassenger(_player); -// ((CraftPlayer) _player).getHandle().spectating = true; -// } - + //Boolean completed public boolean tick() { @@ -155,56 +134,40 @@ public class EvolveData } else { - //If no desc to display - if (_to.GetDesc().length <= 0) - { - //Don't start displaying desc until after 1 second from evolve - if (!UtilTime.elapsed(_endTime, 4000)) - return false; - - despawn(_eTo); - -// _ride.eject(); -// _ride.remove(); -// -// ((CraftPlayer) _player).getHandle().spectating = false; - - Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); - return true; - } - - //Don't start displaying until 1 second after evolve - if (!UtilTime.elapsed(_endTime, 1500)) + if (!UtilTime.elapsed(_endTime, 2400)) return false; - if (_descIndex >= _to.GetDesc().length) + despawn(_eTo); + + for (ConditionType type : ConditionType.values()) { - if (!Recharge.Instance.usable(_player, "EvolveDesc")) - return false; - - despawn(_eTo); - - Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); - return true; + if (type == ConditionType.CLOAK) + continue; + + _manager.Host.Manager.GetCondition().EndCondition(_player, type, "Removing kit effects"); } - - if (!Recharge.Instance.use(_player, "EvolveDesc", 2200, false, false)) - return false; - - UtilTextBottom.display(_to.GetDesc()[_descIndex], _player); - - _descIndex++; - return false; + + _player.setFlying(false); + _player.setAllowFlight(false); + Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); + return true; } } private void teleport() - { - _player.setFireTicks(0); + { + if (_player.getFireTicks() > 0) + _player.setFireTicks(0); + + ((CraftEntity) _player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0)); + + _player.setFallDistance(0); _player.setHealth(20.0); _player.setAllowFlight(true); _player.setFlying(true); + ((CraftPlayer) _player).getHandle().p(0); + if (!_rotateIterator.hasNext()) _rotateIterator = _rotateLocs.iterator(); @@ -222,7 +185,7 @@ public class EvolveData if (entity instanceof EntitySlime) { - ((EntitySlime) entity).setSize(4); + ((EntitySlime) entity).setSize(3); } UtilPlayer.sendPacket(_player, packet); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java similarity index 58% rename from Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitPlayer.java rename to Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java index ed1a6ef4c..6b0840a0a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java @@ -1,24 +1,26 @@ package nautilus.game.arcade.game.games.evolution.kits; +import mineplex.core.itemstack.ItemBuilder; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -public class KitPlayer extends Kit +public class KitEvolutionist extends Kit { - public KitPlayer(ArcadeManager manager) + public KitEvolutionist(ArcadeManager manager) { - super(manager, "Player", KitAvailability.Free, 0, new String[] + super(manager, "Evolutionist", KitAvailability.Free, 0, new String[] { "They grow up so fast :')" }, new Perk[] { - }, EntityType.SKELETON, null); + }, EntityType.SKELETON, new ItemBuilder(Material.IRON_SWORD).build()); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java index a1021185d..832b13482 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java @@ -33,6 +33,10 @@ public class KitBlaze extends EvoKit @Override public void GiveItems(Player player) { + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).build()); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD)); player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 4f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index ab5663cc2..f42566474 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -39,6 +39,11 @@ public class KitChicken extends EvoKit @Override public void GiveItems(Player player) { + player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_IDLE, 4f, 1f); //Disguise diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java index e694f97da..e01a23bf9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java @@ -33,7 +33,11 @@ public class KitCreeper extends EvoKit @Override public void GiveItems(Player player) { - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE)); + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).build()); + + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 4f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java index a21f02190..352ff832f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java @@ -32,6 +32,10 @@ public class KitEnderman extends EvoKit @Override public void GiveItems(Player player) { + player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.CHAINMAIL_BOOTS).build()); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java index 1ce3730da..c7225bdd6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java @@ -33,6 +33,10 @@ public class KitGolem extends EvoKit @Override public void GiveItems(Player player) { + player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.CHAINMAIL_BOOTS).build()); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE)); player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 4f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java index 5b9486db5..6cc4eb454 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java @@ -40,6 +40,11 @@ public class KitSkeleton extends EvoKit @Override public void GiveItems(Player player) { + player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java index 154addc1a..ab3316ed1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java @@ -33,6 +33,10 @@ public class KitSlime extends EvoKit @Override public void GiveItems(Player player) { + player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.CHAINMAIL_BOOTS).build()); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 4f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java index 2342a1cce..3034509b4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java @@ -2,9 +2,9 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.disguise.disguises.DisguiseSnowman; import mineplex.core.itemstack.ItemBuilder; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -12,7 +12,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkArcticAura; import nautilus.game.arcade.kit.perks.PerkConstructor; import org.bukkit.Bukkit; @@ -31,19 +30,22 @@ public class KitSnowman extends EvoKit super(manager, "Snowman", new String[] { - F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball"), - F.elem("You freeze enemies around you with slowness") + F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball") }, new Perk[] { - new PerkConstructor("Snowballer", 0.5, 16, Material.SNOW_BALL, "Snowball", false), - new PerkArcticAura(), + new PerkConstructor("Snowballer", 0.5, 16, Material.SNOW_BALL, "Snowball", false) }, EntityType.SNOWMAN); } @Override public void GiveItems(Player player) { + player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 4f, 1f); //Disguise diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java index 98b4a4677..fd83fcee6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java @@ -8,6 +8,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkWebEVO; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkConstructor; import org.bukkit.Material; import org.bukkit.Sound; @@ -25,13 +26,19 @@ public class KitSpider extends EvoKit }, new Perk[] { - new PerkWebEVO() + new PerkWebEVO(), + new PerkConstructor("Web Weaver", 3.0, 8, Material.WEB, "Spiderweb", false) }, EntityType.SPIDER); } @Override public void GiveItems(Player player) { + player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.CHAINMAIL_BOOTS).build()); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 4f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java index 43e19371b..781e23c04 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java @@ -35,6 +35,11 @@ public class KitWolf extends EvoKit @Override public void GiveItems(Player player) { + player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build()); + player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); + player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); + player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE)); player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 4f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java index 4aa115b57..5db22f185 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java @@ -93,11 +93,9 @@ public class PerkBlockTossEVO extends Perk implements IThrown return; } - if (!Recharge.Instance.use(event.getPlayer(), GetName(), 6000, true, false)) + if (!Recharge.Instance.use(event.getPlayer(), GetName(), 6000, true, true)) return; - - Recharge.Instance.Get(event.getPlayer()).get(GetName()).DisplayForce = true; - + //Event PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData()); UtilServer.getServer().getPluginManager().callEvent(blockEvent); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index 3114d7118..6af1348ca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -63,7 +63,7 @@ public class PerkBounceEVO extends Perk if (useEvent.isCancelled()) return; - if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) + if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) return; UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 0, 0.5, 3.0, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java index 235b0cb37..a836dbfe6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -85,11 +85,9 @@ public class PerkSiesmicSlamEVO extends Perk if (useEvent.isCancelled()) return; - if (!Recharge.Instance.use(player, GetName(), 7000, true, false)) + if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) return; - Recharge.Instance.Get(player).get(GetName()).DisplayForce = true; - //Action Vector vec = player.getLocation().getDirection(); if (vec.getY() < 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index b20249615..7bf7af344 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -64,11 +64,9 @@ public class PerkSulphurBombEVO extends Perk implements IThrown if (useEvent.isCancelled()) return; - if (!Recharge.Instance.use(player, GetName(), 3000, true, false)) + if (!Recharge.Instance.use(player, GetName(), 3000, true, true)) return; - Recharge.Instance.Get(player).get(GetName()).DisplayForce = true; - event.setCancelled(true); Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java index b7b554b2e..098819ace 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -2,13 +2,9 @@ package nautilus.game.arcade.game.games.evolution.mobs.perks; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; import mineplex.core.projectile.ProjectileUser; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.UpdateType; -import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; @@ -33,31 +29,6 @@ public class PerkWebEVO extends Perk implements IThrown }); } - @EventHandler - public void Spawn(UpdateEvent event) - { - if (event.getType() != UpdateType.FAST) - return; - - for (Player cur : UtilServer.getPlayers()) - { - if (!Kit.HasKit(cur)) - continue; - - if (!Manager.GetGame().IsAlive(cur)) - continue; - - if (!Recharge.Instance.use(cur, GetName(), 3000, false, false)) - continue; - - if (UtilInv.contains(cur, Material.WEB, (byte)0, 8)) - continue; - - //Add - cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WEB)); - } - } - @EventHandler public void Throw(PlayerInteractEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/SpectatorShop.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/SpectatorShop.java index cc9686292..26b0de8c3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/SpectatorShop.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/SpectatorShop.java @@ -1,13 +1,14 @@ package nautilus.game.arcade.gui.spectatorMenu; import org.bukkit.entity.Player; + import mineplex.core.account.CoreClientManager; import mineplex.core.common.CurrencyType; import mineplex.core.donation.DonationManager; import mineplex.core.shop.ShopBase; import mineplex.core.shop.page.ShopPageBase; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.addons.CompassAddon; +import nautilus.game.arcade.addons.compass.CompassAddon; import nautilus.game.arcade.gui.spectatorMenu.page.SpectatorPage; /** diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java index 8e7f24c55..ebe10c41a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/gui/spectatorMenu/page/SpectatorPage.java @@ -21,7 +21,7 @@ import mineplex.core.donation.DonationManager; import mineplex.core.shop.item.ShopItem; import mineplex.core.shop.page.ShopPageBase; import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.addons.CompassAddon; +import nautilus.game.arcade.addons.compass.CompassAddon; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.gui.spectatorMenu.SpectatorShop; import nautilus.game.arcade.gui.spectatorMenu.button.SpectatorButton; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkConstructor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkConstructor.java index 7b031d8c1..62b42fdbc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkConstructor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkConstructor.java @@ -2,15 +2,6 @@ package nautilus.game.arcade.kit.perks; import java.util.HashSet; -import org.bukkit.GameMode; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.player.PlayerDropItemEvent; - import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; @@ -18,10 +9,20 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.recharge.Recharge; -import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent; + +import org.bukkit.Bukkit; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.PlayerDeathEvent; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.player.PlayerDropItemEvent; public class PerkConstructor extends Perk { @@ -71,6 +72,12 @@ public class PerkConstructor extends Perk if (UtilInv.contains(cur, _type, (byte)0, _max)) continue; + PerkConstructorEvent cE = new PerkConstructorEvent(cur); + Bukkit.getServer().getPluginManager().callEvent(cE); + + if (cE.isCancelled()) + continue; + //Add byte data = 0; if (_type == Material.WOOL) @@ -83,7 +90,7 @@ public class PerkConstructor extends Perk continue; cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, team.GetColorData(), 1)); - return; + continue; } cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(_type, data, 1, F.item(_name))); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/event/PerkConstructorEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/event/PerkConstructorEvent.java new file mode 100644 index 000000000..4a077dafa --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/event/PerkConstructorEvent.java @@ -0,0 +1,40 @@ +package nautilus.game.arcade.kit.perks.event; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class PerkConstructorEvent extends PlayerEvent implements Cancellable +{ + private static HandlerList _handlers = new HandlerList(); + + private boolean _cancelled = false; + + public PerkConstructorEvent(Player who) + { + super(who); + } + + @Override + public void setCancelled(boolean cancelled) + { + _cancelled = cancelled; + } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + public static HandlerList getHandlerList() + { + return _handlers; + } + + public HandlerList getHandlers() + { + return getHandlerList(); + } +} From 62072077c19ed6f7dc5e18a0dd297f5a56236e65 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sat, 1 Aug 2015 00:47:44 -0600 Subject: [PATCH 07/56] Fixed evolution rotation --- .../arcade/game/games/evolution/EvoKit.java | 4 +- .../game/games/evolution/Evolution.java | 33 +++---- .../games/evolution/evolve/EvolveData.java | 93 ++++++++++++++----- .../games/evolution/evolve/EvolveManager.java | 5 + 4 files changed, 88 insertions(+), 47 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index b918a37fa..45f70f190 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -33,6 +33,8 @@ public abstract class EvoKit extends Kit { player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 0.1F); + UtilPlayer.message(player, C.Line); + UtilPlayer.message(player, C.Line); UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName()) + "!"); @@ -43,7 +45,7 @@ public abstract class EvoKit extends Kit UtilPlayer.message(player, C.Line); UtilPlayer.message(player, ArcadeFormat.Line); - } + } @Override public abstract void GiveItems(Player player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index f82f29d89..ca0a92956 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -172,6 +172,18 @@ public class Evolution extends SoloGame _evolve.tick(); } + @EventHandler + public void moveEvolve(PlayerMoveEvent event) + { + if (!IsLive()) + return; + + if (!_evolve.isEvolving(event.getPlayer())) + return; + + _evolve.getEvolve(event.getPlayer()).teleport(); + } + @Override public boolean HasKit(Player player, Kit kit) { @@ -210,16 +222,6 @@ public class Evolution extends SoloGame event.SetCancelled("Player is evolving!"); } - @EventHandler - public void onEvolveMove(PlayerMoveEvent event) - { - if (!IsLive()) - return; - - if (_evolve.isEvolving(event.getPlayer())) - event.getPlayer().teleport(event.getFrom()); - } - @EventHandler public void onEvolveAbility(EvolutionAbilityUseEvent event) { @@ -268,17 +270,6 @@ public class Evolution extends SoloGame public void endEvolve(final EvolutionPostEvolveEvent event) { event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); - - Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - @Override - public void run() - { - SetKit(event.getPlayer(), GetKit(event.getPlayer()), false); - } - }, 4); - - Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index a4a7928f0..93946bf66 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -4,7 +4,9 @@ import java.util.ArrayList; import java.util.Iterator; import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -12,6 +14,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; @@ -38,8 +41,8 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.Bat; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -62,15 +65,21 @@ public class EvolveData private String _evolveTop; + private Bat _bat; + private ArrayList _rotateLocs = new ArrayList(); private Iterator _rotateIterator; - private double _radius = 3.4; + + private double _radius = 4.0; + private double _speed = 6.0; + private double _height = 2.5; public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to) { _manager = manager; _player = player; + _manager.Host.Manager.GetCondition().Factory().Cloak(null, _player, null, Double.MAX_VALUE, false, false); _to = to; _evolveTop = C.cWhite + "You evolved into " + ("aeiou".indexOf(_to.GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + C.cGreen + C.Bold + _to.GetName(); @@ -78,13 +87,16 @@ public class EvolveData _eFrom = spawn(from.getEntity()); setupLocs(); + setupBat(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); + + teleport(); } private void setupLocs() { - for (double i = 0 ; i < 50.0 ; i+= .02) + for (double i = 0 ; i < 50.0 ; i+= .03) { Location loc = _manager.getLocation().clone().add(Math.cos(i) * _radius, 3.0, Math.sin(i) * _radius); @@ -98,6 +110,23 @@ public class EvolveData _rotateIterator = _rotateLocs.iterator(); } + + private void setupBat() + { + _manager.Host.CreatureAllowOverride = true; + Bat bat = _manager.getLocation().getWorld().spawn(_rotateIterator.next(), Bat.class); + _manager.Host.CreatureAllowOverride = false; + + bat.setAwake(true); + bat.setRemoveWhenFarAway(false); + + UtilEnt.Vegetate(bat, true); + UtilEnt.ghost(bat, false, true); + + bat.setPassenger(_player); + + _bat = bat; + } //Boolean completed public boolean tick() @@ -120,6 +149,19 @@ public class EvolveData UtilTextMiddle.display(null, _evolveTop, _player); + for (ConditionType type : ConditionType.values()) + { + if (type == ConditionType.CLOAK) + continue; + + if (!_manager.Host.Manager.GetCondition().HasCondition(_player, type, null)) + continue; + + _manager.Host.Manager.GetCondition().GetActiveCondition(_player, type).Expire(); + } + + _manager.Host.SetKit(_player, _manager.Host.GetKit(_player), false); + Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); } else @@ -137,43 +179,44 @@ public class EvolveData if (!UtilTime.elapsed(_endTime, 2400)) return false; - despawn(_eTo); + despawn(_eTo); + + _player.leaveVehicle(); + _bat.remove(); - for (ConditionType type : ConditionType.values()) - { - if (type == ConditionType.CLOAK) - continue; - - _manager.Host.Manager.GetCondition().EndCondition(_player, type, "Removing kit effects"); - } - - _player.setFlying(false); - _player.setAllowFlight(false); Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); + + Condition cloak = _manager.Host.Manager.GetCondition().GetActiveCondition(_player, ConditionType.CLOAK); + + if (cloak != null) + cloak.Expire(); + return true; } } - private void teleport() + public void teleport() { + _player.teleport(_player.getLocation().setDirection(UtilAlg.getTrajectory(_player.getEyeLocation(), _manager.getLocation()))); + + if (_bat.isEmpty() || _bat.getPassenger() != _player) + _bat.setPassenger(_player); + if (_player.getFireTicks() > 0) _player.setFireTicks(0); - - ((CraftEntity) _player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0)); - + _player.setFallDistance(0); _player.setHealth(20.0); - _player.setAllowFlight(true); - _player.setFlying(true); ((CraftPlayer) _player).getHandle().p(0); - if (!_rotateIterator.hasNext()) - _rotateIterator = _rotateLocs.iterator(); - - _player.teleport(_rotateIterator.next()); + //Orbit + double oX = -Math.sin(_bat.getTicksLived() / _speed) * 2 * _radius; + double oZ = Math.cos(_bat.getTicksLived() / _speed) * 2 * _radius; + + UtilAction.velocity(_bat, UtilAlg.getTrajectory(_bat.getLocation(), _manager.getLocation().clone().add(oX, _height, oZ)), 0.4, false, 0, 0.1, 1, true); } - + private EntityInsentient spawn(EntityType type) { try diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index a9fe89f2e..c015b574a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -43,6 +43,11 @@ public class EvolveManager _data.put(player.getName(), new EvolveData(this, player, from, to)); } + public EvolveData getEvolve(Player player) + { + return _data.get(player.getName()); + } + public void tick() { Iterator> iterator = _data.entrySet().iterator(); From 9c14e3d35a6f5d49c8b5066871a26ae599cb36f9 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sat, 1 Aug 2015 17:24:12 -0600 Subject: [PATCH 08/56] Worked on evolution --- .../arcade/game/games/evolution/EvoKit.java | 2 +- .../game/games/evolution/Evolution.java | 34 ++++- .../games/evolution/evolve/EvolveData.java | 131 +++++++++++------- 3 files changed, 116 insertions(+), 51 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 45f70f190..e2f76ea9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -36,7 +36,7 @@ public abstract class EvoKit extends Kit UtilPlayer.message(player, C.Line); UtilPlayer.message(player, C.Line); UtilPlayer.message(player, ArcadeFormat.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName()) + "!"); + UtilPlayer.message(player, C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName())); UtilPlayer.message(player, C.Line); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index ca0a92956..7343a2b25 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -10,7 +10,6 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -42,6 +41,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.vehicle.VehicleExitEvent; public class Evolution extends SoloGame { @@ -53,6 +53,8 @@ public class Evolution extends SoloGame private ArrayList _evoPlatforms = new ArrayList(); + private ArrayList _except = new ArrayList(); + public Evolution(ArcadeManager manager) { super(manager, GameType.Evolution, @@ -119,6 +121,11 @@ public class Evolution extends SoloGame return _evolve; } + public void addDismountException(Player player) + { + _except.add(player.getName()); + } + @Override public void ParseData() { @@ -181,7 +188,7 @@ public class Evolution extends SoloGame if (!_evolve.isEvolving(event.getPlayer())) return; - _evolve.getEvolve(event.getPlayer()).teleport(); + _evolve.getEvolve(event.getPlayer()).teleport(false); } @Override @@ -252,6 +259,29 @@ public class Evolution extends SoloGame event.setCancelled(true); } + @EventHandler + public void onEvolveDismount(VehicleExitEvent event) + { + if (!IsLive()) + return; + + if (!(event.getExited() instanceof Player)) + return; + + Player player = (Player) event.getExited(); + + if (!_evolve.isEvolving(player)) + return; + + if (!_except.contains(player.getName())) + { + event.setCancelled(true); + return; + } + + _except.remove(player.getName()); + } + @EventHandler public void startEvolve(EvolutionBeginEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 93946bf66..d88c1c88b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.evolution.evolve; -import java.util.ArrayList; -import java.util.Iterator; +import java.lang.reflect.Method; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilAction; @@ -14,18 +13,19 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; -import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; +import net.minecraft.server.v1_7_R4.Entity; import net.minecraft.server.v1_7_R4.EntityBlaze; import net.minecraft.server.v1_7_R4.EntityChicken; import net.minecraft.server.v1_7_R4.EntityCreeper; import net.minecraft.server.v1_7_R4.EntityEnderman; import net.minecraft.server.v1_7_R4.EntityInsentient; import net.minecraft.server.v1_7_R4.EntityIronGolem; +import net.minecraft.server.v1_7_R4.EntityPlayer; import net.minecraft.server.v1_7_R4.EntitySkeleton; import net.minecraft.server.v1_7_R4.EntitySlime; import net.minecraft.server.v1_7_R4.EntitySnowman; @@ -67,13 +67,9 @@ public class EvolveData private Bat _bat; - private ArrayList _rotateLocs = new ArrayList(); - private Iterator _rotateIterator; - - private double _radius = 4.0; - private double _speed = 6.0; - private double _height = 2.5; - +// private ArrayList _rotateLocs = new ArrayList(); +// private Iterator _rotateIterator; + public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to) { _manager = manager; @@ -86,35 +82,35 @@ public class EvolveData _eFrom = spawn(from.getEntity()); - setupLocs(); +// setupLocs(); setupBat(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); - teleport(); + teleport(true); } - private void setupLocs() - { - for (double i = 0 ; i < 50.0 ; i+= .03) - { - Location loc = _manager.getLocation().clone().add(Math.cos(i) * _radius, 3.0, Math.sin(i) * _radius); - - Vector pyRef = UtilAlg.getTrajectory(loc, _manager.getLocation()); - - loc.setPitch(UtilAlg.GetPitch(pyRef)); - loc.setYaw(UtilAlg.GetYaw(pyRef)); - - _rotateLocs.add(loc); - } - - _rotateIterator = _rotateLocs.iterator(); - } +// private void setupLocs() +// { +// for (double i = 0 ; i < 50.0 ; i+= .03) +// { +// Location loc = _manager.getLocation().clone().add(Math.cos(i) * _radius, 3.0, Math.sin(i) * _radius); +// +// Vector pyRef = UtilAlg.getTrajectory(loc, _manager.getLocation()); +// +// loc.setPitch(UtilAlg.GetPitch(pyRef)); +// loc.setYaw(UtilAlg.GetYaw(pyRef)); +// +// _rotateLocs.add(loc); +// } +// +// _rotateIterator = _rotateLocs.iterator(); +// } private void setupBat() { _manager.Host.CreatureAllowOverride = true; - Bat bat = _manager.getLocation().getWorld().spawn(_rotateIterator.next(), Bat.class); + Bat bat = _manager.getLocation().getWorld().spawn(_manager.getLocation(), Bat.class); _manager.Host.CreatureAllowOverride = false; bat.setAwake(true); @@ -122,8 +118,6 @@ public class EvolveData UtilEnt.Vegetate(bat, true); UtilEnt.ghost(bat, false, true); - - bat.setPassenger(_player); _bat = bat; } @@ -131,7 +125,7 @@ public class EvolveData //Boolean completed public boolean tick() { - teleport(); + teleport(false); //Hasn't ended yet if (_active) @@ -179,29 +173,24 @@ public class EvolveData if (!UtilTime.elapsed(_endTime, 2400)) return false; - despawn(_eTo); + despawn(_eTo); _player.leaveVehicle(); + _manager.Host.addDismountException(_player); + + _player.setVelocity(new Vector()); + _bat.remove(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); - Condition cloak = _manager.Host.Manager.GetCondition().GetActiveCondition(_player, ConditionType.CLOAK); - - if (cloak != null) - cloak.Expire(); - + _manager.Host.Manager.GetCondition().GetActiveCondition(_player, ConditionType.CLOAK).Expire(); return true; } } - public void teleport() + public void teleport(boolean teleport) { - _player.teleport(_player.getLocation().setDirection(UtilAlg.getTrajectory(_player.getEyeLocation(), _manager.getLocation()))); - - if (_bat.isEmpty() || _bat.getPassenger() != _player) - _bat.setPassenger(_player); - if (_player.getFireTicks() > 0) _player.setFireTicks(0); @@ -210,11 +199,57 @@ public class EvolveData ((CraftPlayer) _player).getHandle().p(0); - //Orbit - double oX = -Math.sin(_bat.getTicksLived() / _speed) * 2 * _radius; - double oZ = Math.cos(_bat.getTicksLived() / _speed) * 2 * _radius; + double sizeMod = 3.5; + double speed = 15d; + double oX = -Math.sin(_bat.getTicksLived()/speed) * 2 * sizeMod; + double oY = 3; + double oZ = Math.cos(_bat.getTicksLived()/speed) * 2 * sizeMod; - UtilAction.velocity(_bat, UtilAlg.getTrajectory(_bat.getLocation(), _manager.getLocation().clone().add(oX, _height, oZ)), 0.4, false, 0, 0.1, 1, true); + if (teleport) + { + _bat.teleport(_manager.getLocation().clone().add(oX, oY, oZ)); + } + else + { + UtilAction.velocity(_bat, + UtilAlg.getTrajectory(_bat.getLocation(), _manager.getLocation().clone().add(oX, oY, oZ)), + 0.4, false, 0, 0.0, 1, true); + } + + if (_bat.isEmpty() || _bat.getPassenger() != _player) + { + _bat.setPassenger(_player); + ((CraftPlayer) _player).getHandle().setSneaking(false); + } + + EntityPlayer eP = ((CraftPlayer) _player).getHandle(); + + Vector to = UtilAlg.getTrajectory(_player.getEyeLocation(), _manager.getLocation()); + + try + { + + float pitch = ; + float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory(_player.getEyeLocation(), _manager.getLocation())); + + eP.lastYaw = yaw; + eP.yaw = yaw; + + eP.lastPitch = pitch; + eP.pitch = pitch; + + Method method = Entity.class.getDeclaredMethod("b", float.class, float.class); + method.setAccessible(true); + method.invoke(eP, yaw, pitch); + method.setAccessible(false); + + eP.aO = eP.yaw; + eP.aM = eP.yaw; + } + catch (Exception ex) + { + ex.printStackTrace(); + } } private EntityInsentient spawn(EntityType type) From 4fdd42c599af12c1cfc0580bc333fafab6cf2d49 Mon Sep 17 00:00:00 2001 From: libraryaddict Date: Mon, 3 Aug 2015 01:51:15 +1200 Subject: [PATCH 09/56] Mysticate's request: Add PacketPlayOutCamera --- .../core/packethandler/PacketHandler.java | 3 +- .../packethandler/PacketPlayOutCamera.java | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java index 008aa8f1f..056b75877 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketHandler.java @@ -50,7 +50,8 @@ public class PacketHandler extends MiniPlugin Method method = ProtocolInjector.class.getDeclaredMethod("addPacket", EnumProtocol.class,boolean.class, int.class, Class.class); method.setAccessible(true); - + + method.invoke(null, EnumProtocol.PLAY, true, 67, PacketPlayOutCamera.class); method.invoke(null, EnumProtocol.PLAY, true, 68, PacketPlayOutWorldBorder.class); // EnumProtocol.PLAY.b().put(68, PacketPlayOutWorldBorder.class); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java new file mode 100644 index 000000000..aaf3c94c1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java @@ -0,0 +1,39 @@ +package mineplex.core.packethandler; + +import org.bukkit.entity.Entity; + +import net.minecraft.server.v1_7_R4.Packet; +import net.minecraft.server.v1_7_R4.PacketDataSerializer; +import net.minecraft.server.v1_7_R4.PacketListener; + +public class PacketPlayOutCamera extends Packet +{ + public int a; + + public PacketPlayOutCamera() + { + } + + public PacketPlayOutCamera(Entity paramEntity) + { + this.a = paramEntity.getEntityId(); + } + + public void a(PacketDataSerializer paramPacketDataSerializer) + { + } + + public void b(PacketDataSerializer paramPacketDataSerializer) + { + paramPacketDataSerializer.b(this.a); + } + + public void a(PacketListener paramPacketListenerPlayOut) + { + } + + @Override + public void handle(PacketListener arg0) + { + } +} \ No newline at end of file From 0a20a04903a14254ba1c5ae214d31a650ef080d5 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 2 Aug 2015 10:48:00 -0600 Subject: [PATCH 10/56] Used packets to spectate the rotation bat. --- .../game/games/evolution/Evolution.java | 35 +-------- .../games/evolution/evolve/EvolveData.java | 71 ++++++++----------- 2 files changed, 31 insertions(+), 75 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 7343a2b25..2a3dfa567 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -41,7 +41,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.vehicle.VehicleExitEvent; public class Evolution extends SoloGame { @@ -52,9 +51,7 @@ public class Evolution extends SoloGame private NautHashMap _tokens = new NautHashMap(); private ArrayList _evoPlatforms = new ArrayList(); - - private ArrayList _except = new ArrayList(); - + public Evolution(ArcadeManager manager) { super(manager, GameType.Evolution, @@ -121,11 +118,6 @@ public class Evolution extends SoloGame return _evolve; } - public void addDismountException(Player player) - { - _except.add(player.getName()); - } - @Override public void ParseData() { @@ -258,30 +250,7 @@ public class Evolution extends SoloGame if (_evolve.isEvolving(event.getPlayer())) event.setCancelled(true); } - - @EventHandler - public void onEvolveDismount(VehicleExitEvent event) - { - if (!IsLive()) - return; - - if (!(event.getExited() instanceof Player)) - return; - - Player player = (Player) event.getExited(); - - if (!_evolve.isEvolving(player)) - return; - - if (!_except.contains(player.getName())) - { - event.setCancelled(true); - return; - } - - _except.remove(player.getName()); - } - + @EventHandler public void startEvolve(EvolutionBeginEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index d88c1c88b..96c9767e3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -13,19 +13,20 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; +import mineplex.core.packethandler.PacketPlayOutCamera; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; import net.minecraft.server.v1_7_R4.Entity; +import net.minecraft.server.v1_7_R4.EntityBat; import net.minecraft.server.v1_7_R4.EntityBlaze; import net.minecraft.server.v1_7_R4.EntityChicken; import net.minecraft.server.v1_7_R4.EntityCreeper; import net.minecraft.server.v1_7_R4.EntityEnderman; import net.minecraft.server.v1_7_R4.EntityInsentient; import net.minecraft.server.v1_7_R4.EntityIronGolem; -import net.minecraft.server.v1_7_R4.EntityPlayer; import net.minecraft.server.v1_7_R4.EntitySkeleton; import net.minecraft.server.v1_7_R4.EntitySlime; import net.minecraft.server.v1_7_R4.EntitySnowman; @@ -41,6 +42,7 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftBat; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Bat; import org.bukkit.entity.EntityType; @@ -88,25 +90,10 @@ public class EvolveData Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); teleport(true); + + setupPlayer(); } -// private void setupLocs() -// { -// for (double i = 0 ; i < 50.0 ; i+= .03) -// { -// Location loc = _manager.getLocation().clone().add(Math.cos(i) * _radius, 3.0, Math.sin(i) * _radius); -// -// Vector pyRef = UtilAlg.getTrajectory(loc, _manager.getLocation()); -// -// loc.setPitch(UtilAlg.GetPitch(pyRef)); -// loc.setYaw(UtilAlg.GetYaw(pyRef)); -// -// _rotateLocs.add(loc); -// } -// -// _rotateIterator = _rotateLocs.iterator(); -// } - private void setupBat() { _manager.Host.CreatureAllowOverride = true; @@ -122,6 +109,13 @@ public class EvolveData _bat = bat; } + private void setupPlayer() + { + //Spectate + PacketPlayOutCamera packet = new PacketPlayOutCamera(_bat); + UtilPlayer.sendPacket(_player, packet); + } + //Boolean completed public boolean tick() { @@ -174,17 +168,20 @@ public class EvolveData return false; despawn(_eTo); - - _player.leaveVehicle(); - _manager.Host.addDismountException(_player); + + UtilAction.velocity(_player, 0.0, 0.0, 0.0, false); - _player.setVelocity(new Vector()); + //Stop spectating + PacketPlayOutCamera packet = new PacketPlayOutCamera(_player); + UtilPlayer.sendPacket(_player, packet); _bat.remove(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); - _manager.Host.Manager.GetCondition().GetActiveCondition(_player, ConditionType.CLOAK).Expire(); + _manager.Host.Manager.GetCondition().Clean(_player); + + _to.ApplyKit(_player); return true; } } @@ -216,35 +213,25 @@ public class EvolveData 0.4, false, 0, 0.0, 1, true); } - if (_bat.isEmpty() || _bat.getPassenger() != _player) - { - _bat.setPassenger(_player); - ((CraftPlayer) _player).getHandle().setSneaking(false); - } + EntityBat eB = ((CraftBat) _bat).getHandle(); - EntityPlayer eP = ((CraftPlayer) _player).getHandle(); - - Vector to = UtilAlg.getTrajectory(_player.getEyeLocation(), _manager.getLocation()); + Vector to = UtilAlg.getTrajectory(_bat.getEyeLocation(), _manager.getLocation()); try { - - float pitch = ; - float yaw = UtilAlg.GetYaw(UtilAlg.getTrajectory(_player.getEyeLocation(), _manager.getLocation())); + float pitch = UtilAlg.GetPitch(to); + float yaw = UtilAlg.GetYaw(to); - eP.lastYaw = yaw; - eP.yaw = yaw; + eB.lastYaw = yaw; + eB.yaw = yaw; - eP.lastPitch = pitch; - eP.pitch = pitch; + eB.lastPitch = pitch; + eB.pitch = pitch; Method method = Entity.class.getDeclaredMethod("b", float.class, float.class); method.setAccessible(true); - method.invoke(eP, yaw, pitch); + method.invoke(eB, yaw, pitch); method.setAccessible(false); - - eP.aO = eP.yaw; - eP.aM = eP.yaw; } catch (Exception ex) { From d88a37832b1fda0a2c4c63d96f96e04f4f3e3c3e Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 3 Aug 2015 18:22:31 -0600 Subject: [PATCH 11/56] Work on evolving --- .../games/evolution/evolve/EvolveData.java | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 96c9767e3..2c88d0180 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -15,6 +15,7 @@ import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.packethandler.PacketPlayOutCamera; import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.ConditionActive; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; @@ -68,9 +69,6 @@ public class EvolveData private String _evolveTop; private Bat _bat; - -// private ArrayList _rotateLocs = new ArrayList(); -// private Iterator _rotateIterator; public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to) { @@ -84,7 +82,6 @@ public class EvolveData _eFrom = spawn(from.getEntity()); -// setupLocs(); setupBat(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); @@ -137,15 +134,15 @@ public class EvolveData UtilTextMiddle.display(null, _evolveTop, _player); - for (ConditionType type : ConditionType.values()) + if (_manager.Host.Manager.GetCondition().GetActiveConditions().containsKey(_player)) { - if (type == ConditionType.CLOAK) - continue; - - if (!_manager.Host.Manager.GetCondition().HasCondition(_player, type, null)) - continue; - - _manager.Host.Manager.GetCondition().GetActiveCondition(_player, type).Expire(); + for (ConditionActive condition : _manager.Host.Manager.GetCondition().GetActiveConditions().get(_player)) + { + if (condition.GetCondition().GetType() == ConditionType.CLOAK) + continue; + + condition.GetCondition().Expire(); + } } _manager.Host.SetKit(_player, _manager.Host.GetKit(_player), false); @@ -179,8 +176,15 @@ public class EvolveData Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); - _manager.Host.Manager.GetCondition().Clean(_player); - + try + { + _manager.Host.Manager.GetCondition().GetActiveCondition(_player, ConditionType.CLOAK).Expire(); + } + catch (NullPointerException ex) + { + ex.printStackTrace(); + } + _to.ApplyKit(_player); return true; } @@ -213,6 +217,8 @@ public class EvolveData 0.4, false, 0, 0.0, 1, true); } + setupPlayer(); + EntityBat eB = ((CraftBat) _bat).getHandle(); Vector to = UtilAlg.getTrajectory(_bat.getEyeLocation(), _manager.getLocation()); From 858e57bb0daed6cc097fda66fb5084d634814407 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 7 Aug 2015 14:39:29 -0400 Subject: [PATCH 12/56] edited a few things --- .../game/games/evolution/Evolution.java | 28 +++++-- .../games/evolution/evolve/EvolveData.java | 80 ++++++------------- 2 files changed, 47 insertions(+), 61 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 83b9cf12c..a151e4843 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -10,6 +10,8 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.ConditionActive; +import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -98,8 +100,6 @@ public class Evolution extends SoloGame DeathOut = false; PrepareFreeze = false; - - this.PrepareFreeze = false; GemKillDeathRespawn = 2; GemAssistDeathRespawn = .5; @@ -254,21 +254,36 @@ public class Evolution extends SoloGame @EventHandler public void startEvolve(EvolutionBeginEvent event) { - Manager.GetCondition().Factory().Cloak("Evolution", event.getPlayer(), null, Double.MAX_VALUE, false, false); - Recharge.Instance.Get(event.getPlayer()).clear(); } @EventHandler public void stopEvolve(EvolutionEndEvent event) { + if (Manager.GetCondition().GetActiveConditions().containsKey(event.getPlayer())) + { + for (ConditionActive condition : Manager.GetCondition().GetActiveConditions().get(event.getPlayer())) + { + if (condition.GetCondition().GetType() == ConditionType.CLOAK) + continue; + + condition.GetCondition().Expire(); + } + } + upgradeKit(event.getPlayer(), true); } @EventHandler public void endEvolve(final EvolutionPostEvolveEvent event) { - event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); + try + { + Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); + } + catch (NullPointerException ex) + { + } } @EventHandler @@ -315,6 +330,9 @@ public class Evolution extends SoloGame End(); return; } + + killer.teleport(GetTeam(killer).GetSpawn()); + Manager.GetCondition().Factory().Cloak("Evolving", killer, null, 10, true, true); } //Boolean ending diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 2c88d0180..adc7825a3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -14,14 +14,11 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.packethandler.PacketPlayOutCamera; -import mineplex.minecraft.game.core.condition.Condition.ConditionType; -import mineplex.minecraft.game.core.condition.ConditionActive; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; import net.minecraft.server.v1_7_R4.Entity; -import net.minecraft.server.v1_7_R4.EntityBat; import net.minecraft.server.v1_7_R4.EntityBlaze; import net.minecraft.server.v1_7_R4.EntityChicken; import net.minecraft.server.v1_7_R4.EntityCreeper; @@ -43,11 +40,11 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftBat; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.Bat; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftZombie; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; public class EvolveData @@ -68,54 +65,50 @@ public class EvolveData private String _evolveTop; - private Bat _bat; + private Zombie _zombie; + private int _ticks = 0; public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to) { _manager = manager; _player = player; - _manager.Host.Manager.GetCondition().Factory().Cloak(null, _player, null, Double.MAX_VALUE, false, false); _to = to; _evolveTop = C.cWhite + "You evolved into " + ("aeiou".indexOf(_to.GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + C.cGreen + C.Bold + _to.GetName(); _eFrom = spawn(from.getEntity()); - setupBat(); + setupZombie(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); - - teleport(true); - + setupPlayer(); } - private void setupBat() + private void setupZombie() { _manager.Host.CreatureAllowOverride = true; - Bat bat = _manager.getLocation().getWorld().spawn(_manager.getLocation(), Bat.class); + Zombie zombie = _manager.getLocation().getWorld().spawn(_manager.getLocation(), Zombie.class); _manager.Host.CreatureAllowOverride = false; - bat.setAwake(true); - bat.setRemoveWhenFarAway(false); + UtilEnt.Vegetate(zombie, true); + UtilEnt.ghost(zombie, false, true); - UtilEnt.Vegetate(bat, true); - UtilEnt.ghost(bat, false, true); - - _bat = bat; + _zombie = zombie; } private void setupPlayer() { //Spectate - PacketPlayOutCamera packet = new PacketPlayOutCamera(_bat); + PacketPlayOutCamera packet = new PacketPlayOutCamera(_zombie); UtilPlayer.sendPacket(_player, packet); } //Boolean completed public boolean tick() { + _ticks++; teleport(false); //Hasn't ended yet @@ -134,17 +127,6 @@ public class EvolveData UtilTextMiddle.display(null, _evolveTop, _player); - if (_manager.Host.Manager.GetCondition().GetActiveConditions().containsKey(_player)) - { - for (ConditionActive condition : _manager.Host.Manager.GetCondition().GetActiveConditions().get(_player)) - { - if (condition.GetCondition().GetType() == ConditionType.CLOAK) - continue; - - condition.GetCondition().Expire(); - } - } - _manager.Host.SetKit(_player, _manager.Host.GetKit(_player), false); Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); @@ -165,27 +147,14 @@ public class EvolveData return false; despawn(_eTo); - - UtilAction.velocity(_player, 0.0, 0.0, 0.0, false); - + //Stop spectating PacketPlayOutCamera packet = new PacketPlayOutCamera(_player); UtilPlayer.sendPacket(_player, packet); - _bat.remove(); + _zombie.remove(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); - - try - { - _manager.Host.Manager.GetCondition().GetActiveCondition(_player, ConditionType.CLOAK).Expire(); - } - catch (NullPointerException ex) - { - ex.printStackTrace(); - } - - _to.ApplyKit(_player); return true; } } @@ -202,26 +171,25 @@ public class EvolveData double sizeMod = 3.5; double speed = 15d; - double oX = -Math.sin(_bat.getTicksLived()/speed) * 2 * sizeMod; + double oX = -Math.sin(_ticks/speed) * 2 * sizeMod; double oY = 3; - double oZ = Math.cos(_bat.getTicksLived()/speed) * 2 * sizeMod; + double oZ = Math.cos(_ticks/speed) * 2 * sizeMod; if (teleport) { - _bat.teleport(_manager.getLocation().clone().add(oX, oY, oZ)); + _zombie.teleport(_manager.getLocation().clone().add(oX, oY, oZ)); + setupPlayer(); } else { - UtilAction.velocity(_bat, - UtilAlg.getTrajectory(_bat.getLocation(), _manager.getLocation().clone().add(oX, oY, oZ)), - 0.4, false, 0, 0.0, 1, true); + UtilAction.velocity(_zombie, + UtilAlg.getTrajectory(_zombie.getLocation(), _manager.getLocation().clone().add(oX, oY, oZ)), + 0.4, false, 0, 0.0, 0.0, false); } - setupPlayer(); + EntityZombie eB = ((CraftZombie) _zombie).getHandle(); - EntityBat eB = ((CraftBat) _bat).getHandle(); - - Vector to = UtilAlg.getTrajectory(_bat.getEyeLocation(), _manager.getLocation()); + Vector to = UtilAlg.getTrajectory(_zombie.getEyeLocation(), _manager.getLocation()).normalize(); try { From 5298fa341e17887071fa88340f9079a4a07cb8cf Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sat, 8 Aug 2015 16:13:54 -0400 Subject: [PATCH 13/56] Removed the revolving thing. --- .../packethandler/PacketPlayOutCamera.java | 5 + .../game/games/evolution/Evolution.java | 73 +++++--- .../games/evolution/evolve/EvolveData.java | 170 +++++++++--------- .../games/evolution/evolve/EvolveManager.java | 25 ++- .../games/evolution/evolve/PlatformToken.java | 20 +++ .../game/games/evolution/mobs/KitCreeper.java | 1 - .../mobs/perks/PerkSulphurBombEVO.java | 2 +- 7 files changed, 172 insertions(+), 124 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java index aaf3c94c1..11dd54051 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/packethandler/PacketPlayOutCamera.java @@ -14,6 +14,11 @@ public class PacketPlayOutCamera extends Packet { } + public PacketPlayOutCamera(int id) + { + a = id; + } + public PacketPlayOutCamera(Entity paramEntity) { this.a = paramEntity.getEntityId(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index a151e4843..28c7315f8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -2,16 +2,19 @@ package nautilus.game.arcade.game.games.evolution; import java.util.ArrayList; import java.util.Collections; +import java.util.Iterator; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.condition.ConditionActive; import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.ConditionActive; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -42,7 +45,7 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.util.Vector; public class Evolution extends SoloGame { @@ -52,8 +55,9 @@ public class Evolution extends SoloGame private NautHashMap _tokens = new NautHashMap(); - private ArrayList _evoPlatforms = new ArrayList(); - + //Platform location, viewing location. + private NautHashMap _evoPlatforms = new NautHashMap(); + public Evolution(ArcadeManager manager) { super(manager, GameType.Evolution, @@ -121,13 +125,37 @@ public class Evolution extends SoloGame @Override public void ParseData() { - for (Location loc : WorldData.GetDataLocs("RED")) - { - loc.getBlock().setType(Material.AIR); - _evoPlatforms.add(loc); + for (Location platform : WorldData.GetDataLocs("RED")) + { + platform.getBlock().setType(Material.AIR); + + Iterator green = WorldData.GetDataLocs("GREEN").iterator(); + while (green.hasNext()) + { + Location viewing = green.next(); + + viewing.getBlock().setType(Material.AIR); + + if (UtilMath.offset2d(platform, viewing) > 8.0) + continue; + + green.remove(); + _evoPlatforms.put(platform, loadAngle(platform, viewing)); + break; + } } } + private Location loadAngle(Location platform, Location viewing) + { + Vector b = UtilAlg.getTrajectory(viewing, platform).normalize(); + + viewing.setPitch(UtilAlg.GetPitch(b)); + viewing.setYaw(UtilAlg.GetYaw(b)); + + return viewing; + } + //Double Kit @EventHandler(priority = EventPriority.MONITOR) public void storeTokens(GameStateChangeEvent event) @@ -139,14 +167,14 @@ public class Evolution extends SoloGame { _tokens.put(player.getName(), new EvoToken(player)); - upgradeKit(player, false); + upgradeKit(player, true); } } @EventHandler(priority = EventPriority.LOWEST) public void endNoEvolve(GameStateChangeEvent event) { - if (event.GetState() != GameState.Live) + if (event.GetState() != GameState.Prepare) return; if (_evoPlatforms.size() <= 0) @@ -156,7 +184,7 @@ public class Evolution extends SoloGame return; } - _evolve = new EvolveManager(this, _evoPlatforms.get(0)); + _evolve = new EvolveManager(this, _evoPlatforms); } @EventHandler @@ -171,25 +199,13 @@ public class Evolution extends SoloGame _evolve.tick(); } - @EventHandler - public void moveEvolve(PlayerMoveEvent event) - { - if (!IsLive()) - return; - - if (!_evolve.isEvolving(event.getPlayer())) - return; - - _evolve.getEvolve(event.getPlayer()).teleport(false); - } - @Override public boolean HasKit(Player player, Kit kit) { if (GetKit(player) == null) return false; - if (GetKit(player) == (kit)) + if (GetKit(player) == kit) return true; return false; @@ -255,6 +271,9 @@ public class Evolution extends SoloGame public void startEvolve(EvolutionBeginEvent event) { Recharge.Instance.Get(event.getPlayer()).clear(); + + event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); + Manager.GetCondition().Factory().Cloak("Evolving", event.getPlayer(), null, 10, true, true); } @EventHandler @@ -270,7 +289,7 @@ public class Evolution extends SoloGame condition.GetCondition().Expire(); } } - + upgradeKit(event.getPlayer(), true); } @@ -330,9 +349,6 @@ public class Evolution extends SoloGame End(); return; } - - killer.teleport(GetTeam(killer).GetSpawn()); - Manager.GetCondition().Factory().Cloak("Evolving", killer, null, 10, true, true); } //Boolean ending @@ -397,6 +413,7 @@ public class Evolution extends SoloGame if (player.isOnline()) AddGems(player, 10, "Participation", false, false); + _evolve.end(); SetState(GameState.End); AnnounceEnd(players); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index adc7825a3..38760c6f8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -1,10 +1,6 @@ package nautilus.game.arcade.game.games.evolution.evolve; -import java.lang.reflect.Method; - import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilAction; -import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; @@ -18,7 +14,6 @@ import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; -import net.minecraft.server.v1_7_R4.Entity; import net.minecraft.server.v1_7_R4.EntityBlaze; import net.minecraft.server.v1_7_R4.EntityChicken; import net.minecraft.server.v1_7_R4.EntityCreeper; @@ -40,62 +35,70 @@ import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftZombie; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; -import org.bukkit.util.Vector; public class EvolveData { + private boolean _ended = false; + private final long _timestamp = System.currentTimeMillis(); private long _endTime = System.currentTimeMillis(); private final EvolveManager _manager; + private final PlatformToken _token; private boolean _active = true; private final Player _player; private final EvoKit _to; + private String _evolveTop; private final EntityInsentient _eFrom; private EntityInsentient _eTo; - private String _evolveTop; - private Zombie _zombie; - private int _ticks = 0; - - public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to) + + public EvolveData(EvolveManager manager, PlatformToken token, Player player, EvoKit from, EvoKit to) { _manager = manager; + _token = token; _player = player; _to = to; _evolveTop = C.cWhite + "You evolved into " + ("aeiou".indexOf(_to.GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + C.cGreen + C.Bold + _to.GetName(); - _eFrom = spawn(from.getEntity()); - - setupZombie(); + _eFrom = spawn(from.getEntity(), token.Platform, false); + + _zombie = setupZombie(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); - - setupPlayer(); + + Bukkit.getScheduler().scheduleSyncDelayedTask(_manager.Host.Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + setupPlayer(); + } + }, 2); } - private void setupZombie() + private Zombie setupZombie() { _manager.Host.CreatureAllowOverride = true; - Zombie zombie = _manager.getLocation().getWorld().spawn(_manager.getLocation(), Zombie.class); + Zombie zombie = _token.Viewing.getWorld().spawn(_token.Viewing, Zombie.class); _manager.Host.CreatureAllowOverride = false; - - UtilEnt.Vegetate(zombie, true); - UtilEnt.ghost(zombie, false, true); - _zombie = zombie; + UtilEnt.Vegetate(zombie, true); + UtilEnt.ghost(zombie, true, true); + + zombie.teleport(_token.Viewing); + + return zombie; } private void setupPlayer() @@ -104,31 +107,41 @@ public class EvolveData PacketPlayOutCamera packet = new PacketPlayOutCamera(_zombie); UtilPlayer.sendPacket(_player, packet); } + + private void endPlayer() + { + //Stop spectating + PacketPlayOutCamera packet = new PacketPlayOutCamera(_player); + UtilPlayer.sendPacket(_player, packet); + } //Boolean completed public boolean tick() { - _ticks++; - teleport(false); - + //Failsafe + if (_ended) + { + return true; + } + //Hasn't ended yet if (_active) - { + { + handleAnimation(_eFrom); + //If 2 seconds past if (UtilTime.elapsed(_timestamp, 2400)) { _active = false; _endTime = System.currentTimeMillis(); - _eTo = spawn(_to.getEntity()); + _eTo = spawn(_to.getEntity(), _token.Platform, false); despawn(_eFrom); - UtilFirework.playFirework(_manager.getLocation().clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); + UtilFirework.playFirework(_token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); UtilTextMiddle.display(null, _evolveTop, _player); - - _manager.Host.SetKit(_player, _manager.Host.GetKit(_player), false); - + Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); } else @@ -136,89 +149,63 @@ public class EvolveData //Play particles if (UtilTime.elapsed(_timestamp, 500)) { - UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, new Location(_eFrom.world.getWorld(), _eFrom.locX, _eFrom.locY + 1.0, _eFrom.locZ), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.SHORT, _player); + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, _token.Platform.clone().add(0.0, 1.0, 0.0), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.SHORT, _player); } } return false; } else { + handleAnimation(_eTo); + if (!UtilTime.elapsed(_endTime, 2400)) return false; despawn(_eTo); - //Stop spectating - PacketPlayOutCamera packet = new PacketPlayOutCamera(_player); - UtilPlayer.sendPacket(_player, packet); + endPlayer(); _zombie.remove(); - + Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); return true; } } - public void teleport(boolean teleport) - { - if (_player.getFireTicks() > 0) - _player.setFireTicks(0); - - _player.setFallDistance(0); - _player.setHealth(20.0); + //Force end. (Game ended) + public void end() + { + _active = false; - ((CraftPlayer) _player).getHandle().p(0); + if (_eFrom != null) + despawn(_eFrom); - double sizeMod = 3.5; - double speed = 15d; - double oX = -Math.sin(_ticks/speed) * 2 * sizeMod; - double oY = 3; - double oZ = Math.cos(_ticks/speed) * 2 * sizeMod; - - if (teleport) - { - _zombie.teleport(_manager.getLocation().clone().add(oX, oY, oZ)); - setupPlayer(); - } - else - { - UtilAction.velocity(_zombie, - UtilAlg.getTrajectory(_zombie.getLocation(), _manager.getLocation().clone().add(oX, oY, oZ)), - 0.4, false, 0, 0.0, 0.0, false); - } + if (_eTo != null) + despawn(_eTo); - EntityZombie eB = ((CraftZombie) _zombie).getHandle(); + endPlayer(); - Vector to = UtilAlg.getTrajectory(_zombie.getEyeLocation(), _manager.getLocation()).normalize(); + _zombie.remove(); - try - { - float pitch = UtilAlg.GetPitch(to); - float yaw = UtilAlg.GetYaw(to); - - eB.lastYaw = yaw; - eB.yaw = yaw; - - eB.lastPitch = pitch; - eB.pitch = pitch; - - Method method = Entity.class.getDeclaredMethod("b", float.class, float.class); - method.setAccessible(true); - method.invoke(eB, yaw, pitch); - method.setAccessible(false); - } - catch (Exception ex) - { - ex.printStackTrace(); - } + _ended = true; + } + + private void handleAnimation(EntityInsentient entity) + { + setupPlayer(); +// float yaw = entity.yaw; +// yaw += 2; +// +// _token.Platform.setYaw(yaw); +// entity.setLocation(_token.Platform.getX(), _token.Platform.getY(), _token.Platform.getZ(), yaw, entity.pitch); } - private EntityInsentient spawn(EntityType type) + private EntityInsentient spawn(EntityType type, Location loc, boolean invisible) { try { - EntityInsentient entity = getEntity(type).getConstructor(World.class).newInstance(((CraftWorld) _manager.getLocation().getWorld()).getHandle()); - entity.setLocation(_manager.getLocation().getX(), _manager.getLocation().getY(), _manager.getLocation().getZ(), 0.0F, 0.0F); + EntityInsentient entity = getEntity(type).getConstructor(World.class).newInstance(((CraftWorld) loc.getWorld()).getHandle()); + entity.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(entity); entity.setCustomNameVisible(false); @@ -227,6 +214,13 @@ public class EvolveData ((EntitySlime) entity).setSize(3); } + if (invisible) + { + entity.Invisible = true; + } + + entity.ghost = true; + UtilPlayer.sendPacket(_player, packet); return entity; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index c015b574a..90e825240 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -1,9 +1,11 @@ package nautilus.game.arcade.game.games.evolution.evolve; +import java.util.ArrayList; import java.util.Iterator; import java.util.Map.Entry; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.Evolution; @@ -15,19 +17,22 @@ public class EvolveManager { public final Evolution Host; - private final Location _evolveLoc; + private final NautHashMap _evolveLocs; private NautHashMap _data = new NautHashMap(); - public EvolveManager(Evolution evolution, Location evolveLoc) + public EvolveManager(Evolution evolution, NautHashMap evolveLocs) { Host = evolution; - _evolveLoc = evolveLoc; + _evolveLocs = evolveLocs; } - public Location getLocation() + private PlatformToken getLocation() { - return _evolveLoc; + ArrayList> locs = new ArrayList>(_evolveLocs.entrySet()); + Entry entry = locs.get(UtilMath.r(locs.size())); + + return new PlatformToken(entry.getKey(), entry.getValue()); } public boolean isEvolving(Player player) @@ -40,7 +45,7 @@ public class EvolveManager if (_data.containsKey(player.getName())) return; - _data.put(player.getName(), new EvolveData(this, player, from, to)); + _data.put(player.getName(), new EvolveData(this, getLocation(), player, from, to)); } public EvolveData getEvolve(Player player) @@ -76,4 +81,12 @@ public class EvolveManager } } } + + public void end() + { + for (EvolveData data : _data.values()) + { + data.end(); + } + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java new file mode 100644 index 000000000..4921724a5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java @@ -0,0 +1,20 @@ +package nautilus.game.arcade.game.games.evolution.evolve; + +import org.bukkit.Location; + +public class PlatformToken +{ + /** + * @author Mysticate + * August 8, 2015 + */ + + public final Location Platform; + public final Location Viewing; + + public PlatformToken(Location platform, Location viewing) + { + Platform = platform.clone(); + Viewing = viewing.clone(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java index e01a23bf9..780600f3c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java @@ -27,7 +27,6 @@ public class KitCreeper extends EvoKit { new PerkSulphurBombEVO() }, EntityType.CREEPER); - } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index 7bf7af344..55cd2c4aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -50,7 +50,7 @@ public class PerkSulphurBombEVO extends Perk implements IThrown if (!UtilEvent.isAction(event, ActionType.R)) return; - if (!UtilInv.IsItem(event.getItem(), Material.DIAMOND_AXE, (byte) 0)) + if (!UtilInv.IsItem(event.getItem(), Material.IRON_AXE, (byte) 0)) return; Player player = event.getPlayer(); From b9edb92c1e20aa06087ec788126ab63cb6292e1a Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 9 Aug 2015 01:08:43 -0400 Subject: [PATCH 14/56] Ready for full on testing. --- .../arcade/game/games/evolution/EvoKit.java | 13 ++- .../arcade/game/games/evolution/EvoToken.java | 4 + .../game/games/evolution/Evolution.java | 70 +++++++++++++-- .../events/EvolutionAbilityUseEvent.java | 4 + .../evolution/events/EvolutionBeginEvent.java | 4 + .../evolution/events/EvolutionEndEvent.java | 3 + .../events/EvolutionPostEvolveEvent.java | 4 + .../games/evolution/evolve/EvolveData.java | 88 ++++--------------- .../games/evolution/evolve/EvolveManager.java | 6 +- .../games/evolution/kits/KitEvolutionist.java | 6 +- .../games/evolution/mobs/KitSkeleton.java | 6 +- .../mobs/perks/PerkBlockTossEVO.java | 4 + .../evolution/mobs/perks/PerkBounceEVO.java | 4 + .../mobs/perks/PerkFlamingSwordEVO.java | 4 + .../evolution/mobs/perks/PerkPounceEVO.java | 4 + .../mobs/perks/PerkSiesmicSlamEVO.java | 4 + .../mobs/perks/PerkSulphurBombEVO.java | 4 + .../evolution/mobs/perks/PerkWebEVO.java | 4 + 18 files changed, 148 insertions(+), 88 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index e2f76ea9a..5d7bb8a1b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.evolution; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; @@ -15,6 +16,10 @@ import org.bukkit.entity.Player; public abstract class EvoKit extends Kit { + /** + * @author Mysticate + */ + private EntityType _entity; public EvoKit(ArcadeManager manager, String name, String[] kitDesc, Perk[] kitPerks, EntityType type) @@ -31,12 +36,14 @@ public abstract class EvoKit extends Kit public void upgradeGive(Player player) { + String def = C.cWhite + C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName()); + player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 0.1F); UtilPlayer.message(player, C.Line); UtilPlayer.message(player, C.Line); UtilPlayer.message(player, ArcadeFormat.Line); - UtilPlayer.message(player, C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName())); + UtilPlayer.message(player, def); UtilPlayer.message(player, C.Line); @@ -45,7 +52,9 @@ public abstract class EvoKit extends Kit UtilPlayer.message(player, C.Line); UtilPlayer.message(player, ArcadeFormat.Line); - } + + UtilTextMiddle.display(null, def, player); + } @Override public abstract void GiveItems(Player player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java index 78d9e9e43..a0e4f7810 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java @@ -4,6 +4,10 @@ import org.bukkit.entity.Player; public class EvoToken implements Comparable { + /** + * @author Mysticate + */ + public final Player Player; public int Kills = 0; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 28c7315f8..2dd999be3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -42,13 +42,21 @@ import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent; import org.bukkit.Location; 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.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.util.Vector; public class Evolution extends SoloGame { + /** + * @author Mysticate + * Reworked from Original Code. + */ + private EvolveManager _evolve; private ArrayList _mobKits = new ArrayList(); @@ -148,7 +156,7 @@ public class Evolution extends SoloGame private Location loadAngle(Location platform, Location viewing) { - Vector b = UtilAlg.getTrajectory(viewing, platform).normalize(); + Vector b = UtilAlg.getTrajectory(viewing, platform.clone().subtract(0.0, 1.0, 0.0)).normalize(); viewing.setPitch(UtilAlg.GetPitch(b)); viewing.setYaw(UtilAlg.GetYaw(b)); @@ -167,7 +175,24 @@ public class Evolution extends SoloGame { _tokens.put(player.getName(), new EvoToken(player)); - upgradeKit(player, true); + upgradeKit(player, false); + } + } + + @EventHandler + public void showKit(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Live) + return; + + for (Player player : GetPlayers(true)) + { + Kit kit = GetKit(player); + + if (!(kit instanceof EvoKit)) + continue; + + ((EvoKit) kit).upgradeGive(player); } } @@ -266,14 +291,40 @@ public class Evolution extends SoloGame if (_evolve.isEvolving(event.getPlayer())) event.setCancelled(true); } + + @EventHandler + public void onEvolveMove(PlayerMoveEvent event) + { + if (!IsLive()) + return; + + if (_evolve.isEvolving(event.getPlayer())) + event.getPlayer().teleport(event.getFrom()); + } @EventHandler public void startEvolve(EvolutionBeginEvent event) { - Recharge.Instance.Get(event.getPlayer()).clear(); + Player player = event.getPlayer(); - event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); - Manager.GetCondition().Factory().Cloak("Evolving", event.getPlayer(), null, 10, true, true); + Recharge.Instance.Get(player).clear(); + + player.setSprinting(false); + player.setSneaking(false); + + player.setHealth(player.getMaxHealth()); + + player.setFireTicks(0); + player.setFallDistance(0); + + player.eject(); + player.leaveVehicle(); + + ((CraftPlayer) player).getHandle().p(0); + + Manager.GetCondition().Factory().Cloak("Evolving", player, null, 20, false, false); + + ((Player) player).playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1.25f); } @EventHandler @@ -291,18 +342,19 @@ public class Evolution extends SoloGame } upgradeKit(event.getPlayer(), true); + event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.LEVEL_UP, 1, 0.6F); } @EventHandler - public void endEvolve(final EvolutionPostEvolveEvent event) + public void endEvolve(EvolutionPostEvolveEvent event) { try { Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); } - catch (NullPointerException ex) - { - } + catch (NullPointerException ex){} + + event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java index bd28edc52..2fe24d1ea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java @@ -7,6 +7,10 @@ import org.bukkit.event.player.PlayerEvent; public class EvolutionAbilityUseEvent extends PlayerEvent implements Cancellable { + /** + * @author Mysticate + */ + private static HandlerList _handlers = new HandlerList(); private boolean _cancelled = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionBeginEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionBeginEvent.java index 8f8704ed4..9389e1daf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionBeginEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionBeginEvent.java @@ -6,6 +6,10 @@ import org.bukkit.event.player.PlayerEvent; public class EvolutionBeginEvent extends PlayerEvent { + /** + * @author Mysticate + */ + private static HandlerList _handlers = new HandlerList(); public EvolutionBeginEvent(Player who) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java index 05c927223..8fb56f3b9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java @@ -6,6 +6,9 @@ import org.bukkit.event.player.PlayerEvent; public class EvolutionEndEvent extends PlayerEvent { + /** + * @author Mysticate + */ private static HandlerList _handlers = new HandlerList(); public EvolutionEndEvent(Player who) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionPostEvolveEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionPostEvolveEvent.java index 8a38ddc24..d203e8038 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionPostEvolveEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionPostEvolveEvent.java @@ -6,6 +6,10 @@ import org.bukkit.event.player.PlayerEvent; public class EvolutionPostEvolveEvent extends PlayerEvent { + /** + * @author Mysticate + */ + private static HandlerList _handlers = new HandlerList(); public EvolutionPostEvolveEvent(Player who) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 38760c6f8..30cca9d82 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -1,15 +1,11 @@ package nautilus.game.arcade.game.games.evolution.evolve; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; -import mineplex.core.packethandler.PacketPlayOutCamera; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; @@ -37,16 +33,18 @@ import org.bukkit.Location; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.entity.Zombie; public class EvolveData { + /** + * @author Mysticate + */ + private boolean _ended = false; private final long _timestamp = System.currentTimeMillis(); private long _endTime = System.currentTimeMillis(); - private final EvolveManager _manager; private final PlatformToken _token; private boolean _active = true; @@ -54,65 +52,28 @@ public class EvolveData private final Player _player; private final EvoKit _to; - private String _evolveTop; private final EntityInsentient _eFrom; private EntityInsentient _eTo; - private Zombie _zombie; - - public EvolveData(EvolveManager manager, PlatformToken token, Player player, EvoKit from, EvoKit to) + public EvolveData(PlatformToken token, Player player, EvoKit from, EvoKit to) { - _manager = manager; _token = token; _player = player; _to = to; - _evolveTop = C.cWhite + "You evolved into " + ("aeiou".indexOf(_to.GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + C.cGreen + C.Bold + _to.GetName(); _eFrom = spawn(from.getEntity(), token.Platform, false); - - _zombie = setupZombie(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); - - Bukkit.getScheduler().scheduleSyncDelayedTask(_manager.Host.Manager.getPlugin(), new Runnable() - { - @Override - public void run() - { - setupPlayer(); - } - }, 2); - } - - private Zombie setupZombie() - { - _manager.Host.CreatureAllowOverride = true; - Zombie zombie = _token.Viewing.getWorld().spawn(_token.Viewing, Zombie.class); - _manager.Host.CreatureAllowOverride = false; - UtilEnt.Vegetate(zombie, true); - UtilEnt.ghost(zombie, true, true); - - zombie.teleport(_token.Viewing); - - return zombie; + setupPlayer(); } private void setupPlayer() { - //Spectate - PacketPlayOutCamera packet = new PacketPlayOutCamera(_zombie); - UtilPlayer.sendPacket(_player, packet); - } - - private void endPlayer() - { - //Stop spectating - PacketPlayOutCamera packet = new PacketPlayOutCamera(_player); - UtilPlayer.sendPacket(_player, packet); + _player.teleport(_token.Viewing); } //Boolean completed @@ -124,13 +85,13 @@ public class EvolveData return true; } + teleport(); + //Hasn't ended yet if (_active) - { - handleAnimation(_eFrom); - - //If 2 seconds past - if (UtilTime.elapsed(_timestamp, 2400)) + { + //If 3 seconds past + if (UtilTime.elapsed(_timestamp, 3200)) { _active = false; _endTime = System.currentTimeMillis(); @@ -139,9 +100,7 @@ public class EvolveData despawn(_eFrom); UtilFirework.playFirework(_token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); - - UtilTextMiddle.display(null, _evolveTop, _player); - + Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); } else @@ -155,17 +114,11 @@ public class EvolveData return false; } else - { - handleAnimation(_eTo); - - if (!UtilTime.elapsed(_endTime, 2400)) + { + if (!UtilTime.elapsed(_endTime, 3000)) return false; despawn(_eTo); - - endPlayer(); - - _zombie.remove(); Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); return true; @@ -183,21 +136,12 @@ public class EvolveData if (_eTo != null) despawn(_eTo); - endPlayer(); - - _zombie.remove(); - _ended = true; } - private void handleAnimation(EntityInsentient entity) + public void teleport() { setupPlayer(); -// float yaw = entity.yaw; -// yaw += 2; -// -// _token.Platform.setYaw(yaw); -// entity.setLocation(_token.Platform.getX(), _token.Platform.getY(), _token.Platform.getZ(), yaw, entity.pitch); } private EntityInsentient spawn(EntityType type, Location loc, boolean invisible) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index 90e825240..9332480aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -15,6 +15,10 @@ import org.bukkit.entity.Player; public class EvolveManager { + /** + * @author Mysticate + */ + public final Evolution Host; private final NautHashMap _evolveLocs; @@ -45,7 +49,7 @@ public class EvolveManager if (_data.containsKey(player.getName())) return; - _data.put(player.getName(), new EvolveData(this, getLocation(), player, from, to)); + _data.put(player.getName(), new EvolveData(getLocation(), player, from, to)); } public EvolveData getEvolve(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java index 6b0840a0a..b849aecab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java @@ -12,9 +12,13 @@ import org.bukkit.entity.Player; public class KitEvolutionist extends Kit { + /** + * @author Mysticate + */ + public KitEvolutionist(ArcadeManager manager) { - super(manager, "Evolutionist", KitAvailability.Free, 0, new String[] + super(manager, "Darwinist", KitAvailability.Free, 0, new String[] { "They grow up so fast :')" }, new Perk[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java index 6cc4eb454..e93d52412 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java @@ -10,7 +10,7 @@ import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkFletcher; +import nautilus.game.arcade.kit.perks.PerkConstructor; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -32,7 +32,7 @@ public class KitSkeleton extends EvoKit new Perk[] { - new PerkFletcher(3, 2, false), + new PerkConstructor("Fletcher", 3, 2, Material.ARROW, "Fletched Arrow", false), new PerkBarrage(5, 250, true, false) }, EntityType.SKELETON); } @@ -44,7 +44,7 @@ public class KitSkeleton extends EvoKit player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); - + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java index 5db22f185..945493273 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java @@ -39,6 +39,10 @@ import org.bukkit.event.player.PlayerInteractEvent; public class PerkBlockTossEVO extends Perk implements IThrown { + /** + * @author Mysticate + */ + private HashMap _hold = new HashMap(); private HashMap _charge = new HashMap(); private HashSet _charged = new HashSet(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index 6af1348ca..ac2cd6a51 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -27,6 +27,10 @@ import org.bukkit.event.player.PlayerInteractEvent; public class PerkBounceEVO extends Perk { + /** + * @author Mysticate + */ + private NautHashMap _live = new NautHashMap(); public PerkBounceEVO() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java index 1475935cd..76d451973 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java @@ -31,6 +31,10 @@ import org.bukkit.util.Vector; public class PerkFlamingSwordEVO extends Perk { + /** + * @author Mysticate + */ + private HashMap _active = new HashMap(); public PerkFlamingSwordEVO() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java index 1a54a0c53..44901edea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java @@ -27,6 +27,10 @@ import org.bukkit.event.player.PlayerInteractEvent; public class PerkPounceEVO extends Perk { + /** + * @author Mysticate + */ + private NautHashMap _live = new NautHashMap(); public PerkPounceEVO() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java index a836dbfe6..a68dec4d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -34,6 +34,10 @@ import org.bukkit.util.Vector; public class PerkSiesmicSlamEVO extends Perk { + /** + * @author Mysticate + */ + private HashMap _live = new HashMap(); public PerkSiesmicSlamEVO() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index 55cd2c4aa..48b4490b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -33,6 +33,10 @@ import org.bukkit.event.player.PlayerInteractEvent; public class PerkSulphurBombEVO extends Perk implements IThrown { + /** + * @author Mysticate + */ + public PerkSulphurBombEVO() { super("Sulphur Bomb", new String[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java index 098819ace..3a2f7af1c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -21,6 +21,10 @@ import org.bukkit.event.player.PlayerInteractEvent; public class PerkWebEVO extends Perk implements IThrown { + /** + * @author Mysticate + */ + public PerkWebEVO() { super("Web Shot", new String[] From d9a8830e7526beebfd13ba423035bdb3527cbb41 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 9 Aug 2015 14:34:55 -0400 Subject: [PATCH 15/56] Few changes --- .../mineplex/core/itemstack/ItemBuilder.java | 3 +- .../arcade/game/games/evolution/EvoToken.java | 6 +- .../game/games/evolution/Evolution.java | 236 ++++++++++-------- .../games/evolution/evolve/EvolveManager.java | 93 ++++++- 4 files changed, 224 insertions(+), 114 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java index e13338dd1..3a1f090e0 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemBuilder.java @@ -308,9 +308,10 @@ public class ItemBuilder return this; } - public void setData(short newData) + public ItemBuilder setData(short newData) { this._data = newData; + return this; } public ItemBuilder setPotion(Potion potion) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java index a0e4f7810..392dbaf0f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java @@ -10,7 +10,7 @@ public class EvoToken implements Comparable public final Player Player; - public int Kills = 0; + public int Level = 0; public EvoToken(Player player) { @@ -20,11 +20,11 @@ public class EvoToken implements Comparable @Override public int compareTo(EvoToken o) { - if (Kills == o.Kills) + if (Level == o.Level) { return 0; } - if (Kills > o.Kills) + if (Level > o.Level) { return -1; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 2dd999be3..155de90d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -7,21 +7,24 @@ import java.util.Iterator; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.itemstack.ItemBuilder; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.condition.ConditionActive; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; -import nautilus.game.arcade.addons.compass.CompassAttemptTargetEvent; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.SoloGame; -import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; @@ -38,7 +41,6 @@ import nautilus.game.arcade.game.games.evolution.mobs.KitSnowman; import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; import nautilus.game.arcade.game.games.evolution.mobs.KitWolf; import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent; import org.bukkit.Location; import org.bukkit.Material; @@ -47,7 +49,8 @@ import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; public class Evolution extends SoloGame @@ -66,6 +69,9 @@ public class Evolution extends SoloGame //Platform location, viewing location. private NautHashMap _evoPlatforms = new NautHashMap(); + private ArrayList _evolutionsAvailable = new ArrayList(); + private ArrayList _attemptingEvolve = new ArrayList(); + public Evolution(ArcadeManager manager) { super(manager, GameType.Evolution, @@ -179,6 +185,8 @@ public class Evolution extends SoloGame } } + + @EventHandler public void showKit(GameStateChangeEvent event) { @@ -212,18 +220,6 @@ public class Evolution extends SoloGame _evolve = new EvolveManager(this, _evoPlatforms); } - @EventHandler - public void tickEvolve(UpdateEvent event) - { - if (!IsLive()) - return; - - if (event.getType() != UpdateType.TICK) - return; - - _evolve.tick(); - } - @Override public boolean HasKit(Player player, Kit kit) { @@ -235,73 +231,23 @@ public class Evolution extends SoloGame return false; } + + //Boolean ending + public void upgradeKit(Player player, boolean give) + { + if (!IsAlive(player)) + return; - @EventHandler(priority = EventPriority.MONITOR) - public void onEvolveDamageRecieve(CustomDamageEvent event) - { - if (!IsLive()) - return; - - if (!(event.GetDamageeEntity() instanceof Player)) - return; - - if (_evolve.isEvolving(event.GetDamageePlayer())) - event.SetCancelled("Player is evolving!"); - } - - @EventHandler(priority = EventPriority.MONITOR) - public void onEvolveDamageDeal(CustomDamageEvent event) - { - if (!IsLive()) - return; - - if (!(event.GetDamagerEntity(true) instanceof Player)) - return; - - if (_evolve.isEvolving(event.GetDamagerPlayer(true))) - event.SetCancelled("Player is evolving!"); - } - - @EventHandler - public void onEvolveAbility(EvolutionAbilityUseEvent event) - { - if (!IsLive()) - return; - - if (_evolve.isEvolving(event.getPlayer())) - event.setCancelled(true); - } - - @EventHandler - public void onEvolveCompass(CompassAttemptTargetEvent event) - { - if (!IsLive()) - return; - - if (_evolve.isEvolving(event.getTarget())) - event.setCancelled(true); - } - - @EventHandler - public void onEvolveConstruct(PerkConstructorEvent event) - { - if (!IsLive()) - return; - - if (_evolve.isEvolving(event.getPlayer())) - event.setCancelled(true); - } - - @EventHandler - public void onEvolveMove(PlayerMoveEvent event) - { - if (!IsLive()) - return; - - if (_evolve.isEvolving(event.getPlayer())) - event.getPlayer().teleport(event.getFrom()); - } + EvoKit newKit = _mobKits.get(getScore(player)); + SetKit(player, newKit, false); + + if (give) + { + newKit.upgradeGive(player); + } + } + @EventHandler public void startEvolve(EvolutionBeginEvent event) { @@ -387,37 +333,111 @@ public class Evolution extends SoloGame return; } - EvoToken token = _tokens.get(killer.getName()); + _evolutionsAvailable.add(killer); +// EvoToken token = _tokens.get(killer.getName()); +// +// try +// { +// EvoKit from = _mobKits.get(token.Kills - 1); //Account for the score increase +// EvoKit to = _mobKits.get(token.Kills); +// +// _evolve.addEvolve(killer, from, to); +// } +// catch (IndexOutOfBoundsException ex) +// { +// End(); +// return; +// } + } + + @EventHandler + public void updateAvailableEvolutions(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; - try + if (!IsLive()) + return; + + Iterator iterator = _evolutionsAvailable.iterator(); + while (iterator.hasNext()) { - EvoKit from = _mobKits.get(token.Kills - 1); //Account for the score increase - EvoKit to = _mobKits.get(token.Kills); + Player player = iterator.next(); - _evolve.addEvolve(killer, from, to); - } - catch (IndexOutOfBoundsException ex) - { - End(); - return; + if (player == null || !player.isOnline()) + { + iterator.remove(); + return; + } + + if (!IsAlive(player)) + { + iterator.remove(); + return; + } + + if (!_attemptingEvolve.contains(player)) + { + UtilTextMiddle.display("", C.cGreen + C.Bold + "Evolution Available!"); + } + + if (!UtilGear.isMat(player.getInventory().getItem(7), Material.STAINED_CLAY)) + { + player.getInventory().setItem(7, new ItemBuilder(Material.STAINED_CLAY).build()); + } + else + { + //Rainbow effect on the clay + ItemStack item = player.getInventory().getItem(7); + byte data = UtilInv.GetData(item); + + data++; + + if (data > 15) + data = 0; + + item.setDurability(data); + } } } - - //Boolean ending - public void upgradeKit(Player player, boolean give) - { - if (!IsAlive(player)) + + @EventHandler + public void onInteractWithEvolve(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) return; - - EvoKit newKit = _mobKits.get(getScore(player)); - - SetKit(player, newKit, false); - - if (give) - { - newKit.upgradeGive(player); - } + + if (!IsLive()) + return; + + if (event.getItem().getType() != Material.STAINED_CLAY) + return; + + //Make sure it's the 7 slot + if (event.getPlayer().getInventory().getItem(7) != event.getItem()) + return; + + if (_attemptingEvolve.contains(event.getPlayer())) + return; + + _attemptingEvolve.add(event.getPlayer()); } + + @EventHandler + public void updateAttemptingEvolve(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + Iterator iterator = _attemptingEvolve.iterator(); + while (iterator.hasNext()) + { + Player player = iterator.next(); + } + `} public void increaseScore(Player player) { @@ -427,7 +447,7 @@ public class Evolution extends SoloGame if (!_tokens.containsKey(player.getName())) return; - _tokens.get(player.getName()).Kills++; + _tokens.get(player.getName()).Level++; } public int getScore(Player player) @@ -435,7 +455,7 @@ public class Evolution extends SoloGame if (!IsPlaying(player)) return 0; - return _tokens.get(player.getName()).Kills; + return _tokens.get(player.getName()).Level; } private void End() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index 9332480aa..f7bf4613f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -7,13 +7,25 @@ import java.util.Map.Entry; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.addons.compass.CompassAttemptTargetEvent; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.Evolution; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; +import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.HandlerList; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerMoveEvent; -public class EvolveManager +public class EvolveManager implements Listener { /** * @author Mysticate @@ -29,6 +41,8 @@ public class EvolveManager { Host = evolution; _evolveLocs = evolveLocs; + + Bukkit.getPluginManager().registerEvents(this, Host.Manager.getPlugin()); } private PlatformToken getLocation() @@ -57,8 +71,15 @@ public class EvolveManager return _data.get(player.getName()); } - public void tick() + @EventHandler + public void tick(UpdateEvent event) { + if (event.getType() != UpdateType.TICK) + return; + + if (!Host.IsLive()) + return; + Iterator> iterator = _data.entrySet().iterator(); while (iterator.hasNext()) { @@ -92,5 +113,73 @@ public class EvolveManager { data.end(); } + + HandlerList.unregisterAll(this); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onEvolveDamageRecieve(CustomDamageEvent event) + { + if (!Host.IsLive()) + return; + + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + if (isEvolving(event.GetDamageePlayer())) + event.SetCancelled("Player is evolving!"); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onEvolveDamageDeal(CustomDamageEvent event) + { + if (!Host.IsLive()) + return; + + if (!(event.GetDamagerEntity(true) instanceof Player)) + return; + + if (isEvolving(event.GetDamagerPlayer(true))) + event.SetCancelled("Player is evolving!"); + } + + @EventHandler + public void onEvolveAbility(EvolutionAbilityUseEvent event) + { + if (!Host.IsLive()) + return; + + if (isEvolving(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler + public void onEvolveCompass(CompassAttemptTargetEvent event) + { + if (!Host.IsLive()) + return; + + if (isEvolving(event.getTarget())) + event.setCancelled(true); + } + + @EventHandler + public void onEvolveConstruct(PerkConstructorEvent event) + { + if (!Host.IsLive()) + return; + + if (isEvolving(event.getPlayer())) + event.setCancelled(true); + } + + @EventHandler + public void onEvolveMove(PlayerMoveEvent event) + { + if (!Host.IsLive()) + return; + + if (isEvolving(event.getPlayer())) + event.getPlayer().teleport(event.getFrom()); } } From 158dcdc01e211ec4332af051a727b20198849b59 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 9 Aug 2015 23:25:26 -0400 Subject: [PATCH 16/56] Created a new way to Evolve. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Getting a kill presents you the option "Hold Shift to Evolve" • Holding shift for about 5 seconds evolves you as normal. --- .../game/games/evolution/Evolution.java | 246 ++++++++++-------- .../evolution/events/EvolutionEndEvent.java | 17 +- .../games/evolution/evolve/EvolveData.java | 98 ++++++- .../games/evolution/evolve/EvolveManager.java | 5 +- 4 files changed, 252 insertions(+), 114 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 155de90d1..f7d342e49 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -7,17 +7,21 @@ import java.util.Iterator; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; -import mineplex.core.itemstack.ItemBuilder; import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.condition.ConditionActive; @@ -42,15 +46,17 @@ import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; import nautilus.game.arcade.game.games.evolution.mobs.KitWolf; import nautilus.game.arcade.kit.Kit; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; +import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; -import org.bukkit.inventory.ItemStack; import org.bukkit.util.Vector; public class Evolution extends SoloGame @@ -70,7 +76,6 @@ public class Evolution extends SoloGame private NautHashMap _evoPlatforms = new NautHashMap(); private ArrayList _evolutionsAvailable = new ArrayList(); - private ArrayList _attemptingEvolve = new ArrayList(); public Evolution(ArcadeManager manager) { @@ -79,7 +84,8 @@ public class Evolution extends SoloGame new Kit[0], new String[] { - "You evolve when you get a kill.", + "You recieve an Evolution token every 2 kills.", + "Use it to Evolve into a new mob.", "Each evolution has unique skills.", "First to get through 10 evolutions wins!" }); @@ -182,6 +188,9 @@ public class Evolution extends SoloGame _tokens.put(player.getName(), new EvoToken(player)); upgradeKit(player, false); + + player.setLevel(0); + player.setExp(0F); } } @@ -286,21 +295,56 @@ public class Evolution extends SoloGame condition.GetCondition().Expire(); } } + + if (increaseScore(event.getPlayer()) >= 10) + { + ScoreboardUpdate(new UpdateEvent(UpdateType.FAST)); - upgradeKit(event.getPlayer(), true); - event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.LEVEL_UP, 1, 0.6F); + event.setCancelled(true); + + End(); + } + else + { + upgradeKit(event.getPlayer(), true); + event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.LEVEL_UP, 1, 0.6F); + } } @EventHandler - public void endEvolve(EvolutionPostEvolveEvent event) + public void endEvolve(final EvolutionPostEvolveEvent event) { try { Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); } catch (NullPointerException ex){} - - event.getPlayer().teleport(GetTeam(event.getPlayer()).GetSpawn()); + + if (getScore(event.getPlayer()) >= 10) + { + End(); + } + + Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() + { + @Override + public void run() + { + GetKit(event.getPlayer()).ApplyKit(event.getPlayer()); + } + }, 4); + } + + @EventHandler + public void onDeath(PlayerDeathEvent event) + { + if (!IsLive()) + return; + + if (_evolutionsAvailable.contains(event.getEntity())) + { + _evolutionsAvailable.remove(event.getEntity()); + } } @EventHandler @@ -308,55 +352,55 @@ public class Evolution extends SoloGame { if (!IsLive()) return; - - if (!event.GetLog().GetKiller().IsPlayer()) - return; - - Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); - - if (killer == null || !killer.isOnline()) + + CombatComponent damager = event.GetLog().GetKiller(); + + if (!damager.IsPlayer()) return; - if (!IsAlive(killer)) - return; - - if (killer == event.GetEvent().getEntity()) + Player player = UtilPlayer.searchExact(damager.GetName()); + + if (player == null || !player.isOnline()) return; - increaseScore(killer); - - ScoreboardUpdate(new UpdateEvent(UpdateType.FAST)); - - if (getScore(killer) >= 10) + if (!IsAlive(player)) + return; + + if (((Player) event.GetEvent().getEntity()) == player) + return; + + if (!_evolutionsAvailable.contains(player)) { - End(); + _evolutionsAvailable.add(player); + + player.setLevel(0); + player.setExp(0F); + } + } + + @EventHandler + public void onEgg(PlayerInteractEvent event) + { + if (!IsLive()) + return; + + if (!UtilEvent.isAction(event, ActionType.R_BLOCK) && !UtilEvent.isAction(event, ActionType.L_BLOCK)) + return; + + if (event.getClickedBlock().getType() == Material.DRAGON_EGG) + { + event.setCancelled(true); return; } - - _evolutionsAvailable.add(killer); -// EvoToken token = _tokens.get(killer.getName()); -// -// try -// { -// EvoKit from = _mobKits.get(token.Kills - 1); //Account for the score increase -// EvoKit to = _mobKits.get(token.Kills); -// -// _evolve.addEvolve(killer, from, to); -// } -// catch (IndexOutOfBoundsException ex) -// { -// End(); -// return; -// } } @EventHandler public void updateAvailableEvolutions(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) + { + if (!IsLive()) return; - if (!IsLive()) + if (event.getType() != UpdateType.TICK) return; Iterator iterator = _evolutionsAvailable.iterator(); @@ -367,87 +411,81 @@ public class Evolution extends SoloGame if (player == null || !player.isOnline()) { iterator.remove(); - return; + continue; } if (!IsAlive(player)) { iterator.remove(); - return; + continue; } - if (!_attemptingEvolve.contains(player)) + if (player.isSneaking()) { - UtilTextMiddle.display("", C.cGreen + C.Bold + "Evolution Available!"); - } - - if (!UtilGear.isMat(player.getInventory().getItem(7), Material.STAINED_CLAY)) - { - player.getInventory().setItem(7, new ItemBuilder(Material.STAINED_CLAY).build()); + if (onEvolveAttempting(player)) + { + iterator.remove(); + continue; + } } else { - //Rainbow effect on the clay - ItemStack item = player.getInventory().getItem(7); - byte data = UtilInv.GetData(item); + if (player.getExp() != 0F) + player.setExp(0F); - data++; + if (player.getLevel() != 0) + player.setLevel(0); - if (data > 15) - data = 0; - - item.setDurability(data); + if (Recharge.Instance.use(player, "Evolve Available", 2000, false, false)) + { + UtilTextMiddle.display("", C.cGreen + C.Bold + "Hold Shift to Evolve", 0, 60, 20, player); + } } } } - @EventHandler - public void onInteractWithEvolve(PlayerInteractEvent event) - { - if (!UtilEvent.isAction(event, ActionType.R)) - return; + //Boolean remove + @SuppressWarnings("deprecation") + private boolean onEvolveAttempting(Player player) + { + //No evolving in midair + if (!player.isOnGround() || !UtilEnt.isGrounded(player) || !UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + return false; - if (!IsLive()) - return; - - if (event.getItem().getType() != Material.STAINED_CLAY) - return; - - //Make sure it's the 7 slot - if (event.getPlayer().getInventory().getItem(7) != event.getItem()) - return; - - if (_attemptingEvolve.contains(event.getPlayer())) - return; - - _attemptingEvolve.add(event.getPlayer()); - } - - @EventHandler - public void updateAttemptingEvolve(UpdateEvent event) - { - if (event.getType() != UpdateType.TICK) - return; - - if (!IsLive()) - return; - - Iterator iterator = _attemptingEvolve.iterator(); - while (iterator.hasNext()) + if (player.getExp() >= .9999F) { - Player player = iterator.next(); - } - `} + UtilTextMiddle.display("", "", player); + + player.setExp(0F); + player.setLevel(0); - public void increaseScore(Player player) + EvoToken token = _tokens.get(player.getName()); + + EvoKit from = _mobKits.get(token.Level); + EvoKit to = _mobKits.get((token.Level + 1) >= _mobKits.size() ? token.Level : token.Level + 1); //Account for the score increase after evolve + + _evolve.addEvolve(Manager.getHologramManager(), player, from, to); + return true; + } + + player.setExp(Math.min(player.getExp() + .008F, .9999F)); + + UtilTextMiddle.display("", UtilTextMiddle.progress(player.getExp()).trim(), player); + + UtilParticle.PlayParticle(ParticleType.PORTAL, player.getLocation().clone().add(0, 1, 0), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.NORMAL, UtilServer.getPlayers()); + return false; + } + + private int increaseScore(Player player) { if (!IsAlive(player)) - return; + return 0; if (!_tokens.containsKey(player.getName())) - return; + return 0; _tokens.get(player.getName()).Level++; + return getScore(player); } public int getScore(Player player) @@ -485,6 +523,10 @@ public class Evolution extends SoloGame if (player.isOnline()) AddGems(player, 10, "Participation", false, false); + _tokens.clear(); + _evoPlatforms.clear(); + _evolutionsAvailable.clear(); + _evolve.end(); SetState(GameState.End); AnnounceEnd(players); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java index 8fb56f3b9..8db507389 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java @@ -1,16 +1,19 @@ package nautilus.game.arcade.game.games.evolution.events; import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; import org.bukkit.event.player.PlayerEvent; -public class EvolutionEndEvent extends PlayerEvent +public class EvolutionEndEvent extends PlayerEvent implements Cancellable { /** * @author Mysticate */ private static HandlerList _handlers = new HandlerList(); + private boolean _cancelled = false; + public EvolutionEndEvent(Player who) { super(who); @@ -26,4 +29,16 @@ public class EvolutionEndEvent extends PlayerEvent { return getHandlerList(); } + + @Override + public boolean isCancelled() + { + return _cancelled; + } + + @Override + public void setCancelled(boolean flag) + { + _cancelled = flag; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 30cca9d82..1de5ea85f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -1,11 +1,21 @@ package nautilus.game.arcade.game.games.evolution.evolve; +import java.util.AbstractMap.SimpleEntry; +import java.util.HashMap; +import java.util.Map.Entry; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.hologram.Hologram; +import mineplex.core.hologram.HologramManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; @@ -30,6 +40,7 @@ import org.bukkit.Bukkit; import org.bukkit.Color; import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -45,23 +56,40 @@ public class EvolveData private final long _timestamp = System.currentTimeMillis(); private long _endTime = System.currentTimeMillis(); + private final long _preEvolve; + private final long _postEvolve; + private final PlatformToken _token; private boolean _active = true; private final Player _player; + private final Location _eggLoc; + private final SimpleEntry _eggLocData; + + private final Hologram _eggHolo; + private final EvoKit _to; private final EntityInsentient _eFrom; private EntityInsentient _eTo; - public EvolveData(PlatformToken token, Player player, EvoKit from, EvoKit to) + @SuppressWarnings("deprecation") + public EvolveData(HologramManager holo, PlatformToken token, Player player, EvoKit from, EvoKit to) { + _preEvolve = 3200; + _postEvolve = 3400; + _token = token; _player = player; + _eggLoc = player.getLocation().getBlock().getLocation(); + _eggLocData = new SimpleEntry(_eggLoc.getBlock().getType(), _eggLoc.getBlock().getData()); + + _eggHolo = new Hologram(holo, _eggLoc.clone().add(0.5, 1.0, 0.5), C.cYellow + _player.getName()).setViewDistance(20).start(); + _to = to; _eFrom = spawn(from.getEntity(), token.Platform, false); @@ -69,11 +97,24 @@ public class EvolveData Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); setupPlayer(); + setupEgg(); } + private void setupEgg() + { + _eggLoc.getBlock().setType(Material.DRAGON_EGG); + } + + @SuppressWarnings("deprecation") + private void restoreEgg() + { + _eggLoc.getBlock().setType(_eggLocData.getKey()); + _eggLoc.getBlock().setData(_eggLocData.getValue()); + } + private void setupPlayer() { - _player.teleport(_token.Viewing); + _player.teleport(_token.Viewing.clone().add(0.5, 0.0, 0.5)); } //Boolean completed @@ -86,22 +127,29 @@ public class EvolveData } teleport(); +// updateHologram(); //Hasn't ended yet if (_active) - { + { //If 3 seconds past - if (UtilTime.elapsed(_timestamp, 3200)) + if (UtilTime.elapsed(_timestamp, _preEvolve)) { _active = false; _endTime = System.currentTimeMillis(); + EvolutionEndEvent event = new EvolutionEndEvent(_player); + Bukkit.getServer().getPluginManager().callEvent(event); + + if (event.isCancelled()) + { + return true; + } + _eTo = spawn(_to.getEntity(), _token.Platform, false); despawn(_eFrom); - UtilFirework.playFirework(_token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); - - Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); + UtilFirework.playFirework(_token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); } else { @@ -109,18 +157,33 @@ public class EvolveData if (UtilTime.elapsed(_timestamp, 500)) { UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, _token.Platform.clone().add(0.0, 1.0, 0.0), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.SHORT, _player); + UtilParticle.PlayParticle(ParticleType.PORTAL, _eggLoc, 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.NORMAL, UtilServer.getPlayers()); } } return false; } else { - if (!UtilTime.elapsed(_endTime, 3000)) + if (!UtilTime.elapsed(_endTime, _postEvolve)) return false; despawn(_eTo); + _eggHolo.stop(); - Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); + restoreEgg(); + _player.teleport(_eggLoc); + + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _eggLoc.clone().add(0.0, 1.0, 0.0), 2.0F, 2.0F, 2.0F, 0, 8, ViewDist.NORMAL, UtilServer.getPlayers()); + knockback(); + + Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() + { + @Override + public void run() + { + Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); + } + }, 4); return true; } } @@ -136,6 +199,10 @@ public class EvolveData if (_eTo != null) despawn(_eTo); + _eggHolo.stop(); + restoreEgg(); + + _player.teleport(_eggLoc.clone().add(0.5, 0.0, 0.5)); _ended = true; } @@ -144,6 +211,19 @@ public class EvolveData setupPlayer(); } + private void knockback() + { + HashMap radius = UtilPlayer.getInRadius(_eggLoc, 8.0); + + for (Entry entry : radius.entrySet()) + { + if (entry.getKey() == _player) + continue; + + UtilAction.velocity(entry.getKey(), UtilAlg.getTrajectory2d(_eggLoc, entry.getKey().getLocation()), 1.6 - (entry.getValue() / 10), true, 0.8, 0, 10, true); + } + } + private EntityInsentient spawn(EntityType type, Location loc, boolean invisible) { try diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index f7bf4613f..17a2cd113 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -7,6 +7,7 @@ import java.util.Map.Entry; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.hologram.HologramManager; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent; @@ -58,12 +59,12 @@ public class EvolveManager implements Listener return _data.containsKey(player.getName()); } - public void addEvolve(Player player, EvoKit from, EvoKit to) + public void addEvolve(HologramManager holo, Player player, EvoKit from, EvoKit to) { if (_data.containsKey(player.getName())) return; - _data.put(player.getName(), new EvolveData(getLocation(), player, from, to)); + _data.put(player.getName(), new EvolveData(holo, getLocation(), player, from, to)); } public EvolveData getEvolve(Player player) From a19cd3559d187410f8936a321c541aea5e24ba27 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 9 Aug 2015 23:26:59 -0400 Subject: [PATCH 17/56] Renamed "Shift" to "Crouch" --- .../nautilus/game/arcade/game/games/evolution/Evolution.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index f7d342e49..3ad62de58 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -438,7 +438,7 @@ public class Evolution extends SoloGame if (Recharge.Instance.use(player, "Evolve Available", 2000, false, false)) { - UtilTextMiddle.display("", C.cGreen + C.Bold + "Hold Shift to Evolve", 0, 60, 20, player); + UtilTextMiddle.display("", C.cGreen + C.Bold + "Hold Crouch to Evolve", 0, 60, 20, player); } } } From 463dfc7049cea92a919458b779440f2d59f6ad3d Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 10 Aug 2015 00:21:48 -0400 Subject: [PATCH 18/56] Minor Tweaks. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Fixed wrong evo location • Added a "Frozen" effect when evolving. --- .../game/games/evolution/Evolution.java | 82 +++++++++++++------ .../games/evolution/evolve/EvolveData.java | 4 +- 2 files changed, 60 insertions(+), 26 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 3ad62de58..0778d22d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -23,7 +23,9 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.conditions.Cloak; import mineplex.minecraft.game.core.condition.ConditionActive; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -76,6 +78,8 @@ public class Evolution extends SoloGame private NautHashMap _evoPlatforms = new NautHashMap(); private ArrayList _evolutionsAvailable = new ArrayList(); + private NautHashMap _chargingExp = new NautHashMap(); + private NautHashMap _evolvingDebuffs = new NautHashMap(); public Evolution(ArcadeManager manager) { @@ -84,8 +88,7 @@ public class Evolution extends SoloGame new Kit[0], new String[] { - "You recieve an Evolution token every 2 kills.", - "Use it to Evolve into a new mob.", + "You can evolve every kill.", "Each evolution has unique skills.", "First to get through 10 evolutions wins!" }); @@ -188,9 +191,6 @@ public class Evolution extends SoloGame _tokens.put(player.getName(), new EvoToken(player)); upgradeKit(player, false); - - player.setLevel(0); - player.setExp(0F); } } @@ -279,6 +279,22 @@ public class Evolution extends SoloGame Manager.GetCondition().Factory().Cloak("Evolving", player, null, 20, false, false); + //Freeze + Condition cloak = new Cloak(Manager.GetCondition(), "Evolving", player, null, ConditionType.CLOAK, 0, (int)(20 * 20), false, Material.GHAST_TEAR, (byte)0, false); + Condition speed = new Condition(Manager.GetCondition(), "Evolving", player, null, ConditionType.SPEED, 128, (int)(20 * 20), false, Material.FEATHER, (byte)0, false, false); + Condition slow = new Condition(Manager.GetCondition(), "Evolving", player, null, ConditionType.SLOW, Integer.MAX_VALUE, (int)(20 * 20), false, Material.WEB, (byte)0, false, false); + Condition jump = new Condition(Manager.GetCondition(), "Evolving", player, null, ConditionType.JUMP, -Integer.MAX_VALUE, (int)(20 * 20), false, Material.CARROT_ITEM, (byte)0, false, false); + + _evolvingDebuffs.put(player.getName(), new Condition[] + { + cloak, speed, slow, jump + }); + + Manager.GetCondition().AddCondition(cloak); + Manager.GetCondition().AddCondition(speed); + Manager.GetCondition().AddCondition(slow); + Manager.GetCondition().AddCondition(jump); + ((Player) player).playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1.25f); } @@ -289,8 +305,23 @@ public class Evolution extends SoloGame { for (ConditionActive condition : Manager.GetCondition().GetActiveConditions().get(event.getPlayer())) { - if (condition.GetCondition().GetType() == ConditionType.CLOAK) - continue; + if (_evolvingDebuffs.containsKey(event.getPlayer().getName())) + { + boolean d = false; + for (Condition debuf : _evolvingDebuffs.get(event.getPlayer().getName())) + { + if (condition.GetCondition() == debuf) + { + d = true; + break; + } + } + + if (d) + { + continue; + } + } condition.GetCondition().Expire(); } @@ -314,11 +345,13 @@ public class Evolution extends SoloGame @EventHandler public void endEvolve(final EvolutionPostEvolveEvent event) { - try + if (_evolvingDebuffs.containsKey(event.getPlayer().getName())) { - Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); + for (Condition debuf : _evolvingDebuffs.get(event.getPlayer().getName())) + { + debuf.Expire(); + } } - catch (NullPointerException ex){} if (getScore(event.getPlayer()) >= 10) { @@ -372,9 +405,9 @@ public class Evolution extends SoloGame if (!_evolutionsAvailable.contains(player)) { _evolutionsAvailable.add(player); - - player.setLevel(0); - player.setExp(0F); + + if (_chargingExp.containsKey(player.getName())) + _chargingExp.remove(player.getName()); } } @@ -430,12 +463,9 @@ public class Evolution extends SoloGame } else { - if (player.getExp() != 0F) - player.setExp(0F); - - if (player.getLevel() != 0) - player.setLevel(0); - + if (_chargingExp.containsKey(player.getName())) + _chargingExp.remove(player.getName()); + if (Recharge.Instance.use(player, "Evolve Available", 2000, false, false)) { UtilTextMiddle.display("", C.cGreen + C.Bold + "Hold Crouch to Evolve", 0, 60, 20, player); @@ -452,12 +482,16 @@ public class Evolution extends SoloGame if (!player.isOnGround() || !UtilEnt.isGrounded(player) || !UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) return false; - if (player.getExp() >= .9999F) + if (!_chargingExp.containsKey(player.getName())) + _chargingExp.put(player.getName(), 0F); + + float exp = _chargingExp.get(player.getName()); + + if (exp >= .9999F) { UtilTextMiddle.display("", "", player); - player.setExp(0F); - player.setLevel(0); + _chargingExp.remove(player.getName()); EvoToken token = _tokens.get(player.getName()); @@ -468,9 +502,9 @@ public class Evolution extends SoloGame return true; } - player.setExp(Math.min(player.getExp() + .008F, .9999F)); + _chargingExp.put(player.getName(), Math.min(exp + .008F, .9999F)); - UtilTextMiddle.display("", UtilTextMiddle.progress(player.getExp()).trim(), player); + UtilTextMiddle.display("", UtilTextMiddle.progress(_chargingExp.get(player.getName())).trim(), player); UtilParticle.PlayParticle(ParticleType.PORTAL, player.getLocation().clone().add(0, 1, 0), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.NORMAL, UtilServer.getPlayers()); return false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 1de5ea85f..47376bed6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -88,7 +88,7 @@ public class EvolveData _eggLoc = player.getLocation().getBlock().getLocation(); _eggLocData = new SimpleEntry(_eggLoc.getBlock().getType(), _eggLoc.getBlock().getData()); - _eggHolo = new Hologram(holo, _eggLoc.clone().add(0.5, 1.0, 0.5), C.cYellow + _player.getName()).setViewDistance(20).start(); + _eggHolo = new Hologram(holo, _eggLoc.clone().add(0.5, 1.0, 0.5), C.cYellow + _player.getName()).start(); _to = to; @@ -114,7 +114,7 @@ public class EvolveData private void setupPlayer() { - _player.teleport(_token.Viewing.clone().add(0.5, 0.0, 0.5)); + _player.teleport(_token.Viewing); } //Boolean completed From 1804d668e161d325a53c73d8281dca06393b537c Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 10 Aug 2015 08:42:03 -0400 Subject: [PATCH 19/56] A few small tweaks. Removed the "Frozen" effect. --- .../game/games/evolution/Evolution.java | 56 ++++--------------- .../games/evolution/evolve/EvolveData.java | 6 +- .../evolution/mobs/perks/PerkBounceEVO.java | 3 + .../evolution/mobs/perks/PerkPounceEVO.java | 5 +- 4 files changed, 21 insertions(+), 49 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 0778d22d4..39292cc1b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -23,9 +23,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; -import mineplex.minecraft.game.core.condition.Condition; import mineplex.minecraft.game.core.condition.Condition.ConditionType; -import mineplex.minecraft.game.core.condition.conditions.Cloak; import mineplex.minecraft.game.core.condition.ConditionActive; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -79,7 +77,6 @@ public class Evolution extends SoloGame private ArrayList _evolutionsAvailable = new ArrayList(); private NautHashMap _chargingExp = new NautHashMap(); - private NautHashMap _evolvingDebuffs = new NautHashMap(); public Evolution(ArcadeManager manager) { @@ -276,24 +273,9 @@ public class Evolution extends SoloGame player.leaveVehicle(); ((CraftPlayer) player).getHandle().p(0); - - Manager.GetCondition().Factory().Cloak("Evolving", player, null, 20, false, false); - + //Freeze - Condition cloak = new Cloak(Manager.GetCondition(), "Evolving", player, null, ConditionType.CLOAK, 0, (int)(20 * 20), false, Material.GHAST_TEAR, (byte)0, false); - Condition speed = new Condition(Manager.GetCondition(), "Evolving", player, null, ConditionType.SPEED, 128, (int)(20 * 20), false, Material.FEATHER, (byte)0, false, false); - Condition slow = new Condition(Manager.GetCondition(), "Evolving", player, null, ConditionType.SLOW, Integer.MAX_VALUE, (int)(20 * 20), false, Material.WEB, (byte)0, false, false); - Condition jump = new Condition(Manager.GetCondition(), "Evolving", player, null, ConditionType.JUMP, -Integer.MAX_VALUE, (int)(20 * 20), false, Material.CARROT_ITEM, (byte)0, false, false); - - _evolvingDebuffs.put(player.getName(), new Condition[] - { - cloak, speed, slow, jump - }); - - Manager.GetCondition().AddCondition(cloak); - Manager.GetCondition().AddCondition(speed); - Manager.GetCondition().AddCondition(slow); - Manager.GetCondition().AddCondition(jump); + Manager.GetCondition().Factory().Cloak("Evolving", player, null, 10, false, false); ((Player) player).playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1.25f); } @@ -303,27 +285,12 @@ public class Evolution extends SoloGame { if (Manager.GetCondition().GetActiveConditions().containsKey(event.getPlayer())) { - for (ConditionActive condition : Manager.GetCondition().GetActiveConditions().get(event.getPlayer())) + for (ConditionActive cond : Manager.GetCondition().GetActiveConditions().get(event.getPlayer())) { - if (_evolvingDebuffs.containsKey(event.getPlayer().getName())) - { - boolean d = false; - for (Condition debuf : _evolvingDebuffs.get(event.getPlayer().getName())) - { - if (condition.GetCondition() == debuf) - { - d = true; - break; - } - } - - if (d) - { - continue; - } - } - - condition.GetCondition().Expire(); + if (cond.GetCondition().GetType() == ConditionType.CLOAK) + continue; + + cond.GetCondition().Expire(); } } @@ -345,12 +312,10 @@ public class Evolution extends SoloGame @EventHandler public void endEvolve(final EvolutionPostEvolveEvent event) { - if (_evolvingDebuffs.containsKey(event.getPlayer().getName())) + //Make sure they're not invis when they're done evolving + while (Manager.GetCondition().IsCloaked(event.getPlayer())) { - for (Condition debuf : _evolvingDebuffs.get(event.getPlayer().getName())) - { - debuf.Expire(); - } + Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); } if (getScore(event.getPlayer()) >= 10) @@ -562,6 +527,7 @@ public class Evolution extends SoloGame _evolutionsAvailable.clear(); _evolve.end(); + SetState(GameState.End); AnnounceEnd(players); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 47376bed6..bf863b6e4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -85,10 +85,10 @@ public class EvolveData _player = player; - _eggLoc = player.getLocation().getBlock().getLocation(); + _eggLoc = player.getLocation(); _eggLocData = new SimpleEntry(_eggLoc.getBlock().getType(), _eggLoc.getBlock().getData()); - _eggHolo = new Hologram(holo, _eggLoc.clone().add(0.5, 1.0, 0.5), C.cYellow + _player.getName()).start(); + _eggHolo = new Hologram(holo, _eggLoc.getBlock().getLocation().clone().add(0.5, 1.0, 0.5), C.cYellow + _player.getName()).start(); _to = to; @@ -173,7 +173,7 @@ public class EvolveData restoreEgg(); _player.teleport(_eggLoc); - UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _eggLoc.clone().add(0.0, 1.0, 0.0), 2.0F, 2.0F, 2.0F, 0, 8, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _eggLoc.clone().add(0.0, 1.0, 0.0), 1.4F, 3.0F, 1.4F, 0, 12, ViewDist.NORMAL, UtilServer.getPlayers()); knockback(); Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index ac2cd6a51..7adf9ca1f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -24,6 +24,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; public class PerkBounceEVO extends Perk { @@ -143,6 +144,8 @@ public class PerkBounceEVO extends Perk DamageCause.CUSTOM, damage, true, true, false, damager.getName(), GetName()); + UtilAction.velocity(damager, new Vector()); + //Inform UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java index 44901edea..38b6b59ae 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java @@ -24,6 +24,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.util.Vector; public class PerkPounceEVO extends Perk { @@ -70,7 +71,7 @@ public class PerkPounceEVO extends Perk if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) return; - UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.3, 1.8, true); + UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.3, 1.8, false); //Record _live.put(player, System.currentTimeMillis()); @@ -143,6 +144,8 @@ public class PerkPounceEVO extends Perk DamageCause.CUSTOM, damage, true, true, false, damager.getName(), GetName()); + UtilAction.velocity(damager, new Vector()); + //Inform UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); From a618b19b73ceabe2f4e01bb71ed469dac9da003a Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 10 Aug 2015 14:32:35 -0400 Subject: [PATCH 20/56] Small changes --- .../game/games/evolution/Evolution.java | 156 +++++++++++++++--- .../games/evolution/evolve/EvolveData.java | 41 ++++- 2 files changed, 169 insertions(+), 28 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 39292cc1b..6b8b1631b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -5,10 +5,10 @@ import java.util.Collections; import java.util.Iterator; import mineplex.core.common.util.C; +import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilMath; @@ -28,7 +28,9 @@ import mineplex.minecraft.game.core.condition.ConditionActive; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.SoloGame; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; @@ -74,6 +76,7 @@ public class Evolution extends SoloGame //Platform location, viewing location. private NautHashMap _evoPlatforms = new NautHashMap(); + private ArrayList _spawns = new ArrayList(); private ArrayList _evolutionsAvailable = new ArrayList(); private NautHashMap _chargingExp = new NautHashMap(); @@ -164,11 +167,16 @@ public class Evolution extends SoloGame break; } } + + for (GameTeam team : GetTeamList()) + { + _spawns.addAll(team.GetSpawns()); + } } private Location loadAngle(Location platform, Location viewing) { - Vector b = UtilAlg.getTrajectory(viewing, platform.clone().subtract(0.0, 1.0, 0.0)).normalize(); + Vector b = UtilAlg.getTrajectory(viewing, platform.clone().add(0.0, 1.0, 0.0)).normalize(); viewing.setPitch(UtilAlg.GetPitch(b)); viewing.setYaw(UtilAlg.GetYaw(b)); @@ -191,8 +199,6 @@ public class Evolution extends SoloGame } } - - @EventHandler public void showKit(GameStateChangeEvent event) { @@ -376,6 +382,24 @@ public class Evolution extends SoloGame } } + @Override + public void RespawnPlayer(final Player player) + { + player.eject(); + player.teleport(getSpawn()); + + Manager.Clear(player); + + //Re-Give Kit + Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + public void run() + { + GetKit(player).ApplyKit(player); + } + }, 0); + } + @EventHandler public void onEgg(PlayerInteractEvent event) { @@ -392,6 +416,7 @@ public class Evolution extends SoloGame } } + @SuppressWarnings("deprecation") @EventHandler public void updateAvailableEvolutions(UpdateEvent event) { @@ -417,46 +442,56 @@ public class Evolution extends SoloGame iterator.remove(); continue; } - - if (player.isSneaking()) + + if (player.isSneaking() && (player.isOnGround() || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))) { - if (onEvolveAttempting(player)) + if (!player.getLocation().getBlock().isLiquid()) { - iterator.remove(); + if (onEvolveAttempting(player)) + { + iterator.remove(); + } continue; } - } - else - { - if (_chargingExp.containsKey(player.getName())) - _chargingExp.remove(player.getName()); - - if (Recharge.Instance.use(player, "Evolve Available", 2000, false, false)) + else { - UtilTextMiddle.display("", C.cGreen + C.Bold + "Hold Crouch to Evolve", 0, 60, 20, player); + if (Recharge.Instance.use(player, "No Evolve Water Message", 2000, false, false)) + { + UtilPlayer.message(player, F.main("Game", "You cannot evolve in water!")); + } } } + + if (_chargingExp.containsKey(player.getName())) + _chargingExp.remove(player.getName()); + + if (hasEvolvingEffects(player)) + removeEvolvingEffects(player); + + if (Recharge.Instance.use(player, "Evolve Available", 2000, false, false)) + { + UtilTextMiddle.display("", C.cGreen + C.Bold + "Hold Crouch to Evolve", 0, 60, 20, player); + } + } } //Boolean remove - @SuppressWarnings("deprecation") private boolean onEvolveAttempting(Player player) { - //No evolving in midair - if (!player.isOnGround() || !UtilEnt.isGrounded(player) || !UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) - return false; - if (!_chargingExp.containsKey(player.getName())) _chargingExp.put(player.getName(), 0F); float exp = _chargingExp.get(player.getName()); if (exp >= .9999F) - { + { UtilTextMiddle.display("", "", player); _chargingExp.remove(player.getName()); + + if (hasEvolvingEffects(player)) + removeEvolvingEffects(player); EvoToken token = _tokens.get(player.getName()); @@ -467,14 +502,63 @@ public class Evolution extends SoloGame return true; } - _chargingExp.put(player.getName(), Math.min(exp + .008F, .9999F)); + if (!hasEvolvingEffects(player)) + addEvolvingEffects(player); + + _chargingExp.put(player.getName(), Math.min(exp + .01F, .9999F)); UtilTextMiddle.display("", UtilTextMiddle.progress(_chargingExp.get(player.getName())).trim(), player); - UtilParticle.PlayParticle(ParticleType.PORTAL, player.getLocation().clone().add(0, 1, 0), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.PORTAL, player.getLocation().clone().add(0, 1, 0), 0.5F, 1.0F, 0.5F, 0, 10, ViewDist.NORMAL, UtilServer.getPlayers()); return false; } + private boolean hasEvolvingEffects(Player player) + { + if (!Manager.GetCondition().GetActiveConditions().containsKey(player)) + return false; + + for (ConditionActive active : Manager.GetCondition().GetActiveConditions().get(player)) + { + if (!active.GetCondition().GetReason().equalsIgnoreCase("Charging")) + continue; + + return true; + } + + return false; + } + + private void removeEvolvingEffects(Player player) + { + if (!Manager.GetCondition().GetActiveConditions().containsKey(player)) + return; + + for (ConditionActive active : Manager.GetCondition().GetActiveConditions().get(player)) + { + if (!active.GetCondition().GetReason().equalsIgnoreCase("Charging")) + continue; + + active.GetCondition().Expire(); + } + } + + private void addEvolvingEffects(Player player) + { + Manager.GetCondition().Factory().Jump("Charging", player, null, 20, 128, false, false, false); + Manager.GetCondition().Factory().Slow("Charging", player, null, 20, 255, false, false, false, false); + } + + @EventHandler + public void onEvolveAttemptingAbility(EvolutionAbilityUseEvent event) + { + if (!IsLive()) + return; + + if (_evolve.isEvolving(event.getPlayer())) + event.setCancelled(true); + } + private int increaseScore(Player player) { if (!IsAlive(player)) @@ -495,6 +579,28 @@ public class Evolution extends SoloGame return _tokens.get(player.getName()).Level; } + public Location getSpawn() + { + ArrayList allPlayers = new ArrayList(); + + for (Player cur : GetPlayers(true)) + { + if (UtilPlayer.isSpectator(cur)) + continue; + + if (_evolve.isEvolving(cur)) + { + allPlayers.add(_evolve.getEvolve(cur).getEggLocation()); + } + else + { + allPlayers.add(cur.getLocation()); + } + } + + return UtilAlg.getLocationAwayFromOtherLocations(_spawns, allPlayers); + } + private void End() { ArrayList tokens = new ArrayList(_tokens.values()); @@ -531,7 +637,7 @@ public class Evolution extends SoloGame SetState(GameState.End); AnnounceEnd(players); } - + @Override @EventHandler public void ScoreboardUpdate(UpdateEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index bf863b6e4..f82eed3cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.HologramManager; +import mineplex.core.hologram.Hologram.HologramTarget; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; @@ -59,6 +60,8 @@ public class EvolveData private final long _preEvolve; private final long _postEvolve; + private HologramManager _holoManager; + private final PlatformToken _token; private boolean _active = true; @@ -72,6 +75,8 @@ public class EvolveData private final EvoKit _to; + private Hologram _holo; + private final EntityInsentient _eFrom; private EntityInsentient _eTo; @@ -81,6 +86,8 @@ public class EvolveData _preEvolve = 3200; _postEvolve = 3400; + _holoManager = holo; + _token = token; _player = player; @@ -91,13 +98,14 @@ public class EvolveData _eggHolo = new Hologram(holo, _eggLoc.getBlock().getLocation().clone().add(0.5, 1.0, 0.5), C.cYellow + _player.getName()).start(); _to = to; - + _eFrom = spawn(from.getEntity(), token.Platform, false); - + Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); setupPlayer(); setupEgg(); + setupHologram(holo, _eFrom, C.cYellow + C.Bold + from.GetName()); } private void setupEgg() @@ -112,11 +120,32 @@ public class EvolveData _eggLoc.getBlock().setData(_eggLocData.getValue()); } + public Location getEggLocation() + { + return _eggLoc; + } + private void setupPlayer() { _player.teleport(_token.Viewing); } + private void setupHologram(HologramManager manager, EntityInsentient entity, String name) + { + if (_holo == null) + _holo = new Hologram(manager, _token.Platform); + + double add = entity.boundingBox.e - entity.boundingBox.b + .5; + + _holo.setLocation(_token.Platform.clone().add(0, add, 0)); + _holo.setText(name); + + _holo.setHologramTarget(HologramTarget.WHITELIST); + _holo.addPlayer(_player); + + _holo.start(); + } + //Boolean completed public boolean tick() { @@ -149,6 +178,8 @@ public class EvolveData _eTo = spawn(_to.getEntity(), _token.Platform, false); despawn(_eFrom); + setupHologram(_holoManager, _eTo, C.cYellow + C.Bold + _to.GetName()); + UtilFirework.playFirework(_token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); } else @@ -157,7 +188,7 @@ public class EvolveData if (UtilTime.elapsed(_timestamp, 500)) { UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, _token.Platform.clone().add(0.0, 1.0, 0.0), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.SHORT, _player); - UtilParticle.PlayParticle(ParticleType.PORTAL, _eggLoc, 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, _eggLoc.getBlock().getLocation().clone().add(0.5, 0.5, 0.5), 1.0F, 1.0F, 1.0F, 0, 10, ViewDist.NORMAL, UtilServer.getPlayers()); } } return false; @@ -171,6 +202,7 @@ public class EvolveData _eggHolo.stop(); restoreEgg(); + _holo.stop(); _player.teleport(_eggLoc); UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _eggLoc.clone().add(0.0, 1.0, 0.0), 1.4F, 3.0F, 1.4F, 0, 12, ViewDist.NORMAL, UtilServer.getPlayers()); @@ -202,6 +234,9 @@ public class EvolveData _eggHolo.stop(); restoreEgg(); + if (_holo != null) + _holo.stop(); + _player.teleport(_eggLoc.clone().add(0.5, 0.0, 0.5)); _ended = true; } From e81a3f7ecd83402dd8c33f57276a24f7f2a494ec Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 10 Aug 2015 14:32:49 -0400 Subject: [PATCH 21/56] Added a method to UtilAlg. --- .../mineplex/core/common/util/UtilAlg.java | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index d686faa2d..a839076c9 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -251,6 +251,25 @@ public class UtilAlg return bestLoc; } + public static Location findFurthest(Location mid, ArrayList locs) + { + Location bestLoc = null; + double bestDist = 0; + + for (Location loc : locs) + { + double dist = UtilMath.offset(mid, loc); + + if (bestLoc == null || dist > bestDist) + { + bestLoc = loc; + bestDist = dist; + } + } + + return bestLoc; + } + public static boolean isInPyramid(Vector a, Vector b, double angleLimit) { return (Math.abs(GetPitch(a) - GetPitch(b)) < angleLimit) && (Math.abs(GetYaw(a) - GetYaw(b)) < angleLimit); @@ -298,6 +317,42 @@ public class UtilAlg return bestLoc; } + public static Location getLocationAwayFromOtherLocations(ArrayList locs, ArrayList players) + { + Location bestLoc = null; + double bestDist = 0; + + for (Location loc : locs) + { + double closest = -1; + + for (Location player : players) + { + //Different Worlds + if (!player.getWorld().equals(loc.getWorld())) + continue; + + double dist = UtilMath.offsetSquared(player, loc); + + if (closest == -1 || dist < closest) + { + closest = dist; + } + } + + if (closest == -1) + continue; + + if (bestLoc == null || closest > bestDist) + { + bestLoc = loc; + bestDist = closest; + } + } + + return bestLoc; + } + public static Location getLocationNearPlayers(ArrayList locs, ArrayList players, ArrayList dontOverlap) { Location bestLoc = null; From 873a2f3c5632634ac729ca539782212041c8b38b Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 10 Aug 2015 19:45:40 -0400 Subject: [PATCH 22/56] Changed slowness from 255 - 2 --- .../nautilus/game/arcade/game/games/evolution/Evolution.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 6b8b1631b..8c900945d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -546,7 +546,7 @@ public class Evolution extends SoloGame private void addEvolvingEffects(Player player) { Manager.GetCondition().Factory().Jump("Charging", player, null, 20, 128, false, false, false); - Manager.GetCondition().Factory().Slow("Charging", player, null, 20, 255, false, false, false, false); + Manager.GetCondition().Factory().Slow("Charging", player, null, 20, 2, false, false, false, false); } @EventHandler From 0c3c9702d9934c7a82b40121bd85c56ce6c7eb24 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 12 Aug 2015 09:44:55 -0400 Subject: [PATCH 23/56] Small fixes. Added holograms to show kit abilities. Fireworks are now client side only. Decreased the # of emerald particles. --- .../core/common/util/UtilFirework.java | 27 ++++++++++++++ .../arcade/game/games/evolution/EvoKit.java | 9 ++++- .../game/games/evolution/Evolution.java | 22 +++--------- .../games/evolution/evolve/EvolveData.java | 35 ++++++++++--------- .../games/evolution/evolve/EvolveManager.java | 11 ++++++ .../game/games/evolution/mobs/KitBlaze.java | 6 ++++ .../game/games/evolution/mobs/KitChicken.java | 13 +++++-- .../game/games/evolution/mobs/KitCreeper.java | 6 +++- .../games/evolution/mobs/KitEnderman.java | 5 +++ .../game/games/evolution/mobs/KitGolem.java | 6 +++- .../games/evolution/mobs/KitSkeleton.java | 6 +++- .../game/games/evolution/mobs/KitSlime.java | 6 +++- .../game/games/evolution/mobs/KitSnowman.java | 7 +++- .../game/games/evolution/mobs/KitSpider.java | 5 +++ .../game/games/evolution/mobs/KitWolf.java | 6 +++- 15 files changed, 126 insertions(+), 44 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java index 7b9a8479f..c07b7b3b4 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilFirework.java @@ -1,5 +1,7 @@ package mineplex.core.common.util; +import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; + import org.bukkit.Color; import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect.Type; @@ -8,6 +10,7 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework; import org.bukkit.entity.Firework; +import org.bukkit.entity.Player; import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.util.Vector; @@ -68,5 +71,29 @@ public class UtilFirework public static void playFirework(Location loc, Type type, Color color, boolean flicker, boolean trail) { playFirework(loc, FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build()); + } + + public static void packetPlayFirework(Player player, Location loc, Type type, Color color, boolean flicker, boolean trail) + { + Firework firework = (Firework) loc.getWorld().spawn(loc, Firework.class); + FireworkEffect effect = FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build(); + + FireworkMeta data = (FireworkMeta) firework.getFireworkMeta(); + data.clearEffects(); + data.setPower(1); + data.addEffect(effect); + firework.setFireworkMeta(data); + + ((CraftFirework) firework).getHandle().expectedLifespan = 1; + + PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(firework.getEntityId()); + + for (Player viewing : UtilServer.getPlayers()) + { + if (player == viewing) + continue; + + UtilPlayer.sendPacket(viewing, packet); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 5d7bb8a1b..06a7c3d2c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -21,12 +21,14 @@ public abstract class EvoKit extends Kit */ private EntityType _entity; + private String[] _shortKitDesc; - public EvoKit(ArcadeManager manager, String name, String[] kitDesc, Perk[] kitPerks, EntityType type) + public EvoKit(ArcadeManager manager, String name, String[] kitDesc, String[] shortKitDesc, Perk[] kitPerks, EntityType type) { super(manager, name, KitAvailability.Hide, 0, kitDesc, kitPerks, type, null); _entity = type; + _shortKitDesc = shortKitDesc; } public EntityType getEntity() @@ -56,6 +58,11 @@ public abstract class EvoKit extends Kit UtilTextMiddle.display(null, def, player); } + public String[] getShortKitDesc() + { + return _shortKitDesc; + } + @Override public abstract void GiveItems(Player player); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 8c900945d..47e0b8428 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -176,7 +176,7 @@ public class Evolution extends SoloGame private Location loadAngle(Location platform, Location viewing) { - Vector b = UtilAlg.getTrajectory(viewing, platform.clone().add(0.0, 1.0, 0.0)).normalize(); + Vector b = UtilAlg.getTrajectory(viewing, platform.clone().subtract(0, 1.1, 0)).normalize(); viewing.setPitch(UtilAlg.GetPitch(b)); viewing.setYaw(UtilAlg.GetYaw(b)); @@ -231,18 +231,6 @@ public class Evolution extends SoloGame _evolve = new EvolveManager(this, _evoPlatforms); } - - @Override - public boolean HasKit(Player player, Kit kit) - { - if (GetKit(player) == null) - return false; - - if (GetKit(player) == kit) - return true; - - return false; - } //Boolean ending public void upgradeKit(Player player, boolean give) @@ -505,11 +493,11 @@ public class Evolution extends SoloGame if (!hasEvolvingEffects(player)) addEvolvingEffects(player); - _chargingExp.put(player.getName(), Math.min(exp + .01F, .9999F)); + _chargingExp.put(player.getName(), Math.min(exp + .012F, .9999F)); UtilTextMiddle.display("", UtilTextMiddle.progress(_chargingExp.get(player.getName())).trim(), player); - UtilParticle.PlayParticle(ParticleType.PORTAL, player.getLocation().clone().add(0, 1, 0), 0.5F, 1.0F, 0.5F, 0, 10, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().clone().add(0, 1, 0), 0.4F, 0.56F, 0.4F, 0, 3, ViewDist.NORMAL, UtilServer.getPlayers()); return false; } @@ -546,7 +534,7 @@ public class Evolution extends SoloGame private void addEvolvingEffects(Player player) { Manager.GetCondition().Factory().Jump("Charging", player, null, 20, 128, false, false, false); - Manager.GetCondition().Factory().Slow("Charging", player, null, 20, 2, false, false, false, false); + Manager.GetCondition().Factory().Slow("Charging", player, null, 20, 1, false, false, false, false); } @EventHandler @@ -555,7 +543,7 @@ public class Evolution extends SoloGame if (!IsLive()) return; - if (_evolve.isEvolving(event.getPlayer())) + if (_chargingExp.containsKey(event.getPlayer().getName())) event.setCancelled(true); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index f82eed3cd..b3071d325 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.evolution.evolve; import java.util.AbstractMap.SimpleEntry; +import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; @@ -15,8 +16,8 @@ import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.hologram.Hologram; -import mineplex.core.hologram.HologramManager; import mineplex.core.hologram.Hologram.HologramTarget; +import mineplex.core.hologram.HologramManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; @@ -105,7 +106,7 @@ public class EvolveData setupPlayer(); setupEgg(); - setupHologram(holo, _eFrom, C.cYellow + C.Bold + from.GetName()); + setupHologram(holo, _eFrom, from); } private void setupEgg() @@ -130,15 +131,21 @@ public class EvolveData _player.teleport(_token.Viewing); } - private void setupHologram(HologramManager manager, EntityInsentient entity, String name) + private void setupHologram(HologramManager manager, EntityInsentient entity, EvoKit kit) { if (_holo == null) _holo = new Hologram(manager, _token.Platform); - double add = entity.boundingBox.e - entity.boundingBox.b + .5; + double add = entity.boundingBox.e - entity.boundingBox.b + .5 + (.32 * kit.GetDesc().length); _holo.setLocation(_token.Platform.clone().add(0, add, 0)); - _holo.setText(name); + + ArrayList text = new ArrayList(); + text.add(C.cGreen + C.Bold + kit.GetName()); + for (String desc : kit.getShortKitDesc()) + text.add(desc.replaceAll("§7", C.cWhite)); + + _holo.setText(text.toArray(new String[0])); _holo.setHologramTarget(HologramTarget.WHITELIST); _holo.addPlayer(_player); @@ -178,9 +185,9 @@ public class EvolveData _eTo = spawn(_to.getEntity(), _token.Platform, false); despawn(_eFrom); - setupHologram(_holoManager, _eTo, C.cYellow + C.Bold + _to.GetName()); + setupHologram(_holoManager, _eTo, _to); - UtilFirework.playFirework(_token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); + UtilFirework.packetPlayFirework(_player, _token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); } else { @@ -188,22 +195,17 @@ public class EvolveData if (UtilTime.elapsed(_timestamp, 500)) { UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, _token.Platform.clone().add(0.0, 1.0, 0.0), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.SHORT, _player); - UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, _eggLoc.getBlock().getLocation().clone().add(0.5, 0.5, 0.5), 1.0F, 1.0F, 1.0F, 0, 10, ViewDist.NORMAL, UtilServer.getPlayers()); + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, _eggLoc.getBlock().getLocation().clone().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0, 3, ViewDist.NORMAL, UtilServer.getPlayers()); } } return false; } else - { + { if (!UtilTime.elapsed(_endTime, _postEvolve)) return false; - despawn(_eTo); - _eggHolo.stop(); - - restoreEgg(); - _holo.stop(); - _player.teleport(_eggLoc); + end(); UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _eggLoc.clone().add(0.0, 1.0, 0.0), 1.4F, 3.0F, 1.4F, 0, 12, ViewDist.NORMAL, UtilServer.getPlayers()); knockback(); @@ -215,12 +217,11 @@ public class EvolveData { Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); } - }, 4); + }, 2); return true; } } - //Force end. (Game ended) public void end() { _active = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index 17a2cd113..40ee56682 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -25,6 +25,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; public class EvolveManager implements Listener { @@ -118,6 +119,16 @@ public class EvolveManager implements Listener HandlerList.unregisterAll(this); } + @EventHandler + public void onLogout(PlayerQuitEvent event) + { + if (!Host.IsLive()) + return; + + if (isEvolving(event.getPlayer())) + getEvolve(event.getPlayer()).end(); + } + @EventHandler(priority = EventPriority.MONITOR) public void onEvolveDamageRecieve(CustomDamageEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java index 832b13482..fce6070ef 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseBlaze; import mineplex.core.itemstack.ItemBuilder; @@ -24,6 +25,11 @@ public class KitBlaze extends EvoKit F.elem("Hold Block") + " to use " + F.elem("Inferno"), F.elem("Attacks ignite opponents for 4 seconds") }, + new String[] + { + F.elem("Hold Block") + C.cWhite + " - " + F.elem("Inferno"), + F.elem("Attacks ignite enemies") + }, new Perk[] { new PerkFlamingSwordEVO() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index f42566474..0b5d3254b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; @@ -29,11 +30,17 @@ public class KitChicken extends EvoKit { super(manager, "Chicken", new String[] { - F.elem("Right-Click with Egg") + " to use " + F.elem("Throw Egg") - }, new Perk[] + F.elem("Right-Click with Egg") + " to use " + F.elem("Throw Egg"), + F.elem("Eggs deal " + C.cWhite + "9 Damage") + }, + new String[] { + F.elem("Recieve ") + C.cWhite + "1 Egg / 6 Seconds", + }, + new Perk[] + { new PerkConstructor("Egg Pouch", 6.0, 3, Material.EGG, "Egg", false) - }, EntityType.CHICKEN); + }, EntityType.CHICKEN); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java index 780600f3c..e034aa5d5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.itemstack.ItemBuilder; @@ -22,7 +23,10 @@ public class KitCreeper extends EvoKit new String[] { F.elem("Right-Click With Axe") + " to use " + F.elem("Sulphur Bomb") - }, + }, + new String[] { + F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Suphur Bomb") + }, new Perk[] { new PerkSulphurBombEVO() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java index 352ff832f..535d4211f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseEnderman; import mineplex.core.itemstack.ItemBuilder; @@ -23,6 +24,10 @@ public class KitEnderman extends EvoKit { F.elem("Right-Click Block With Sword") + " to use " + F.elem("Block Toss") }, + new String[] + { + F.elem("Interact Block With Sword") + C.cWhite + " - " + F.elem("Block Toss") + }, new Perk[] { new PerkBlockTossEVO() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java index c7225bdd6..da6996732 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseIronGolem; import mineplex.core.itemstack.ItemBuilder; @@ -23,7 +24,10 @@ public class KitGolem extends EvoKit { F.elem("Right-Click with Axe") + " to use " + F.elem("Ground Pound") }, - + new String[] + { + F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Ground Pound") + }, new Perk[] { new PerkSiesmicSlamEVO(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java index e93d52412..76e3f6f65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilInv; import mineplex.core.disguise.disguises.DisguiseSkeleton; @@ -29,7 +30,10 @@ public class KitSkeleton extends EvoKit { F.elem("Charge Bow") + " to use " + F.elem("Barrage") }, - + new String[] + { + F.elem("Charge Bow") + C.cWhite + " - " + F.elem("Barrage") + }, new Perk[] { new PerkConstructor("Fletcher", 3, 2, Material.ARROW, "Fletched Arrow", false), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java index ab3316ed1..c7722bfd5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.itemstack.ItemBuilder; @@ -23,7 +24,10 @@ public class KitSlime extends EvoKit { F.elem("Right-Click with Axe") + " to use " + F.elem("Bounce") }, - + new String[] + { + F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Bounce") + }, new Perk[] { new PerkBounceEVO() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java index 3034509b4..24d41b0cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; @@ -32,9 +33,13 @@ public class KitSnowman extends EvoKit { F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball") }, + new String[] + { + F.elem("Recieve ") + C.cWhite + "1 Snowball / 1 Second", + }, new Perk[] { - new PerkConstructor("Snowballer", 0.5, 16, Material.SNOW_BALL, "Snowball", false) + new PerkConstructor("Snowballer", 1, 16, Material.SNOW_BALL, "Snowball", false) }, EntityType.SNOWMAN); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java index fd83fcee6..e287388db 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseSpider; import mineplex.core.itemstack.ItemBuilder; @@ -24,6 +25,10 @@ public class KitSpider extends EvoKit { F.elem("Right-Click Web") + " to use " + F.elem("Web Toss"), }, + new String[] + { + F.elem("Click Web") + C.cWhite + " - " + F.elem("Web Toss") + }, new Perk[] { new PerkWebEVO(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java index 781e23c04..a322ae4dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; +import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseWolf; import mineplex.core.itemstack.ItemBuilder; @@ -24,7 +25,10 @@ public class KitWolf extends EvoKit { F.elem("Right-Click with Axe") + " to use " + F.elem("Pounce") }, - + new String[] + { + F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Pounce") + }, new Perk[] { new PerkSpeed(1), From ad94b63903bf9aad575b6832f031072c1f4525cd Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 12 Aug 2015 10:46:12 -0400 Subject: [PATCH 24/56] Blaze and Enderman now take water damage. --- .../game/games/evolution/Evolution.java | 2 - .../game/games/evolution/mobs/KitBlaze.java | 10 ++-- .../games/evolution/mobs/KitEnderman.java | 10 ++-- .../arcade/kit/perks/PerkWaterDamage.java | 47 +++++++++++++++++++ 4 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWaterDamage.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 47e0b8428..c2d17d6a4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -74,7 +74,6 @@ public class Evolution extends SoloGame private NautHashMap _tokens = new NautHashMap(); - //Platform location, viewing location. private NautHashMap _evoPlatforms = new NautHashMap(); private ArrayList _spawns = new ArrayList(); @@ -232,7 +231,6 @@ public class Evolution extends SoloGame _evolve = new EvolveManager(this, _evoPlatforms); } - //Boolean ending public void upgradeKit(Player player, boolean give) { if (!IsAlive(player)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java index fce6070ef..01d9a187c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java @@ -9,6 +9,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkFlamingSwordEVO; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkWaterDamage; import org.bukkit.Material; import org.bukkit.Sound; @@ -23,16 +24,19 @@ public class KitBlaze extends EvoKit new String[] { F.elem("Hold Block") + " to use " + F.elem("Inferno"), - F.elem("Attacks ignite opponents for 4 seconds") + F.elem("Attacks ignite opponents for 4 seconds"), + C.cRed + "You are damaged by water!" }, new String[] { F.elem("Hold Block") + C.cWhite + " - " + F.elem("Inferno"), - F.elem("Attacks ignite enemies") + F.elem("Attacks ignite enemies"), + C.cRed + "Damaged by Water" }, new Perk[] { - new PerkFlamingSwordEVO() + new PerkFlamingSwordEVO(), + new PerkWaterDamage(3, 1) }, EntityType.BLAZE); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java index 535d4211f..3e43104b3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java @@ -9,6 +9,7 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkBlockTossEVO; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkWaterDamage; import org.bukkit.Material; import org.bukkit.Sound; @@ -22,15 +23,18 @@ public class KitEnderman extends EvoKit super(manager, "Enderman", new String[] { - F.elem("Right-Click Block With Sword") + " to use " + F.elem("Block Toss") + F.elem("Right-Click Block With Sword") + " to use " + F.elem("Block Toss"), + C.cRed + "You are damaged by water!" }, new String[] { - F.elem("Interact Block With Sword") + C.cWhite + " - " + F.elem("Block Toss") + F.elem("Interact Block With Sword") + C.cWhite + " - " + F.elem("Block Toss"), + C.cRed + "Damaged by Water" }, new Perk[] { - new PerkBlockTossEVO() + new PerkBlockTossEVO(), + new PerkWaterDamage(2, 1) }, EntityType.ENDERMAN); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWaterDamage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWaterDamage.java new file mode 100644 index 000000000..9f06c2019 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWaterDamage.java @@ -0,0 +1,47 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkWaterDamage extends Perk +{ + private double _damage; + private long _time; + + public PerkWaterDamage(double damage, int time) + { + super("(Not) Water Bender", new String[] + { + "You are deathly afraid of water.", + "Entering water deals " + C.cYellow + "2 Damage" + C.cGray + " every " + C.cGreen + "1 Second" + }); + + _damage = damage; + _time = time * 1000; + } + + @EventHandler + public void update(UpdateEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)){ + if (!Kit.HasKit(player)) + continue; + + if (!Recharge.Instance.use(player, "Not Water Bender Damage", _time, false, false)) + continue; + + if (UtilEnt.inWater(player)) + Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.DROWNING, _damage, false, false, true, "Water", "Water Hating Kit"); + } + } +} From a7da10cb34940cdddfdebe5cf100c5b0ad6d0a12 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 12 Aug 2015 12:12:26 -0400 Subject: [PATCH 25/56] You no longer remain "charging" when you die. --- .../game/arcade/game/games/evolution/Evolution.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index c2d17d6a4..836bd3522 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -335,6 +335,16 @@ public class Evolution extends SoloGame { _evolutionsAvailable.remove(event.getEntity()); } + + if (_chargingExp.containsKey(event.getEntity().getName())) + { + _chargingExp.remove(event.getEntity().getName()); + } + + if (hasEvolvingEffects(event.getEntity())) + { + removeEvolvingEffects(event.getEntity()); + } } @EventHandler @@ -498,7 +508,6 @@ public class Evolution extends SoloGame UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().clone().add(0, 1, 0), 0.4F, 0.56F, 0.4F, 0, 3, ViewDist.NORMAL, UtilServer.getPlayers()); return false; } - private boolean hasEvolvingEffects(Player player) { if (!Manager.GetCondition().GetActiveConditions().containsKey(player)) From d7e28e9eb861e08307bdce81e622999c7c3978b0 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 12 Aug 2015 13:28:31 -0400 Subject: [PATCH 26/56] You can no longer have the option to Evolve if you kill while dead. --- .../nautilus/game/arcade/game/games/evolution/Evolution.java | 3 +++ .../game/arcade/game/games/evolution/mobs/KitSnowman.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 836bd3522..c450a7328 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -366,6 +366,9 @@ public class Evolution extends SoloGame if (!IsAlive(player)) return; + if (UtilPlayer.isSpectator(player)) + return; + if (((Player) event.GetEvent().getEntity()) == player) return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java index 24d41b0cf..0c2eca81f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java @@ -51,6 +51,8 @@ public class KitSnowman extends EvoKit player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); + player.getInventory().setItem(0, new ItemBuilder(Material.WOOD_SPADE).build()); + player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 4f, 1f); //Disguise From ed7dbddf4a829b2e2f1c96cf426529c330c30bfa Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 13 Aug 2015 00:12:28 -0400 Subject: [PATCH 27/56] Redid how kits are done. --- .../arcade/game/games/evolution/EvoKit.java | 116 ++++++++- .../game/games/evolution/Evolution.java | 94 ++++---- .../games/evolution/evolve/EvolveData.java | 12 +- .../games/evolution/kits/KitEvolutionist.java | 36 --- .../game/games/evolution/mobs/KitBlaze.java | 47 ++-- .../game/games/evolution/mobs/KitChicken.java | 91 ++++--- .../game/games/evolution/mobs/KitCreeper.java | 35 +-- .../games/evolution/mobs/KitEnderman.java | 82 ++----- .../game/games/evolution/mobs/KitGolem.java | 42 ++-- .../games/evolution/mobs/KitSkeleton.java | 169 ++++++------- .../game/games/evolution/mobs/KitSlime.java | 40 ++-- .../game/games/evolution/mobs/KitSnowman.java | 224 ++++++++---------- .../game/games/evolution/mobs/KitSpider.java | 39 ++- .../game/games/evolution/mobs/KitWolf.java | 98 ++++---- .../evolution/mobs/perks/PerkBounceEVO.java | 2 +- .../mobs/perks/PerkDoubleJumpEVO.java | 137 +++++++++++ .../mobs/perks/PerkFlamingSwordEVO.java | 150 ++++-------- .../mobs/perks/PerkSiesmicSlamEVO.java | 17 +- .../mobs/perks/PerkSulphurBombEVO.java | 2 +- .../evolution/mobs/perks/PerkWebEVO.java | 26 +- .../kit/perks/PerkExplosionModifier.java | 45 ++++ .../arcade/kit/perks/PerkFallModifier.java | 44 ++++ .../arcade/kit/perks/PerkKnockbackTaken.java | 44 ++++ .../arcade/kit/perks/PerkNoFallDamage.java | 34 +++ .../arcade/kit/perks/PerkWaterDamage.java | 4 +- 25 files changed, 906 insertions(+), 724 deletions(-) delete mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplosionModifier.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallModifier.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackTaken.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoFallDamage.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 06a7c3d2c..4bb68c5ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -1,9 +1,12 @@ package nautilus.game.arcade.game.games.evolution; +import java.util.ArrayList; + import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; @@ -13,6 +16,9 @@ import nautilus.game.arcade.kit.Perk; import org.bukkit.Sound; 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; public abstract class EvoKit extends Kit { @@ -21,14 +27,23 @@ public abstract class EvoKit extends Kit */ private EntityType _entity; - private String[] _shortKitDesc; - public EvoKit(ArcadeManager manager, String name, String[] kitDesc, String[] shortKitDesc, Perk[] kitPerks, EntityType type) + protected final double _health; + protected final double _damage; + + public EvoKit(ArcadeManager manager, String name, String[] desc, double health, double damage, Perk[] kitPerks, EntityType type) { - super(manager, name, KitAvailability.Hide, 0, kitDesc, kitPerks, type, null); + this(manager, name, desc, health, damage, kitPerks, type, false); + } + + public EvoKit(ArcadeManager manager, String name, String[] desc, double health, double damage, Perk[] kitPerks, EntityType type, boolean visible) + { + super(manager, name, visible ? KitAvailability.Free : KitAvailability.Hide, 0, desc, kitPerks, type, null); _entity = type; - _shortKitDesc = shortKitDesc; + + _health = health; + _damage = damage; } public EntityType getEntity() @@ -36,6 +51,61 @@ public abstract class EvoKit extends Kit return _entity; } + public double getHealth() + { + return _health; + } + + public double getDamage() + { + return _damage; + } + + public String[] buildHologram() + { + ArrayList text = new ArrayList(); + + text.add(C.cAqua + C.Bold + GetName()); + text.add(C.cYellow + "Melee: " + C.cWhite + _damage); + text.add(C.cYellow + "Health: " + C.cWhite + _health); + + if (GetDesc().length > 0) + { + text.add(C.Line); + + for (String desc : GetDesc()) + text.add(desc); + } + + return text.toArray(new String[0]); + } + + @Override + public void DisplayDesc(Player player) + { + for (int i=0 ; i<3 ; i++) + UtilPlayer.message(player, ""); + + UtilPlayer.message(player, ArcadeFormat.Line); + + UtilPlayer.message(player, "§aKit - §f§l" + GetName()); + + UtilPlayer.message(player, C.Line); + + UtilPlayer.message(player, C.cYellow + "Melee: " + C.cWhite + _damage); + UtilPlayer.message(player, C.cYellow + "Health: " + C.cWhite + _health); + + UtilPlayer.message(player, C.Line); + + for (String desc : GetDesc()) + UtilPlayer.message(player, desc); + + UtilPlayer.message(player, C.Line); + + UtilPlayer.message(player, ArcadeFormat.Line); + + } + public void upgradeGive(Player player) { String def = C.cWhite + C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName()); @@ -46,6 +116,11 @@ public abstract class EvoKit extends Kit UtilPlayer.message(player, C.Line); UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, def); + + UtilPlayer.message(player, C.Line); + + UtilPlayer.message(player, C.cYellow + "Melee: " + C.cWhite + _damage); + UtilPlayer.message(player, C.cYellow + "Health: " + C.cWhite + _health); UtilPlayer.message(player, C.Line); @@ -58,11 +133,38 @@ public abstract class EvoKit extends Kit UtilTextMiddle.display(null, def, player); } - public String[] getShortKitDesc() + @EventHandler(priority = EventPriority.HIGH) + public void onDamage(CustomDamageEvent event) { - return _shortKitDesc; + if (event.GetCause() != DamageCause.ENTITY_ATTACK) + return; + + Player damager = event.GetDamagerPlayer(false); + if (damager == null) return; + + if (!HasKit(damager)) + return; + + if (!Manager.IsAlive(damager)) + return; + + double mod = _damage - event.GetDamageInitial(); + + event.AddMod(damager.getName(), "Attack", mod, true); } @Override - public abstract void GiveItems(Player player); + public final void GiveItems(Player player) + { + player.setMaxHealth(_health); + player.setHealth(player.getMaxHealth()); + player.getInventory().setHeldItemSlot(0); + + player.setLevel(0); + player.setExp(0F); + + giveItems(player); + } + + protected abstract void giveItems(Player player); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index c450a7328..b87e66d08 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -35,20 +35,14 @@ import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager; -import nautilus.game.arcade.game.games.evolution.kits.KitEvolutionist; import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze; import nautilus.game.arcade.game.games.evolution.mobs.KitChicken; import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper; -import nautilus.game.arcade.game.games.evolution.mobs.KitEnderman; import nautilus.game.arcade.game.games.evolution.mobs.KitGolem; -import nautilus.game.arcade.game.games.evolution.mobs.KitSkeleton; import nautilus.game.arcade.game.games.evolution.mobs.KitSlime; -import nautilus.game.arcade.game.games.evolution.mobs.KitSnowman; import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; -import nautilus.game.arcade.game.games.evolution.mobs.KitWolf; import nautilus.game.arcade.kit.Kit; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -59,6 +53,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerItemHeldEvent; import org.bukkit.util.Vector; public class Evolution extends SoloGame @@ -82,43 +77,29 @@ public class Evolution extends SoloGame public Evolution(ArcadeManager manager) { - super(manager, GameType.Evolution, - - new Kit[0], - new String[] - { - "You can evolve every kill.", - "Each evolution has unique skills.", - "First to get through 10 evolutions wins!" - }); - + super(manager, GameType.Evolution, new Kit[0], new String[0]); + //Custom kit stuff to make other things easiet _mobKits.add(new KitGolem(manager)); _mobKits.add(new KitBlaze(manager)); - _mobKits.add(new KitSlime(manager)); - _mobKits.add(new KitCreeper(manager)); - _mobKits.add(new KitEnderman(manager)); _mobKits.add(new KitSpider(manager)); - _mobKits.add(new KitSnowman(manager)); - _mobKits.add(new KitWolf(manager)); + _mobKits.add(new KitCreeper(manager)); + _mobKits.add(new KitSlime(manager)); +// _mobKits.add(new KitEnderman(manager)); +// _mobKits.add(new KitSnowman(manager)); +// _mobKits.add(new KitWolf(manager)); _mobKits.add(new KitChicken(manager)); - _mobKits.add(new KitSkeleton(manager)); - - ArrayList kits = new ArrayList(); - - kits.add(new KitEvolutionist(manager)); - kits.addAll(_mobKits); +// _mobKits.add(new KitSkeleton(manager)); - Kit[] aKits = new Kit[kits.size()]; + setKits(_mobKits.toArray(new EvoKit[0])); + + _gameDesc = new String[] + { + "You can evolve every kill.", + "Each evolution has unique skills.", + "First to get through " + _mobKits.size() + " evolutions wins!" + }; - for (Kit kit : kits) - { - aKits[kits.indexOf(kit)] = kit; - } - - setKits(aKits); - - DamageFall = false; DamageTeamSelf = true; HungerSet = 20; @@ -286,7 +267,7 @@ public class Evolution extends SoloGame } } - if (increaseScore(event.getPlayer()) >= 10) + if (increaseScore(event.getPlayer()) >= _mobKits.size()) { ScoreboardUpdate(new UpdateEvent(UpdateType.FAST)); @@ -310,19 +291,19 @@ public class Evolution extends SoloGame Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); } - if (getScore(event.getPlayer()) >= 10) + if (getScore(event.getPlayer()) >= _mobKits.size()) { End(); } - Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() - { - @Override - public void run() - { - GetKit(event.getPlayer()).ApplyKit(event.getPlayer()); - } - }, 4); +// Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() +// { +// @Override +// public void run() +// { +// GetKit(event.getPlayer()).ApplyKit(event.getPlayer()); +// } +// }, 4); } @EventHandler @@ -577,6 +558,27 @@ public class Evolution extends SoloGame return _tokens.get(player.getName()).Level; } + @EventHandler + public void onSlot(PlayerItemHeldEvent event) + { + if (!Manager.GetGame().InProgress()) + return; + + if (!IsAlive(event.getPlayer())) + return; + + if (UtilPlayer.isSpectator(event.getPlayer())) + return; + + if (event.getNewSlot() != 0) + { + event.setCancelled(true); + + if (Recharge.Instance.use(event.getPlayer(), "Change Slot Message", 300, false, false)); + UtilPlayer.message(event.getPlayer(), F.main("Game", C.cYellow + "Right Click" + C.cGray + " to activate " + C.cGreen + "Ability")); + } + } + public Location getSpawn() { ArrayList allPlayers = new ArrayList(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index b3071d325..b1411253c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.evolution.evolve; import java.util.AbstractMap.SimpleEntry; -import java.util.ArrayList; import java.util.HashMap; import java.util.Map.Entry; @@ -136,16 +135,11 @@ public class EvolveData if (_holo == null) _holo = new Hologram(manager, _token.Platform); - double add = entity.boundingBox.e - entity.boundingBox.b + .5 + (.32 * kit.GetDesc().length); + double add = entity.boundingBox.e - entity.boundingBox.b + .3; _holo.setLocation(_token.Platform.clone().add(0, add, 0)); - ArrayList text = new ArrayList(); - text.add(C.cGreen + C.Bold + kit.GetName()); - for (String desc : kit.getShortKitDesc()) - text.add(desc.replaceAll("§7", C.cWhite)); - - _holo.setText(text.toArray(new String[0])); + _holo.setText(kit.buildHologram()); _holo.setHologramTarget(HologramTarget.WHITELIST); _holo.addPlayer(_player); @@ -271,7 +265,7 @@ public class EvolveData if (entity instanceof EntitySlime) { - ((EntitySlime) entity).setSize(3); + ((EntitySlime) entity).setSize(2); } if (invisible) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java deleted file mode 100644 index b849aecab..000000000 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolutionist.java +++ /dev/null @@ -1,36 +0,0 @@ -package nautilus.game.arcade.game.games.evolution.kits; - -import mineplex.core.itemstack.ItemBuilder; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.kit.Kit; -import nautilus.game.arcade.kit.KitAvailability; -import nautilus.game.arcade.kit.Perk; - -import org.bukkit.Material; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - -public class KitEvolutionist extends Kit -{ - /** - * @author Mysticate - */ - - public KitEvolutionist(ArcadeManager manager) - { - super(manager, "Darwinist", KitAvailability.Free, 0, new String[] - { - "They grow up so fast :')" - }, new Perk[] - { - - }, EntityType.SKELETON, new ItemBuilder(Material.IRON_SWORD).build()); - } - - @Override - public void GiveItems(Player player) - { - - } - -} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java index 01d9a187c..2760bfa24 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java @@ -1,14 +1,13 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseBlaze; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkFlamingSwordEVO; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkNoFallDamage; import nautilus.game.arcade.kit.perks.PerkWaterDamage; import org.bukkit.Material; @@ -19,37 +18,21 @@ import org.bukkit.entity.Player; public class KitBlaze extends EvoKit { public KitBlaze(ArcadeManager manager) - { - super(manager, "Blaze", - new String[] - { - F.elem("Hold Block") + " to use " + F.elem("Inferno"), - F.elem("Attacks ignite opponents for 4 seconds"), - C.cRed + "You are damaged by water!" - }, - new String[] - { - F.elem("Hold Block") + C.cWhite + " - " + F.elem("Inferno"), - F.elem("Attacks ignite enemies"), - C.cRed + "Damaged by Water" - }, - new Perk[] - { - new PerkFlamingSwordEVO(), - new PerkWaterDamage(3, 1) - }, EntityType.BLAZE); + { + super(manager, "Blaze", new String[] + { + C.cYellow + "Ability: " + C.cWhite + "Flamethrower", C.Line, + C.cGreen + "No Fall Damage", C.cRed + "Water Damage" + }, 36, 5, new Perk[] + { + new PerkFlamingSwordEVO(), new PerkWaterDamage(1, 0.25), new PerkNoFallDamage() + }, EntityType.BLAZE); } @Override - public void GiveItems(Player player) + protected void giveItems(Player player) { - player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).build()); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD)); - - player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 4f, 1f); + player.getInventory().setItem(0, new ItemBuilder(Material.GOLD_SWORD).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Flamethrower").build()); //Disguise DisguiseBlaze disguise = new DisguiseBlaze(player); @@ -57,8 +40,8 @@ public class KitBlaze extends EvoKit disguise.setCustomNameVisible(true); Manager.GetDisguise().undisguise(player); - Manager.GetDisguise().disguise(disguise); + Manager.GetDisguise().disguise(disguise); - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); - } + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 4f, 1f); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index 0b5d3254b..060f86c1e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilGear; @@ -12,6 +11,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; +import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkDoubleJumpEVO; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkConstructor; @@ -29,29 +29,21 @@ public class KitChicken extends EvoKit public KitChicken(ArcadeManager manager) { super(manager, "Chicken", new String[] + { + C.cYellow + "Ability: " + C.cWhite + "Egg Throw", C.Line, + C.cGreen + "No Fall Damage", C.cGreen + "Double Jump" + }, 16, 3, + new Perk[] { - F.elem("Right-Click with Egg") + " to use " + F.elem("Throw Egg"), - F.elem("Eggs deal " + C.cWhite + "9 Damage") - }, - new String[] - { - F.elem("Recieve ") + C.cWhite + "1 Egg / 6 Seconds", - }, - new Perk[] - { - new PerkConstructor("Egg Pouch", 6.0, 3, Material.EGG, "Egg", false) - }, EntityType.CHICKEN); + new PerkConstructor("Egg Pouch", 2.0, 3, Material.EGG, + "Egg Launcher Ammo", false), new PerkDoubleJumpEVO("Double Jump", 0.9, 0.9, false) + }, EntityType.CHICKEN); } - + @Override - public void GiveItems(Player player) + protected void giveItems(Player player) { - player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); - - player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_IDLE, 4f, 1f); + player.getInventory().setItem(0, new ItemBuilder(Material.FEATHER).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Egg Launch").build()); //Disguise DisguiseChicken disguise = new DisguiseChicken(player); @@ -61,11 +53,42 @@ public class KitChicken extends EvoKit Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_IDLE, 4f, 1f); } @EventHandler - public void onInteract(final PlayerInteractEvent event) + public void onLaunch(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!HasKit(event.getPlayer())) + return; + + if (!UtilGear.isMat(event.getItem(), Material.FEATHER)) + return; + + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer()); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + { + event.setCancelled(true); + return; + } + + if (!UtilInv.contains(event.getPlayer(), Material.EGG, (byte) 0, 1)) + return; + + UtilInv.remove(event.getPlayer(), Material.EGG, (byte) 0, 1); + event.getPlayer().launchProjectile(Egg.class); + } + + @EventHandler + public void onEggLaunch(final PlayerInteractEvent event) { if (!UtilEvent.isAction(event, ActionType.R)) return; @@ -79,23 +102,15 @@ public class KitChicken extends EvoKit if (!UtilGear.isMat(event.getItem(), Material.EGG)) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer()); - Bukkit.getServer().getPluginManager().callEvent(useEvent); - - if (useEvent.isCancelled()) + event.setCancelled(true); + Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable() { - event.setCancelled(true); - - Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + @Override + public void run() { - @Override - public void run() - { - UtilInv.Update(event.getPlayer()); - } - }, 10); - return; - } + UtilInv.Update(event.getPlayer()); + } + }, 2); } @EventHandler @@ -121,6 +136,6 @@ public class KitChicken extends EvoKit if (!(event.GetProjectile() instanceof Egg)) return; - event.AddMod("Chicken Kit", "Egg", 9, true); + event.AddMod("Chicken Kit", "Egg", 2, true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java index e034aa5d5..20f15dbd2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java @@ -1,14 +1,13 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkSulphurBombEVO; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkExplosionModifier; import org.bukkit.Material; import org.bukkit.Sound; @@ -19,30 +18,20 @@ public class KitCreeper extends EvoKit { public KitCreeper(ArcadeManager manager) { - super(manager, "Creeper", - new String[] - { - F.elem("Right-Click With Axe") + " to use " + F.elem("Sulphur Bomb") - }, - new String[] { - F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Suphur Bomb") - }, - new Perk[] - { - new PerkSulphurBombEVO() - }, EntityType.CREEPER); + super(manager, "Creeper", new String[] + { + C.cYellow + "Ability: " + C.cWhite + "Sulphur Bomb", C.Line, + C.cGreen + "Take 50% Explosion Damage" + }, 28, 4, new Perk[] + { + new PerkSulphurBombEVO(), new PerkExplosionModifier(0.5) + }, EntityType.CREEPER); } @Override - public void GiveItems(Player player) + protected void giveItems(Player player) { - player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).build()); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); - - player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 4f, 1f); + player.getInventory().setItem(0, new ItemBuilder(Material.SULPHUR).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Sulphur Bomb").build()); //Disguise DisguiseCreeper disguise = new DisguiseCreeper(player); @@ -52,6 +41,6 @@ public class KitCreeper extends EvoKit Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 4f, 1f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java index 3e43104b3..3c62aee27 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java @@ -1,62 +1,30 @@ package nautilus.game.arcade.game.games.evolution.mobs; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.disguise.disguises.DisguiseEnderman; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.evolution.EvoKit; -import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkBlockTossEVO; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkWaterDamage; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - -public class KitEnderman extends EvoKit +public class KitEnderman +//extends EvoKit { - public KitEnderman(ArcadeManager manager) - { - super(manager, "Enderman", - new String[] - { - F.elem("Right-Click Block With Sword") + " to use " + F.elem("Block Toss"), - C.cRed + "You are damaged by water!" - }, - new String[] - { - F.elem("Interact Block With Sword") + C.cWhite + " - " + F.elem("Block Toss"), - C.cRed + "Damaged by Water" - }, - new Perk[] - { - new PerkBlockTossEVO(), - new PerkWaterDamage(2, 1) - }, EntityType.ENDERMAN); - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.CHAINMAIL_BOOTS).build()); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); - - player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f); - - //Disguise - DisguiseEnderman disguise = new DisguiseEnderman(player); - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - disguise.setCustomNameVisible(true); - - Manager.GetDisguise().undisguise(player); - Manager.GetDisguise().disguise(disguise); - - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); - } +// public KitEnderman(ArcadeManager manager) +// { +// super(manager, "Enderman", new String[]{""}, 20, 10, new Perk[]{ +// new PerkBlockTossEVO(), +// new PerkWaterDamage(2, 1) +// }, EntityType.ENDERMAN); +// } +// +// @Override +// protected void giveItems(Player player) +// { +// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); +// +// player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f); +// +// //Disguise +// DisguiseEnderman disguise = new DisguiseEnderman(player); +// disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); +// disguise.setCustomNameVisible(true); +// +// Manager.GetDisguise().undisguise(player); +// Manager.GetDisguise().disguise(disguise); +// } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java index da6996732..6be923799 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java @@ -1,14 +1,13 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseIronGolem; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkSiesmicSlamEVO; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkKnockbackTaken; import org.bukkit.Material; import org.bukkit.Sound; @@ -19,32 +18,21 @@ public class KitGolem extends EvoKit { public KitGolem(ArcadeManager manager) { - super(manager, "Iron Golem", - new String[] - { - F.elem("Right-Click with Axe") + " to use " + F.elem("Ground Pound") - }, - new String[] - { - F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Ground Pound") - }, - new Perk[] - { - new PerkSiesmicSlamEVO(), - }, EntityType.IRON_GOLEM); + super(manager, "Iron Golem", new String[] + { + C.cYellow + "Abililty: " + C.cWhite + "Seismic Slam", C.Line, + C.cGreen + "Take 50% Knockback" + }, 40, 6, new Perk[] + { + new PerkSiesmicSlamEVO(), new PerkKnockbackTaken(.5) + }, EntityType.IRON_GOLEM); } - + @Override - public void GiveItems(Player player) + protected void giveItems(Player player) { - player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.CHAINMAIL_BOOTS).build()); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE)); - - player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 4f, 1f); - + player.getInventory().setItem(0, new ItemBuilder(Material.IRON_INGOT).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Seismic Slam").build()); + //Disguise DisguiseIronGolem disguise = new DisguiseIronGolem(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); @@ -52,7 +40,7 @@ public class KitGolem extends EvoKit Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); - - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); + + player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 4f, 1f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java index 76e3f6f65..6e1323407 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java @@ -1,99 +1,80 @@ package nautilus.game.arcade.game.games.evolution.mobs; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseSkeleton; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.evolution.EvoKit; -import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkBarrage; -import nautilus.game.arcade.kit.perks.PerkConstructor; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.entity.EntityShootBowEvent; - -public class KitSkeleton extends EvoKit +public class KitSkeleton +//extends EvoKit { - public KitSkeleton(ArcadeManager manager) - { - super(manager, "Skeletal Archer", - new String[] - { - F.elem("Charge Bow") + " to use " + F.elem("Barrage") - }, - new String[] - { - F.elem("Charge Bow") + C.cWhite + " - " + F.elem("Barrage") - }, - new Perk[] - { - new PerkConstructor("Fletcher", 3, 2, Material.ARROW, "Fletched Arrow", false), - new PerkBarrage(5, 250, true, false) - }, EntityType.SKELETON); - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); - - player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f); - - //Disguise - DisguiseSkeleton disguise = new DisguiseSkeleton(player); - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - disguise.setCustomNameVisible(true); - - Manager.GetDisguise().undisguise(player); - Manager.GetDisguise().disguise(disguise); - - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); - } - - @EventHandler - public void onBowShoot(final EntityShootBowEvent event) - { - if (!(event.getEntity() instanceof Player)) - return; - - if (!Manager.GetGame().IsLive()) - return; - - final Player player = (Player) event.getEntity(); - - if (!HasKit(player)) - return; - - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); - Bukkit.getServer().getPluginManager().callEvent(useEvent); - - if (useEvent.isCancelled()) - { - event.setCancelled(true); - - Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - @Override - public void run() - { - UtilInv.Update(player); - } - }, 10); - return; - } - } +// public KitSkeleton(ArcadeManager manager) +// { +// super(manager, "Skeletal Archer", +// new String[] +// { +// F.elem("Charge Bow") + " to use " + F.elem("Barrage") +// }, +// new String[] +// { +// F.elem("Charge Bow") + C.cWhite + " - " + F.elem("Barrage") +// }, +// new Perk[] +// { +// new PerkConstructor("Fletcher", 3, 2, Material.ARROW, "Fletched Arrow", false), +// new PerkBarrage(5, 250, true, false) +// }, EntityType.SKELETON); +// } +// +// @Override +// public void GiveItems(Player player) +// { +// player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build()); +// player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); +// player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); +// player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); +// +// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); +// +// player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f); +// +// //Disguise +// DisguiseSkeleton disguise = new DisguiseSkeleton(player); +// disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); +// disguise.setCustomNameVisible(true); +// +// Manager.GetDisguise().undisguise(player); +// Manager.GetDisguise().disguise(disguise); +// +// player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); +// } +// +// @EventHandler +// public void onBowShoot(final EntityShootBowEvent event) +// { +// if (!(event.getEntity() instanceof Player)) +// return; +// +// if (!Manager.GetGame().IsLive()) +// return; +// +// final Player player = (Player) event.getEntity(); +// +// if (!HasKit(player)) +// return; +// +// EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); +// Bukkit.getServer().getPluginManager().callEvent(useEvent); +// +// if (useEvent.isCancelled()) +// { +// event.setCancelled(true); +// +// Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() +// { +// @Override +// public void run() +// { +// UtilInv.Update(player); +// } +// }, 10); +// return; +// } +// } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java index c7722bfd5..b237f41cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java @@ -1,14 +1,13 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseSlime; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkBounceEVO; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkFallModifier; import org.bukkit.Material; import org.bukkit.Sound; @@ -19,41 +18,30 @@ public class KitSlime extends EvoKit { public KitSlime(ArcadeManager manager) { - super(manager, "Slime", - new String[] - { - F.elem("Right-Click with Axe") + " to use " + F.elem("Bounce") - }, - new String[] - { - F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Bounce") - }, - new Perk[] - { - new PerkBounceEVO() - }, EntityType.SLIME); + super(manager, "Slime", new String[] + { + C.cYellow + "Ability: " + C.cWhite + "Bounce", C.Line, + C.cGreen + "Take 50% Fall Damage" + }, 22, 4, new Perk[] + { + new PerkBounceEVO(), new PerkFallModifier(.5) + }, EntityType.SLIME); } @Override - public void GiveItems(Player player) + protected void giveItems(Player player) { - player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.CHAINMAIL_BOOTS).build()); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + player.getInventory().setItem(0, new ItemBuilder(Material.SLIME_BALL).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Bounce").build()); - player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 4f, 1f); - //Disguise DisguiseSlime disguise = new DisguiseSlime(player); disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); disguise.setCustomNameVisible(true); - disguise.SetSize(3); + disguise.SetSize(2); Manager.GetDisguise().undisguise(player); Manager.GetDisguise().disguise(disguise); - - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); + + player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 4f, 1f); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java index 0c2eca81f..05e60eb52 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java @@ -1,128 +1,106 @@ package nautilus.game.arcade.game.games.evolution.mobs; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilEvent; -import mineplex.core.common.util.UtilEvent.ActionType; -import mineplex.core.common.util.UtilGear; -import mineplex.core.common.util.UtilInv; -import mineplex.core.disguise.disguises.DisguiseSnowman; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.evolution.EvoKit; -import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkConstructor; -import org.bukkit.Bukkit; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.entity.Snowball; -import org.bukkit.event.EventHandler; -import org.bukkit.event.player.PlayerInteractEvent; - -public class KitSnowman extends EvoKit +public class KitSnowman +//extends EvoKit { - public KitSnowman(ArcadeManager manager) - { - super(manager, "Snowman", - new String[] - { - F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball") - }, - new String[] - { - F.elem("Recieve ") + C.cWhite + "1 Snowball / 1 Second", - }, - new Perk[] - { - new PerkConstructor("Snowballer", 1, 16, Material.SNOW_BALL, "Snowball", false) - }, EntityType.SNOWMAN); - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); - - player.getInventory().setItem(0, new ItemBuilder(Material.WOOD_SPADE).build()); - - player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 4f, 1f); - - //Disguise - DisguiseSnowman disguise = new DisguiseSnowman(player); - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - disguise.setCustomNameVisible(true); - - Manager.GetDisguise().undisguise(player); - Manager.GetDisguise().disguise(disguise); - - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); - } - - @EventHandler - public void onInteract(final PlayerInteractEvent event) - { - if (!UtilEvent.isAction(event, ActionType.R)) - return; - - if (!Manager.GetGame().IsLive()) - return; - - if (!HasKit(event.getPlayer())) - return; - - if (!UtilGear.isMat(event.getItem(), Material.SNOW_BALL)) - return; - - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer()); - Bukkit.getServer().getPluginManager().callEvent(useEvent); - - if (useEvent.isCancelled()) - { - event.setCancelled(true); - - Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() - { - @Override - public void run() - { - UtilInv.Update(event.getPlayer()); - } - }, 10); - return; - } - } - - @EventHandler - public void SnowballHit(CustomDamageEvent event) - { - if (!Manager.GetGame().IsLive()) - return; - - if (!(event.GetDamagerEntity(true) instanceof Player)) - return; - - Player player = event.GetDamagerPlayer(true); - - if (!Manager.IsAlive(player)) - return; - - if (!HasKit(player)) - return; - - if (event.GetProjectile() == null) - return; - - if (!(event.GetProjectile() instanceof Snowball)) - return; - - event.AddMod("Snowman Kit", "Snowball", 3, true); - } +// public KitSnowman(ArcadeManager manager) +// { +// super(manager, "Snowman", +// new String[] +// { +// F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball") +// }, +// new String[] +// { +// F.elem("Recieve ") + C.cWhite + "1 Snowball / 1 Second", +// }, +// new Perk[] +// { +// new PerkConstructor("Snowballer", 1, 16, Material.SNOW_BALL, "Snowball", false) +// }, EntityType.SNOWMAN); +// } +// +// @Override +// public void GiveItems(Player player) +// { +// player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).build()); +// player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build()); +// player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build()); +// player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); +// +// player.getInventory().setItem(0, new ItemBuilder(Material.WOOD_SPADE).build()); +// +// player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 4f, 1f); +// +// //Disguise +// DisguiseSnowman disguise = new DisguiseSnowman(player); +// disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); +// disguise.setCustomNameVisible(true); +// +// Manager.GetDisguise().undisguise(player); +// Manager.GetDisguise().disguise(disguise); +// +// player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); +// } +// +// @EventHandler +// public void onInteract(final PlayerInteractEvent event) +// { +// if (!UtilEvent.isAction(event, ActionType.R)) +// return; +// +// if (!Manager.GetGame().IsLive()) +// return; +// +// if (!HasKit(event.getPlayer())) +// return; +// +// if (!UtilGear.isMat(event.getItem(), Material.SNOW_BALL)) +// return; +// +// EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer()); +// Bukkit.getServer().getPluginManager().callEvent(useEvent); +// +// if (useEvent.isCancelled()) +// { +// event.setCancelled(true); +// +// Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() +// { +// @Override +// public void run() +// { +// UtilInv.Update(event.getPlayer()); +// } +// }, 10); +// return; +// } +// } +// +// @EventHandler +// public void SnowballHit(CustomDamageEvent event) +// { +// if (!Manager.GetGame().IsLive()) +// return; +// +// if (!(event.GetDamagerEntity(true) instanceof Player)) +// return; +// +// Player player = event.GetDamagerPlayer(true); +// +// if (!Manager.IsAlive(player)) +// return; +// +// if (!HasKit(player)) +// return; +// +// if (event.GetProjectile() == null) +// return; +// +// if (!(event.GetProjectile() instanceof Snowball)) +// return; +// +// event.AddMod("Snowman Kit", "Snowball", 3, true); +// } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java index e287388db..20626fe4c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java @@ -1,15 +1,14 @@ package nautilus.game.arcade.game.games.evolution.mobs; import mineplex.core.common.util.C; -import mineplex.core.common.util.F; import mineplex.core.disguise.disguises.DisguiseSpider; import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkWebEVO; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkSpeed; import org.bukkit.Material; import org.bukkit.Sound; @@ -20,31 +19,23 @@ public class KitSpider extends EvoKit { public KitSpider(ArcadeManager manager) { - super(manager, "Spider", - new String[] - { - F.elem("Right-Click Web") + " to use " + F.elem("Web Toss"), - }, - new String[] - { - F.elem("Click Web") + C.cWhite + " - " + F.elem("Web Toss") - }, - new Perk[] - { + super(manager, "Spider", new String[] + { + C.cYellow + "Ability: " + C.cWhite + "Web Shot", C.Line, + C.cGreen + "Recieve Speed 1", C.cGreen + "Take No Fall Damage" + }, 32, 5, new Perk[] + { new PerkWebEVO(), - new PerkConstructor("Web Weaver", 3.0, 8, Material.WEB, "Spiderweb", false) - }, EntityType.SPIDER); + new PerkConstructor("Web Weaver", 3.0, 4, Material.WEB, + "Spiderweb", false), new PerkSpeed(0) + + }, EntityType.SPIDER); } @Override - public void GiveItems(Player player) + protected void giveItems(Player player) { - player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.CHAINMAIL_BOOTS).build()); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE)); + player.getInventory().setItem(0, new ItemBuilder(Material.SPIDER_EYE).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Web Shot").build()); player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 4f, 1f); @@ -54,8 +45,6 @@ public class KitSpider extends EvoKit disguise.setCustomNameVisible(true); Manager.GetDisguise().undisguise(player); - Manager.GetDisguise().disguise(disguise); - - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); + Manager.GetDisguise().disguise(disguise); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java index a322ae4dd..3c6506a85 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java @@ -1,61 +1,47 @@ package nautilus.game.arcade.game.games.evolution.mobs; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.disguise.disguises.DisguiseWolf; -import mineplex.core.itemstack.ItemBuilder; -import mineplex.core.itemstack.ItemStackFactory; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.games.evolution.EvoKit; -import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkPounceEVO; -import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkSpeed; -import org.bukkit.Material; -import org.bukkit.Sound; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; - -public class KitWolf extends EvoKit +public class KitWolf +//extends EvoKit { - public KitWolf(ArcadeManager manager) - { - super(manager, "Wolf", - new String[] - { - F.elem("Right-Click with Axe") + " to use " + F.elem("Pounce") - }, - new String[] - { - F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Pounce") - }, - new Perk[] - { - new PerkSpeed(1), - new PerkPounceEVO() - }, EntityType.WOLF); - } - - @Override - public void GiveItems(Player player) - { - player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build()); - player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); - player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); - player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); - - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE)); - - player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 4f, 1f); - - //Disguise - DisguiseWolf disguise = new DisguiseWolf(player); - disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); - disguise.setCustomNameVisible(true); - - Manager.GetDisguise().undisguise(player); - Manager.GetDisguise().disguise(disguise); - - player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); - } +// public KitWolf(ArcadeManager manager) +// { +// super(manager, "Wolf", +// new String[] +// { +// F.elem("Right-Click with Axe") + " to use " + F.elem("Pounce") +// }, +// new String[] +// { +// F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Pounce") +// }, +// new Perk[] +// { +// new PerkSpeed(1), +// new PerkPounceEVO() +// }, EntityType.WOLF); +// } +// +// @Override +// public void GiveItems(Player player) +// { +// player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build()); +// player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build()); +// player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build()); +// player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build()); +// +// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE)); +// +// player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 4f, 1f); +// +// //Disguise +// DisguiseWolf disguise = new DisguiseWolf(player); +// disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName()); +// disguise.setCustomNameVisible(true); +// +// Manager.GetDisguise().undisguise(player); +// Manager.GetDisguise().disguise(disguise); +// +// player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build()); +// } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index 7adf9ca1f..5fb0c2cf4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -54,7 +54,7 @@ public class PerkBounceEVO extends Perk if (UtilBlock.usable(event.getClickedBlock())) return; - if (!UtilInv.IsItem(event.getItem(), Material.IRON_AXE, (byte) 0)) + if (!UtilInv.IsItem(event.getItem(), Material.SLIME_BALL, (byte) 0)) return; Player player = event.getPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java new file mode 100644 index 000000000..0780f8a9d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java @@ -0,0 +1,137 @@ +package nautilus.game.arcade.game.games.evolution.mobs.perks; + +import java.util.HashSet; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilServer; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Bukkit; +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerToggleFlightEvent; + +public class PerkDoubleJumpEVO extends Perk +{ + private double _power; + private double _heightMax; + private boolean _control; + private long _recharge; + private boolean _displayForce; + + private HashSet _disabled = new HashSet(); + + public PerkDoubleJumpEVO(String name, double power, double heightLimit, boolean control) + { + super(name, new String[0]); + + _power = power; + _heightMax = heightLimit; + _control = control; + _recharge = 0; + _displayForce = false; + } + + public PerkDoubleJumpEVO(String name, double power, double heightLimit, boolean control, long recharge, boolean displayForce) + { + super(name, new String[0]); + + _power = power; + _heightMax = heightLimit; + _control = control; + _recharge = recharge; + _displayForce = displayForce; + } + + @EventHandler + public void FlightHop(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (!Kit.HasKit(player)) + return; + + if (Manager.isSpectator(player)) + return; + + if (player.getGameMode() == GameMode.CREATIVE) + return; + + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + + event.setCancelled(true); + player.setFlying(false); + + //Disable Flight + player.setAllowFlight(false); + + //Velocity + if (_control) + { + UtilAction.velocity(player, _power, 0.2, _heightMax, true); + } + else + { + UtilAction.velocity(player, player.getLocation().getDirection(), _power, true, _power, 0, _heightMax, true); + } + + //Sound + player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0); + + //Recharge + if (_recharge > 0) + { + Recharge.Instance.useForce(player, GetName(), _recharge); + + if (_displayForce) + { + Recharge.Instance.setDisplayForce(player, GetName(), true); + } + } + } + + @EventHandler + public void FlightUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : UtilServer.getPlayers()) + { + if (Manager.isSpectator(player)) + continue; + + if (!Kit.HasKit(player)) + continue; + + if (_recharge > 0 && !Recharge.Instance.usable(player, GetName())) + continue; + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + player.setAllowFlight(true); + } + } + + public void disableForPlayer(Player player) + { + _disabled.add(player); + } + + public void enableForPlayer(Player player) + { + _disabled.remove(player); + } +} \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java index 76d451973..2e3d0bc39 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java @@ -1,19 +1,10 @@ package nautilus.game.arcade.game.games.evolution.mobs.perks; -import java.util.HashMap; - 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.common.util.UtilServer; -import mineplex.core.common.util.UtilTime; import mineplex.core.itemstack.ItemStackFactory; -import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; @@ -23,10 +14,6 @@ import org.bukkit.Sound; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.block.Action; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; public class PerkFlamingSwordEVO extends Perk @@ -34,112 +21,69 @@ public class PerkFlamingSwordEVO extends Perk /** * @author Mysticate */ - - private HashMap _active = new HashMap(); - + public PerkFlamingSwordEVO() { - super("Flaming Sword", new String[] + super("Flamethrower", new String[] { - "Attacks ignite opponents for 4 seconds.", - C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Inferno" + C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Flamethrower" }); } - @EventHandler(priority = EventPriority.HIGH) - public void IgniteTarget(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - if (event.GetCause() != DamageCause.ENTITY_ATTACK) - return; - - Player damager = event.GetDamagerPlayer(false); - if (damager == null) return; - - if (!Kit.HasKit(damager)) - return; - - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(damager); - Bukkit.getServer().getPluginManager().callEvent(useEvent); - - if (useEvent.isCancelled()) - return; - - Manager.GetCondition().Factory().Ignite("Flaming Sword", event.GetDamageeEntity(), damager, 4, false, false); - } - @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("_SWORD")) - return; - - Player player = event.getPlayer(); - - if (!Kit.HasKit(player)) - return; - - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); - Bukkit.getServer().getPluginManager().callEvent(useEvent); - - if (useEvent.isCancelled()) - return; - - if (!Recharge.Instance.use(player, "Inferno", 4000, true, true)) - return; - - _active.put(player, System.currentTimeMillis()); - - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill("Inferno") + ".")); - } - - @EventHandler - public void Update(UpdateEvent event) + public void update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; - - for (Player cur : UtilServer.getPlayers()) + + if (!Manager.GetGame().IsLive()) + return; + + for (Player player : Manager.GetGame().GetPlayers(true)) { - if (!_active.containsKey(cur)) + if (!Kit.HasKit(player)) continue; - if (!cur.isBlocking()) - { - _active.remove(cur); - continue; - } + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + Bukkit.getServer().getPluginManager().callEvent(useEvent); - if (UtilTime.elapsed(_active.get(cur), 1500)) - { - _active.remove(cur); + if (useEvent.isCancelled()) continue; - } - - //Fire - Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); - Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 1, "Inferno"); - - fire.teleport(cur.getEyeLocation()); - double x = 0.07 - (UtilMath.r(14)/100d); - double y = 0.07 - (UtilMath.r(14)/100d); - double z = 0.07 - (UtilMath.r(14)/100d); - fire.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6)); - - //Effect - cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f); + + charge(player); } } + + private void charge(Player player) + { + if (player.isBlocking()) + { + if (player.getExp() <= .0001) + return; + + player.setExp((float) Math.max(player.getExp() - 0.025, .0001)); + flame(player); + return; + } + else + { + player.setExp((float) Math.min(player.getExp() + 0.01, .9999)); + } + } + + private void flame(Player player) + { + //Fire + Item fire = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); + Manager.GetFire().Add(fire, player, 0.7, 0, 0.5, 1, "Inferno"); + fire.teleport(player.getEyeLocation()); + double x = 0.07 - (UtilMath.r(14)/100d); + double y = 0.07 - (UtilMath.r(14)/100d); + double z = 0.07 - (UtilMath.r(14)/100d); + fire.setVelocity(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6)); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java index a68dec4d0..2699b444d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -5,7 +5,6 @@ import java.util.HashMap; 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.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; @@ -42,10 +41,7 @@ public class PerkSiesmicSlamEVO extends Perk public PerkSiesmicSlamEVO() { - super("Ground Pound", new String[] - { - - }); + super("Seismic Slam", new String[0]); } @EventHandler @@ -75,7 +71,7 @@ public class PerkSiesmicSlamEVO extends Perk if (!UtilEvent.isAction(event, ActionType.R)) return; - if (!UtilInv.IsItem(event.getItem(), Material.DIAMOND_AXE, (byte) 0)) + if (!UtilInv.IsItem(event.getItem(), Material.IRON_INGOT, (byte) 0)) return; Player player = event.getPlayer(); @@ -113,12 +109,15 @@ public class PerkSiesmicSlamEVO extends Perk if (event.getType() != UpdateType.TICK) return; + if (!Manager.GetGame().IsLive()) + return; + for (Player player : Manager.GetGame().GetPlayers(true)) { - if (!UtilEnt.isGrounded(player)) + if (!_live.containsKey(player)) continue; - if (!_live.containsKey(player)) + if (!player.isOnGround()) continue; if (!UtilTime.elapsed(_live.get(player), 1000)) @@ -127,7 +126,7 @@ public class PerkSiesmicSlamEVO extends Perk _live.remove(player); //Action - int damage = 8; + int damage = 16; double range = 6; HashMap targets = UtilPlayer.getInRadius(player.getLocation(), range); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index 48b4490b5..23f4e0714 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -54,7 +54,7 @@ public class PerkSulphurBombEVO extends Perk implements IThrown if (!UtilEvent.isAction(event, ActionType.R)) return; - if (!UtilInv.IsItem(event.getItem(), Material.IRON_AXE, (byte) 0)) + if (!UtilInv.IsItem(event.getItem(), Material.SULPHUR, (byte) 0)) return; Player player = event.getPlayer(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java index 3a2f7af1c..fbb7f45a4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -1,6 +1,8 @@ package nautilus.game.arcade.game.games.evolution.mobs.perks; import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.projectile.IThrown; @@ -9,6 +11,7 @@ import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent import nautilus.game.arcade.kit.Perk; import org.bukkit.Bukkit; +import org.bukkit.EntityEffect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -16,7 +19,7 @@ import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; -import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; public class PerkWebEVO extends Perk implements IThrown @@ -27,16 +30,13 @@ public class PerkWebEVO extends Perk implements IThrown public PerkWebEVO() { - super("Web Shot", new String[] - { - - }); + super("Web Shot", new String[0]); } @EventHandler public void Throw(PlayerInteractEvent event) { - if (event.getAction() == Action.PHYSICAL) + if (!UtilEvent.isAction(event, ActionType.R)) return; if (!Manager.GetGame().IsLive()) @@ -45,7 +45,10 @@ public class PerkWebEVO extends Perk implements IThrown if (!Manager.IsAlive(event.getPlayer())) return; - if (!UtilInv.IsItem(event.getItem(), Material.WEB, (byte) 0)) + if (!UtilInv.contains(event.getPlayer(), Material.WEB, (byte) 0, 1)) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.SPIDER_EYE, (byte) 0)) return; Player player = event.getPlayer(); @@ -61,7 +64,7 @@ public class PerkWebEVO extends Perk implements IThrown event.setCancelled(true); - UtilInv.remove(player, Material.WEB, (byte)0, 1); + UtilInv.remove(player, Material.WEB, (byte) 0, 1); UtilInv.Update(player); Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WEB)); @@ -76,7 +79,12 @@ public class PerkWebEVO extends Perk implements IThrown { if (target instanceof Player) { - if (!Manager.GetGame().IsAlive((Player)target)) + if (Manager.GetGame().IsAlive((Player)target)) + { + Manager.GetDamage().NewDamageEvent(target, null, null, DamageCause.CUSTOM, 4, false, false, false, "Web Shot", "Webbed Net"); + target.playEffect(EntityEffect.HURT); + } + else { return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplosionModifier.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplosionModifier.java new file mode 100644 index 000000000..b408caa7f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplosionModifier.java @@ -0,0 +1,45 @@ + +package nautilus.game.arcade.kit.perks; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +public class PerkExplosionModifier extends Perk +{ + private double _explosion; + + public PerkExplosionModifier(double explosion) + { + super("Enforced Armor", new String[]{"You take " + explosion * 100 + "% explosion damage!"}); + + _explosion = explosion; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Knockback(CustomDamageEvent event) + { + if (event.GetCause() == DamageCause.ENTITY_EXPLOSION || event.GetCause() == DamageCause.BLOCK_EXPLOSION) + return; + + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + Player player = event.GetDamageePlayer(); + + if (player == null) + return; + + if (!Kit.HasKit(player)) + return; + + if (!Manager.IsAlive(player)) + return; + + event.AddMod("Explosion Modifier", "Reduce damage", (-event.GetDamage()) + event.GetDamageInitial() * _explosion, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallModifier.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallModifier.java new file mode 100644 index 000000000..e4ed59e07 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallModifier.java @@ -0,0 +1,44 @@ +package nautilus.game.arcade.kit.perks; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +public class PerkFallModifier extends Perk +{ + private double _fall; + + public PerkFallModifier(double fall) + { + super("Feathered Boots", new String[]{"You take " + fall * 100 + "% fall damage!"}); + + _fall = fall; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Knockback(CustomDamageEvent event) + { + if (event.GetCause() == DamageCause.FALL) + return; + + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + Player player = event.GetDamageePlayer(); + + if (player == null) + return; + + if (!Kit.HasKit(player)) + return; + + if (!Manager.IsAlive(player)) + return; + + event.AddMod("Fall Modifier", "Reduce damage", (-event.GetDamage()) + event.GetDamageInitial() * _fall, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackTaken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackTaken.java new file mode 100644 index 000000000..fb5d0321b --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkKnockbackTaken.java @@ -0,0 +1,44 @@ +package nautilus.game.arcade.kit.perks; + +import java.util.Map.Entry; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class PerkKnockbackTaken extends Perk +{ + private double _knockback; + + public PerkKnockbackTaken(double knockback) + { + super("Knockback", new String[]{"You take " + knockback * 100 + "% knockback!"}); + + _knockback = knockback; + } + + @EventHandler(priority = EventPriority.HIGH) + public void Knockback(CustomDamageEvent event) + { + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + Player player = event.GetDamageePlayer(); + + if (player == null) + return; + + if (!Kit.HasKit(player)) + return; + + if (!Manager.IsAlive(player)) + return; + + //Multiply all knockback + for (Entry entry : event.GetKnockback().entrySet()) + entry.setValue(entry.getValue() * _knockback); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoFallDamage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoFallDamage.java new file mode 100644 index 000000000..6cb73501a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkNoFallDamage.java @@ -0,0 +1,34 @@ +package nautilus.game.arcade.kit.perks; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.kit.Perk; + +public class PerkNoFallDamage extends Perk +{ + public PerkNoFallDamage() + { + super("Feathered Boots", new String[]{"You take no fall damage!"}); + } + + @EventHandler + public void onDamage(CustomDamageEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!(event.GetDamageeEntity() instanceof Player)) + return; + + if (!Kit.HasKit(event.GetDamageePlayer())) + return; + + if (event.GetCause() == DamageCause.FALL) + { + event.SetCancelled("Feathered Boots"); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWaterDamage.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWaterDamage.java index 9f06c2019..2261c9793 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWaterDamage.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWaterDamage.java @@ -15,7 +15,7 @@ public class PerkWaterDamage extends Perk private double _damage; private long _time; - public PerkWaterDamage(double damage, int time) + public PerkWaterDamage(double damage, double time) { super("(Not) Water Bender", new String[] { @@ -24,7 +24,7 @@ public class PerkWaterDamage extends Perk }); _damage = damage; - _time = time * 1000; + _time = (long) (time * 1000); } @EventHandler From eaad787075449018cec0b9ac2e761274168d8958 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 13 Aug 2015 08:16:33 -0400 Subject: [PATCH 28/56] Removed the base kit and replaced it with Iron Golem. --- .../game/games/evolution/Evolution.java | 52 +++++++++++-------- .../game/games/evolution/mobs/KitGolem.java | 2 +- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index b87e66d08..85648c03a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -65,7 +65,7 @@ public class Evolution extends SoloGame private EvolveManager _evolve; - private ArrayList _mobKits = new ArrayList(); +// private ArrayList _mobKits = new ArrayList(); private NautHashMap _tokens = new NautHashMap(); @@ -77,27 +77,35 @@ public class Evolution extends SoloGame public Evolution(ArcadeManager manager) { - super(manager, GameType.Evolution, new Kit[0], new String[0]); - - //Custom kit stuff to make other things easiet - _mobKits.add(new KitGolem(manager)); - _mobKits.add(new KitBlaze(manager)); - _mobKits.add(new KitSpider(manager)); - _mobKits.add(new KitCreeper(manager)); - _mobKits.add(new KitSlime(manager)); -// _mobKits.add(new KitEnderman(manager)); -// _mobKits.add(new KitSnowman(manager)); -// _mobKits.add(new KitWolf(manager)); - _mobKits.add(new KitChicken(manager)); -// _mobKits.add(new KitSkeleton(manager)); - - setKits(_mobKits.toArray(new EvoKit[0])); + super(manager, GameType.Evolution, new EvoKit[] + { + new KitGolem(manager), + new KitBlaze(manager), + new KitSpider(manager), + new KitCreeper(manager), + new KitSlime(manager), + new KitChicken(manager) + }, new String[0]); +// +// //Custom kit stuff to make other things easiet +// _mobKits.add(new KitGolem(manager)); +// _mobKits.add(new KitBlaze(manager)); +// _mobKits.add(new KitSpider(manager)); +// _mobKits.add(new KitCreeper(manager)); +// _mobKits.add(new KitSlime(manager)); +//// _mobKits.add(new KitEnderman(manager)); +//// _mobKits.add(new KitSnowman(manager)); +//// _mobKits.add(new KitWolf(manager)); +// _mobKits.add(new KitChicken(manager)); +//// _mobKits.add(new KitSkeleton(manager)); +// +// setKits(_mobKits.toArray(new EvoKit[0])); _gameDesc = new String[] { "You can evolve every kill.", "Each evolution has unique skills.", - "First to get through " + _mobKits.size() + " evolutions wins!" + "First to get through " + GetKits().length + " evolutions wins!" }; DamageTeamSelf = true; @@ -217,7 +225,7 @@ public class Evolution extends SoloGame if (!IsAlive(player)) return; - EvoKit newKit = _mobKits.get(getScore(player)); + EvoKit newKit = (EvoKit) GetKits()[getScore(player)]; SetKit(player, newKit, false); @@ -267,7 +275,7 @@ public class Evolution extends SoloGame } } - if (increaseScore(event.getPlayer()) >= _mobKits.size()) + if (increaseScore(event.getPlayer()) >= GetKits().length) { ScoreboardUpdate(new UpdateEvent(UpdateType.FAST)); @@ -291,7 +299,7 @@ public class Evolution extends SoloGame Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); } - if (getScore(event.getPlayer()) >= _mobKits.size()) + if (getScore(event.getPlayer()) >= GetKits().length) { End(); } @@ -475,8 +483,8 @@ public class Evolution extends SoloGame EvoToken token = _tokens.get(player.getName()); - EvoKit from = _mobKits.get(token.Level); - EvoKit to = _mobKits.get((token.Level + 1) >= _mobKits.size() ? token.Level : token.Level + 1); //Account for the score increase after evolve + EvoKit from = (EvoKit) GetKits()[token.Level]; + EvoKit to = (EvoKit) GetKits()[token.Level + 1 >= GetKits().length ? token.Level : token.Level + 1]; //Account for the score increase after evolve _evolve.addEvolve(Manager.getHologramManager(), player, from, to); return true; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java index 6be923799..27597d11c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java @@ -25,7 +25,7 @@ public class KitGolem extends EvoKit }, 40, 6, new Perk[] { new PerkSiesmicSlamEVO(), new PerkKnockbackTaken(.5) - }, EntityType.IRON_GOLEM); + }, EntityType.IRON_GOLEM, true); } @Override From ac18dd3b792006ab79d39a51de1777b6a928d796 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 14 Aug 2015 20:22:00 -0400 Subject: [PATCH 29/56] Fixed iron golem select message. Removed slot change message. --- .../nautilus/game/arcade/game/games/evolution/EvoKit.java | 7 ++----- .../game/arcade/game/games/evolution/Evolution.java | 3 --- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 4bb68c5ee..0149a181e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -92,16 +92,13 @@ public abstract class EvoKit extends Kit UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.cYellow + "Melee: " + C.cWhite + _damage); - UtilPlayer.message(player, C.cYellow + "Health: " + C.cWhite + _health); + UtilPlayer.message(player, C.cYellow + "Melee: " + C.cWhite + _damage + " " + C.cYellow + "Health: " + C.cWhite + _health); UtilPlayer.message(player, C.Line); for (String desc : GetDesc()) - UtilPlayer.message(player, desc); + UtilPlayer.message(player, C.cGray + " " + desc); - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, ArcadeFormat.Line); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 85648c03a..8a99dba20 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -581,9 +581,6 @@ public class Evolution extends SoloGame if (event.getNewSlot() != 0) { event.setCancelled(true); - - if (Recharge.Instance.use(event.getPlayer(), "Change Slot Message", 300, false, false)); - UtilPlayer.message(event.getPlayer(), F.main("Game", C.cYellow + "Right Click" + C.cGray + " to activate " + C.cGreen + "Ability")); } } From 2659dd4e39386464959abf5b18ac97faa9852640 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 14 Aug 2015 23:17:56 -0400 Subject: [PATCH 30/56] Fixed minor bugs. Head now follows mob altitude. --- .../src/mineplex/core/common/util/MapUtil.java | 5 +++++ .../arcade/game/games/evolution/EvoKit.java | 16 +++++++--------- .../games/evolution/evolve/EvolveData.java | 18 ++++++++++++++---- .../game/games/evolution/mobs/KitSpider.java | 4 +++- .../kit/perks/PerkExplosionModifier.java | 2 +- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java index b327bf32e..73ae33c86 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/MapUtil.java @@ -69,6 +69,11 @@ public class MapUtil { QuickChangeBlockAt(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), setTo); } + + public static void QuickChangeBlockAt(Location location, Material setTo, byte data) + { + QuickChangeBlockAt(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), setTo, data); + } public static void QuickChangeBlockAt(Location location, int id, byte data) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 0149a181e..0385e8012 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -66,8 +66,7 @@ public abstract class EvoKit extends Kit ArrayList text = new ArrayList(); text.add(C.cAqua + C.Bold + GetName()); - text.add(C.cYellow + "Melee: " + C.cWhite + _damage); - text.add(C.cYellow + "Health: " + C.cWhite + _health); + text.add(C.cYellow + "Melee: " + C.cWhite + _damage + " " + C.cYellow + "Health: " + C.cWhite + _health); if (GetDesc().length > 0) { @@ -92,7 +91,7 @@ public abstract class EvoKit extends Kit UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.cYellow + "Melee: " + C.cWhite + _damage + " " + C.cYellow + "Health: " + C.cWhite + _health); + UtilPlayer.message(player, C.cYellow + " Melee: " + C.cWhite + _damage + " " + C.cYellow + "Health: " + C.cWhite + _health); UtilPlayer.message(player, C.Line); @@ -109,22 +108,21 @@ public abstract class EvoKit extends Kit player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 0.1F); - UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.Line); + for (int i=0 ; i<3 ; i++) + UtilPlayer.message(player, ""); + UtilPlayer.message(player, ArcadeFormat.Line); UtilPlayer.message(player, def); UtilPlayer.message(player, C.Line); - UtilPlayer.message(player, C.cYellow + "Melee: " + C.cWhite + _damage); - UtilPlayer.message(player, C.cYellow + "Health: " + C.cWhite + _health); + UtilPlayer.message(player, C.cYellow + " Melee: " + C.cWhite + _damage + " " + C.cYellow + "Health: " + C.cWhite + _health); UtilPlayer.message(player, C.Line); for (String desc : GetDesc()) - UtilPlayer.message(player, desc); + UtilPlayer.message(player, C.cGray + " " + desc); - UtilPlayer.message(player, C.Line); UtilPlayer.message(player, ArcadeFormat.Line); UtilTextMiddle.display(null, def, player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index b1411253c..4aef4dd42 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.Map.Entry; import mineplex.core.common.util.C; +import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilFirework; @@ -45,6 +46,7 @@ import org.bukkit.Material; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.util.Vector; public class EvolveData { @@ -103,6 +105,7 @@ public class EvolveData Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); + setupViewingToken(_eFrom); setupPlayer(); setupEgg(); setupHologram(holo, _eFrom, from); @@ -110,14 +113,12 @@ public class EvolveData private void setupEgg() { - _eggLoc.getBlock().setType(Material.DRAGON_EGG); + MapUtil.QuickChangeBlockAt(_eggLoc, Material.DRAGON_EGG); } - @SuppressWarnings("deprecation") private void restoreEgg() { - _eggLoc.getBlock().setType(_eggLocData.getKey()); - _eggLoc.getBlock().setData(_eggLocData.getValue()); + MapUtil.QuickChangeBlockAt(_eggLoc, _eggLocData.getKey(), _eggLocData.getValue()); } public Location getEggLocation() @@ -125,6 +126,12 @@ public class EvolveData return _eggLoc; } + private void setupViewingToken(EntityInsentient ent) + { + Vector viewing = UtilAlg.getTrajectory(_token.Viewing, _token.Platform.clone().add(0.5, (ent.boundingBox.e - ent.boundingBox.b) / 2 - 1, 0.5)); + _token.Viewing.setPitch(UtilAlg.GetPitch(viewing)); + } + private void setupPlayer() { _player.teleport(_token.Viewing); @@ -179,6 +186,9 @@ public class EvolveData _eTo = spawn(_to.getEntity(), _token.Platform, false); despawn(_eFrom); + setupViewingToken(_eTo); + setupPlayer(); + setupHologram(_holoManager, _eTo, _to); UtilFirework.packetPlayFirework(_player, _token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java index 20626fe4c..fa046ded2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java @@ -8,6 +8,7 @@ import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkWebEVO; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.PerkConstructor; +import nautilus.game.arcade.kit.perks.PerkNoFallDamage; import nautilus.game.arcade.kit.perks.PerkSpeed; import org.bukkit.Material; @@ -27,7 +28,8 @@ public class KitSpider extends EvoKit { new PerkWebEVO(), new PerkConstructor("Web Weaver", 3.0, 4, Material.WEB, - "Spiderweb", false), new PerkSpeed(0) + "Spiderweb", false), new PerkSpeed(0), + new PerkNoFallDamage() }, EntityType.SPIDER); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplosionModifier.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplosionModifier.java index b408caa7f..d34c7cbb2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplosionModifier.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkExplosionModifier.java @@ -23,7 +23,7 @@ public class PerkExplosionModifier extends Perk @EventHandler(priority = EventPriority.HIGH) public void Knockback(CustomDamageEvent event) { - if (event.GetCause() == DamageCause.ENTITY_EXPLOSION || event.GetCause() == DamageCause.BLOCK_EXPLOSION) + if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION) return; if (!(event.GetDamageeEntity() instanceof Player)) From 993ed0a92d3950d16ef74c5650f197a135ca96a6 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Sun, 16 Aug 2015 22:38:59 -0400 Subject: [PATCH 31/56] Fixed a possible NPE --- .../arcade/game/games/evolution/evolve/EvolveData.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 4aef4dd42..1e9ceeeb8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -242,7 +242,13 @@ public class EvolveData if (_holo != null) _holo.stop(); - _player.teleport(_eggLoc.clone().add(0.5, 0.0, 0.5)); + try + { + _player.teleport(_eggLoc.clone().add(0.5, 0.0, 0.5)); + } + catch (NullPointerException ex) + {} + _ended = true; } From 75a4b3d568ac6f0268b8c7fae0a0795e1b8cd9fb Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 17 Aug 2015 10:36:28 -0400 Subject: [PATCH 32/56] Changes to make evolving easier MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Speed 1 on kill • Evolve chargeup decreases 1.5 seconds per kill. --- .../arcade/game/games/evolution/EvoToken.java | 1 + .../game/games/evolution/Evolution.java | 23 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java index 392dbaf0f..6990799d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java @@ -11,6 +11,7 @@ public class EvoToken implements Comparable public final Player Player; public int Level = 0; + public int LifeKills = 0; public EvoToken(Player player) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 8a99dba20..815279907 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -320,6 +320,9 @@ public class Evolution extends SoloGame if (!IsLive()) return; + if (!IsAlive(event.getEntity())) + return; + if (_evolutionsAvailable.contains(event.getEntity())) { _evolutionsAvailable.remove(event.getEntity()); @@ -334,6 +337,11 @@ public class Evolution extends SoloGame { removeEvolvingEffects(event.getEntity()); } + + if (_tokens.containsKey(event.getEntity().getName())) + { + _tokens.get(event.getEntity().getName()).LifeKills = 0; + } } @EventHandler @@ -368,6 +376,15 @@ public class Evolution extends SoloGame if (_chargingExp.containsKey(player.getName())) _chargingExp.remove(player.getName()); } + + if (_tokens.containsKey(player.getName())) + { + _tokens.get(player.getName()).LifeKills++; + } + + //Buffs + Manager.GetCondition().Factory().Speed("Kill", player, null, 2, 0, true, false, false); + UtilPlayer.health(player, player.getMaxHealth() / 2); } @Override @@ -483,6 +500,8 @@ public class Evolution extends SoloGame EvoToken token = _tokens.get(player.getName()); + token.LifeKills = 0; + EvoKit from = (EvoKit) GetKits()[token.Level]; EvoKit to = (EvoKit) GetKits()[token.Level + 1 >= GetKits().length ? token.Level : token.Level + 1]; //Account for the score increase after evolve @@ -493,7 +512,9 @@ public class Evolution extends SoloGame if (!hasEvolvingEffects(player)) addEvolvingEffects(player); - _chargingExp.put(player.getName(), Math.min(exp + .012F, .9999F)); + int kills = _tokens.get(player.getName()).LifeKills; + + _chargingExp.put(player.getName(), (float) Math.min(exp + Math.max(.002, .012F - .003 * kills), .9999F)); UtilTextMiddle.display("", UtilTextMiddle.progress(_chargingExp.get(player.getName())).trim(), player); From 53395a770061ba99cde4e92852845543cbeee861 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 18 Aug 2015 13:07:46 -0400 Subject: [PATCH 33/56] Made player immovable whilst evolving. --- .../game/games/evolution/Evolution.java | 47 +++++++++++++------ .../games/evolution/evolve/EvolveData.java | 35 ++++++++++++-- .../games/evolution/evolve/EvolveManager.java | 44 ++++++++++------- .../games/evolution/evolve/PlatformToken.java | 4 +- 4 files changed, 93 insertions(+), 37 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 815279907..589284bdd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; @@ -51,6 +52,7 @@ import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; @@ -69,7 +71,7 @@ public class Evolution extends SoloGame private NautHashMap _tokens = new NautHashMap(); - private NautHashMap _evoPlatforms = new NautHashMap(); + private NautHashMap> _evoPlatforms = new NautHashMap>(); private ArrayList _spawns = new ArrayList(); private ArrayList _evolutionsAvailable = new ArrayList(); @@ -137,22 +139,26 @@ public class Evolution extends SoloGame public void ParseData() { for (Location platform : WorldData.GetDataLocs("RED")) - { + { platform.getBlock().setType(Material.AIR); - Iterator green = WorldData.GetDataLocs("GREEN").iterator(); - while (green.hasNext()) - { - Location viewing = green.next(); - + for (Location viewing : WorldData.GetDataLocs("GREEN")) + { viewing.getBlock().setType(Material.AIR); - if (UtilMath.offset2d(platform, viewing) > 8.0) - continue; - - green.remove(); - _evoPlatforms.put(platform, loadAngle(platform, viewing)); - break; + Iterator iS = WorldData.GetDataLocs("YELLOW").iterator(); + while (iS.hasNext()) + { + Location store = iS.next(); + + store.getBlock().setType(Material.AIR); + + if (UtilMath.offset(store, viewing) > 8 || UtilMath.offset(store, platform) > 8 || UtilMath.offset(platform, viewing) > 8) + continue; + + iS.remove(); + _evoPlatforms.put(platform, new SimpleEntry(loadAngle(platform, viewing), store)); + } } } @@ -383,7 +389,7 @@ public class Evolution extends SoloGame } //Buffs - Manager.GetCondition().Factory().Speed("Kill", player, null, 2, 0, true, false, false); + Manager.GetCondition().Factory().Speed("Kill", player, null, 3, 0, true, false, false); UtilPlayer.health(player, player.getMaxHealth() / 2); } @@ -421,6 +427,16 @@ public class Evolution extends SoloGame } } + @EventHandler + public void onEggFall(BlockPhysicsEvent event) + { + if (!IsLive()) + return; + + if (event.getChangedType() == Material.DRAGON_EGG) + event.setCancelled(true); + } + @SuppressWarnings("deprecation") @EventHandler public void updateAvailableEvolutions(UpdateEvent event) @@ -514,13 +530,14 @@ public class Evolution extends SoloGame int kills = _tokens.get(player.getName()).LifeKills; - _chargingExp.put(player.getName(), (float) Math.min(exp + Math.max(.002, .012F - .003 * kills), .9999F)); + _chargingExp.put(player.getName(), (float) Math.min(exp + Math.min(.022, .012 + (kills <= 0 ? 0 : (.002 * (kills - 1)))), .9999F)); UtilTextMiddle.display("", UtilTextMiddle.progress(_chargingExp.get(player.getName())).trim(), player); UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().clone().add(0, 1, 0), 0.4F, 0.56F, 0.4F, 0, 3, ViewDist.NORMAL, UtilServer.getPlayers()); return false; } + private boolean hasEvolvingEffects(Player player) { if (!Manager.GetCondition().GetActiveConditions().containsKey(player)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 1e9ceeeb8..339c54c7f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -8,6 +8,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -18,6 +19,7 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram.HologramTarget; import mineplex.core.hologram.HologramManager; +import mineplex.core.packethandler.PacketPlayOutCamera; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; @@ -44,8 +46,10 @@ import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftZombie; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; public class EvolveData @@ -62,6 +66,7 @@ public class EvolveData private final long _preEvolve; private final long _postEvolve; + private EvolveManager _manager; private HologramManager _holoManager; private final PlatformToken _token; @@ -69,6 +74,7 @@ public class EvolveData private boolean _active = true; private final Player _player; + private Zombie _zombie; private final Location _eggLoc; private final SimpleEntry _eggLocData; @@ -83,11 +89,12 @@ public class EvolveData private EntityInsentient _eTo; @SuppressWarnings("deprecation") - public EvolveData(HologramManager holo, PlatformToken token, Player player, EvoKit from, EvoKit to) + public EvolveData(EvolveManager manager, HologramManager holo, PlatformToken token, Player player, EvoKit from, EvoKit to) { _preEvolve = 3200; _postEvolve = 3400; + _manager = manager; _holoManager = holo; _token = token; @@ -106,6 +113,8 @@ public class EvolveData Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); setupViewingToken(_eFrom); + spawnZombie(); + setupZombie(); setupPlayer(); setupEgg(); setupHologram(holo, _eFrom, from); @@ -132,9 +141,25 @@ public class EvolveData _token.Viewing.setPitch(UtilAlg.GetPitch(viewing)); } + private void spawnZombie() + { + _manager.Host.CreatureAllowOverride = true; + _zombie = (Zombie) _player.getWorld().spawnEntity(_token.Viewing, EntityType.ZOMBIE); + _manager.Host.CreatureAllowOverride = true; + UtilEnt.Vegetate(_zombie, true); + UtilEnt.ghost(_zombie, true, true); + } + + private void setupZombie() + { + ((CraftZombie) _zombie).getHandle().getControllerLook().a(((CraftZombie) _zombie).getHandle(), _token.Viewing.getYaw(), _token.Viewing.getPitch()); + } + private void setupPlayer() { - _player.teleport(_token.Viewing); + _player.teleport(_token.Store); + + UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_zombie.getEntityId())); } private void setupHologram(HologramManager manager, EntityInsentient entity, EvoKit kit) @@ -163,8 +188,8 @@ public class EvolveData return true; } + setupZombie(); teleport(); -// updateHologram(); //Hasn't ended yet if (_active) @@ -187,6 +212,7 @@ public class EvolveData despawn(_eFrom); setupViewingToken(_eTo); + setupZombie(); setupPlayer(); setupHologram(_holoManager, _eTo, _to); @@ -242,6 +268,9 @@ public class EvolveData if (_holo != null) _holo.stop(); + UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_player)); + _zombie.remove(); + try { _player.teleport(_eggLoc.clone().add(0.5, 0.0, 0.5)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index 40ee56682..c12674bff 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.evolve; +import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.Iterator; import java.util.Map.Entry; @@ -25,7 +26,6 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerMoveEvent; -import org.bukkit.event.player.PlayerQuitEvent; public class EvolveManager implements Listener { @@ -35,11 +35,11 @@ public class EvolveManager implements Listener public final Evolution Host; - private final NautHashMap _evolveLocs; + private final NautHashMap> _evolveLocs; private NautHashMap _data = new NautHashMap(); - public EvolveManager(Evolution evolution, NautHashMap evolveLocs) + public EvolveManager(Evolution evolution, NautHashMap> evolveLocs) { Host = evolution; _evolveLocs = evolveLocs; @@ -49,10 +49,10 @@ public class EvolveManager implements Listener private PlatformToken getLocation() { - ArrayList> locs = new ArrayList>(_evolveLocs.entrySet()); - Entry entry = locs.get(UtilMath.r(locs.size())); + ArrayList>> locs = new ArrayList>>(_evolveLocs.entrySet()); + Entry> entry = locs.get(UtilMath.r(locs.size())); - return new PlatformToken(entry.getKey(), entry.getValue()); + return new PlatformToken(entry.getKey(), entry.getValue().getKey(), entry.getValue().getValue()); } public boolean isEvolving(Player player) @@ -65,7 +65,7 @@ public class EvolveManager implements Listener if (_data.containsKey(player.getName())) return; - _data.put(player.getName(), new EvolveData(holo, getLocation(), player, from, to)); + _data.put(player.getName(), new EvolveData(this, holo, getLocation(), player, from, to)); } public EvolveData getEvolve(Player player) @@ -91,18 +91,36 @@ public class EvolveManager implements Listener if (player == null || !player.isOnline()) { + try + { + entry.getValue().end(); + } + catch (NullPointerException ex) {} + iterator.remove(); continue; } if (!Host.IsAlive(player)) { + try + { + entry.getValue().end(); + } + catch (NullPointerException ex) {} + iterator.remove(); continue; } if (entry.getValue().tick()) - { + { + try + { + entry.getValue().end(); + } + catch (NullPointerException ex) {} + iterator.remove(); continue; } @@ -119,16 +137,6 @@ public class EvolveManager implements Listener HandlerList.unregisterAll(this); } - @EventHandler - public void onLogout(PlayerQuitEvent event) - { - if (!Host.IsLive()) - return; - - if (isEvolving(event.getPlayer())) - getEvolve(event.getPlayer()).end(); - } - @EventHandler(priority = EventPriority.MONITOR) public void onEvolveDamageRecieve(CustomDamageEvent event) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java index 4921724a5..a8fc52e90 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java @@ -11,10 +11,12 @@ public class PlatformToken public final Location Platform; public final Location Viewing; + public final Location Store; - public PlatformToken(Location platform, Location viewing) + public PlatformToken(Location platform, Location viewing, Location store) { Platform = platform.clone(); Viewing = viewing.clone(); + Store = store.clone(); } } From 64990ed3564dac65f6228b59a0b6d1be675c3eba Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 18 Aug 2015 21:37:52 -0400 Subject: [PATCH 34/56] Fixed parse distance. --- .../nautilus/game/arcade/game/games/evolution/Evolution.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 589284bdd..7e2d41493 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -153,7 +153,7 @@ public class Evolution extends SoloGame store.getBlock().setType(Material.AIR); - if (UtilMath.offset(store, viewing) > 8 || UtilMath.offset(store, platform) > 8 || UtilMath.offset(platform, viewing) > 8) + if (UtilMath.offset(store, platform) > 8 || UtilMath.offset(platform, viewing) > 8) continue; iS.remove(); From 86ad6a09de272c2aad0ebd940be313984f0fec75 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 20 Aug 2015 13:04:22 -0400 Subject: [PATCH 35/56] Used armor stands for evolving. --- .../arcade/game/games/evolution/Evolution.java | 9 +++++++++ .../game/games/evolution/evolve/EvolveData.java | 15 ++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 7e2d41493..89ff75804 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -53,6 +53,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerItemHeldEvent; @@ -128,6 +129,8 @@ public class Evolution extends SoloGame DeathSpectateSecs = 4.0; VersionRequire1_8 = true; + + CreatureAllow = false; } public EvolveManager getEvolve() @@ -644,6 +647,12 @@ public class Evolution extends SoloGame return UtilAlg.getLocationAwayFromOtherLocations(_spawns, allPlayers); } + @EventHandler + public void onCombust(EntityCombustEvent event) + { + event.setCancelled(true); + } + private void End() { ArrayList tokens = new ArrayList(_tokens.values()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 339c54c7f..f4c5e59cd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.disguise.disguises.DisguiseArmorStand; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram.HologramTarget; import mineplex.core.hologram.HologramManager; @@ -46,7 +47,6 @@ import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftZombie; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.entity.Zombie; @@ -75,6 +75,7 @@ public class EvolveData private final Player _player; private Zombie _zombie; + private DisguiseArmorStand _disguise; private final Location _eggLoc; private final SimpleEntry _eggLocData; @@ -147,12 +148,20 @@ public class EvolveData _zombie = (Zombie) _player.getWorld().spawnEntity(_token.Viewing, EntityType.ZOMBIE); _manager.Host.CreatureAllowOverride = true; UtilEnt.Vegetate(_zombie, true); - UtilEnt.ghost(_zombie, true, true); + + _disguise = new DisguiseArmorStand(_zombie); + _disguise.setInvisible(true); + + _manager.Host.Manager.GetDisguise().disguise(_disguise); } private void setupZombie() { - ((CraftZombie) _zombie).getHandle().getControllerLook().a(((CraftZombie) _zombie).getHandle(), _token.Viewing.getYaw(), _token.Viewing.getPitch()); + _disguise.setHeadPosition(_token.Viewing.getDirection()); + + _disguise.UpdateDataWatcher(); + _manager.Host.Manager.GetDisguise().updateDisguise(_disguise); +// ((CraftZombie) _zombie).getHandle().getControllerLook().a(((CraftZombie) _zombie).getHandle(), _token.Viewing.getYaw(), _token.Viewing.getPitch()); } private void setupPlayer() From cbaaee60d9111c3cce0cd44745eb6c4088ed1ac9 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 21 Aug 2015 13:00:08 -0400 Subject: [PATCH 36/56] Removed mob spectating method from evolving. --- .../mineplex/core/common/util/UtilAlg.java | 21 ++++- .../game/games/evolution/Evolution.java | 2 +- .../games/evolution/evolve/EvolveData.java | 86 +++++++++++-------- .../games/evolution/evolve/PlatformToken.java | 2 +- 4 files changed, 68 insertions(+), 43 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java index ab8f4dfdb..807dbccb5 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilAlg.java @@ -5,10 +5,8 @@ import java.util.List; import java.util.Set; import java.util.TreeSet; - - - import org.bukkit.Location; +import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -408,4 +406,21 @@ public class UtilAlg return bestLoc; } + + public static Location getNearestCornerLocation(Location near, Block block) + { + ArrayList corners = new ArrayList(); + + corners.add(block.getLocation().clone()); + corners.add(block.getLocation().clone().add(.999, 0, 0)); + corners.add(block.getLocation().clone().add(.999, 0, .999)); + corners.add(block.getLocation().clone().add(0, 0, .999)); + + corners.add(block.getLocation().clone().add(0, .999, 0)); + corners.add(block.getLocation().clone().add(.999, .999, 0)); + corners.add(block.getLocation().clone().add(.999, .999, .999)); + corners.add(block.getLocation().clone().add(0, .999, .999)); + + return UtilAlg.findClosest(near, corners); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 89ff75804..a1d4e84bf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -216,7 +216,7 @@ public class Evolution extends SoloGame @EventHandler(priority = EventPriority.LOWEST) public void endNoEvolve(GameStateChangeEvent event) { - if (event.GetState() != GameState.Prepare) + if (event.GetState() != GameState.Live) return; if (_evoPlatforms.size() <= 0) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index f4c5e59cd..0eb0a12ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -8,7 +8,6 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle.ParticleType; @@ -16,11 +15,9 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; -import mineplex.core.disguise.disguises.DisguiseArmorStand; import mineplex.core.hologram.Hologram; import mineplex.core.hologram.Hologram.HologramTarget; import mineplex.core.hologram.HologramManager; -import mineplex.core.packethandler.PacketPlayOutCamera; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; @@ -49,7 +46,6 @@ import org.bukkit.Material; import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; -import org.bukkit.entity.Zombie; import org.bukkit.util.Vector; public class EvolveData @@ -66,7 +62,7 @@ public class EvolveData private final long _preEvolve; private final long _postEvolve; - private EvolveManager _manager; +// private EvolveManager _manager; private HologramManager _holoManager; private final PlatformToken _token; @@ -74,8 +70,8 @@ public class EvolveData private boolean _active = true; private final Player _player; - private Zombie _zombie; - private DisguiseArmorStand _disguise; +// private Zombie _zombie; +// private DisguiseArmorStand _disguise; private final Location _eggLoc; private final SimpleEntry _eggLocData; @@ -95,7 +91,7 @@ public class EvolveData _preEvolve = 3200; _postEvolve = 3400; - _manager = manager; +// _manager = manager; _holoManager = holo; _token = token; @@ -114,8 +110,8 @@ public class EvolveData Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); setupViewingToken(_eFrom); - spawnZombie(); - setupZombie(); +// spawnZombie(); +// setupZombie(); setupPlayer(); setupEgg(); setupHologram(holo, _eFrom, from); @@ -138,37 +134,51 @@ public class EvolveData private void setupViewingToken(EntityInsentient ent) { - Vector viewing = UtilAlg.getTrajectory(_token.Viewing, _token.Platform.clone().add(0.5, (ent.boundingBox.e - ent.boundingBox.b) / 2 - 1, 0.5)); + Location center = _token.Platform.clone().add(0.5, (ent.boundingBox.e - ent.boundingBox.b) / 2 - 1, 0.5); + Location offset = UtilAlg.getNearestCornerLocation(_token.Viewing, center.getBlock()); + + center.setX(offset.getX()); + center.setZ(offset.getZ()); + + Vector viewing = UtilAlg.getTrajectory(_token.Viewing, offset); _token.Viewing.setPitch(UtilAlg.GetPitch(viewing)); } - private void spawnZombie() - { - _manager.Host.CreatureAllowOverride = true; - _zombie = (Zombie) _player.getWorld().spawnEntity(_token.Viewing, EntityType.ZOMBIE); - _manager.Host.CreatureAllowOverride = true; - UtilEnt.Vegetate(_zombie, true); - - _disguise = new DisguiseArmorStand(_zombie); - _disguise.setInvisible(true); - - _manager.Host.Manager.GetDisguise().disguise(_disguise); - } - - private void setupZombie() - { - _disguise.setHeadPosition(_token.Viewing.getDirection()); - - _disguise.UpdateDataWatcher(); - _manager.Host.Manager.GetDisguise().updateDisguise(_disguise); -// ((CraftZombie) _zombie).getHandle().getControllerLook().a(((CraftZombie) _zombie).getHandle(), _token.Viewing.getYaw(), _token.Viewing.getPitch()); - } +// private void spawnZombie() +// { +// _manager.Host.CreatureAllowOverride = true; +// _zombie = (Zombie) _player.getWorld().spawnEntity(_token.Viewing, EntityType.ZOMBIE); +// _manager.Host.CreatureAllowOverride = true; +// UtilEnt.Vegetate(_zombie, true); +// UtilEnt.ghost(_zombie, true, true); +// +// _disguise = new DisguiseArmorStand(_zombie); +// +// _disguise.setInvisible(true); +// _disguise.Global = false; +// +// _manager.Host.Manager.GetDisguise().disguise(_disguise, _player); +// } +// +// private void setupZombie() +// { +// _zombie.teleport(_token.Viewing); +// +// _disguise.setHeadPosition(_token.Viewing.getDirection()); +// +//// _disguise.UpdateDataWatcher(); +// _manager.Host.Manager.GetDisguise().updateDisguise(_disguise); +// +// } private void setupPlayer() { - _player.teleport(_token.Store); + _player.teleport(_token.Viewing); - UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_zombie.getEntityId())); +// _player.teleport(_token.Store); +// _player.teleport(_token.Viewing); + +// UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_zombie.getEntityId())); } private void setupHologram(HologramManager manager, EntityInsentient entity, EvoKit kit) @@ -197,7 +207,7 @@ public class EvolveData return true; } - setupZombie(); +// setupZombie(); teleport(); //Hasn't ended yet @@ -221,7 +231,7 @@ public class EvolveData despawn(_eFrom); setupViewingToken(_eTo); - setupZombie(); +// setupZombie(); setupPlayer(); setupHologram(_holoManager, _eTo, _to); @@ -277,8 +287,8 @@ public class EvolveData if (_holo != null) _holo.stop(); - UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_player)); - _zombie.remove(); +// UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_player)); +// _zombie.remove(); try { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java index a8fc52e90..1525f2dd2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/PlatformToken.java @@ -10,7 +10,7 @@ public class PlatformToken */ public final Location Platform; - public final Location Viewing; + public final Location Viewing; /**This was when I was using a spectate packet. Will be used again once I can have teh armorstand : >>>>>>>>*/ public final Location Store; public PlatformToken(Location platform, Location viewing, Location store) From 7b42f2155d66bc3ffcb85eaa0e79d8bea4b86aef Mon Sep 17 00:00:00 2001 From: Mysticate Date: Mon, 24 Aug 2015 20:40:34 -0400 Subject: [PATCH 37/56] Tweaks. :D --- .../mineplex/core/common/util/UtilSkull.java | 78 ++++++++-------- .../arcade/game/games/evolution/EvoKit.java | 14 +++ .../game/games/evolution/Evolution.java | 62 ++++++++----- .../games/evolution/evolve/EvolveData.java | 6 +- .../games/evolution/evolve/EvolveManager.java | 33 ++++++- .../game/games/evolution/mobs/KitBlaze.java | 2 +- .../game/games/evolution/mobs/KitCreeper.java | 6 +- .../game/games/evolution/mobs/KitSlime.java | 4 +- .../evolution/mobs/perks/PerkBounceEVO.java | 4 +- .../mobs/perks/PerkFlamingSwordEVO.java | 89 ++++++++++++++----- .../arcade/managers/GamePlayerManager.java | 41 +++++---- 11 files changed, 221 insertions(+), 118 deletions(-) diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSkull.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSkull.java index 14925bf49..9b6044b4e 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSkull.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilSkull.java @@ -6,23 +6,23 @@ public class UtilSkull { public static byte getSkullData(Entity entity) { - if (entity instanceof Skeleton) - { - Skeleton sk = ((Skeleton) entity); - if (sk.getSkeletonType() == Skeleton.SkeletonType.WITHER) - return 1; - else return 0; - } - else if (entity instanceof Zombie || entity instanceof Giant) - { + if (entity == null) + return 0; + + return getSkullData(entity.getType()); + } + + public static byte getSkullData(EntityType type) + { + if (type == EntityType.SKELETON) + return 0; + if (type == EntityType.WITHER) + return 1; + if (type == EntityType.ZOMBIE || type == EntityType.GIANT) return 2; - } - else if (entity instanceof Creeper) - { + if (type == EntityType.CREEPER) return 4; - } - else - return 3; + return 3; } public static boolean isPlayerHead(byte data) @@ -31,52 +31,54 @@ public class UtilSkull } public static String getPlayerHeadName(Entity entity) + { + return getPlayerHeadName(entity.getType()); + } + + public static String getPlayerHeadName(EntityType entity) { String name = "MHF_Alex"; // order is important for some of these - if (entity instanceof Blaze) + if (entity == EntityType.BLAZE) name = "MHF_Blaze"; - else if (entity instanceof CaveSpider) + else if (entity == EntityType.CAVE_SPIDER) name = "MHF_CaveSpider"; - else if (entity instanceof Spider) + else if (entity == EntityType.SPIDER) name = "MHF_Spider"; - else if (entity instanceof Chicken) + else if (entity == EntityType.CHICKEN) name = "MHF_Chicken"; - else if (entity instanceof MushroomCow) + else if (entity == EntityType.MUSHROOM_COW) name = "MHF_MushroomCow"; - else if (entity instanceof Cow) + else if (entity == EntityType.COW) name = "MHF_Cow"; - else if (entity instanceof Creeper) + else if (entity == EntityType.CREEPER) name = "MHF_Creeper"; - else if (entity instanceof Enderman) + else if (entity == EntityType.ENDERMAN) name = "MHF_Enderman"; - else if (entity instanceof Ghast) + else if (entity == EntityType.GHAST) name = "MHF_Ghast"; - else if (entity instanceof Golem) + else if (entity == EntityType.IRON_GOLEM) name = "MHF_Golem"; - else if (entity instanceof PigZombie) + else if (entity == EntityType.PIG_ZOMBIE) name = "MHF_PigZombie"; - else if (entity instanceof MagmaCube) + else if (entity == EntityType.MAGMA_CUBE) name = "MHF_LavaSlime"; - else if (entity instanceof Slime) + else if (entity == EntityType.SLIME) name = "MHF_Slime"; - else if (entity instanceof Ocelot) + else if (entity == EntityType.OCELOT) name = "MHF_Ocelot"; - else if (entity instanceof PigZombie) - name = "MHF_PigZombie"; - else if (entity instanceof Pig) + else if (entity == EntityType.PIG) name = "MHF_Pig"; - else if (entity instanceof Sheep) - name = "MHF_Pig"; - else if (entity instanceof Squid) + else if (entity == EntityType.SHEEP) + name = "MHF_Sheep"; + else if (entity == EntityType.SQUID) name = "MHF_Squid"; - else if (entity instanceof HumanEntity) + else if (entity == EntityType.PLAYER) name = "MHF_Steve"; - else if (entity instanceof Villager) + else if (entity == EntityType.VILLAGER) name = "MHF_Villager"; return name; } - } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 0385e8012..00ffd052b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -1,11 +1,14 @@ package nautilus.game.arcade.game.games.evolution; import java.util.ArrayList; +import java.util.Arrays; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilSkull; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.itemstack.ItemStackFactory; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; @@ -13,6 +16,7 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -148,6 +152,7 @@ public abstract class EvoKit extends Kit event.AddMod(damager.getName(), "Attack", mod, true); } + @SuppressWarnings("deprecation") @Override public final void GiveItems(Player player) { @@ -158,6 +163,15 @@ public abstract class EvoKit extends Kit player.setLevel(0); player.setExp(0F); + if (UtilSkull.isPlayerHead(UtilSkull.getSkullData(getEntity()))) + { + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) 3, 1, C.cGreen + C.Bold + GetName(), Arrays.asList(""), UtilSkull.getPlayerHeadName(getEntity()))); + } + else + { + player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) UtilSkull.getSkullData(getEntity()), 1, C.cGreen + C.Bold + GetName())); + } + giveItems(player); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index a1d4e84bf..4ec558c6f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -26,6 +26,7 @@ import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.condition.ConditionActive; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -49,10 +50,12 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -131,6 +134,8 @@ public class Evolution extends SoloGame VersionRequire1_8 = true; CreatureAllow = false; + + DeathMessages = false; } public EvolveManager getEvolve() @@ -323,6 +328,21 @@ public class Evolution extends SoloGame // }, 4); } + @EventHandler + public void onDamage(CustomDamageEvent event) + { + if (!IsLive()) + return; + + if (!IsAlive(event.GetDamageeEntity())) + return; + + if (!_chargingExp.containsKey(event.GetDamageePlayer().getName())) + return; + + _chargingExp.put(event.GetDamageePlayer().getName(), (float) Math.max(0, _chargingExp.get(event.GetDamageePlayer().getName()) * .95)); + } + @EventHandler public void onDeath(PlayerDeathEvent event) { @@ -388,7 +408,11 @@ public class Evolution extends SoloGame if (_tokens.containsKey(player.getName())) { - _tokens.get(player.getName()).LifeKills++; + int kills = _tokens.get(player.getName()).LifeKills++; + + UtilPlayer.message(player, ""); + UtilPlayer.message(player, F.main("Game", F.elem(kills + " Kills") + " - " + F.elem(Math.min(1.0, 6.0 - (1.5 * (kills - 1))) + " Second ") + "evolve")); + UtilPlayer.message(player, ""); } //Buffs @@ -430,17 +454,6 @@ public class Evolution extends SoloGame } } - @EventHandler - public void onEggFall(BlockPhysicsEvent event) - { - if (!IsLive()) - return; - - if (event.getChangedType() == Material.DRAGON_EGG) - event.setCancelled(true); - } - - @SuppressWarnings("deprecation") @EventHandler public void updateAvailableEvolutions(UpdateEvent event) { @@ -467,9 +480,16 @@ public class Evolution extends SoloGame continue; } - if (player.isSneaking() && (player.isOnGround() || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))) + if (player.isSneaking()) { - if (!player.getLocation().getBlock().isLiquid()) + if (player.getLocation().getBlock().isLiquid()) + { + if (Recharge.Instance.use(player, "No Evolve Water Message", 2000, false, false)) + { + UtilPlayer.message(player, F.main("Game", "You cannot evolve in water!")); + } + } + else { if (onEvolveAttempting(player)) { @@ -477,13 +497,6 @@ public class Evolution extends SoloGame } continue; } - else - { - if (Recharge.Instance.use(player, "No Evolve Water Message", 2000, false, false)) - { - UtilPlayer.message(player, F.main("Game", "You cannot evolve in water!")); - } - } } if (_chargingExp.containsKey(player.getName())) @@ -528,14 +541,19 @@ public class Evolution extends SoloGame return true; } + if (Manager.GetCondition().HasCondition(player, ConditionType.SPEED, "Kill")) + Manager.GetCondition().GetActiveCondition(player, ConditionType.SPEED).Expire(); + if (!hasEvolvingEffects(player)) addEvolvingEffects(player); int kills = _tokens.get(player.getName()).LifeKills; - _chargingExp.put(player.getName(), (float) Math.min(exp + Math.min(.022, .012 + (kills <= 0 ? 0 : (.002 * (kills - 1)))), .9999F)); + if (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.DRAGON_EGG) + _chargingExp.put(player.getName(), (float) Math.min(exp + Math.min(.022, .012 + (kills <= 0 ? 0 : (.003 * (kills - 1)))), .9999F)); UtilTextMiddle.display("", UtilTextMiddle.progress(_chargingExp.get(player.getName())).trim(), player); + player.playSound(player.getLocation(), Sound.NOTE_BASS, 1, _chargingExp.get(player.getName()) + 1); UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().clone().add(0, 1, 0), 0.4F, 0.56F, 0.4F, 0, 3, ViewDist.NORMAL, UtilServer.getPlayers()); return false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 0eb0a12ab..7c0a2ba08 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -59,8 +59,8 @@ public class EvolveData private final long _timestamp = System.currentTimeMillis(); private long _endTime = System.currentTimeMillis(); - private final long _preEvolve; - private final long _postEvolve; + private final long _preEvolve = 1800; + private final long _postEvolve = 5200; // private EvolveManager _manager; private HologramManager _holoManager; @@ -88,8 +88,6 @@ public class EvolveData @SuppressWarnings("deprecation") public EvolveData(EvolveManager manager, HologramManager holo, PlatformToken token, Player player, EvoKit from, EvoKit to) { - _preEvolve = 3200; - _postEvolve = 3400; // _manager = manager; _holoManager = holo; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java index c12674bff..4f1f48b2e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveManager.java @@ -20,11 +20,15 @@ import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent; import org.bukkit.Bukkit; import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; +import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.player.PlayerMoveEvent; public class EvolveManager implements Listener @@ -200,6 +204,33 @@ public class EvolveManager implements Listener return; if (isEvolving(event.getPlayer())) - event.getPlayer().teleport(event.getFrom()); + event.setTo(event.getFrom()); } + + @EventHandler + public void onEggFall(BlockPhysicsEvent event) + { + if (!Host.IsLive()) + return; + + if (event.getChangedType() == Material.DRAGON_EGG || event.getBlock().getType() == Material.DRAGON_EGG) + event.setCancelled(true); + } + + @EventHandler + public void onEggSolidify(EntityChangeBlockEvent event) + { + if (!Host.IsLive()) + return; + + if (!(event.getEntity() instanceof FallingBlock)) + return; + + if (((FallingBlock) event.getEntity()).getMaterial() != Material.DRAGON_EGG) + return; + + event.setCancelled(true); + event.getEntity().remove(); + } + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java index 2760bfa24..7f0f3944b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java @@ -32,7 +32,7 @@ public class KitBlaze extends EvoKit @Override protected void giveItems(Player player) { - player.getInventory().setItem(0, new ItemBuilder(Material.GOLD_SWORD).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Flamethrower").build()); + player.getInventory().setItem(0, new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Flamethrower").build()); //Disguise DisguiseBlaze disguise = new DisguiseBlaze(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java index 20f15dbd2..b3673b103 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java @@ -7,7 +7,6 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.EvoKit; import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkSulphurBombEVO; import nautilus.game.arcade.kit.Perk; -import nautilus.game.arcade.kit.perks.PerkExplosionModifier; import org.bukkit.Material; import org.bukkit.Sound; @@ -20,11 +19,10 @@ public class KitCreeper extends EvoKit { super(manager, "Creeper", new String[] { - C.cYellow + "Ability: " + C.cWhite + "Sulphur Bomb", C.Line, - C.cGreen + "Take 50% Explosion Damage" + C.cYellow + "Ability: " + C.cWhite + "Sulphur Bomb" }, 28, 4, new Perk[] { - new PerkSulphurBombEVO(), new PerkExplosionModifier(0.5) + new PerkSulphurBombEVO() }, EntityType.CREEPER); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java index b237f41cf..101b7cfa1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java @@ -20,7 +20,7 @@ public class KitSlime extends EvoKit { super(manager, "Slime", new String[] { - C.cYellow + "Ability: " + C.cWhite + "Bounce", C.Line, + C.cYellow + "Ability: " + C.cWhite + "Slime Slam", C.Line, C.cGreen + "Take 50% Fall Damage" }, 22, 4, new Perk[] { @@ -31,7 +31,7 @@ public class KitSlime extends EvoKit @Override protected void giveItems(Player player) { - player.getInventory().setItem(0, new ItemBuilder(Material.SLIME_BALL).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Bounce").build()); + player.getInventory().setItem(0, new ItemBuilder(Material.SLIME_BALL).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Slime Slam").build()); //Disguise DisguiseSlime disguise = new DisguiseSlime(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index 5fb0c2cf4..d1163083d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -36,7 +36,7 @@ public class PerkBounceEVO extends Perk public PerkBounceEVO() { - super("Bounce", new String[] + super("Slime Slam", new String[] { }); } @@ -71,7 +71,7 @@ public class PerkBounceEVO extends Perk if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) return; - UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 0, 0.5, 3.0, true); + UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 0, 0.5, 1.6, true); //Record _live.put(player, System.currentTimeMillis()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java index 2e3d0bc39..a8e8d54fa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java @@ -1,8 +1,17 @@ package nautilus.game.arcade.game.games.evolution.mobs.perks; +import java.util.Iterator; +import java.util.Map.Entry; + import mineplex.core.common.util.C; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; @@ -14,6 +23,7 @@ import org.bukkit.Sound; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; public class PerkFlamingSwordEVO extends Perk @@ -21,15 +31,47 @@ public class PerkFlamingSwordEVO extends Perk /** * @author Mysticate */ + + private NautHashMap _active = new NautHashMap(); public PerkFlamingSwordEVO() { super("Flamethrower", new String[] { - C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Flamethrower" + C.cYellow + "Block" + C.cGray + " to use " + C.cGreen + "Flamethrower" }); } + @EventHandler + public void onInteract(PlayerInteractEvent event) + { + if (!UtilEvent.isAction(event, ActionType.R)) + return; + + if (!Manager.GetGame().IsLive()) + return; + + if (!UtilInv.IsItem(event.getItem(), Material.BLAZE_ROD, (byte) 0)) + return; + + if (!Manager.IsAlive(event.getPlayer())) + return; + + if (_active.containsKey(event.getPlayer())) + return; + + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer()); + Bukkit.getServer().getPluginManager().callEvent(useEvent); + + if (useEvent.isCancelled()) + return; + + if (!Recharge.Instance.use(event.getPlayer(), GetName(), 5000, true, true)) + return; + + _active.put(event.getPlayer(), System.currentTimeMillis()); + } + @EventHandler public void update(UpdateEvent event) { @@ -39,35 +81,36 @@ public class PerkFlamingSwordEVO extends Perk if (!Manager.GetGame().IsLive()) return; - for (Player player : Manager.GetGame().GetPlayers(true)) + Iterator> iterator = _active.entrySet().iterator(); + while (iterator.hasNext()) { - if (!Kit.HasKit(player)) - continue; + Entry entry = iterator.next(); - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + if (entry.getKey() == null || !entry.getKey().isOnline()) + { + iterator.remove(); + continue; + } + + if (!Manager.IsAlive(entry.getKey())) + { + iterator.remove(); + continue; + } + + if (UtilTime.elapsed(entry.getValue(), 1000)) + { + iterator.remove(); + continue; + } + + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(entry.getKey()); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) continue; - charge(player); - } - } - - private void charge(Player player) - { - if (player.isBlocking()) - { - if (player.getExp() <= .0001) - return; - - player.setExp((float) Math.max(player.getExp() - 0.025, .0001)); - flame(player); - return; - } - else - { - player.setExp((float) Math.min(player.getExp() + 0.01, .9999)); + flame(entry.getKey()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index d1417d420..7aed2cf33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -2,26 +2,6 @@ package nautilus.game.arcade.managers; import java.util.ArrayList; -import org.bukkit.ChatColor; -import org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Sound; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.Entity; -import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.Player; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.inventory.InventoryClickEvent; -import org.bukkit.event.inventory.InventoryType; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.event.player.PlayerInteractEntityEvent; -import org.bukkit.event.player.PlayerJoinEvent; -import org.bukkit.event.player.PlayerRespawnEvent; - import mineplex.core.common.CurrencyType; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -45,6 +25,25 @@ import nautilus.game.arcade.shop.ArcadeShop; import nautilus.game.arcade.shop.KitPackage; import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; +import org.bukkit.ChatColor; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.Entity; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.inventory.InventoryClickEvent; +import org.bukkit.event.inventory.InventoryType; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerRespawnEvent; + public class GamePlayerManager implements Listener { ArcadeManager Manager; @@ -60,7 +59,7 @@ public class GamePlayerManager implements Listener public void PlayerDeath(CombatDeathEvent event) { //Don't actually die - event.GetEvent().getEntity().setHealth(20); + event.GetEvent().getEntity().setHealth(event.GetEvent().getEntity().getMaxHealth()); //Dont display message if (Manager.GetGame() != null) From 988382375fd94b7578e01b50eb0d4e6b8db15eba Mon Sep 17 00:00:00 2001 From: Mysticate Date: Tue, 25 Aug 2015 23:36:18 -0600 Subject: [PATCH 38/56] Started adding kits --- .../arcade/game/games/evolution/EvoToken.java | 7 ++- .../game/games/evolution/Evolution.java | 43 ++++++++----------- .../game/games/evolution/kits/KitAbility.java | 8 ++++ .../game/games/evolution/mobs/KitGolem.java | 2 +- 4 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java index 6990799d0..838549dea 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoToken.java @@ -1,5 +1,7 @@ package nautilus.game.arcade.game.games.evolution; +import nautilus.game.arcade.kit.Kit; + import org.bukkit.entity.Player; public class EvoToken implements Comparable @@ -10,12 +12,15 @@ public class EvoToken implements Comparable public final Player Player; + public final Kit SupplementKit; + public int Level = 0; public int LifeKills = 0; - public EvoToken(Player player) + public EvoToken(Player player, Kit kit) { Player = player; + SupplementKit = kit; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 4ec558c6f..741624116 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -50,12 +50,9 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; -import org.bukkit.entity.FallingBlock; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; -import org.bukkit.event.block.BlockPhysicsEvent; -import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.player.PlayerInteractEvent; @@ -71,7 +68,7 @@ public class Evolution extends SoloGame private EvolveManager _evolve; -// private ArrayList _mobKits = new ArrayList(); + private ArrayList _mobKits = new ArrayList(); private NautHashMap _tokens = new NautHashMap(); @@ -83,29 +80,25 @@ public class Evolution extends SoloGame public Evolution(ArcadeManager manager) { - super(manager, GameType.Evolution, new EvoKit[] - { - new KitGolem(manager), - new KitBlaze(manager), - new KitSpider(manager), - new KitCreeper(manager), - new KitSlime(manager), - new KitChicken(manager) - }, new String[0]); + super(manager, GameType.Evolution, new EvoKit[0], new String[0]); // // //Custom kit stuff to make other things easiet -// _mobKits.add(new KitGolem(manager)); -// _mobKits.add(new KitBlaze(manager)); -// _mobKits.add(new KitSpider(manager)); -// _mobKits.add(new KitCreeper(manager)); -// _mobKits.add(new KitSlime(manager)); -//// _mobKits.add(new KitEnderman(manager)); -//// _mobKits.add(new KitSnowman(manager)); -//// _mobKits.add(new KitWolf(manager)); -// _mobKits.add(new KitChicken(manager)); -//// _mobKits.add(new KitSkeleton(manager)); -// -// setKits(_mobKits.toArray(new EvoKit[0])); + _mobKits.add(new KitGolem(manager)); + _mobKits.add(new KitBlaze(manager)); + _mobKits.add(new KitSpider(manager)); + _mobKits.add(new KitCreeper(manager)); + _mobKits.add(new KitSlime(manager)); +// _mobKits.add(new KitEnderman(manager)); +// _mobKits.add(new KitSnowman(manager)); +// _mobKits.add(new KitWolf(manager)); + _mobKits.add(new KitChicken(manager)); +// _mobKits.add(new KitSkeleton(manager)); + + ArrayList allKits = new ArrayList(); + allKits.addAll(_mobKits); + //TODO Add regular kits + + setKits(allKits.toArray(new Kit[0])); _gameDesc = new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java new file mode 100644 index 000000000..ba7a74f3a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java @@ -0,0 +1,8 @@ +package nautilus.game.arcade.game.games.evolution.kits; + +import nautilus.game.arcade.kit.Kit; + +public class KitAbility extends Kit +{ + +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java index 27597d11c..6be923799 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java @@ -25,7 +25,7 @@ public class KitGolem extends EvoKit }, 40, 6, new Perk[] { new PerkSiesmicSlamEVO(), new PerkKnockbackTaken(.5) - }, EntityType.IRON_GOLEM, true); + }, EntityType.IRON_GOLEM); } @Override From cfdb0dfa4f31647a4b3ac4bfe0048d44e986e28d Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 26 Aug 2015 13:19:17 -0600 Subject: [PATCH 39/56] Added kits + achievements. Hurrah! --- .../core/achievement/Achievement.java | 44 +++++++++- .../core/achievement/AchievementCategory.java | 12 ++- .../game/games/evolution/Evolution.java | 85 ++++++++++++++----- .../events/EvolutionAbilityUseEvent.java | 23 ++++- .../events/EvolutionAttemptingTickEvent.java | 42 +++++++++ .../evolution/events/EvolutionEndEvent.java | 1 + .../game/games/evolution/kits/KitAbility.java | 28 ++++++ .../games/evolution/kits/KitEvolveSpeed.java | 36 ++++++++ .../game/games/evolution/kits/KitHealth.java | 53 ++++++++++++ .../evolution/kits/perks/PerkCooldownEVO.java | 37 ++++++++ .../kits/perks/PerkEvolveSpeedEVO.java | 37 ++++++++ .../game/games/evolution/mobs/KitBlaze.java | 4 + .../game/games/evolution/mobs/KitChicken.java | 6 +- .../game/games/evolution/mobs/KitCreeper.java | 4 + .../games/evolution/mobs/KitEnderman.java | 4 + .../game/games/evolution/mobs/KitGolem.java | 4 + .../games/evolution/mobs/KitSkeleton.java | 4 + .../game/games/evolution/mobs/KitSlime.java | 4 + .../game/games/evolution/mobs/KitSnowman.java | 4 + .../game/games/evolution/mobs/KitSpider.java | 4 + .../game/games/evolution/mobs/KitWolf.java | 4 + .../mobs/perks/PerkBlockTossEVO.java | 11 +-- .../evolution/mobs/perks/PerkBounceEVO.java | 4 +- .../mobs/perks/PerkDoubleJumpEVO.java | 2 +- .../mobs/perks/PerkFlamingSwordEVO.java | 6 +- .../evolution/mobs/perks/PerkPounceEVO.java | 4 +- .../mobs/perks/PerkSiesmicSlamEVO.java | 4 +- .../mobs/perks/PerkSulphurBombEVO.java | 4 +- .../evolution/mobs/perks/PerkWebEVO.java | 2 +- .../trackers/KillsWhileEvolvingTracker.java | 39 +++++++++ .../evolution/trackers/NoAbilityTracker.java | 61 +++++++++++++ .../NoDamageWhileEvolvingTracker.java | 68 +++++++++++++++ .../evolution/trackers/NoMeleeTracker.java | 68 +++++++++++++++ 33 files changed, 663 insertions(+), 50 deletions(-) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAttemptingTickEvent.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkCooldownEVO.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkEvolveSpeedEVO.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/KillsWhileEvolvingTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoDamageWhileEvolvingTracker.java create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 64d6215aa..a0cc164f3 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -666,7 +666,49 @@ public enum Achievement new String[]{"Bomb Lobbers.Direct Hit"}, new String[]{"Get 50 direct hits"}, new int[]{50}, - AchievementCategory.BOMB_LOBBERS) + AchievementCategory.BOMB_LOBBERS), + + EVOLUTION_WINS("Expert Evolver", 1200, + new String[]{"Evolution.Wins"}, + new String[]{"Win 20 games of Evolution"}, + new int[]{20}, + AchievementCategory.EVOLUTION), + + EVOLUTION_NO_DEATHS("Perfect Game", 2000, + new String[]{"Evolution.NoDeaths"}, + new String[]{"Win a game withing dying"}, + new int[]{1}, + AchievementCategory.EVOLUTION), + + EVOLUTION_STEALTH("Stealth Mastah", 1000, + new String[]{"Evolution.Stealth"}, + new String[]{"Win without taking any", "damage while evolving"}, + new int[1], + AchievementCategory.EVOLUTION), + + EVOLUTION_RAMPAGE("Rampage", 800, + new String[]{"Evolution.Rampage"}, + new String[]{"Get 3 kills within 5 seconds", "of each other"}, + new int[1], + AchievementCategory.EVOLUTION), + + EVOLUTION_MELEE("Melee Monster", 1000, + new String[]{"Evolution.MeleeOnly"}, + new String[]{"Win without using any abilities"}, + new int[1], + AchievementCategory.EVOLUTION), + + EVOLUTION_SKILLS("Ability Assassin", 1000, + new String[]{"Evolution.AbilityOnly"}, + new String[]{"Win without any melee attacks"}, + new int[1], + AchievementCategory.EVOLUTION), + + EVOLUTION_EVOLVEKILL("No Evolve 5 U", 800, + new String[]{"Evolution.EvolveKill"}, + new String[]{"Kill 50 people while they", "Are trying to evolve"}, + new int[50], + AchievementCategory.EVOLUTION) ; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java index 9c9491ad5..fd3045f2d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/AchievementCategory.java @@ -2,9 +2,6 @@ package mineplex.core.achievement; import java.util.List; -import org.bukkit.Material; -import org.bukkit.entity.Player; - import mineplex.core.account.CoreClientManager; import mineplex.core.common.Rank; import mineplex.core.common.util.C; @@ -12,6 +9,9 @@ import mineplex.core.common.util.UtilTime; import mineplex.core.stats.PlayerStats; import mineplex.core.stats.StatsManager; +import org.bukkit.Material; +import org.bukkit.entity.Player; + public enum AchievementCategory { GLOBAL("Global", null, @@ -122,7 +122,11 @@ public enum AchievementCategory BOMB_LOBBERS("Bomb Lobbers", null, new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED }, - Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit"); + Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit"), + + EVOLUTION("Evolution", null, + new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED}, + Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit"); private String _name; private String[] _statsToPull; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 741624116..e55646c8e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -33,18 +33,29 @@ import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAttemptingTickEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager; +import nautilus.game.arcade.game.games.evolution.kits.KitAbility; +import nautilus.game.arcade.game.games.evolution.kits.KitEvolveSpeed; +import nautilus.game.arcade.game.games.evolution.kits.KitHealth; import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze; import nautilus.game.arcade.game.games.evolution.mobs.KitChicken; import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper; import nautilus.game.arcade.game.games.evolution.mobs.KitGolem; import nautilus.game.arcade.game.games.evolution.mobs.KitSlime; import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; +import nautilus.game.arcade.game.games.evolution.trackers.KillsWhileEvolvingTracker; +import nautilus.game.arcade.game.games.evolution.trackers.NoAbilityTracker; +import nautilus.game.arcade.game.games.evolution.trackers.NoDamageWhileEvolvingTracker; +import nautilus.game.arcade.game.games.evolution.trackers.NoMeleeTracker; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.stats.KillFastStatTracker; +import nautilus.game.arcade.stats.WinWithoutDyingStatTracker; +import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; @@ -78,6 +89,7 @@ public class Evolution extends SoloGame private ArrayList _evolutionsAvailable = new ArrayList(); private NautHashMap _chargingExp = new NautHashMap(); + @SuppressWarnings("unchecked") public Evolution(ArcadeManager manager) { super(manager, GameType.Evolution, new EvoKit[0], new String[0]); @@ -96,7 +108,10 @@ public class Evolution extends SoloGame ArrayList allKits = new ArrayList(); allKits.addAll(_mobKits); - //TODO Add regular kits + + allKits.add(new KitAbility(Manager)); + allKits.add(new KitEvolveSpeed(Manager)); + allKits.add(new KitHealth(Manager)); setKits(allKits.toArray(new Kit[0])); @@ -104,7 +119,7 @@ public class Evolution extends SoloGame { "You can evolve every kill.", "Each evolution has unique skills.", - "First to get through " + GetKits().length + " evolutions wins!" + "First to get through " + _mobKits.size() + " evolutions wins!" }; DamageTeamSelf = true; @@ -129,6 +144,15 @@ public class Evolution extends SoloGame CreatureAllow = false; DeathMessages = false; + + registerStatTrackers( + new WinWithoutDyingStatTracker(this, "NoDeaths"), + new NoDamageWhileEvolvingTracker(this), + new KillFastStatTracker(this, 3, 5, "Rampage"), + new NoAbilityTracker(this), + new NoMeleeTracker(this), + new KillsWhileEvolvingTracker(this) + ); } public EvolveManager getEvolve() @@ -188,7 +212,7 @@ public class Evolution extends SoloGame for (Player player : GetPlayers(true)) { - _tokens.put(player.getName(), new EvoToken(player)); + _tokens.put(player.getName(), new EvoToken(player, GetKit(player))); upgradeKit(player, false); } @@ -232,9 +256,10 @@ public class Evolution extends SoloGame if (!IsAlive(player)) return; - EvoKit newKit = (EvoKit) GetKits()[getScore(player)]; + EvoKit newKit = _mobKits.get(getScore(player)); SetKit(player, newKit, false); + _tokens.get(player.getName()).SupplementKit.ApplyKit(player); if (give) { @@ -242,6 +267,18 @@ public class Evolution extends SoloGame } } + @Override + public boolean HasKit(Player player, Kit kit) + { + if (super.HasKit(player, kit)) + return true; + + if (!_tokens.containsKey(player.getName())) + return false; + + return _tokens.get(player.getName()).SupplementKit.equals(kit); + } + @EventHandler public void startEvolve(EvolutionBeginEvent event) { @@ -282,7 +319,7 @@ public class Evolution extends SoloGame } } - if (increaseScore(event.getPlayer()) >= GetKits().length) + if (increaseScore(event.getPlayer()) >= _mobKits.size()) { ScoreboardUpdate(new UpdateEvent(UpdateType.FAST)); @@ -306,19 +343,10 @@ public class Evolution extends SoloGame Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire(); } - if (getScore(event.getPlayer()) >= GetKits().length) + if (getScore(event.getPlayer()) >= _mobKits.size()) { End(); } - -// Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable() -// { -// @Override -// public void run() -// { -// GetKit(event.getPlayer()).ApplyKit(event.getPlayer()); -// } -// }, 4); } @EventHandler @@ -427,6 +455,9 @@ public class Evolution extends SoloGame public void run() { GetKit(player).ApplyKit(player); + + if (_tokens.containsKey(player.getName())) + _tokens.get(player.getName()).SupplementKit.ApplyKit(player); } }, 0); } @@ -502,10 +533,14 @@ public class Evolution extends SoloGame { UtilTextMiddle.display("", C.cGreen + C.Bold + "Hold Crouch to Evolve", 0, 60, 20, player); } - } } + public boolean isAttemptingEvolve(Player player) + { + return _chargingExp.containsKey(player.getName()); + } + //Boolean remove private boolean onEvolveAttempting(Player player) { @@ -527,15 +562,14 @@ public class Evolution extends SoloGame token.LifeKills = 0; - EvoKit from = (EvoKit) GetKits()[token.Level]; - EvoKit to = (EvoKit) GetKits()[token.Level + 1 >= GetKits().length ? token.Level : token.Level + 1]; //Account for the score increase after evolve + EvoKit from = (EvoKit) _mobKits.get(token.Level); + EvoKit to = (EvoKit) _mobKits.get(token.Level + 1 >= _mobKits.size() ? token.Level : token.Level + 1); //Account for the score increase after evolve _evolve.addEvolve(Manager.getHologramManager(), player, from, to); return true; } - if (Manager.GetCondition().HasCondition(player, ConditionType.SPEED, "Kill")) - Manager.GetCondition().GetActiveCondition(player, ConditionType.SPEED).Expire(); + Manager.GetCondition().EndCondition(player, ConditionType.SPEED, "Kill"); if (!hasEvolvingEffects(player)) addEvolvingEffects(player); @@ -543,7 +577,12 @@ public class Evolution extends SoloGame int kills = _tokens.get(player.getName()).LifeKills; if (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.DRAGON_EGG) - _chargingExp.put(player.getName(), (float) Math.min(exp + Math.min(.022, .012 + (kills <= 0 ? 0 : (.003 * (kills - 1)))), .9999F)); + { + EvolutionAttemptingTickEvent tickEvent = new EvolutionAttemptingTickEvent(player, (float) Math.min(.022, .012 + (kills <= 0 ? 0 : (.003 * (kills - 1))))); + Bukkit.getPluginManager().callEvent(tickEvent); + + _chargingExp.put(player.getName(), (float) Math.min(exp + tickEvent.getProgress(), .9999F)); + } UtilTextMiddle.display("", UtilTextMiddle.progress(_chargingExp.get(player.getName())).trim(), player); player.playSound(player.getLocation(), Sound.NOTE_BASS, 1, _chargingExp.get(player.getName()) + 1); @@ -714,12 +753,14 @@ public class Evolution extends SoloGame Scoreboard.Reset(); Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cGold + C.Bold + "First to " + _mobKits.size()); for (Player player : GetPlayers(true)) { Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true); } - + Scoreboard.Draw(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java index 2fe24d1ea..377471014 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAbilityUseEvent.java @@ -15,9 +15,30 @@ public class EvolutionAbilityUseEvent extends PlayerEvent implements Cancellable private boolean _cancelled = false; - public EvolutionAbilityUseEvent(Player who) + private String _ability; + private long _cooldown; + + public EvolutionAbilityUseEvent(Player who, String ability, long cooldown) { super(who); + + _ability = ability; + _cooldown = cooldown; + } + + public String getAbility() + { + return _ability; + } + + public long getCooldown() + { + return _cooldown; + } + + public void setCooldown(long cooldown) + { + _cooldown = cooldown; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAttemptingTickEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAttemptingTickEvent.java new file mode 100644 index 000000000..935a78c62 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAttemptingTickEvent.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.game.games.evolution.events; + +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.player.PlayerEvent; + +public class EvolutionAttemptingTickEvent extends PlayerEvent +{ + /** + * @author Mysticate + */ + + private static HandlerList _handlers = new HandlerList(); + + private static HandlerList getHandlerList() + { + return _handlers; + } + + @Override + public HandlerList getHandlers() + { + return getHandlerList(); + } + + private float _progress; + + public EvolutionAttemptingTickEvent(Player who, float _progress) + { + super(who); + } + + public float getProgress() + { + return _progress; + } + + public void setProgress(float progress) + { + _progress = progress; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java index 8db507389..e1cc04125 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionEndEvent.java @@ -10,6 +10,7 @@ public class EvolutionEndEvent extends PlayerEvent implements Cancellable /** * @author Mysticate */ + private static HandlerList _handlers = new HandlerList(); private boolean _cancelled = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java index ba7a74f3a..8d0b1853d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java @@ -1,8 +1,36 @@ package nautilus.game.arcade.game.games.evolution.kits; +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.kits.perks.PerkCooldownEVO; import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; public class KitAbility extends Kit { + /** + * @author Mysticate + */ + + public KitAbility(ArcadeManager manager) + { + super(manager, "Ability Master", KitAvailability.Free, new String[] + { + "Your DNA allows you to chop cooldown times!" + }, new Perk[] + { + new PerkCooldownEVO() + }, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.FEATHER)); + } + @Override + public void GiveItems(Player player) + { + + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java new file mode 100644 index 000000000..5f2916add --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java @@ -0,0 +1,36 @@ +package nautilus.game.arcade.game.games.evolution.kits; + +import mineplex.core.itemstack.ItemStackFactory; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.games.evolution.kits.perks.PerkEvolveSpeedEVO; +import nautilus.game.arcade.kit.Kit; +import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class KitEvolveSpeed extends Kit +{ + /** + * @author Mysticate + */ + + public KitEvolveSpeed(ArcadeManager manager) + { + super(manager, "Quick Evolver", KitAvailability.Gem, 4000, new String[] + { + "You always had dreams of growing up..." + }, new Perk[] + { + new PerkEvolveSpeedEVO() + }, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS)); + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java new file mode 100644 index 000000000..58979b10a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java @@ -0,0 +1,53 @@ +package nautilus.game.arcade.game.games.evolution.kits; + +import mineplex.core.achievement.Achievement; +import mineplex.core.common.util.F; +import mineplex.core.itemstack.ItemStackFactory; +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.PerkKillHealth; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; + +public class KitHealth extends Kit +{ + /** + * @author Mysticate + */ + + public KitHealth(ArcadeManager manager) + { + super(manager, "Health Harvester", KitAvailability.Achievement, new String[] + { + "Harvest health every day..." + }, new Perk[] + { + new PerkKillHealth("Health Harvester", new String[] + { + "You regain " + F.elem("100% Health") + " health on kill." + }, 1000, true) + }, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); + + setAchievementRequirements(new Achievement[] + { + Achievement.EVOLUTION_EVOLVEKILL, + Achievement.EVOLUTION_MELEE, + Achievement.EVOLUTION_NO_DEATHS, + Achievement.EVOLUTION_RAMPAGE, + Achievement.EVOLUTION_SKILLS, + Achievement.EVOLUTION_STEALTH, + Achievement.EVOLUTION_WINS + } + ); + } + + @Override + public void GiveItems(Player player) + { + + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkCooldownEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkCooldownEVO.java new file mode 100644 index 000000000..84ba70005 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkCooldownEVO.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.game.games.evolution.kits.perks; + +import mineplex.core.common.util.F; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.event.EventHandler; + +public class PerkCooldownEVO extends Perk +{ + /** + * @author Mysticate + */ + + public PerkCooldownEVO() + { + super("Cooldown", new String[] + { + "All ability cooldowns are reduced by" + F.elem("1/3") + "." + }); + } + + @EventHandler + public void onAbility(EvolutionAbilityUseEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!Manager.IsAlive(event.getPlayer())) + return; + + if (!Kit.HasKit(event.getPlayer())) + return; + + event.setCooldown((long) (event.getCooldown() * .666)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkEvolveSpeedEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkEvolveSpeedEVO.java new file mode 100644 index 000000000..b9dd45c06 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkEvolveSpeedEVO.java @@ -0,0 +1,37 @@ +package nautilus.game.arcade.game.games.evolution.kits.perks; + +import mineplex.core.common.util.F; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAttemptingTickEvent; +import nautilus.game.arcade.kit.Perk; + +import org.bukkit.event.EventHandler; + +public class PerkEvolveSpeedEVO extends Perk +{ + /** + * @author Mysticate + */ + + public PerkEvolveSpeedEVO() + { + super("Speedy", new String[] + { + "You evolve " + F.elem("25%") + " faster." + }); + } + + @EventHandler + public void onAbility(EvolutionAttemptingTickEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + if (!Manager.IsAlive(event.getPlayer())) + return; + + if (!Kit.HasKit(event.getPlayer())) + return; + + event.setProgress((float) (event.getProgress() * 1.25)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java index 7f0f3944b..4c801b1bc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitBlaze.java @@ -17,6 +17,10 @@ import org.bukkit.entity.Player; public class KitBlaze extends EvoKit { + /** + * @author Mysticate + */ + public KitBlaze(ArcadeManager manager) { super(manager, "Blaze", new String[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index 060f86c1e..5f8eda79e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -26,6 +26,10 @@ import org.bukkit.event.player.PlayerInteractEvent; public class KitChicken extends EvoKit { + /** + * @author Mysticate + */ + public KitChicken(ArcadeManager manager) { super(manager, "Chicken", new String[] @@ -71,7 +75,7 @@ public class KitChicken extends EvoKit if (!UtilGear.isMat(event.getItem(), Material.FEATHER)) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer()); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer(), "Egg", 0); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java index b3673b103..7773a3efe 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitCreeper.java @@ -15,6 +15,10 @@ import org.bukkit.entity.Player; public class KitCreeper extends EvoKit { + /** + * @author Mysticate + */ + public KitCreeper(ArcadeManager manager) { super(manager, "Creeper", new String[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java index 3c62aee27..60fb991dd 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitEnderman.java @@ -4,6 +4,10 @@ package nautilus.game.arcade.game.games.evolution.mobs; public class KitEnderman //extends EvoKit { + /** + * @author Mysticate + */ + // public KitEnderman(ArcadeManager manager) // { // super(manager, "Enderman", new String[]{""}, 20, 10, new Perk[]{ diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java index 6be923799..897704830 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java @@ -16,6 +16,10 @@ import org.bukkit.entity.Player; public class KitGolem extends EvoKit { + /** + * @author Mysticate + */ + public KitGolem(ArcadeManager manager) { super(manager, "Iron Golem", new String[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java index 6e1323407..d4831cbbb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSkeleton.java @@ -4,6 +4,10 @@ package nautilus.game.arcade.game.games.evolution.mobs; public class KitSkeleton //extends EvoKit { + /** + * @author Mysticate + */ + // public KitSkeleton(ArcadeManager manager) // { // super(manager, "Skeletal Archer", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java index 101b7cfa1..d2ff691bc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java @@ -16,6 +16,10 @@ import org.bukkit.entity.Player; public class KitSlime extends EvoKit { + /** + * @author Mysticate + */ + public KitSlime(ArcadeManager manager) { super(manager, "Slime", new String[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java index 05e60eb52..fcf33d0aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSnowman.java @@ -4,6 +4,10 @@ package nautilus.game.arcade.game.games.evolution.mobs; public class KitSnowman //extends EvoKit { + /** + * @author Mysticate + */ + // public KitSnowman(ArcadeManager manager) // { // super(manager, "Snowman", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java index fa046ded2..eb0f67214 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java @@ -18,6 +18,10 @@ import org.bukkit.entity.Player; public class KitSpider extends EvoKit { + /** + * @author Mysticate + */ + public KitSpider(ArcadeManager manager) { super(manager, "Spider", new String[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java index 3c6506a85..eb763df81 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitWolf.java @@ -4,6 +4,10 @@ package nautilus.game.arcade.game.games.evolution.mobs; public class KitWolf //extends EvoKit { + /** + * @author Mysticate + */ + // public KitWolf(ArcadeManager manager) // { // super(manager, "Wolf", diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java index 945493273..d72652411 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBlockTossEVO.java @@ -21,7 +21,6 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.perks.data.BlockTossData; -import nautilus.game.arcade.kit.perks.event.PerkBlockGrabEvent; import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent; import org.bukkit.Bukkit; @@ -74,7 +73,7 @@ public class PerkBlockTossEVO extends Perk implements IThrown if (!Kit.HasKit(player)) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 6000); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) @@ -97,13 +96,9 @@ public class PerkBlockTossEVO extends Perk implements IThrown return; } - if (!Recharge.Instance.use(event.getPlayer(), GetName(), 6000, true, true)) + if (!Recharge.Instance.use(event.getPlayer(), useEvent.getAbility(), useEvent.getCooldown(), true, true)) return; - - //Event - PerkBlockGrabEvent blockEvent = new PerkBlockGrabEvent(player, grab.getTypeId(), grab.getData()); - UtilServer.getServer().getPluginManager().callEvent(blockEvent); - + //Block to Data int id = grab.getTypeId(); byte data = grab.getData(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index d1163083d..a8b1146cc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -62,13 +62,13 @@ public class PerkBounceEVO extends Perk if (!Kit.HasKit(player)) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 7000); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) return; - if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) + if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true)) return; UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 0, 0.5, 1.6, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java index 0780f8a9d..11978b075 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkDoubleJumpEVO.java @@ -66,7 +66,7 @@ public class PerkDoubleJumpEVO extends Perk if (player.getGameMode() == GameMode.CREATIVE) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 0); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java index a8e8d54fa..bc4dc9a8c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java @@ -60,13 +60,13 @@ public class PerkFlamingSwordEVO extends Perk if (_active.containsKey(event.getPlayer())) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer()); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer(), GetName(), 5000); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) return; - if (!Recharge.Instance.use(event.getPlayer(), GetName(), 5000, true, true)) + if (!Recharge.Instance.use(event.getPlayer(), useEvent.getAbility(), useEvent.getCooldown(), true, true)) return; _active.put(event.getPlayer(), System.currentTimeMillis()); @@ -104,7 +104,7 @@ public class PerkFlamingSwordEVO extends Perk continue; } - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(entry.getKey()); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(entry.getKey(), GetName(), 0); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java index 38b6b59ae..cc4c021ed 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkPounceEVO.java @@ -62,13 +62,13 @@ public class PerkPounceEVO extends Perk if (!Kit.HasKit(player)) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 6000); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) return; - if (!Recharge.Instance.use(player, GetName(), 6000, true, true)) + if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true)) return; UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.3, 1.8, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java index 2699b444d..0e477a8e9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -79,13 +79,13 @@ public class PerkSiesmicSlamEVO extends Perk if (!Kit.HasKit(player)) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 7000); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) return; - if (!Recharge.Instance.use(player, GetName(), 7000, true, true)) + if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true)) return; //Action diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index 23f4e0714..f989dc8c8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -62,13 +62,13 @@ public class PerkSulphurBombEVO extends Perk implements IThrown if (!Kit.HasKit(player)) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 3000); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) return; - if (!Recharge.Instance.use(player, GetName(), 3000, true, true)) + if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true)) return; event.setCancelled(true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java index fbb7f45a4..a127778d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -56,7 +56,7 @@ public class PerkWebEVO extends Perk implements IThrown if (!Kit.HasKit(player)) return; - EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player); + EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 0); Bukkit.getServer().getPluginManager().callEvent(useEvent); if (useEvent.isCancelled()) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/KillsWhileEvolvingTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/KillsWhileEvolvingTracker.java new file mode 100644 index 000000000..52fc68890 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/KillsWhileEvolvingTracker.java @@ -0,0 +1,39 @@ +package nautilus.game.arcade.game.games.evolution.trackers; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.game.games.evolution.Evolution; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +public class KillsWhileEvolvingTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + public KillsWhileEvolvingTracker(Evolution game) + { + super(game); + } + + @EventHandler + public void onDamage(CombatDeathEvent event) + { + if (!getGame().IsLive()) + return; + + Player damagee = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); + Player damager = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (damagee == null || damager == null) + return; + + if (!getGame().IsAlive(damagee) || !getGame().IsAlive(damager)) + return; + + if (getGame().isAttemptingEvolve(damagee)) + addStat(damager, "EvolveKill", 1, false, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java new file mode 100644 index 000000000..4bbf08b83 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java @@ -0,0 +1,61 @@ +package nautilus.game.arcade.game.games.evolution.trackers; + +import java.util.ArrayList; +import java.util.List; + +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.evolution.Evolution; +import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class NoAbilityTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private ArrayList _out = new ArrayList(); + + public NoAbilityTracker(Evolution game) + { + super(game); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onEvolutionAbility(EvolutionAbilityUseEvent event) + { + if (!getGame().IsLive()) + return; + + if (!getGame().IsAlive(event.getPlayer())) + return; + + if (!_out.contains(event.getPlayer().getName())) + _out.add(event.getPlayer().getName()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onGameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + List winners = getGame().getWinners(); + + if (winners == null) + return; + + for (Player winner : winners) + { + if (_out.contains(winner.getName())) + continue; + + addStat(winner, "MeleeOnly", 1, true, false); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoDamageWhileEvolvingTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoDamageWhileEvolvingTracker.java new file mode 100644 index 000000000..9efb309f6 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoDamageWhileEvolvingTracker.java @@ -0,0 +1,68 @@ +package nautilus.game.arcade.game.games.evolution.trackers; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.evolution.Evolution; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class NoDamageWhileEvolvingTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private ArrayList _out = new ArrayList(); + + public NoDamageWhileEvolvingTracker(Evolution game) + { + super(game); + } + + @EventHandler + public void onDamage(CustomDamageEvent event) + { + if (!getGame().IsLive()) + return; + + Player player = event.GetDamageePlayer(); + if (player == null) + return; + + if (!getGame().IsAlive(player)) + return; + + if (getGame().isAttemptingEvolve(player)) + { + if (!_out.contains(player.getName())) + _out.add(player.getName()); + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onGameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + List winners = getGame().getWinners(); + + if (winners == null) + return; + + for (Player winner : winners) + { + if (_out.contains(winner.getName())) + continue; + + addStat(winner, "Stealth", 1, true, false); + } + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java new file mode 100644 index 000000000..43f5ca9be --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java @@ -0,0 +1,68 @@ +package nautilus.game.arcade.game.games.evolution.trackers; + +import java.util.ArrayList; +import java.util.List; + +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.evolution.Evolution; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class NoMeleeTracker extends StatTracker +{ + /** + * @author Mysticate + */ + + private ArrayList _out = new ArrayList(); + + public NoMeleeTracker(Evolution game) + { + super(game); + } + + @EventHandler + public void onDamage(CustomDamageEvent event) + { + if (!getGame().IsLive()) + return; + + Player player = event.GetDamagerPlayer(false); + if (player == null) + return; + + if (!getGame().IsAlive(player)) + return; + + if (event.GetReason().equalsIgnoreCase("Attack")) + { + if (!_out.contains(player.getName())) + _out.add(player.getName()); + } + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onGameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + List winners = getGame().getWinners(); + + if (winners == null) + return; + + for (Player winner : winners) + { + if (_out.contains(winner.getName())) + continue; + + addStat(winner, "AbilityOnly", 1, true, false); + } + } +} From a351a8f1ed9cbe5abf17d8ee87cb21cfd8f2802c Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 26 Aug 2015 13:47:01 -0600 Subject: [PATCH 40/56] Minor improvements. --- .../game/arcade/game/games/evolution/Evolution.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index e55646c8e..1ddfc81f1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -23,6 +23,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.combat.CombatManager.AttackReason; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.condition.ConditionActive; @@ -145,6 +146,8 @@ public class Evolution extends SoloGame DeathMessages = false; + Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.Attack); + registerStatTrackers( new WinWithoutDyingStatTracker(this, "NoDeaths"), new NoDamageWhileEvolvingTracker(this), @@ -429,10 +432,11 @@ public class Evolution extends SoloGame if (_tokens.containsKey(player.getName())) { - int kills = _tokens.get(player.getName()).LifeKills++; + EvoToken token = _tokens.get(player.getName()); + token.LifeKills++; UtilPlayer.message(player, ""); - UtilPlayer.message(player, F.main("Game", F.elem(kills + " Kills") + " - " + F.elem(Math.min(1.0, 6.0 - (1.5 * (kills - 1))) + " Second ") + "evolve")); + UtilPlayer.message(player, F.main("Game", F.elem(token.LifeKills + " Kills") + " - " + F.elem(Math.min(1.0, 6.0 - (1.5 * (token.LifeKills - 1))) + " Second ") + "evolve speed" + (token.SupplementKit instanceof KitEvolveSpeed ? C.cGreen + " - 30% (Quick Evolver)" : ""))); UtilPlayer.message(player, ""); } From f2f6afb6cad02d47f5bc4e967497a9dd57ea657f Mon Sep 17 00:00:00 2001 From: Mysticate Date: Wed, 26 Aug 2015 20:10:58 -0600 Subject: [PATCH 41/56] Fixes :D --- .../core/achievement/Achievement.java | 6 +- .../minecraft/game/core/fire/Fire.java | 18 +++--- .../minecraft/game/core/fire/FireData.java | 6 +- .../arcade/game/games/evolution/EvoKit.java | 23 ++++++-- .../game/games/evolution/Evolution.java | 56 ++++++++++++------- .../events/EvolutionAttemptingTickEvent.java | 4 +- .../games/evolution/evolve/EvolveData.java | 4 +- .../game/games/evolution/kits/KitAbility.java | 2 +- .../games/evolution/kits/KitEvolveSpeed.java | 3 +- .../game/games/evolution/kits/KitHealth.java | 34 +++++++++-- .../evolution/kits/perks/PerkCooldownEVO.java | 2 +- .../game/games/evolution/mobs/KitChicken.java | 2 +- .../evolution/mobs/perks/PerkBounceEVO.java | 6 +- .../mobs/perks/PerkFlamingSwordEVO.java | 2 +- .../mobs/perks/PerkSulphurBombEVO.java | 2 +- .../evolution/mobs/perks/PerkWebEVO.java | 4 +- .../evolution/trackers/NoMeleeTracker.java | 2 +- 17 files changed, 117 insertions(+), 59 deletions(-) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index a0cc164f3..4aae7dea6 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -676,7 +676,7 @@ public enum Achievement EVOLUTION_NO_DEATHS("Perfect Game", 2000, new String[]{"Evolution.NoDeaths"}, - new String[]{"Win a game withing dying"}, + new String[]{"Win a game without dying"}, new int[]{1}, AchievementCategory.EVOLUTION), @@ -706,8 +706,8 @@ public enum Achievement EVOLUTION_EVOLVEKILL("No Evolve 5 U", 800, new String[]{"Evolution.EvolveKill"}, - new String[]{"Kill 50 people while they", "Are trying to evolve"}, - new int[50], + new String[]{"Kill 25 people while they", "Are trying to evolve"}, + new int[]{25}, AchievementCategory.EVOLUTION) ; diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java index 9ace55077..1cc41f938 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/Fire.java @@ -4,19 +4,19 @@ import java.util.HashMap; import java.util.HashSet; import mineplex.core.MiniPlugin; -import mineplex.core.recharge.Recharge; -import mineplex.core.updater.event.UpdateEvent; -import mineplex.core.updater.UpdateType; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilMath; -import mineplex.minecraft.game.core.condition.ConditionManager; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; +import mineplex.minecraft.game.core.condition.ConditionManager; import mineplex.minecraft.game.core.damage.DamageManager; -import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.EntityEffect; import org.bukkit.Location; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Item; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -25,12 +25,8 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.inventory.InventoryPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.metadata.FixedMetadataValue; -import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.potion.PotionEffectType; -import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; public class Fire extends MiniPlugin { @@ -46,9 +42,9 @@ public class Fire extends MiniPlugin _damageManager = damageManager; } - public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, int damage, String skillName) + public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, double d, String skillName) { - _fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, damage, skillName)); + _fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, d, skillName)); item.setPickupDelay(0); } diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/FireData.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/FireData.java index e70f5627f..a06baaa29 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/FireData.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/fire/FireData.java @@ -8,10 +8,10 @@ public class FireData private long _expireTime; private long _delayTime; private double _burnTime; - private int _damage; + private double _damage; private String _skillName; - public FireData(LivingEntity owner, double expireTime, double delayTime, double burnTime, int damage, String skillName) + public FireData(LivingEntity owner, double expireTime, double delayTime, double burnTime, double damage, String skillName) { _owner = owner; _expireTime = System.currentTimeMillis() + (long)(1000 * expireTime); @@ -31,7 +31,7 @@ public class FireData return _burnTime; } - public int GetDamage() + public double GetDamage() { return _damage; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 00ffd052b..371e191b3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.evolution; import java.util.ArrayList; -import java.util.Arrays; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -16,6 +15,7 @@ import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.entity.EntityType; @@ -23,6 +23,8 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.SkullMeta; public abstract class EvoKit extends Kit { @@ -154,7 +156,7 @@ public abstract class EvoKit extends Kit @SuppressWarnings("deprecation") @Override - public final void GiveItems(Player player) + public final void GiveItems(final Player player) { player.setMaxHealth(_health); player.setHealth(player.getMaxHealth()); @@ -165,11 +167,24 @@ public abstract class EvoKit extends Kit if (UtilSkull.isPlayerHead(UtilSkull.getSkullData(getEntity()))) { - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) 3, 1, C.cGreen + C.Bold + GetName(), Arrays.asList(""), UtilSkull.getPlayerHeadName(getEntity()))); + + final ItemStack skull = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) 3, 1, C.cGreen + C.Bold + GetName()); + SkullMeta meta = (SkullMeta) skull.getItemMeta(); + meta.setOwner(UtilSkull.getPlayerHeadName(getEntity())); + skull.setItemMeta(meta); + + Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() + { + @Override + public void run() + { + player.getInventory().setItem(8, skull); + } + }, 4); } else { - player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) UtilSkull.getSkullData(getEntity()), 1, C.cGreen + C.Bold + GetName())); + player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) UtilSkull.getSkullData(getEntity()), 1, C.cGreen + C.Bold + GetName())); } giveItems(player); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 1ddfc81f1..85787753e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -9,7 +9,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilAlg; -import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilMath; @@ -81,6 +81,7 @@ public class Evolution extends SoloGame private EvolveManager _evolve; private ArrayList _mobKits = new ArrayList(); + private ArrayList _kits = new ArrayList(); private NautHashMap _tokens = new NautHashMap(); @@ -107,12 +108,13 @@ public class Evolution extends SoloGame _mobKits.add(new KitChicken(manager)); // _mobKits.add(new KitSkeleton(manager)); + _kits.add(new KitAbility(Manager)); + _kits.add(new KitEvolveSpeed(Manager)); + _kits.add(new KitHealth(Manager)); + ArrayList allKits = new ArrayList(); allKits.addAll(_mobKits); - - allKits.add(new KitAbility(Manager)); - allKits.add(new KitEvolveSpeed(Manager)); - allKits.add(new KitHealth(Manager)); + allKits.addAll(_kits); setKits(allKits.toArray(new Kit[0])); @@ -207,7 +209,7 @@ public class Evolution extends SoloGame } //Double Kit - @EventHandler(priority = EventPriority.MONITOR) + @EventHandler(priority = EventPriority.HIGH) public void storeTokens(GameStateChangeEvent event) { if (event.GetState() != GameState.Prepare) @@ -215,13 +217,13 @@ public class Evolution extends SoloGame for (Player player : GetPlayers(true)) { - _tokens.put(player.getName(), new EvoToken(player, GetKit(player))); + _tokens.put(player.getName(), new EvoToken(player, GetKit(player) == null ? _kits.get(0) : GetKit(player))); upgradeKit(player, false); } } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR) public void showKit(GameStateChangeEvent event) { if (event.GetState() != GameState.Live) @@ -261,8 +263,8 @@ public class Evolution extends SoloGame EvoKit newKit = _mobKits.get(getScore(player)); - SetKit(player, newKit, false); _tokens.get(player.getName()).SupplementKit.ApplyKit(player); + SetKit(player, newKit, false); if (give) { @@ -364,7 +366,7 @@ public class Evolution extends SoloGame if (!_chargingExp.containsKey(event.GetDamageePlayer().getName())) return; - _chargingExp.put(event.GetDamageePlayer().getName(), (float) Math.max(0, _chargingExp.get(event.GetDamageePlayer().getName()) * .95)); + _chargingExp.put(event.GetDamageePlayer().getName(), (float) Math.max(0, _chargingExp.get(event.GetDamageePlayer().getName()) * .92)); } @EventHandler @@ -404,7 +406,9 @@ public class Evolution extends SoloGame return; CombatComponent damager = event.GetLog().GetKiller(); - + if (damager == null) + return; + if (!damager.IsPlayer()) return; @@ -436,7 +440,7 @@ public class Evolution extends SoloGame token.LifeKills++; UtilPlayer.message(player, ""); - UtilPlayer.message(player, F.main("Game", F.elem(token.LifeKills + " Kills") + " - " + F.elem(Math.min(1.0, 6.0 - (1.5 * (token.LifeKills - 1))) + " Second ") + "evolve speed" + (token.SupplementKit instanceof KitEvolveSpeed ? C.cGreen + " - 30% (Quick Evolver)" : ""))); + UtilPlayer.message(player, F.main("Game", F.elem(token.LifeKills + " Kill" + (token.LifeKills == 1 ? "" : "s")) + " - " + F.elem(Math.max(1.0, 6.0 - (1.5 * (token.LifeKills - 1))) + " Second ") + "evolve speed" + (token.SupplementKit instanceof KitEvolveSpeed ? C.cGreen + " - 30% (Quick Evolver)" : ""))); UtilPlayer.message(player, ""); } @@ -457,11 +461,11 @@ public class Evolution extends SoloGame Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable() { public void run() - { - GetKit(player).ApplyKit(player); - + { if (_tokens.containsKey(player.getName())) _tokens.get(player.getName()).SupplementKit.ApplyKit(player); + + GetKit(player).ApplyKit(player); } }, 0); } @@ -555,6 +559,7 @@ public class Evolution extends SoloGame if (exp >= .9999F) { + UtilTextMiddle.display("", "", player); _chargingExp.remove(player.getName()); @@ -570,6 +575,8 @@ public class Evolution extends SoloGame EvoKit to = (EvoKit) _mobKits.get(token.Level + 1 >= _mobKits.size() ? token.Level : token.Level + 1); //Account for the score increase after evolve _evolve.addEvolve(Manager.getHologramManager(), player, from, to); + + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 1); return true; } @@ -580,11 +587,11 @@ public class Evolution extends SoloGame int kills = _tokens.get(player.getName()).LifeKills; - if (UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)) && player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.DRAGON_EGG) + if (UtilEnt.isGrounded(player) && player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.DRAGON_EGG) { EvolutionAttemptingTickEvent tickEvent = new EvolutionAttemptingTickEvent(player, (float) Math.min(.022, .012 + (kills <= 0 ? 0 : (.003 * (kills - 1))))); Bukkit.getPluginManager().callEvent(tickEvent); - + _chargingExp.put(player.getName(), (float) Math.min(exp + tickEvent.getProgress(), .9999F)); } @@ -748,7 +755,7 @@ public class Evolution extends SoloGame @EventHandler public void ScoreboardUpdate(UpdateEvent event) { - if (GetState() != GameState.Prepare && !IsLive()) + if (!InProgress()) return; if (event.getType() != UpdateType.FAST) @@ -758,13 +765,20 @@ public class Evolution extends SoloGame Scoreboard.WriteBlank(); - Scoreboard.Write(C.cGold + C.Bold + "First to " + _mobKits.size()); - + int index = 0; for (Player player : GetPlayers(true)) { + if (index > 12) + break; + Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true); + index++; } - + + Scoreboard.WriteBlank(); + + Scoreboard.Write(C.cGold + C.Bold + "First to " + _mobKits.size()); + Scoreboard.Draw(); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAttemptingTickEvent.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAttemptingTickEvent.java index 935a78c62..8c249a2b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAttemptingTickEvent.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/events/EvolutionAttemptingTickEvent.java @@ -25,9 +25,11 @@ public class EvolutionAttemptingTickEvent extends PlayerEvent private float _progress; - public EvolutionAttemptingTickEvent(Player who, float _progress) + public EvolutionAttemptingTickEvent(Player who, float progress) { super(who); + + _progress = progress; } public float getProgress() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 7c0a2ba08..551a01cca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -59,8 +59,8 @@ public class EvolveData private final long _timestamp = System.currentTimeMillis(); private long _endTime = System.currentTimeMillis(); - private final long _preEvolve = 1800; - private final long _postEvolve = 5200; + private final long _preEvolve = 2200; + private final long _postEvolve = 4800; // private EvolveManager _manager; private HologramManager _holoManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java index 8d0b1853d..5cff1a8e8 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitAbility.java @@ -19,7 +19,7 @@ public class KitAbility extends Kit public KitAbility(ArcadeManager manager) { - super(manager, "Ability Master", KitAvailability.Free, new String[] + super(manager, "Darwinist", KitAvailability.Free, new String[] { "Your DNA allows you to chop cooldown times!" }, new Perk[] diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java index 5f2916add..7eb6d97ba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitEvolveSpeed.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.evolution.kits; +import mineplex.core.common.util.C; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.game.games.evolution.kits.perks.PerkEvolveSpeedEVO; @@ -21,7 +22,7 @@ public class KitEvolveSpeed extends Kit { super(manager, "Quick Evolver", KitAvailability.Gem, 4000, new String[] { - "You always had dreams of growing up..." + C.cGray + "You always had dreams of growing up..." }, new Perk[] { new PerkEvolveSpeedEVO() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java index 58979b10a..b9d93c102 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/KitHealth.java @@ -2,16 +2,20 @@ package nautilus.game.arcade.game.games.evolution.kits; import mineplex.core.achievement.Achievement; import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.itemstack.ItemStackFactory; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; 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.PerkKillHealth; +import nautilus.game.arcade.kit.perks.PerkDummy; import org.bukkit.Material; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; public class KitHealth extends Kit { @@ -26,10 +30,10 @@ public class KitHealth extends Kit "Harvest health every day..." }, new Perk[] { - new PerkKillHealth("Health Harvester", new String[] + new PerkDummy("Health Haravester", new String[] { - "You regain " + F.elem("100% Health") + " health on kill." - }, 1000, true) + "Recieve " + F.elem("100%") + " health on kill." + }) }, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); setAchievementRequirements(new Achievement[] @@ -50,4 +54,26 @@ public class KitHealth extends Kit { } + + @EventHandler(priority = EventPriority.HIGH) + public void onKill(CombatDeathEvent event) + { + if (!Manager.GetGame().IsLive()) + return; + + Player killer = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); + if (killer == null || !killer.isOnline()) + return; + + if (!Manager.IsAlive(killer)) + return; + + if (UtilPlayer.isSpectator(killer)) + return; + + if (!HasKit(killer)) + return; + + killer.setHealth(killer.getMaxHealth()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkCooldownEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkCooldownEVO.java index 84ba70005..213938a55 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkCooldownEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/kits/perks/PerkCooldownEVO.java @@ -16,7 +16,7 @@ public class PerkCooldownEVO extends Perk { super("Cooldown", new String[] { - "All ability cooldowns are reduced by" + F.elem("1/3") + "." + "All ability cooldowns are reduced by " + F.elem("33%") + "." }); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index 5f8eda79e..63a8de47f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -40,7 +40,7 @@ public class KitChicken extends EvoKit new Perk[] { new PerkConstructor("Egg Pouch", 2.0, 3, Material.EGG, - "Egg Launcher Ammo", false), new PerkDoubleJumpEVO("Double Jump", 0.9, 0.9, false) + "Egg Launcher Ammo", false), new PerkDoubleJumpEVO("Double Jump", 0.4, 0.9, false) }, EntityType.CHICKEN); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index a8b1146cc..a43f2f42a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -19,6 +19,7 @@ import nautilus.game.arcade.kit.Perk; import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -71,13 +72,14 @@ public class PerkBounceEVO extends Perk if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true)) return; - UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 0, 0.5, 1.6, true); + UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 0, 0.4, .4, true); //Record _live.put(player, System.currentTimeMillis()); //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + player.playSound(player.getLocation(), Sound.SLIME_WALK, 1, 1); } @EventHandler @@ -149,6 +151,8 @@ public class PerkBounceEVO extends Perk //Inform UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + ".")); UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + ".")); + + damager.playSound(damager.getLocation(), Sound.SLIME_ATTACK, 1, 1); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java index bc4dc9a8c..b23b9e5a1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java @@ -118,7 +118,7 @@ public class PerkFlamingSwordEVO extends Perk { //Fire Item fire = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER)); - Manager.GetFire().Add(fire, player, 0.7, 0, 0.5, 1, "Inferno"); + Manager.GetFire().Add(fire, player, 0.7, 0, 0.5, 1.5, "Inferno"); fire.teleport(player.getEyeLocation()); double x = 0.07 - (UtilMath.r(14)/100d); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java index f989dc8c8..78481e6ab 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSulphurBombEVO.java @@ -80,7 +80,7 @@ public class PerkSulphurBombEVO extends Perk implements IThrown Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, null, 1f, 1f, null, 1, UpdateType.SLOW, - 0.5f); + 1f); //Inform UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java index a127778d7..7abe68567 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkWebEVO.java @@ -69,7 +69,7 @@ public class PerkWebEVO extends Perk implements IThrown Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WEB)); UtilAction.velocity(ent, player.getLocation().getDirection(), 0.8, false, 0, 0.2, 10, false); - Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 0.5f); + Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1f); } @Override @@ -81,7 +81,7 @@ public class PerkWebEVO extends Perk implements IThrown { if (Manager.GetGame().IsAlive((Player)target)) { - Manager.GetDamage().NewDamageEvent(target, null, null, DamageCause.CUSTOM, 4, false, false, false, "Web Shot", "Webbed Net"); + Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.CUSTOM, 8, false, false, false, "Web Shot", "Webbed Net"); target.playEffect(EntityEffect.HURT); } else diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java index 43f5ca9be..71f66fc76 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java @@ -39,7 +39,7 @@ public class NoMeleeTracker extends StatTracker if (!getGame().IsAlive(player)) return; - if (event.GetReason().equalsIgnoreCase("Attack")) + if (event.GetReason() == null || event.GetReason().equalsIgnoreCase("Attack")) { if (!_out.contains(player.getName())) _out.add(player.getName()); From 571d992dbe9a5e57c1472427626139c3c14cdb71 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Thu, 27 Aug 2015 20:47:55 -0600 Subject: [PATCH 42/56] Fixed a few bugs. --- .../game/arcade/game/games/evolution/EvoKit.java | 3 +-- .../game/arcade/game/games/evolution/Evolution.java | 2 +- .../arcade/game/games/evolution/evolve/EvolveData.java | 9 +++------ .../nautilus/game/arcade/kit/perks/PerkFallModifier.java | 4 ++-- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java index 371e191b3..e6fabd35e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/EvoKit.java @@ -6,7 +6,6 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilSkull; -import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.itemstack.ItemStackFactory; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeFormat; @@ -131,7 +130,7 @@ public abstract class EvoKit extends Kit UtilPlayer.message(player, ArcadeFormat.Line); - UtilTextMiddle.display(null, def, player); +// UtilTextMiddle.display(null, def, player); } @EventHandler(priority = EventPriority.HIGH) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 85787753e..0b353cb76 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -440,7 +440,7 @@ public class Evolution extends SoloGame token.LifeKills++; UtilPlayer.message(player, ""); - UtilPlayer.message(player, F.main("Game", F.elem(token.LifeKills + " Kill" + (token.LifeKills == 1 ? "" : "s")) + " - " + F.elem(Math.max(1.0, 6.0 - (1.5 * (token.LifeKills - 1))) + " Second ") + "evolve speed" + (token.SupplementKit instanceof KitEvolveSpeed ? C.cGreen + " - 30% (Quick Evolver)" : ""))); + UtilPlayer.message(player, F.main("Game", F.elem(token.LifeKills + " Kill" + (token.LifeKills == 1 ? "" : "s")) + C.cWhite + " - " + C.cGreen + Math.max(1.0, 6.0 - (1.5 * (token.LifeKills - 1))) + "s evolve speed" + (token.SupplementKit instanceof KitEvolveSpeed ? C.cGreen + " - 30% (Quick Evolver)" : ""))); UtilPlayer.message(player, ""); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index 551a01cca..ddc70ec66 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -132,13 +132,10 @@ public class EvolveData private void setupViewingToken(EntityInsentient ent) { - Location center = _token.Platform.clone().add(0.5, (ent.boundingBox.e - ent.boundingBox.b) / 2 - 1, 0.5); - Location offset = UtilAlg.getNearestCornerLocation(_token.Viewing, center.getBlock()); + Location playerEye = _token.Viewing.clone().add(.5, .62, .5); + Location entityHalf = _token.Platform.clone().add(.5, -1, .5).add(0, (ent.boundingBox.e - ent.boundingBox.b) / 2, 0); - center.setX(offset.getX()); - center.setZ(offset.getZ()); - - Vector viewing = UtilAlg.getTrajectory(_token.Viewing, offset); + Vector viewing = UtilAlg.getTrajectory(playerEye, entityHalf); _token.Viewing.setPitch(UtilAlg.GetPitch(viewing)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallModifier.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallModifier.java index e4ed59e07..bb8decc97 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallModifier.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkFallModifier.java @@ -22,7 +22,7 @@ public class PerkFallModifier extends Perk @EventHandler(priority = EventPriority.HIGH) public void Knockback(CustomDamageEvent event) { - if (event.GetCause() == DamageCause.FALL) + if (event.GetCause() != DamageCause.FALL) return; if (!(event.GetDamageeEntity() instanceof Player)) @@ -39,6 +39,6 @@ public class PerkFallModifier extends Perk if (!Manager.IsAlive(player)) return; - event.AddMod("Fall Modifier", "Reduce damage", (-event.GetDamage()) + event.GetDamageInitial() * _fall, false); + event.AddMod("Fall Modifier", "Reduce damage", _fall, false); } } From f21ca35638c3746f9aa8ee3ca5d96ffa2b7a0055 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 28 Aug 2015 15:44:41 -0600 Subject: [PATCH 43/56] Final bug changes. --- .../game/games/evolution/Evolution.java | 6 +++- .../games/evolution/evolve/EvolveData.java | 34 +++++++++++++++++-- .../game/arcade/managers/GameFlagManager.java | 19 +++++++++-- 3 files changed, 52 insertions(+), 7 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 0b353cb76..0c2bbfdb4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -148,6 +148,10 @@ public class Evolution extends SoloGame DeathMessages = false; + this.InventoryClick = false; + + this.InventoryOpenBlock = false; + Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.Attack); registerStatTrackers( @@ -768,7 +772,7 @@ public class Evolution extends SoloGame int index = 0; for (Player player : GetPlayers(true)) { - if (index > 12) + if (index > 11) break; Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java index ddc70ec66..96da140aa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/evolve/EvolveData.java @@ -133,7 +133,7 @@ public class EvolveData private void setupViewingToken(EntityInsentient ent) { Location playerEye = _token.Viewing.clone().add(.5, .62, .5); - Location entityHalf = _token.Platform.clone().add(.5, -1, .5).add(0, (ent.boundingBox.e - ent.boundingBox.b) / 2, 0); + Location entityHalf = _token.Platform.clone().add(.5, -1, .5).add(0, (ent.boundingBox.e - ent.boundingBox.b) * .75, 0); Vector viewing = UtilAlg.getTrajectory(playerEye, entityHalf); _token.Viewing.setPitch(UtilAlg.GetPitch(viewing)); @@ -168,7 +168,35 @@ public class EvolveData private void setupPlayer() { - _player.teleport(_token.Viewing); + if (_token.Viewing.getX() != _player.getLocation().getX()) + { + _player.teleport(_token.Viewing); + return; + } + + if (_token.Viewing.getY() != _player.getLocation().getY()) + { + _player.teleport(_token.Viewing); + return; + } + + if (_token.Viewing.getZ() != _player.getLocation().getZ()) + { + _player.teleport(_token.Viewing); + return; + } + + if (_token.Viewing.getPitch() != _player.getLocation().getPitch()) + { + _player.teleport(_token.Viewing); + return; + } + + if (_token.Viewing.getYaw() != _player.getLocation().getYaw()) + { + _player.teleport(_token.Viewing); + return; + } // _player.teleport(_token.Store); // _player.teleport(_token.Viewing); @@ -201,7 +229,7 @@ public class EvolveData { return true; } - + // setupZombie(); teleport(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index 0f25e0656..e7dceb4d2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -23,8 +23,8 @@ import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.PlayerDeathOutEvent; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam.PlayerState; import nautilus.game.arcade.kit.perks.event.PerkDestructorBlockEvent; @@ -33,6 +33,8 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.Chest; +import org.bukkit.block.DoubleChest; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -46,8 +48,8 @@ import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.LeavesDecayEvent; import org.bukkit.event.entity.CreatureSpawnEvent; -import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryOpenEvent; import org.bukkit.event.inventory.InventoryType; @@ -287,8 +289,19 @@ public class GameFlagManager implements Listener event.getInventory().getType() == InventoryType.HOPPER || event.getInventory().getType() == InventoryType.MERCHANT || event.getInventory().getType() == InventoryType.ENDER_CHEST || - event.getInventory().getType() == InventoryType.WORKBENCH) + event.getInventory().getType() == InventoryType.WORKBENCH || + event.getInventory().getType() == InventoryType.CHEST) { + if (event.getInventory().getType() == InventoryType.CHEST) + { + if (event.getInventory().getHolder() instanceof Chest) || !(event.getInventory() instanceof DoubleChest)) + { + event.setCancelled(true); + event.getPlayer().closeInventory(); + } + } + + event.setCancelled(true); event.getPlayer().closeInventory(); } From 513662e6e304ab59db1fc434381c16507eb79339 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 28 Aug 2015 15:46:38 -0600 Subject: [PATCH 44/56] Fixed the block open flag. --- .../game/arcade/managers/GameFlagManager.java | 39 +++++++++++-------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index e7dceb4d2..b2cd460af 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -276,7 +276,8 @@ public class GameFlagManager implements Listener if (!game.InProgress()) return; - + + //normal inventories if (!game.InventoryOpenBlock) { if (event.getInventory().getType() == InventoryType.ANVIL || @@ -291,31 +292,35 @@ public class GameFlagManager implements Listener event.getInventory().getType() == InventoryType.ENDER_CHEST || event.getInventory().getType() == InventoryType.WORKBENCH || event.getInventory().getType() == InventoryType.CHEST) - { + { if (event.getInventory().getType() == InventoryType.CHEST) { - if (event.getInventory().getHolder() instanceof Chest) || !(event.getInventory() instanceof DoubleChest)) + if (event.getInventory().getHolder() != null && event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest) { event.setCancelled(true); event.getPlayer().closeInventory(); } } - - - event.setCancelled(true); - event.getPlayer().closeInventory(); + else + { + event.setCancelled(true); + event.getPlayer().closeInventory(); + } + } + } + + //deal with chests + if (!game.InventoryOpenChest) + { + if (event.getInventory().getType() == InventoryType.CHEST) + { + if (event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest) + { + event.setCancelled(true); + event.getPlayer().closeInventory(); + } } } - - -// if (!game.InventoryOpenChest) -// { -// if (event.getInventory().getType() == InventoryType.CHEST) -// { -// event.setCancelled(true); -// event.getPlayer().closeInventory(); -// } -// } } @EventHandler(priority = EventPriority.LOWEST) From 2d770a8dd11d908f32838d245282c93a4a04daaa Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 28 Aug 2015 16:36:35 -0600 Subject: [PATCH 45/56] More final tweaks. --- .../game/arcade/game/games/evolution/Evolution.java | 4 ++-- .../game/games/evolution/trackers/NoMeleeTracker.java | 2 +- .../nautilus/game/arcade/managers/GameFlagManager.java | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 0c2bbfdb4..a136c20d1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -148,9 +148,9 @@ public class Evolution extends SoloGame DeathMessages = false; - this.InventoryClick = false; + InventoryClick = false; - this.InventoryOpenBlock = false; + InventoryOpenBlock = false; Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.Attack); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java index 71f66fc76..cafca3709 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java @@ -39,7 +39,7 @@ public class NoMeleeTracker extends StatTracker if (!getGame().IsAlive(player)) return; - if (event.GetReason() == null || event.GetReason().equalsIgnoreCase("Attack")) + if (event.GetReason() == null || event.GetReason().contains("Attack")) { if (!_out.contains(player.getName())) _out.add(player.getName()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java index b2cd460af..16a345f1c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameFlagManager.java @@ -1208,10 +1208,10 @@ public class GameFlagManager implements Listener { if (Manager.GetGame() == null) return; - - if (Manager.GetGame().GetType().getResourcePackUrl() == null) - return; - +// +// if (Manager.GetGame().GetType().getResourcePackUrl() == null) +// return; +// UtilPlayer.message(player, " "); UtilPlayer.message(player, C.cGold + C.Bold + Manager.GetGame().GetType().GetName() + " requires you to be using Minecraft 1.8!"); UtilPlayer.message(player, " "); From 56aa235e563d6d6aec270605b692bb8c5c26d1dc Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 28 Aug 2015 19:25:52 -0600 Subject: [PATCH 46/56] Fixed kit messages --- .../game/arcade/game/games/evolution/mobs/KitGolem.java | 2 +- .../game/arcade/game/games/evolution/mobs/KitSlime.java | 2 +- .../game/arcade/game/games/evolution/mobs/KitSpider.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java index 897704830..2e52e42a9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitGolem.java @@ -25,7 +25,7 @@ public class KitGolem extends EvoKit super(manager, "Iron Golem", new String[] { C.cYellow + "Abililty: " + C.cWhite + "Seismic Slam", C.Line, - C.cGreen + "Take 50% Knockback" + C.cGreen + "50% Knockback" }, 40, 6, new Perk[] { new PerkSiesmicSlamEVO(), new PerkKnockbackTaken(.5) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java index d2ff691bc..3f0d7102c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSlime.java @@ -25,7 +25,7 @@ public class KitSlime extends EvoKit super(manager, "Slime", new String[] { C.cYellow + "Ability: " + C.cWhite + "Slime Slam", C.Line, - C.cGreen + "Take 50% Fall Damage" + C.cGreen + "50% Fall Damage" }, 22, 4, new Perk[] { new PerkBounceEVO(), new PerkFallModifier(.5) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java index eb0f67214..95c2ec099 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitSpider.java @@ -27,7 +27,7 @@ public class KitSpider extends EvoKit super(manager, "Spider", new String[] { C.cYellow + "Ability: " + C.cWhite + "Web Shot", C.Line, - C.cGreen + "Recieve Speed 1", C.cGreen + "Take No Fall Damage" + C.cGreen + "Speed 1", C.cGreen + "No Fall Damage" }, 32, 5, new Perk[] { new PerkWebEVO(), From d6c8e51104696852b1b2342ce23715715544a8e8 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 28 Aug 2015 20:57:47 -0600 Subject: [PATCH 47/56] Things ^_^ --- .../game/arcade/game/games/evolution/Evolution.java | 13 +++++++++---- .../games/evolution/trackers/NoMeleeTracker.java | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index a136c20d1..7669bb1cc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -4,6 +4,7 @@ import java.util.AbstractMap.SimpleEntry; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; +import java.util.List; import mineplex.core.common.util.C; import mineplex.core.common.util.F; @@ -24,6 +25,7 @@ import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.CombatManager.AttackReason; +import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; import mineplex.minecraft.game.core.condition.ConditionActive; @@ -145,9 +147,7 @@ public class Evolution extends SoloGame VersionRequire1_8 = true; CreatureAllow = false; - - DeathMessages = false; - + InventoryClick = false; InventoryOpenBlock = false; @@ -406,6 +406,8 @@ public class Evolution extends SoloGame @EventHandler public void onKill(CombatDeathEvent event) { + event.SetBroadcastType(DeathMessageType.Simple); + if (!IsLive()) return; @@ -723,7 +725,7 @@ public class Evolution extends SoloGame ArrayList tokens = new ArrayList(_tokens.values()); Collections.sort(tokens); - ArrayList players = new ArrayList(); + List players = new ArrayList(); for (int i = 0 ; i < tokens.size() ; i++) { @@ -745,6 +747,9 @@ public class Evolution extends SoloGame if (player.isOnline()) AddGems(player, 10, "Participation", false, false); + if (tokens.size() >= 1) + players = players.subList(0, 1); + _tokens.clear(); _evoPlatforms.clear(); _evolutionsAvailable.clear(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java index cafca3709..aee566c16 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java @@ -39,7 +39,7 @@ public class NoMeleeTracker extends StatTracker if (!getGame().IsAlive(player)) return; - if (event.GetReason() == null || event.GetReason().contains("Attack")) + if (event.GetReason() == null || event.GetReason().trim().equals("") || event.GetReason().contains("Attack")) { if (!_out.contains(player.getName())) _out.add(player.getName()); From b5b8bef39efabacbc9fd0418466a3131504b0f84 Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 19:58:51 -0700 Subject: [PATCH 48/56] evo fixes --- .../game/arcade/game/games/evolution/Evolution.java | 9 +++++++-- .../arcade/game/games/evolution/mobs/KitChicken.java | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index a136c20d1..ab6926ada 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -23,6 +23,7 @@ import mineplex.core.recharge.Recharge; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatComponent; +import mineplex.minecraft.game.core.combat.DeathMessageType; import mineplex.minecraft.game.core.combat.CombatManager.AttackReason; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; @@ -146,8 +147,6 @@ public class Evolution extends SoloGame CreatureAllow = false; - DeathMessages = false; - InventoryClick = false; InventoryOpenBlock = false; @@ -785,4 +784,10 @@ public class Evolution extends SoloGame Scoreboard.Draw(); } + + @EventHandler + public void deathMsg(CombatDeathEvent event) + { + event.SetBroadcastType(DeathMessageType.Simple); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java index 63a8de47f..c2f477d71 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/KitChicken.java @@ -40,7 +40,7 @@ public class KitChicken extends EvoKit new Perk[] { new PerkConstructor("Egg Pouch", 2.0, 3, Material.EGG, - "Egg Launcher Ammo", false), new PerkDoubleJumpEVO("Double Jump", 0.4, 0.9, false) + "Egg Launcher Ammo", false), new PerkDoubleJumpEVO("Double Jump", 0.6, 0.9, false) }, EntityType.CHICKEN); } From cc60371c1f586416ec35755c63dbeeae17e4265b Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 28 Aug 2015 21:04:35 -0600 Subject: [PATCH 49/56] Fixed perk cancelling on death --- .../evolution/mobs/perks/PerkBounceEVO.java | 19 +++++++++++++++++-- .../mobs/perks/PerkFlamingSwordEVO.java | 7 +++++++ .../mobs/perks/PerkSiesmicSlamEVO.java | 6 ++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java index a43f2f42a..af1a55d17 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkBounceEVO.java @@ -94,20 +94,32 @@ public class PerkBounceEVO extends Perk //Collide for (Player player : Manager.GetGame().GetPlayers(true)) { + if (UtilPlayer.isSpectator(player)) + { + _live.remove(player); + continue; + } + if (!_live.containsKey(player)) continue; for (Player cur : UtilPlayer.getNearby(player.getLocation(), 2.0)) - { + { if (!Manager.IsAlive(cur)) continue; + if (UtilPlayer.isSpectator(cur)) + { + _live.remove(player); + continue; + } + if (cur == player) continue; DoSlam(player, cur); _live.remove(player); - return; + break; } } } @@ -124,6 +136,9 @@ public class PerkBounceEVO extends Perk //End for (Player player : Manager.GetGame().GetPlayers(true)) { + if (UtilPlayer.isSpectator(player)) + continue; + if (!UtilEnt.isGrounded(player)) continue; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java index b23b9e5a1..2e06e015e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkFlamingSwordEVO.java @@ -6,6 +6,7 @@ import java.util.Map.Entry; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.common.util.UtilInv; @@ -98,6 +99,12 @@ public class PerkFlamingSwordEVO extends Perk continue; } + if (UtilPlayer.isSpectator(entry.getKey())) + { + iterator.remove(); + continue; + } + if (UtilTime.elapsed(entry.getValue(), 1000)) { iterator.remove(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java index 0e477a8e9..ad9232582 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -117,6 +117,12 @@ public class PerkSiesmicSlamEVO extends Perk if (!_live.containsKey(player)) continue; + if (UtilPlayer.isSpectator(player)) + { + _live.remove(player); + continue; + } + if (!player.isOnGround()) continue; From 8238a199d54a4aede9c8a133bb04f01ee2ed8d52 Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 20:06:39 -0700 Subject: [PATCH 50/56] gem stuff --- .../game/games/evolution/Evolution.java | 2 +- .../game/arcade/managers/GameGemManager.java | 41 +++++++++++++++++-- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index a6245c90a..e1e23d10b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -140,7 +140,7 @@ public class Evolution extends SoloGame GemAssistDeathRespawn = .5; CompassEnabled = true; - CompassGiveItem = false; + CompassGiveItem = false; AutomaticRespawn = false; DeathSpectateSecs = 4.0; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index 07bb93f7a..c9cdafe4a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -9,6 +9,7 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; import mineplex.minecraft.game.core.combat.CombatComponent; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import nautilus.game.arcade.ArcadeFormat; @@ -36,8 +37,9 @@ public class GameGemManager implements Listener { ArcadeManager Manager; - boolean DoubleGem = true; - + boolean DoubleGem = false; + boolean TimeReward = true; + public GameGemManager(ArcadeManager manager) { Manager = manager; @@ -184,8 +186,21 @@ public class GameGemManager implements Listener total += (int)(earned * (gemFinder * 0.25)); } } + + //Time Reward + if (TimeReward) + { + long timeOnline = 7380000; + + double hoursOnline = timeOnline/3600000d; + + if (hoursOnline > 5) + hoursOnline = 5; + + total += (int)(earned * (hoursOnline * 0.2)); + } - if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player)) + if (DoubleGem && game.GemDoubleEnabled) total += earned; Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), total); @@ -290,8 +305,26 @@ public class GameGemManager implements Listener } } + //Time Reward + if (TimeReward) + { + long timeOnline = 7380000; + + double hoursOnline = timeOnline/3600000d; + + if (hoursOnline > 5) + hoursOnline = 5; + + int extraGems = (int)(earnedGems * (hoursOnline * 0.2));; + + UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + + F.elem("Online for " + UtilTime.MakeStr(timeOnline) )); + + totalGems += extraGems; + } + //Double Gem - if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player)) + if (DoubleGem && game.GemDoubleEnabled) { UtilPlayer.message(player, F.elem(C.cGreen + "+" + (earnedGems) + " Gems") + " for " + F.elem(C.cDGreen + "Double Gem Weekend")); From 815add4c59d6ab99dde3a3bc584820c1ab9a033f Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 28 Aug 2015 21:28:39 -0600 Subject: [PATCH 51/56] FIXED THE THIGNS --- .../arcade/game/games/evolution/Evolution.java | 12 +++++++----- .../evolution/trackers/NoAbilityTracker.java | 17 +++++------------ .../evolution/trackers/NoMeleeTracker.java | 16 +++++----------- 3 files changed, 17 insertions(+), 28 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 7669bb1cc..1eeed390a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -50,13 +50,13 @@ import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper; import nautilus.game.arcade.game.games.evolution.mobs.KitGolem; import nautilus.game.arcade.game.games.evolution.mobs.KitSlime; import nautilus.game.arcade.game.games.evolution.mobs.KitSpider; +import nautilus.game.arcade.game.games.evolution.trackers.EvoWinWithoutDyingTracker; import nautilus.game.arcade.game.games.evolution.trackers.KillsWhileEvolvingTracker; import nautilus.game.arcade.game.games.evolution.trackers.NoAbilityTracker; import nautilus.game.arcade.game.games.evolution.trackers.NoDamageWhileEvolvingTracker; import nautilus.game.arcade.game.games.evolution.trackers.NoMeleeTracker; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.stats.KillFastStatTracker; -import nautilus.game.arcade.stats.WinWithoutDyingStatTracker; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -93,6 +93,8 @@ public class Evolution extends SoloGame private ArrayList _evolutionsAvailable = new ArrayList(); private NautHashMap _chargingExp = new NautHashMap(); + public Player Winner = null; + @SuppressWarnings("unchecked") public Evolution(ArcadeManager manager) { @@ -155,7 +157,7 @@ public class Evolution extends SoloGame Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.Attack); registerStatTrackers( - new WinWithoutDyingStatTracker(this, "NoDeaths"), + new EvoWinWithoutDyingTracker(this), new NoDamageWhileEvolvingTracker(this), new KillFastStatTracker(this, 3, 5, "Rampage"), new NoAbilityTracker(this), @@ -746,9 +748,9 @@ public class Evolution extends SoloGame for (Player player : GetPlayers(false)) if (player.isOnline()) AddGems(player, 10, "Participation", false, false); - - if (tokens.size() >= 1) - players = players.subList(0, 1); + + if (players.size() >= 1) + Winner = players.get(0); _tokens.clear(); _evoPlatforms.clear(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java index 4bbf08b83..846271039 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoAbilityTracker.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.evolution.trackers; import java.util.ArrayList; -import java.util.List; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game.GameState; @@ -9,7 +8,6 @@ import nautilus.game.arcade.game.games.evolution.Evolution; import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent; import nautilus.game.arcade.stats.StatTracker; -import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -45,17 +43,12 @@ public class NoAbilityTracker extends StatTracker if (event.GetState() != GameState.End) return; - List winners = getGame().getWinners(); - - if (winners == null) + if (getGame().Winner == null) return; - for (Player winner : winners) - { - if (_out.contains(winner.getName())) - continue; - - addStat(winner, "MeleeOnly", 1, true, false); - } + if (_out.contains(getGame().Winner.getName())) + return; + + addStat(getGame().Winner, "MeleeOnly", 1, true, false); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java index aee566c16..7224c5f63 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/NoMeleeTracker.java @@ -1,7 +1,6 @@ package nautilus.game.arcade.game.games.evolution.trackers; import java.util.ArrayList; -import java.util.List; import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -52,17 +51,12 @@ public class NoMeleeTracker extends StatTracker if (event.GetState() != GameState.End) return; - List winners = getGame().getWinners(); - - if (winners == null) + if (getGame().Winner == null) return; - for (Player winner : winners) - { - if (_out.contains(winner.getName())) - continue; - - addStat(winner, "AbilityOnly", 1, true, false); - } + if (_out.contains(getGame().Winner.getName())) + return; + + addStat(getGame().Winner, "AbilityOnly", 1, true, false); } } From 88ca205474bf3df557ca5ad3d6e3591c12a94c5d Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 20:31:29 -0700 Subject: [PATCH 52/56] fixes --- .../game/games/evolution/Evolution.java | 8 +------ .../game/arcade/managers/GameGemManager.java | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index e1e23d10b..944202fec 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -403,7 +403,7 @@ public class Evolution extends SoloGame } } - @EventHandler + @EventHandler(priority = EventPriority.MONITOR) public void onKill(CombatDeathEvent event) { event.SetBroadcastType(DeathMessageType.Simple); @@ -790,10 +790,4 @@ public class Evolution extends SoloGame Scoreboard.Draw(); } - - @EventHandler - public void deathMsg(CombatDeathEvent event) - { - event.SetBroadcastType(DeathMessageType.Simple); - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java index c9cdafe4a..16628a272 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameGemManager.java @@ -190,13 +190,13 @@ public class GameGemManager implements Listener //Time Reward if (TimeReward) { - long timeOnline = 7380000; + long timeOnline = 7980000; double hoursOnline = timeOnline/3600000d; if (hoursOnline > 5) - hoursOnline = 5; - + hoursOnline = 5; + total += (int)(earned * (hoursOnline * 0.2)); } @@ -308,19 +308,22 @@ public class GameGemManager implements Listener //Time Reward if (TimeReward) { - long timeOnline = 7380000; + long timeOnline = 7980000; double hoursOnline = timeOnline/3600000d; if (hoursOnline > 5) hoursOnline = 5; - int extraGems = (int)(earnedGems * (hoursOnline * 0.2));; + int extraGems = (int)(earnedGems * (hoursOnline * 0.2)); - UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + - F.elem("Online for " + UtilTime.MakeStr(timeOnline) )); - - totalGems += extraGems; + if (extraGems > 0) + { + UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " + + F.elem("Online for " + UtilTime.MakeStr(timeOnline) + C.cGreen + " +" + (int)(hoursOnline * 20) + "%")); + + totalGems += extraGems; + } } //Double Gem From 4466c104418d3e8d16c71f9b3ff7fec8c12765a8 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 28 Aug 2015 21:35:31 -0600 Subject: [PATCH 53/56] FIXED --- .../trackers/EvoWinWithoutDyingTracker.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/EvoWinWithoutDyingTracker.java diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/EvoWinWithoutDyingTracker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/EvoWinWithoutDyingTracker.java new file mode 100644 index 000000000..9e8f29285 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/trackers/EvoWinWithoutDyingTracker.java @@ -0,0 +1,60 @@ +package nautilus.game.arcade.game.games.evolution.trackers; + +import java.util.ArrayList; + +import mineplex.core.common.util.UtilPlayer; +import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.games.evolution.Evolution; +import nautilus.game.arcade.stats.StatTracker; + +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; + +public class EvoWinWithoutDyingTracker extends StatTracker +{ + private ArrayList _out = new ArrayList(); + + public EvoWinWithoutDyingTracker(Evolution evo) + { + super(evo); + } + + @EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR) + public void onCombatDeath(CombatDeathEvent event) + { + if (!getGame().IsLive()) + return; + + if (event.GetLog().GetPlayer() == null) + return; + + if (!event.GetLog().GetPlayer().IsPlayer()) + return; + + Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName()); + if (player == null || !player.isOnline()) + { + return; + } + + _out.add(player.getName()); + } + + @EventHandler(priority = EventPriority.MONITOR) + public void onGameStateChange(GameStateChangeEvent event) + { + if (event.GetState() != GameState.End) + return; + + if (getGame().Winner == null) + return; + + if (_out.contains(getGame().Winner.getName())) + return; + + addStat(getGame().Winner, "NoDeaths", 1, true, false); + } +} From 11cc4a6cea1d90656833c68e0fe608876b6ab9cf Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 20:45:59 -0700 Subject: [PATCH 54/56] removed msg --- .../game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java index ad9232582..02435d894 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/mobs/perks/PerkSiesmicSlamEVO.java @@ -151,9 +151,6 @@ public class PerkSiesmicSlamEVO extends Perk //Condition Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true); - - //Inform - UtilPlayer.message(cur, F.main("Game", F.name(player.getName()) +" hit you with " + F.skill(GetName()) + ".")); } //Effect From 19b2ff5b583a8f8db310ae60764a003ea943885a Mon Sep 17 00:00:00 2001 From: Mini-Chiss Date: Fri, 28 Aug 2015 20:48:32 -0700 Subject: [PATCH 55/56] fixed scoreboard --- .../arcade/game/games/evolution/Evolution.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 468d57fd1..8dcc4019d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -776,19 +776,14 @@ public class Evolution extends SoloGame Scoreboard.WriteBlank(); - int index = 0; + Scoreboard.Write(C.cYellow + C.Bold + "First to " + _mobKits.size()); + + Scoreboard.WriteBlank(); + for (Player player : GetPlayers(true)) { - if (index > 11) - break; - - Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true); - index++; + Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true); } - - Scoreboard.WriteBlank(); - - Scoreboard.Write(C.cGold + C.Bold + "First to " + _mobKits.size()); Scoreboard.Draw(); } From 6628f5a1ae799626a8837e2f684376507a3d4548 Mon Sep 17 00:00:00 2001 From: Mysticate Date: Fri, 28 Aug 2015 21:49:57 -0600 Subject: [PATCH 56/56] Added a checker for a no kit issue --- .../arcade/game/games/evolution/Evolution.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java index 1eeed390a..099236672 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/evolution/Evolution.java @@ -229,6 +229,22 @@ public class Evolution extends SoloGame } } + @EventHandler(priority = EventPriority.LOWEST) + public void setKit(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Prepare) + return; + + for (Player player : GetPlayers(true)) + { + if (GetKit(player) != null) + continue; + + this.SetKit(player, GetKits()[0], false); + } + } + + @EventHandler(priority = EventPriority.MONITOR) public void showKit(GameStateChangeEvent event) {