Fixed win rooms

This commit is contained in:
LCastr0 2017-05-09 23:06:49 -03:00
parent 00981cf846
commit bcd60d325b
5 changed files with 83 additions and 32 deletions

View File

@ -76,7 +76,9 @@ public class WinEffectRankEternal extends WinEffectRankBased
Location npcLocation = _npc.getEntity().getBukkitEntity().getLocation();
if (_guardian == null)
_step++;
if (_guardian == null && _step >= 5)
{
Manager.getPetManager().getCreatureModule().SetForce(true);
_guardian = npcLocation.getWorld().spawn(npcLocation.add(0, 20, 0), Guardian.class);
@ -88,13 +90,11 @@ public class WinEffectRankEternal extends WinEffectRankBased
double angle = _step * increment;
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
_guardian.setVelocity(new Vector(0,0,0));
_guardian.teleport(_player.getLocation().clone().add(vector));
_guardian.teleport(_player.getLocation().clone().subtract(vector));
Vector direction = npcLocation.toVector().subtract(_guardian.getEyeLocation().toVector());
Location enderLocation = _guardian.getLocation().setDirection(direction);
_guardian.teleport(enderLocation);
_step++;
if (_step % 2 == 0)
zap();

View File

@ -51,7 +51,7 @@ public class WinEffectRankHero extends WinEffectRankBased
loc.setDirection(_player.getLocation().subtract(loc).toVector().multiply(-1));
_npc = getNPC(getPlayer(), loc, true);
_npc = getNPC(getPlayer(), loc);
}
@Override
@ -71,10 +71,10 @@ public class WinEffectRankHero extends WinEffectRankBased
if (!isRunning())
return;
if (_step > 70)
if (_step > 60)
return;
if (_step == 70)
if (_step == 30)
{
breakBlocks();
}
@ -84,11 +84,14 @@ public class WinEffectRankHero extends WinEffectRankBased
Location npcLocation = _npc.getEntity().getBukkitEntity().getLocation();
if (_enderDragon == null)
_step++;
if (_enderDragon == null && _step >= 5)
{
Manager.getPetManager().getCreatureModule().SetForce(true);
_enderDragon = npcLocation.getWorld().spawn(npcLocation.add(0, 20, 0), EnderDragon.class);
Manager.getPetManager().getCreatureModule().SetForce(false);
_step = 0;
}
double increment = (2 * Math.PI) / POINTS;
@ -96,13 +99,11 @@ public class WinEffectRankHero extends WinEffectRankBased
double angle = _step * increment;
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
_enderDragon.setVelocity(new Vector(0,0,0));
_enderDragon.teleport(_player.getLocation().clone().add(vector));
_enderDragon.teleport(_player.getLocation().clone().subtract(vector));
Vector direction = npcLocation.toVector().subtract(_enderDragon.getEyeLocation().toVector()).multiply(-1);
Location enderLocation = _enderDragon.getLocation().setDirection(direction);
_enderDragon.teleport(enderLocation);
_step++;
if (_step >= 50)
setTarget();
}

View File

@ -76,7 +76,9 @@ public class WinEffectRankLegend extends WinEffectRankBased
Location npcLocation = _npc.getEntity().getBukkitEntity().getLocation();
if (_wither == null)
_step++;
if (_wither == null && _step >= 5)
{
Manager.getPetManager().getCreatureModule().SetForce(true);
_wither = npcLocation.getWorld().spawn(npcLocation.add(0, 20, 0), Wither.class);
@ -88,13 +90,11 @@ public class WinEffectRankLegend extends WinEffectRankBased
double angle = _step * increment;
Vector vector = new Vector(Math.cos(angle) * RADIUS, 0, Math.sin(angle) * RADIUS);
_wither.setVelocity(new Vector(0,0,0));
_wither.teleport(_player.getLocation().clone().add(vector));
_wither.teleport(_player.getLocation().clone().subtract(vector));
Vector direction = npcLocation.toVector().subtract(_wither.getEyeLocation().toVector());
Location enderLocation = _wither.getLocation().setDirection(direction);
_wither.teleport(enderLocation);
_step++;
if (_step % 5 == 0)
spawnSkull();

View File

@ -22,12 +22,15 @@ import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class WinEffectRankTitan extends WinEffectRankBased
{
private DisguisePlayer _npc;
private Giant _giant = null;
private int _step = 0;
private static final int RADIUS = 5;
@ -46,12 +49,6 @@ public class WinEffectRankTitan extends WinEffectRankBased
loc.setDirection(_player.getLocation().subtract(loc).toVector().multiply(-1));
_npc = getNPC(getPlayer(), loc);
Manager.getPetManager().getCreatureModule().SetForce(true);
_giant = loc.getWorld().spawn(loc.add(0, 20, 0), Giant.class);
Manager.getPetManager().getCreatureModule().SetForce(false);
}
@Override
@ -60,6 +57,33 @@ public class WinEffectRankTitan extends WinEffectRankBased
if (_giant != null)
{
_giant.remove();
_giant = null;
}
_step = 0;
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (!isRunning())
return;
if (event.getType() != UpdateType.FASTEST)
return;
if (_giant == null && _step >= 5)
{
Location loc = getBaseLocation();
Manager.getPetManager().getCreatureModule().SetForce(true);
_giant = loc.getWorld().spawn(loc.add(0, 20, 0), Giant.class);
Manager.getPetManager().getCreatureModule().SetForce(false);
}
else
{
_step++;
}
}

View File

@ -23,6 +23,8 @@ import mineplex.core.common.util.UtilText;
import mineplex.core.disguise.disguises.DisguisePlayer;
import mineplex.core.gadget.GadgetManager;
import mineplex.core.gadget.gadgets.wineffect.rankrooms.WinEffectRankBased;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
public class WinEffectRankUltra extends WinEffectRankBased
{
@ -31,6 +33,7 @@ public class WinEffectRankUltra extends WinEffectRankBased
private DisguisePlayer _npc;
private Creeper _creeper;
private int _step = 0;
public WinEffectRankUltra(GadgetManager manager)
{
@ -47,23 +50,46 @@ public class WinEffectRankUltra extends WinEffectRankBased
loc.setPitch(0);
loc.setYaw(0);
_npc = getNPC(getPlayer(), loc, true);
Manager.getPetManager().getCreatureModule().SetForce(true);
_creeper = loc.getWorld().spawn(loc.add(0, 10, 0), Creeper.class);
_creeper.teleport(loc.subtract(0, 0, 2));
_creeper.setTarget((LivingEntity) _npc.getEntity().getBukkitEntity());
Manager.getPetManager().getCreatureModule().SetForce(false);
}
@Override
public void finish()
{
if (!_creeper.isDead())
if (_creeper != null)
{
_creeper.remove();
_creeper = null;
}
_step = 0;
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (!isRunning())
return;
if (event.getType() != UpdateType.FASTEST)
return;
if (_creeper == null && _step >= 5)
{
Location loc = getBaseLocation();
Manager.getPetManager().getCreatureModule().SetForce(true);
_creeper = loc.getWorld().spawn(loc.add(0, 10, 0), Creeper.class);
_creeper.teleport(loc.subtract(0, 0, 2));
_creeper.setTarget((LivingEntity) _npc.getEntity().getBukkitEntity());
Manager.getPetManager().getCreatureModule().SetForce(false);
}
else
{
_step++;
}
}
@EventHandler