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.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;
@ -99,8 +101,6 @@ public class Evolution extends SoloGame
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

View File

@ -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));
@ -166,26 +148,13 @@ public class EvolveData
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
{