Christmas update

Hub Update
This commit is contained in:
Chiss 2013-12-21 15:06:01 +11:00
parent bc9c309aa1
commit c52a7d2fe1
16 changed files with 380 additions and 159 deletions

View File

@ -22,6 +22,8 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
import mineplex.hub.gadget.gadgets.Christmas2013_Helmet;
import mineplex.hub.gadget.gadgets.Christmas2013_SnowCannon;
import mineplex.hub.gadget.gadgets.Halloween2013_BatGun; import mineplex.hub.gadget.gadgets.Halloween2013_BatGun;
import mineplex.hub.gadget.gadgets.Halloween2013_Helmet; import mineplex.hub.gadget.gadgets.Halloween2013_Helmet;
import mineplex.hub.gadget.gadgets.PaintballGun; import mineplex.hub.gadget.gadgets.PaintballGun;
@ -61,6 +63,10 @@ public class GadgetManager extends MiniPlugin
//Halloween 2013 //Halloween 2013
_gadgets.add(new Halloween2013_BatGun(this)); _gadgets.add(new Halloween2013_BatGun(this));
_gadgets.add(new Halloween2013_Helmet(this)); _gadgets.add(new Halloween2013_Helmet(this));
//Christmas 2013
_gadgets.add(new Christmas2013_Helmet(this));
_gadgets.add(new Christmas2013_SnowCannon(this));
} }
@EventHandler @EventHandler

View File

@ -37,6 +37,7 @@ public class MountManager extends MiniPlugin
_types = new HashSet<Mount>(); _types = new HashSet<Mount>();
_types.add(new Undead(this)); _types.add(new Undead(this));
_types.add(new Frost(this));
_types.add(new Mule(this)); _types.add(new Mule(this));
} }

View File

@ -1,6 +1,9 @@
package mineplex.hub.mount.types; package mineplex.hub.mount.types;
import java.util.HashMap;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Horse; import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Color; import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style; import org.bukkit.entity.Horse.Style;
@ -9,6 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle; import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
@ -21,27 +25,57 @@ public class Frost extends Mount
{ {
public Frost(MountManager manager) public Frost(MountManager manager)
{ {
super(manager, "Frosty Steed", new String[] super(manager, "Glacial Steed", new String[]
{ {
C.cWhite + "From the North Pole itself,", C.cWhite + "Born in the North Pole,",
C.cWhite + "one of Santa's own steeds", C.cWhite + "it leaves a trail of frost",
C.cWhite + "used to pull his Sleigh!", C.cWhite + "as it moves!",
" ",
C.cYellow + "Only available on website.",
C.cYellow + "www.mineplex.com/Shop",
}, },
Material.BONE, Material.BONE,
(byte)0, (byte)0,
-1, -1,
Color.WHITE, Style.WHITE, Variant.HORSE, 0.8, null); Color.WHITE, Style.WHITE, Variant.HORSE, 0.8, null);
} }
@EventHandler @EventHandler
public void Trail(UpdateEvent event) public void Trail(UpdateEvent event)
{ {
if (event.getType() == UpdateType.TICK) if (event.getType() == UpdateType.TICK)
{ {
for (Horse horse : GetActive().values())
for (Player player : UtilServer.getPlayers())
{
try
{
UtilParticle.PlayParticle(player, ParticleType.SNOW_SHOVEL, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 3);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
@EventHandler
public void SnowAura(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : GetActive().keySet())
{
double range = 5*player.getExp();
//Blocks
double duration = 2000;
HashMap<Block, Double> blocks = UtilBlock.getInRadius(player.getLocation(), range);
for (Block block : blocks.keySet())
{
//Snow
Manager.Manager.GetBlockRestore().Snow(block, (byte)1, (byte)1, (long)(duration * (1 + blocks.get(block))), 250, 0);
}
} }
} }
} }

View File

@ -26,9 +26,6 @@ public class Undead extends Mount
C.cWhite + "The most ghastly horse in", C.cWhite + "The most ghastly horse in",
C.cWhite + "existance, from the pits of", C.cWhite + "existance, from the pits of",
C.cWhite + "the Nether.", C.cWhite + "the Nether.",
" ",
C.cYellow + "Only available on website.",
C.cYellow + "www.mineplex.com/Shop",
}, },
Material.BONE, Material.BONE,
(byte)0, (byte)0,

View File

@ -12,6 +12,7 @@ import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Snowman;
import org.bukkit.entity.Villager; import org.bukkit.entity.Villager;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -19,6 +20,7 @@ import org.bukkit.event.HandlerList;
import org.bukkit.event.entity.EntityCombustEvent; import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -54,6 +56,7 @@ public class Christmas extends SoloGame
private ArrayList<String> _lastScoreboard = new ArrayList<String>(); private ArrayList<String> _lastScoreboard = new ArrayList<String>();
private long _gameTime = 900000;
public Christmas(ArcadeManager manager) public Christmas(ArcadeManager manager)
{ {
@ -166,7 +169,8 @@ public class Christmas extends SoloGame
WorldData.GetCustomLocs("87"), WorldData.GetCustomLocs("87"),
WorldData.GetCustomLocs("88"), WorldData.GetCustomLocs("88"),
WorldData.GetCustomLocs("89"), WorldData.GetCustomLocs("89"),
WorldData.GetCustomLocs("153"))); WorldData.GetCustomLocs("153"),
WorldData.GetCustomLocs("173")));
} }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
@ -293,7 +297,7 @@ public class Christmas extends SoloGame
public void SantaSay(String string) public void SantaSay(String string)
{ {
Announce(C.cRed + C.Bold + "Santa: " + ChatColor.RESET + string); Announce(C.cRed + C.Bold + "Santa: " + ChatColor.RESET + C.cYellow + string);
} }
public void BossSay(String name, String string) public void BossSay(String name, String string)
@ -302,7 +306,7 @@ public class Christmas extends SoloGame
{ {
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
UtilPlayer.message(player, C.cGreen + C.Bold + name + ": " + ChatColor.RESET + string); UtilPlayer.message(player, C.cDGreen + C.Bold + name + ": " + ChatColor.RESET + C.cGreen + string);
} }
} }
@ -395,7 +399,7 @@ public class Christmas extends SoloGame
SetCustomWinLine("You all died..."); SetCustomWinLine("You all died...");
AnnounceEnd(this.GetTeamList().get(1)); AnnounceEnd(this.GetTeamList().get(1));
} }
else if (UtilTime.elapsed(GetStateTime(), 1200000)) else if (UtilTime.elapsed(GetStateTime(), _gameTime))
{ {
for (Player player : GetPlayers(false)) for (Player player : GetPlayers(false))
{ {
@ -542,7 +546,7 @@ public class Christmas extends SoloGame
_lastScoreboard.add(out); _lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--); GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
out = C.cWhite + "Players Alive:"; out = C.cWhite + "Players:";
if (out.length() >= 16) if (out.length() >= 16)
out = out.substring(0, 15); out = out.substring(0, 15);
_lastScoreboard.add(out); _lastScoreboard.add(out);
@ -567,7 +571,7 @@ public class Christmas extends SoloGame
_lastScoreboard.add(out); _lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--); GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
out = C.cYellow + UtilTime.MakeStr(1200000 - (System.currentTimeMillis() - GetStateTime())); out = C.cYellow + UtilTime.MakeStr(_gameTime - (System.currentTimeMillis() - GetStateTime()));
if (out.length() >= 16) if (out.length() >= 16)
out = out.substring(0, 15); out = out.substring(0, 15);
_lastScoreboard.add(out); _lastScoreboard.add(out);
@ -602,4 +606,10 @@ public class Christmas extends SoloGame
return SpectatorSpawn; return SpectatorSpawn;
} }
@EventHandler
public void ProjectileClean(ProjectileHitEvent event)
{
event.getEntity().remove();
}
} }

View File

@ -121,7 +121,7 @@ public class BossFloor
//Countdown //Countdown
else if (_state == 1) else if (_state == 1)
{ {
long req = 5000 - (1500 * _difficulty); long req = 4000 - (2000 * _difficulty);
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
player.setExp(Math.min(0.99f, Math.max(0.0f, (req - (System.currentTimeMillis() - _last)) / req))); player.setExp(Math.min(0.99f, Math.max(0.0f, (req - (System.currentTimeMillis() - _last)) / req)));
@ -141,7 +141,7 @@ public class BossFloor
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
player.setExp(0.99f); player.setExp(0.99f);
if (UtilTime.elapsed(_last, 3000 - (1000 * _difficulty))) if (UtilTime.elapsed(_last, 2000 - (1000 * _difficulty)))
{ {
_last = System.currentTimeMillis(); _last = System.currentTimeMillis();

View File

@ -50,7 +50,7 @@ public class BossMobs
return; return;
//Timer //Timer
if (!UtilTime.elapsed(_lastSpawn, 1000 - 250 * _difficulty)) if (!UtilTime.elapsed(_lastSpawn, 1500 - 250 * _difficulty))
return; return;
_lastSpawn = System.currentTimeMillis(); _lastSpawn = System.currentTimeMillis();

View File

@ -147,7 +147,7 @@ public class BossSnowmanPattern
BossSnowman ent = entIterator.next(); BossSnowman ent = entIterator.next();
EntityCreature ec = ((CraftCreature)ent.Entity).getHandle(); EntityCreature ec = ((CraftCreature)ent.Entity).getHandle();
ec.getControllerMove().a(ent.Entity.getLocation().getX()+ent.Direction, ent.Entity.getLocation().getY(), ent.Entity.getLocation().getZ(), 1.5 + 0.25*_difficulty); ec.getControllerMove().a(ent.Entity.getLocation().getX()+ent.Direction, ent.Entity.getLocation().getY(), ent.Entity.getLocation().getZ(), 1.25 + 0.25*_difficulty);
if (!ent.Entity.isValid() || UtilMath.offset(ent.Entity.getLocation(), ent.Spawn) > 43) if (!ent.Entity.isValid() || UtilMath.offset(ent.Entity.getLocation(), ent.Spawn) > 43)
{ {
@ -164,15 +164,18 @@ public class BossSnowmanPattern
for (BossSnowman snowman : _ents) for (BossSnowman snowman : _ents)
{ {
if (UtilMath.offset(player, snowman.Entity) < 1) if (UtilMath.offset2d(player, snowman.Entity) < 1)
{ {
UtilAction.velocity(player, new Vector(snowman.Direction,0,0), 2, false, 0, 0.8, 0.8, true); if (Math.abs(player.getLocation().getY() - snowman.Entity.getLocation().getY()) < 2)
Recharge.Instance.useForce(player, "Snowman Hit", 1000); {
UtilAction.velocity(player, new Vector(snowman.Direction,0,0), 2, false, 0, 0.8, 0.8, true);
//Damage Event Recharge.Instance.useForce(player, "Snowman Hit", 1000);
Host.Host.Manager.GetDamage().NewDamageEvent(player, snowman.Entity, null,
DamageCause.ENTITY_ATTACK, 3, true, false, false, //Damage Event
null, null); Host.Host.Manager.GetDamage().NewDamageEvent(player, snowman.Entity, null,
DamageCause.ENTITY_ATTACK, 3, false, false, false,
null, null);
}
} }
} }
} }

View File

@ -6,11 +6,14 @@ import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.games.christmas.parts.Part5; import nautilus.game.arcade.game.games.christmas.parts.Part5;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton;
@ -84,17 +87,6 @@ public class PumpkinKing
else else
UtilEnt.CreatureMoveFast(_ent, _target, (float) (1.2 + (0.06 * Host.GetState()))); UtilEnt.CreatureMoveFast(_ent, _target, (float) (1.2 + (0.06 * Host.GetState())));
for (Player player : Host.Host.GetPlayers(true))
{
if (UtilMath.offset(player, _ent) > 1.5)
continue;
//Damage Event
Host.Host.Manager.GetDamage().NewDamageEvent(player, _ent, null,
DamageCause.ENTITY_ATTACK, 6, true, false, false,
UtilEnt.getName(_ent), null);
}
} }
public void TNTUpdate() public void TNTUpdate()
@ -131,4 +123,16 @@ public class PumpkinKing
UtilEnt.CreatureMoveFast(_ent, _ent.getLocation().getBlock().getLocation().add(0.5, 0, 0.5), 0.6f); UtilEnt.CreatureMoveFast(_ent, _ent.getLocation().getBlock().getLocation().add(0.5, 0, 0.5), 0.6f);
} }
public void Die()
{
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _ent.getLocation(), 0, 1, 0, 0, 1);
UtilParticle.PlayParticle(ParticleType.LAVA, _ent.getLocation(), 0.25f, 1, 0.25f, 0, 50);
_ent.getWorld().playSound(_ent.getLocation(), Sound.ENDERDRAGON_DEATH, 4f, 0.5f);
Host.Host.BossSay("Pumpkin King", "NOOOOOOOOOOOOOO!!!!!!");
_ent.remove();
}
} }

View File

@ -8,12 +8,19 @@ import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.IronGolem; import org.bukkit.entity.IronGolem;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime; import org.bukkit.entity.Slime;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Snowman; import org.bukkit.entity.Snowman;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.Christmas;
import net.minecraft.server.v1_6_R3.EntityCreature; import net.minecraft.server.v1_6_R3.EntityCreature;
@ -22,71 +29,131 @@ public class SnowmanBoss
{ {
private Christmas Host; private Christmas Host;
private Location _spawn; private Location _spawn;
private ArrayList<SnowmanMinion> _minions; private ArrayList<SnowmanMinion> _minions;
private Creature _heart; private Creature _heart;
public SnowmanBoss(Christmas host, Location spawn) public SnowmanBoss(Christmas host, Location spawn)
{ {
Host = host; Host = host;
_spawn = spawn; _spawn = spawn;
_minions = new ArrayList<SnowmanMinion>(); _minions = new ArrayList<SnowmanMinion>();
//Spawn //Spawn
Host.CreatureAllowOverride = true; Host.CreatureAllowOverride = true;
for (int i=0 ; i<20 ; i++) for (int i=0 ; i<14 ; i++)
_minions.add(new SnowmanMinion(_spawn.getWorld().spawn(_spawn, Snowman.class))); _minions.add(new SnowmanMinion(_spawn.getWorld().spawn(_spawn, Snowman.class)));
_heart = _spawn.getWorld().spawn(_spawn, IronGolem.class); _heart = _spawn.getWorld().spawn(_spawn, IronGolem.class);
_heart.setMaxHealth(200); _heart.setMaxHealth(150);
_heart.setHealth(200); _heart.setHealth(150);
UtilEnt.Vegetate(_heart); UtilEnt.Vegetate(_heart);
Host.CreatureAllowOverride = false; Host.CreatureAllowOverride = false;
//Stack //Stack
Entity base = null; Entity base = null;
for (SnowmanMinion ent : _minions) for (SnowmanMinion ent : _minions)
{ {
if (base != null) if (base != null)
base.setPassenger(ent.Ent); base.setPassenger(ent.Ent);
base = ent.Ent; base = ent.Ent;
} }
base.setPassenger(_heart); base.setPassenger(_heart);
} }
public void UpdateSnowball()
{
if (Host.GetPlayers(true).isEmpty())
return;
Entity ent = _heart;
while (ent.getVehicle() != null)
{
ent = ent.getVehicle();
if (Math.random() > 0.005 * Host.GetPlayers(true).size())
continue;
Player target = UtilAlg.Random(Host.GetPlayers(true));
Vector dir = UtilAlg.getTrajectory(ent, target);
dir.multiply(2);
Snowball ball = ent.getWorld().spawn(ent.getLocation().add(0, 1, 0).add(dir), Snowball.class);
ball.setShooter((LivingEntity) ent);
ball.setVelocity(dir.add(new Vector(0, Math.min(0.6, UtilMath.offset2d(target, ent)/150), 0)));
}
}
public void UpdateMove() public void UpdateMove()
{ {
if (_heart != null)
{
//Orbit
double speed = 20d;
double oX = Math.sin(_heart.getTicksLived()/speed) * 8;
double oY = 0;
double oZ = Math.cos(_heart.getTicksLived()/speed) * 8;
Location loc = _spawn.clone().add(oX, oY, oZ);
Entity bottomEnt = _heart;
while (bottomEnt.getVehicle() != null)
bottomEnt = bottomEnt.getVehicle();
float rate = 2f;
if (_heart.getVehicle() == null)
rate = 1f;
UtilEnt.CreatureMoveFast(bottomEnt, loc, rate);
}
for (SnowmanMinion minion : _minions) for (SnowmanMinion minion : _minions)
{ {
if (minion.Ent.getVehicle() != null) if (minion.Ent.getVehicle() != null)
continue; continue;
if (!minion.CanStack()) if (minion.Ent.getPassenger() != null)
continue; continue;
Entity minionStack = minion.Ent; //Return to Stack
while (minionStack.getPassenger() != null) if (minion.CanStack())
minionStack = minionStack.getPassenger();
//Move Towards Heart
if (!(minionStack instanceof Slime))
{ {
EntityCreature ec = ((CraftCreature)minion.Ent).getHandle(); EntityCreature ec = ((CraftCreature)minion.Ent).getHandle();
ec.getControllerMove().a(_heart.getLocation().getX(), minion.Ent.getLocation().getY(), _heart.getLocation().getZ(), 1f); ec.getControllerMove().a(_heart.getLocation().getX(), minion.Ent.getLocation().getY(), _heart.getLocation().getZ(), 2f);
} }
//Move Towards Spawn //Harass Players
else else
{ {
EntityCreature ec = ((CraftCreature)minion.Ent).getHandle(); if ((minion.Target == null || !minion.Target.isValid() || !Host.IsAlive(minion.Target)) && !Host.GetPlayers(true).isEmpty())
ec.getControllerMove().a(_spawn.getX(), _spawn.getY(), _spawn.getZ(), 1f); minion.Target = UtilAlg.Random(Host.GetPlayers(true));
}
//Move
UtilEnt.CreatureMoveFast(minion.Ent, minion.Target.getLocation(), 1.6f);
//Bump
if (UtilMath.offset(minion.Ent, minion.Target) < 1.5)
{
if (!Recharge.Instance.usable(minion.Target, "Snowman Hit"))
return;
UtilAction.velocity(minion.Target, UtilAlg.getTrajectory(minion.Ent, minion.Target), 0.8, false, 0, 0.3, 1.2, true);
Recharge.Instance.useForce(minion.Target, "Snowman Hit", 1000);
//Damage Event
Host.Manager.GetDamage().NewDamageEvent(minion.Target, minion.Ent, null,
DamageCause.ENTITY_ATTACK, 6, false, false, false,
null, null);
}
}
} }
//Clean //Clean
if (_heart != null && !_heart.isValid()) if (_heart != null && !_heart.isValid())
{ {
@ -95,107 +162,139 @@ public class SnowmanBoss
minion.Ent.getWorld().playEffect(minion.Ent.getLocation(), Effect.STEP_SOUND, 80); minion.Ent.getWorld().playEffect(minion.Ent.getLocation(), Effect.STEP_SOUND, 80);
minion.Ent.remove(); minion.Ent.remove();
} }
_minions.clear(); _minions.clear();
} }
} }
public void UpdateCombine() public void UpdateCombine()
{ {
Entity bottomEnt = _heart;
while (bottomEnt.getVehicle() != null)
bottomEnt = bottomEnt.getVehicle();
for (SnowmanMinion minion : _minions) for (SnowmanMinion minion : _minions)
{ {
if (bottomEnt.equals(minion.Ent))
continue;
if (minion.Ent.getVehicle() != null) if (minion.Ent.getVehicle() != null)
continue; continue;
if (!minion.CanStack()) if (!minion.CanStack())
continue; continue;
Entity minionStack = minion.Ent; if (UtilMath.offset(minion.Ent, bottomEnt) < 2)
while (minionStack.getPassenger() != null) {
minionStack = minionStack.getPassenger(); minion.Ent.setPassenger(bottomEnt);
return;
}
}
/*
for (SnowmanMinion minion : _minions)
{
if (minion.Ent.getVehicle() != null)
continue;
if (!minion.CanStack())
continue;
Entity topEnt = minion.Ent;
while (topEnt.getPassenger() != null)
topEnt = topEnt.getPassenger();
//Combine Heart //Combine Heart
if (_heart.getVehicle() == null) if (_heart.getVehicle() == null)
{ {
if (UtilMath.offset(minion.Ent, _heart) < 3) if (UtilMath.offset(minion.Ent, _heart) < 3)
{ {
minionStack.setPassenger(_heart); topEnt.setPassenger(_heart);
return; return;
} }
} }
//Combine Stacks //Combine Stacks
if (minionStack instanceof Slime) if (topEnt instanceof Slime)
{ {
for (SnowmanMinion other : _minions) for (SnowmanMinion other : _minions)
{ {
if (other.Ent.getVehicle() != null) if (other.Ent.getVehicle() != null)
continue; continue;
if (!other.CanStack()) if (!other.CanStack())
continue; continue;
if (minion.equals(other)) if (minion.equals(other))
continue; continue;
if (UtilMath.offset(minion.Ent, other.Ent) > 2) if (UtilMath.offset(minion.Ent, other.Ent) > 2)
continue; continue;
Entity otherStack = other.Ent; Entity otherStack = other.Ent;
while (otherStack.getPassenger() != null) while (otherStack.getPassenger() != null)
otherStack = otherStack.getPassenger(); otherStack = otherStack.getPassenger();
if (minionStack instanceof Slime) if (topEnt instanceof Slime)
{ {
otherStack.setPassenger(minion.Ent); otherStack.setPassenger(minion.Ent);
} }
else else
{ {
minionStack.setPassenger(other.Ent); topEnt.setPassenger(other.Ent);
} }
return; return;
} }
} }
} }
*/
} }
public void Damage(CustomDamageEvent event) public void Damage(CustomDamageEvent event)
{ {
if (_heart == null)
return;
if (event.GetCause() != DamageCause.PROJECTILE)
return;
if (_heart.getVehicle() == null)
return;
//Stack Shatter //Stack Shatter
if (event.GetDamageeEntity().equals(_heart)) if (event.GetDamageeEntity().equals(_heart))
{ {
event.SetCancelled("Ranged Damage");
Host.SantaSay("Good! Now kill it with your swords!");
Entity cur = _heart; Entity cur = _heart;
while (cur.getVehicle() != null) while (cur.getVehicle() != null)
{ {
Entity past = cur; Entity past = cur;
cur = cur.getVehicle(); cur = cur.getVehicle();
cur.eject(); cur.eject();
past.setVelocity(new Vector((Math.random() - 0.5)*2, (Math.random())*1, (Math.random() - 0.5)*2)); past.setVelocity(new Vector((Math.random() - 0.5)*2, (Math.random())*1, (Math.random() - 0.5)*2));
} }
for (SnowmanMinion minion : _minions) for (SnowmanMinion minion : _minions)
minion.StackDelay = System.currentTimeMillis(); minion.StackDelay = System.currentTimeMillis();
return; return;
} }
//Snowman Immunity
for (SnowmanMinion minion : _minions)
{
if (event.GetDamageeEntity().equals(minion.Ent))
{
event.SetCancelled("Snowman Immunity");
return;
}
}
} }
public boolean IsDead() public boolean IsDead()
{ {
return !_heart.isValid(); return !_heart.isValid();
} }
public double GetHealth()
{
return _heart.getHealth()/_heart.getMaxHealth();
}
} }

View File

@ -4,11 +4,13 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowman; import org.bukkit.entity.Snowman;
public class SnowmanMinion public class SnowmanMinion
{ {
public Snowman Ent; public Snowman Ent;
public Player Target;
public Location OrbitLocation; public Location OrbitLocation;
@ -19,6 +21,8 @@ public class SnowmanMinion
{ {
Ent = ent; Ent = ent;
UtilEnt.Vegetate(Ent); UtilEnt.Vegetate(Ent);
Ent.setMaxHealth(30);
Ent.setHealth(Ent.getMaxHealth());
StackDelay = 0; StackDelay = 0;
AttackDelay = System.currentTimeMillis(); AttackDelay = System.currentTimeMillis();
@ -26,6 +30,6 @@ public class SnowmanMinion
public boolean CanStack() public boolean CanStack()
{ {
return UtilTime.elapsed(StackDelay, 5000); return UtilTime.elapsed(StackDelay, 8000);
} }
} }

View File

@ -58,7 +58,7 @@ public class SnowmanWaveA
_spawns.add(bestLoc); _spawns.add(bestLoc);
spawns.remove(bestLoc); spawns.remove(bestLoc);
} }
//Set Present //Set Present
if (UtilMath.offset(presents[0], _spawns.get(0)) < UtilMath.offset(presents[0], _spawns.get(0))) if (UtilMath.offset(presents[0], _spawns.get(0)) < UtilMath.offset(presents[0], _spawns.get(0)))
{ {
@ -131,7 +131,7 @@ public class SnowmanWaveA
for (Snowman snowman : _ents) for (Snowman snowman : _ents)
{ {
if (UtilMath.offset(player, snowman) < 1) if (UtilMath.offset2d(player, snowman) < 1)
{ {
UtilAction.velocity(player, new Vector(xDir,0,0), 4, false, 0, 1.2, 1.2, true); UtilAction.velocity(player, new Vector(xDir,0,0), 4, false, 0, 1.2, 1.2, true);
Recharge.Instance.useForce(player, "Snowman Hit", 2000); Recharge.Instance.useForce(player, "Snowman Hit", 2000);

View File

@ -127,7 +127,7 @@ public class SnowmanWaveB
for (Snowman snowman : _ents) for (Snowman snowman : _ents)
{ {
if (UtilMath.offset(player, snowman) < 1) if (UtilMath.offset2d(player, snowman) < 1)
{ {
UtilAction.velocity(player, new Vector(xDir,0,0), 4, false, 0, 1.2, 1.2, true); UtilAction.velocity(player, new Vector(xDir,0,0), 4, false, 0, 1.2, 1.2, true);
Recharge.Instance.useForce(player, "Snowman Hit", 2000); Recharge.Instance.useForce(player, "Snowman Hit", 2000);

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
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.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -16,7 +17,11 @@ import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Snowman;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class Part3 extends Part public class Part3 extends Part
{ {
@ -39,8 +44,6 @@ public class Part3 extends Part
_snowmenB = snowmenB; _snowmenB = snowmenB;
_boss = boss; _boss = boss;
_bridge = bridge; _bridge = bridge;
} }
@Override @Override
@ -84,7 +87,7 @@ public class Part3 extends Part
if (sound) if (sound)
{ {
loc.getWorld().playSound(loc, Sound.ZOMBIE_UNFECT, 1f, 1f); loc.getWorld().playSound(loc, Sound.ZOMBIE_UNFECT, 3f, 1f);
sound = false; sound = false;
} }
} }
@ -101,10 +104,20 @@ public class Part3 extends Part
if (_snowman != null) if (_snowman != null)
_snowman.UpdateMove(); _snowman.UpdateMove();
if (event.getType() == UpdateType.FASTER) if (event.getType() == UpdateType.FASTEST)
if (_snowman != null) if (_snowman != null)
_snowman.UpdateCombine(); _snowman.UpdateCombine();
if (event.getType() == UpdateType.TICK)
if (_snowman != null)
_snowman.UpdateSnowball();
if (event.getType() == UpdateType.TICK)
if (_snowman != null)
{
SetObjectiveText("Kill the Snow Monster", _snowman.GetHealth());
}
if (event.getType() == UpdateType.TICK) if (event.getType() == UpdateType.TICK)
if (_waveA != null) if (_waveA != null)
_waveA.Update(); _waveA.Update();
@ -118,8 +131,16 @@ public class Part3 extends Part
if (HasPresents()) if (HasPresents())
{ {
_snowman = new SnowmanBoss(Host, _boss.get(0)); _snowman = new SnowmanBoss(Host, _boss.get(0));
Host.SantaSay("WATCH OUT! It's some kind of snow beast!"); Host.SantaSay("WATCH OUT! It's some kind of Snow Monster!");
SetObjectiveText("Kill the Snow Monster", 1);
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Host.Manager.GetPlugin(), new Runnable()
{
public void run()
{
Host.SantaSay("Shoot the Iron Golem with your bow!");
}
}, 80);
} }
} }
@ -153,4 +174,31 @@ public class Part3 extends Part
{ {
return (_snowman != null && _snowman.IsDead() && HasPresents()); return (_snowman != null && _snowman.IsDead() && HasPresents());
} }
@EventHandler(priority = EventPriority.LOWEST)
public void DamageCancel(CustomDamageEvent event)
{
if (!(event.GetDamageeEntity() instanceof Snowman))
return;
if (_boss == null || event.GetDamageeEntity().getPassenger() != null)
{
event.SetCancelled("Snowman Wave Cancel");
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void SnowballDamage(CustomDamageEvent event)
{
if (event.GetProjectile() == null)
return;
if (!(event.GetProjectile() instanceof Snowball))
return;
if (event.GetDamageePlayer() != null)
event.AddMod("Christmas Part 3", "Snowball", 1, false);
else
event.SetCancelled("Snowball vs Mobs");
}
} }

View File

@ -168,7 +168,7 @@ public class Part4 extends Part
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS)); ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
ent.setVillager(true); ent.setVillager(true);
ent.setHealth(12); ent.setHealth(9);
if (Math.random() > 0.8) if (Math.random() > 0.8)
ent.setBaby(true); ent.setBaby(true);

View File

@ -15,6 +15,7 @@ import nautilus.game.arcade.game.games.christmas.Christmas;
import nautilus.game.arcade.game.games.christmas.content.*; import nautilus.game.arcade.game.games.christmas.content.*;
import net.minecraft.server.v1_6_R3.EntityCreature; import net.minecraft.server.v1_6_R3.EntityCreature;
import org.bukkit.Effect;
import org.bukkit.EntityEffect; import org.bukkit.EntityEffect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -23,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature; import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Snowman;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList; import org.bukkit.event.HandlerList;
@ -39,6 +41,7 @@ public class Part5 extends Part
private ArrayList<Location> _mobs; private ArrayList<Location> _mobs;
private ArrayList<Location> _snowmenA; private ArrayList<Location> _snowmenA;
private ArrayList<Location> _snowmenB; private ArrayList<Location> _snowmenB;
private ArrayList<Location> _glass;
private PumpkinKing _boss; private PumpkinKing _boss;
private BossSnowmanPattern _bossSnowmen; private BossSnowmanPattern _bossSnowmen;
@ -68,25 +71,29 @@ public class Part5 extends Part
public Part5(Christmas host, Location sleigh, Location[] presents, public Part5(Christmas host, Location sleigh, Location[] presents,
ArrayList<Location> snowmenA, ArrayList<Location> snowmenB, ArrayList<Location> mobs, ArrayList<Location> snowmenA, ArrayList<Location> snowmenB, ArrayList<Location> mobs,
ArrayList<Location> floor, ArrayList<Location> playerSpawns, ArrayList<Location> hurt, ArrayList<Location> spawn) ArrayList<Location> floor, ArrayList<Location> playerSpawns, ArrayList<Location> hurt, ArrayList<Location> spawn, ArrayList<Location> glass)
{ {
super(host, sleigh, presents); super(host, sleigh, presents);
_floor = floor; _floor = floor;
_playerSpawns = playerSpawns; _playerSpawns = playerSpawns;
_spawn = spawn; _spawn = spawn;
_hurt = hurt;
_mobs = mobs; _mobs = mobs;
_snowmenA = snowmenA; _snowmenA = snowmenA;
_snowmenB = snowmenB; _snowmenB = snowmenB;
_glass = glass;
_hurt = hurt;
for (Location loc : _glass)
loc.getBlock().setType(Material.GLASS);
for (Location loc : _spawn) for (Location loc : _spawn)
loc.getBlock().setType(Material.AIR); loc.getBlock().setType(Material.AIR);
for (Location loc : _playerSpawns) for (Location loc : _playerSpawns)
loc.getBlock().setType(Material.AIR); loc.getBlock().setType(Material.AIR);
for (Location loc : _hurt) for (Location loc : hurt)
loc.getBlock().setType(Material.AIR); loc.getBlock().setType(Material.AIR);
for (Location loc : _mobs) for (Location loc : _mobs)
@ -131,8 +138,8 @@ public class Part5 extends Part
if (!_a) if (!_a)
{ {
//if (UtilMath.offset(Host.GetSleigh().GetLocation(), GetSleighWaypoint()) > 1) if (UtilMath.offset(Host.GetSleigh().GetLocation(), GetSleighWaypoint()) > 1)
// return; return;
_a = true; _a = true;
_dialogueDelay = System.currentTimeMillis(); _dialogueDelay = System.currentTimeMillis();
@ -186,8 +193,12 @@ public class Part5 extends Part
//Teleport //Teleport
for (int i=0 ; i<Host.GetPlayers(true).size() ; i++) for (int i=0 ; i<Host.GetPlayers(true).size() ; i++)
{ {
Host.GetPlayers(true).get(i).teleport(_playerSpawns.get(i%_playerSpawns.size())); Player player = Host.GetPlayers(true).get(i);
Host.GetPlayers(true).get(i).playSound(Host.GetPlayers(true).get(i).getLocation(), Sound.ZOMBIE_UNFECT, 2f, 1f);
player.leaveVehicle();
player.teleport(_playerSpawns.get(i%_playerSpawns.size()));
player.playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 1f);
} }
} }
else if (_h && !_i && UtilTime.elapsed(_dialogueDelay, _delayTime)) else if (_h && !_i && UtilTime.elapsed(_dialogueDelay, _delayTime))
@ -227,22 +238,37 @@ public class Part5 extends Part
_bossSnowmen.SetActive(false, 0); _bossSnowmen.SetActive(false, 0);
_bossFloor.SetActive(false, 0); _bossFloor.SetActive(false, 0);
_bossMob.SetActive(false, 0); _bossMob.SetActive(false, 0);
if (_state > 7)
{
_boss.Die();
for (Location loc : _glass)
{
loc.getWorld().playEffect(loc, Effect.STEP_SOUND, 20);
loc.getBlock().setType(Material.AIR);
}
}
} }
@EventHandler @EventHandler
public void HurtPlayer(UpdateEvent event) public void HurtPlayer(UpdateEvent event)
{ {
if (event.getType() != UpdateType.FAST) if (event.getType() != UpdateType.SEC)
return; return;
for (Player player : Host.GetPlayers(true)) for (Player player : Host.GetPlayers(true))
{ {
if (_hurt.contains(player.getLocation().getBlock())) for (Location loc : _hurt)
{ {
player.damage(1); if (UtilMath.offset(player.getLocation(), loc) < 1.5)
{
player.damage(2);
UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), _spawn.get(0)), 1, true, 0.6, 0, 1, true);
}
} }
} }
} }
@EventHandler @EventHandler
@ -258,7 +284,8 @@ public class Part5 extends Part
return; return;
//Health //Health
SetObjectiveText("Defeat the Pumpkin King!", ((13 * _stateHealthMax) - (_state * _stateHealthMax) - (_stateHealthMax - _stateHealth))/(13d * _stateHealthMax)); SetObjectiveText("Defeat the Pumpkin King!",
((8 * _stateHealthMax) - (_state * _stateHealthMax) - (_stateHealthMax - _stateHealth))/(8d * _stateHealthMax));
if (_bossFloor.ShouldBossMove()) if (_bossFloor.ShouldBossMove())
{ {
@ -305,42 +332,13 @@ public class Part5 extends Part
{ {
_bossSnowmen.SetActive(true, 1); _bossSnowmen.SetActive(true, 1);
} }
//Floor (Hard)
else if (_state == 7)
{
_bossFloor.SetActive(true, 2);
}
//Mobs (Hard)
else if (_state == 8)
{
_bossMob.SetActive(true, 2);
}
//Snowmen (Hard)
else if (_state == 9)
{
_bossSnowmen.SetActive(true, 2);
}
//Floor + Mobs + Snowmen (Easy) //Floor + Mobs + Snowmen (Easy)
else if (_state == 10) else if (_state == 7)
{
_bossSnowmen.SetActive(true, 0);
_bossMob.SetActive(true, 0);
_bossFloor.SetActive(true, 0);
}
//Floor + Mobs + Snowmen (Medium)
else if (_state == 11)
{ {
_bossSnowmen.SetActive(true, 1); _bossSnowmen.SetActive(true, 1);
_bossMob.SetActive(true, 1); _bossMob.SetActive(true, 1);
_bossFloor.SetActive(true, 1); _bossFloor.SetActive(true, 1);
} }
//Floor + Mobs + Snowmen (Hard)
else if (_state == 12)
{
_bossSnowmen.SetActive(true, 2);
_bossMob.SetActive(true, 2);
_bossFloor.SetActive(true, 2);
}
} }
@EventHandler @EventHandler
@ -383,7 +381,18 @@ public class Part5 extends Part
event.SetCancelled("Boss Damage"); event.SetCancelled("Boss Damage");
if (!UtilTime.elapsed(_bossDamageDelay, 1000)) //Knockback
Player damager = event.GetDamagerPlayer(false);
if (damager == null)
return;
if (event.GetCause() == DamageCause.ENTITY_ATTACK)
UtilAction.velocity(damager, UtilAlg.getTrajectory(event.GetDamageeEntity(), damager), 1, true, 0.6, 0, 1, true);
if (!Host.IsAlive(damager))
return;
if (!UtilTime.elapsed(_bossDamageDelay, 400))
return; return;
_bossDamageDelay = System.currentTimeMillis(); _bossDamageDelay = System.currentTimeMillis();
@ -395,12 +404,6 @@ public class Part5 extends Part
//Damage Sound //Damage Sound
_boss.GetEntity().getWorld().playSound(_boss.GetEntity().getLocation(), Sound.ENDERDRAGON_GROWL, 0.5f, 2f); _boss.GetEntity().getWorld().playSound(_boss.GetEntity().getLocation(), Sound.ENDERDRAGON_GROWL, 0.5f, 2f);
//Knockback
Player damager = event.GetDamagerPlayer(false);
if (event.GetCause() == DamageCause.ENTITY_ATTACK)
{
UtilAction.velocity(damager, UtilAlg.getTrajectory(event.GetDamageeEntity(), damager), 1, true, 0.6, 0, 1, true);
}
if (_stateHealth <= 0) if (_stateHealth <= 0)
{ {
@ -414,4 +417,16 @@ public class Part5 extends Part
{ {
return _boss; return _boss;
} }
@EventHandler(priority = EventPriority.LOWEST)
public void DamageCancel(CustomDamageEvent event)
{
if (!(event.GetDamageeEntity() instanceof Snowman))
return;
if (event.GetCause() == DamageCause.LAVA)
return;
event.SetCancelled("Snowman Damage");
}
} }