edited a few things

This commit is contained in:
Mysticate 2015-08-07 14:39:29 -04:00
parent a9350bfacd
commit 858e57bb0d
2 changed files with 47 additions and 61 deletions

View File

@ -10,6 +10,8 @@ import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import 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 mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
@ -99,8 +101,6 @@ public class Evolution extends SoloGame
PrepareFreeze = false; PrepareFreeze = false;
this.PrepareFreeze = false;
GemKillDeathRespawn = 2; GemKillDeathRespawn = 2;
GemAssistDeathRespawn = .5; GemAssistDeathRespawn = .5;
@ -254,21 +254,36 @@ public class Evolution extends SoloGame
@EventHandler @EventHandler
public void startEvolve(EvolutionBeginEvent event) public void startEvolve(EvolutionBeginEvent event)
{ {
Manager.GetCondition().Factory().Cloak("Evolution", event.getPlayer(), null, Double.MAX_VALUE, false, false);
Recharge.Instance.Get(event.getPlayer()).clear(); Recharge.Instance.Get(event.getPlayer()).clear();
} }
@EventHandler @EventHandler
public void stopEvolve(EvolutionEndEvent event) 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); upgradeKit(event.getPlayer(), true);
} }
@EventHandler @EventHandler
public void endEvolve(final EvolutionPostEvolveEvent event) 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 @EventHandler
@ -315,6 +330,9 @@ public class Evolution extends SoloGame
End(); End();
return; return;
} }
killer.teleport(GetTeam(killer).GetSpawn());
Manager.GetCondition().Factory().Cloak("Evolving", killer, null, 10, true, true);
} }
//Boolean ending //Boolean ending

View File

@ -14,14 +14,11 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.packethandler.PacketPlayOutCamera; 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.EvoKit;
import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent; 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.EvolutionEndEvent;
import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent; import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent;
import net.minecraft.server.v1_7_R4.Entity; 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.EntityBlaze;
import net.minecraft.server.v1_7_R4.EntityChicken; import net.minecraft.server.v1_7_R4.EntityChicken;
import net.minecraft.server.v1_7_R4.EntityCreeper; import net.minecraft.server.v1_7_R4.EntityCreeper;
@ -43,11 +40,11 @@ import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; 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.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.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class EvolveData public class EvolveData
@ -68,54 +65,50 @@ public class EvolveData
private String _evolveTop; private String _evolveTop;
private Bat _bat; private Zombie _zombie;
private int _ticks = 0;
public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to) public EvolveData(EvolveManager manager, Player player, EvoKit from, EvoKit to)
{ {
_manager = manager; _manager = manager;
_player = player; _player = player;
_manager.Host.Manager.GetCondition().Factory().Cloak(null, _player, null, Double.MAX_VALUE, false, false);
_to = to; _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(); _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()); _eFrom = spawn(from.getEntity());
setupBat(); setupZombie();
Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player)); Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player));
teleport(true);
setupPlayer(); setupPlayer();
} }
private void setupBat() private void setupZombie()
{ {
_manager.Host.CreatureAllowOverride = true; _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; _manager.Host.CreatureAllowOverride = false;
bat.setAwake(true); UtilEnt.Vegetate(zombie, true);
bat.setRemoveWhenFarAway(false); UtilEnt.ghost(zombie, false, true);
UtilEnt.Vegetate(bat, true); _zombie = zombie;
UtilEnt.ghost(bat, false, true);
_bat = bat;
} }
private void setupPlayer() private void setupPlayer()
{ {
//Spectate //Spectate
PacketPlayOutCamera packet = new PacketPlayOutCamera(_bat); PacketPlayOutCamera packet = new PacketPlayOutCamera(_zombie);
UtilPlayer.sendPacket(_player, packet); UtilPlayer.sendPacket(_player, packet);
} }
//Boolean completed //Boolean completed
public boolean tick() public boolean tick()
{ {
_ticks++;
teleport(false); teleport(false);
//Hasn't ended yet //Hasn't ended yet
@ -134,17 +127,6 @@ public class EvolveData
UtilTextMiddle.display(null, _evolveTop, _player); 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); _manager.Host.SetKit(_player, _manager.Host.GetKit(_player), false);
Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player)); Bukkit.getServer().getPluginManager().callEvent(new EvolutionEndEvent(_player));
@ -166,26 +148,13 @@ public class EvolveData
despawn(_eTo); despawn(_eTo);
UtilAction.velocity(_player, 0.0, 0.0, 0.0, false);
//Stop spectating //Stop spectating
PacketPlayOutCamera packet = new PacketPlayOutCamera(_player); PacketPlayOutCamera packet = new PacketPlayOutCamera(_player);
UtilPlayer.sendPacket(_player, packet); UtilPlayer.sendPacket(_player, packet);
_bat.remove(); _zombie.remove();
Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player)); 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; return true;
} }
} }
@ -202,26 +171,25 @@ public class EvolveData
double sizeMod = 3.5; double sizeMod = 3.5;
double speed = 15d; double speed = 15d;
double oX = -Math.sin(_bat.getTicksLived()/speed) * 2 * sizeMod; double oX = -Math.sin(_ticks/speed) * 2 * sizeMod;
double oY = 3; double oY = 3;
double oZ = Math.cos(_bat.getTicksLived()/speed) * 2 * sizeMod; double oZ = Math.cos(_ticks/speed) * 2 * sizeMod;
if (teleport) if (teleport)
{ {
_bat.teleport(_manager.getLocation().clone().add(oX, oY, oZ)); _zombie.teleport(_manager.getLocation().clone().add(oX, oY, oZ));
setupPlayer();
} }
else else
{ {
UtilAction.velocity(_bat, UtilAction.velocity(_zombie,
UtilAlg.getTrajectory(_bat.getLocation(), _manager.getLocation().clone().add(oX, oY, oZ)), UtilAlg.getTrajectory(_zombie.getLocation(), _manager.getLocation().clone().add(oX, oY, oZ)),
0.4, false, 0, 0.0, 1, true); 0.4, false, 0, 0.0, 0.0, false);
} }
setupPlayer(); EntityZombie eB = ((CraftZombie) _zombie).getHandle();
EntityBat eB = ((CraftBat) _bat).getHandle(); Vector to = UtilAlg.getTrajectory(_zombie.getEyeLocation(), _manager.getLocation()).normalize();
Vector to = UtilAlg.getTrajectory(_bat.getEyeLocation(), _manager.getLocation());
try try
{ {