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.itemstack.ItemStackFactory;
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_Helmet;
import mineplex.hub.gadget.gadgets.PaintballGun;
@ -61,6 +63,10 @@ public class GadgetManager extends MiniPlugin
//Halloween 2013
_gadgets.add(new Halloween2013_BatGun(this));
_gadgets.add(new Halloween2013_Helmet(this));
//Christmas 2013
_gadgets.add(new Christmas2013_Helmet(this));
_gadgets.add(new Christmas2013_SnowCannon(this));
}
@EventHandler

View File

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

View File

@ -1,6 +1,9 @@
package mineplex.hub.mount.types;
import java.util.HashMap;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style;
@ -9,6 +12,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
@ -21,14 +25,11 @@ public class Frost extends Mount
{
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 + "one of Santa's own steeds",
C.cWhite + "used to pull his Sleigh!",
" ",
C.cYellow + "Only available on website.",
C.cYellow + "www.mineplex.com/Shop",
C.cWhite + "Born in the North Pole,",
C.cWhite + "it leaves a trail of frost",
C.cWhite + "as it moves!",
},
Material.BONE,
(byte)0,
@ -36,12 +37,45 @@ public class Frost extends Mount
Color.WHITE, Style.WHITE, Variant.HORSE, 0.8, null);
}
@EventHandler
public void Trail(UpdateEvent event)
{
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 + "existance, from the pits of",
C.cWhite + "the Nether.",
" ",
C.cYellow + "Only available on website.",
C.cYellow + "www.mineplex.com/Shop",
},
Material.BONE,
(byte)0,

View File

@ -12,6 +12,7 @@ import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowman;
import org.bukkit.entity.Villager;
import org.bukkit.event.EventHandler;
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.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.util.Vector;
@ -54,6 +56,7 @@ public class Christmas extends SoloGame
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
private long _gameTime = 900000;
public Christmas(ArcadeManager manager)
{
@ -166,7 +169,8 @@ public class Christmas extends SoloGame
WorldData.GetCustomLocs("87"),
WorldData.GetCustomLocs("88"),
WorldData.GetCustomLocs("89"),
WorldData.GetCustomLocs("153")));
WorldData.GetCustomLocs("153"),
WorldData.GetCustomLocs("173")));
}
@EventHandler(priority = EventPriority.MONITOR)
@ -293,7 +297,7 @@ public class Christmas extends SoloGame
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)
@ -302,7 +306,7 @@ public class Christmas extends SoloGame
{
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...");
AnnounceEnd(this.GetTeamList().get(1));
}
else if (UtilTime.elapsed(GetStateTime(), 1200000))
else if (UtilTime.elapsed(GetStateTime(), _gameTime))
{
for (Player player : GetPlayers(false))
{
@ -542,7 +546,7 @@ public class Christmas extends SoloGame
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
out = C.cWhite + "Players Alive:";
out = C.cWhite + "Players:";
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
@ -567,7 +571,7 @@ public class Christmas extends SoloGame
_lastScoreboard.add(out);
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)
out = out.substring(0, 15);
_lastScoreboard.add(out);
@ -602,4 +606,10 @@ public class Christmas extends SoloGame
return SpectatorSpawn;
}
@EventHandler
public void ProjectileClean(ProjectileHitEvent event)
{
event.getEntity().remove();
}
}

View File

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

View File

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

View File

@ -147,7 +147,7 @@ public class BossSnowmanPattern
BossSnowman ent = entIterator.next();
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)
{
@ -164,19 +164,22 @@ public class BossSnowmanPattern
for (BossSnowman snowman : _ents)
{
if (UtilMath.offset(player, snowman.Entity) < 1)
if (UtilMath.offset2d(player, snowman.Entity) < 1)
{
if (Math.abs(player.getLocation().getY() - snowman.Entity.getLocation().getY()) < 2)
{
UtilAction.velocity(player, new Vector(snowman.Direction,0,0), 2, false, 0, 0.8, 0.8, true);
Recharge.Instance.useForce(player, "Snowman Hit", 1000);
//Damage Event
Host.Host.Manager.GetDamage().NewDamageEvent(player, snowman.Entity, null,
DamageCause.ENTITY_ATTACK, 3, true, false, false,
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.UtilEnt;
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 nautilus.game.arcade.game.games.christmas.parts.Part5;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
@ -84,17 +87,6 @@ public class PumpkinKing
else
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()
@ -131,4 +123,16 @@ public class PumpkinKing
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.Entity;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Slime;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Snowman;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
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.UtilMath;
import mineplex.core.recharge.Recharge;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.games.christmas.Christmas;
import net.minecraft.server.v1_6_R3.EntityCreature;
@ -36,12 +43,12 @@ public class SnowmanBoss
//Spawn
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)));
_heart = _spawn.getWorld().spawn(_spawn, IronGolem.class);
_heart.setMaxHealth(200);
_heart.setHealth(200);
_heart.setMaxHealth(150);
_heart.setHealth(150);
UtilEnt.Vegetate(_heart);
Host.CreatureAllowOverride = false;
@ -59,31 +66,91 @@ public class SnowmanBoss
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()
{
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)
{
if (minion.Ent.getVehicle() != null)
continue;
if (!minion.CanStack())
if (minion.Ent.getPassenger() != null)
continue;
Entity minionStack = minion.Ent;
while (minionStack.getPassenger() != null)
minionStack = minionStack.getPassenger();
//Move Towards Heart
if (!(minionStack instanceof Slime))
//Return to Stack
if (minion.CanStack())
{
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
{
EntityCreature ec = ((CraftCreature)minion.Ent).getHandle();
ec.getControllerMove().a(_spawn.getX(), _spawn.getY(), _spawn.getZ(), 1f);
if ((minion.Target == null || !minion.Target.isValid() || !Host.IsAlive(minion.Target)) && !Host.GetPlayers(true).isEmpty())
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);
}
}
}
@ -102,6 +169,29 @@ public class SnowmanBoss
public void UpdateCombine()
{
Entity bottomEnt = _heart;
while (bottomEnt.getVehicle() != null)
bottomEnt = bottomEnt.getVehicle();
for (SnowmanMinion minion : _minions)
{
if (bottomEnt.equals(minion.Ent))
continue;
if (minion.Ent.getVehicle() != null)
continue;
if (!minion.CanStack())
continue;
if (UtilMath.offset(minion.Ent, bottomEnt) < 2)
{
minion.Ent.setPassenger(bottomEnt);
return;
}
}
/*
for (SnowmanMinion minion : _minions)
{
if (minion.Ent.getVehicle() != null)
@ -110,22 +200,22 @@ public class SnowmanBoss
if (!minion.CanStack())
continue;
Entity minionStack = minion.Ent;
while (minionStack.getPassenger() != null)
minionStack = minionStack.getPassenger();
Entity topEnt = minion.Ent;
while (topEnt.getPassenger() != null)
topEnt = topEnt.getPassenger();
//Combine Heart
if (_heart.getVehicle() == null)
{
if (UtilMath.offset(minion.Ent, _heart) < 3)
{
minionStack.setPassenger(_heart);
topEnt.setPassenger(_heart);
return;
}
}
//Combine Stacks
if (minionStack instanceof Slime)
if (topEnt instanceof Slime)
{
for (SnowmanMinion other : _minions)
{
@ -145,26 +235,40 @@ public class SnowmanBoss
while (otherStack.getPassenger() != null)
otherStack = otherStack.getPassenger();
if (minionStack instanceof Slime)
if (topEnt instanceof Slime)
{
otherStack.setPassenger(minion.Ent);
}
else
{
minionStack.setPassenger(other.Ent);
topEnt.setPassenger(other.Ent);
}
return;
}
}
}
*/
}
public void Damage(CustomDamageEvent event)
{
if (_heart == null)
return;
if (event.GetCause() != DamageCause.PROJECTILE)
return;
if (_heart.getVehicle() == null)
return;
//Stack Shatter
if (event.GetDamageeEntity().equals(_heart))
{
event.SetCancelled("Ranged Damage");
Host.SantaSay("Good! Now kill it with your swords!");
Entity cur = _heart;
while (cur.getVehicle() != null)
@ -182,20 +286,15 @@ public class SnowmanBoss
return;
}
//Snowman Immunity
for (SnowmanMinion minion : _minions)
{
if (event.GetDamageeEntity().equals(minion.Ent))
{
event.SetCancelled("Snowman Immunity");
return;
}
}
}
public boolean IsDead()
{
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 org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowman;
public class SnowmanMinion
{
public Snowman Ent;
public Player Target;
public Location OrbitLocation;
@ -19,6 +21,8 @@ public class SnowmanMinion
{
Ent = ent;
UtilEnt.Vegetate(Ent);
Ent.setMaxHealth(30);
Ent.setHealth(Ent.getMaxHealth());
StackDelay = 0;
AttackDelay = System.currentTimeMillis();
@ -26,6 +30,6 @@ public class SnowmanMinion
public boolean CanStack()
{
return UtilTime.elapsed(StackDelay, 5000);
return UtilTime.elapsed(StackDelay, 8000);
}
}

View File

@ -131,7 +131,7 @@ public class SnowmanWaveA
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);
Recharge.Instance.useForce(player, "Snowman Hit", 2000);

View File

@ -127,7 +127,7 @@ public class SnowmanWaveB
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);
Recharge.Instance.useForce(player, "Snowman Hit", 2000);

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -16,7 +17,11 @@ import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Snowball;
import org.bukkit.entity.Snowman;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
public class Part3 extends Part
{
@ -39,8 +44,6 @@ public class Part3 extends Part
_snowmenB = snowmenB;
_boss = boss;
_bridge = bridge;
}
@Override
@ -84,7 +87,7 @@ public class Part3 extends Part
if (sound)
{
loc.getWorld().playSound(loc, Sound.ZOMBIE_UNFECT, 1f, 1f);
loc.getWorld().playSound(loc, Sound.ZOMBIE_UNFECT, 3f, 1f);
sound = false;
}
}
@ -101,10 +104,20 @@ public class Part3 extends Part
if (_snowman != null)
_snowman.UpdateMove();
if (event.getType() == UpdateType.FASTER)
if (event.getType() == UpdateType.FASTEST)
if (_snowman != null)
_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 (_waveA != null)
_waveA.Update();
@ -118,8 +131,16 @@ public class Part3 extends Part
if (HasPresents())
{
_snowman = new SnowmanBoss(Host, _boss.get(0));
Host.SantaSay("WATCH OUT! It's some kind of snow beast!");
SetObjectiveText("Kill the Snow Monster", 1);
Host.SantaSay("WATCH OUT! It's some kind of Snow Monster!");
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());
}
@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.setVillager(true);
ent.setHealth(12);
ent.setHealth(9);
if (Math.random() > 0.8)
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 net.minecraft.server.v1_6_R3.EntityCreature;
import org.bukkit.Effect;
import org.bukkit.EntityEffect;
import org.bukkit.Location;
import org.bukkit.Material;
@ -23,6 +24,7 @@ import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowman;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
@ -39,6 +41,7 @@ public class Part5 extends Part
private ArrayList<Location> _mobs;
private ArrayList<Location> _snowmenA;
private ArrayList<Location> _snowmenB;
private ArrayList<Location> _glass;
private PumpkinKing _boss;
private BossSnowmanPattern _bossSnowmen;
@ -68,17 +71,21 @@ public class Part5 extends Part
public Part5(Christmas host, Location sleigh, Location[] presents,
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);
_floor = floor;
_playerSpawns = playerSpawns;
_spawn = spawn;
_hurt = hurt;
_mobs = mobs;
_snowmenA = snowmenA;
_snowmenB = snowmenB;
_glass = glass;
_hurt = hurt;
for (Location loc : _glass)
loc.getBlock().setType(Material.GLASS);
for (Location loc : _spawn)
loc.getBlock().setType(Material.AIR);
@ -86,7 +93,7 @@ public class Part5 extends Part
for (Location loc : _playerSpawns)
loc.getBlock().setType(Material.AIR);
for (Location loc : _hurt)
for (Location loc : hurt)
loc.getBlock().setType(Material.AIR);
for (Location loc : _mobs)
@ -131,8 +138,8 @@ public class Part5 extends Part
if (!_a)
{
//if (UtilMath.offset(Host.GetSleigh().GetLocation(), GetSleighWaypoint()) > 1)
// return;
if (UtilMath.offset(Host.GetSleigh().GetLocation(), GetSleighWaypoint()) > 1)
return;
_a = true;
_dialogueDelay = System.currentTimeMillis();
@ -186,8 +193,12 @@ public class Part5 extends Part
//Teleport
for (int i=0 ; i<Host.GetPlayers(true).size() ; i++)
{
Host.GetPlayers(true).get(i).teleport(_playerSpawns.get(i%_playerSpawns.size()));
Host.GetPlayers(true).get(i).playSound(Host.GetPlayers(true).get(i).getLocation(), Sound.ZOMBIE_UNFECT, 2f, 1f);
Player player = Host.GetPlayers(true).get(i);
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))
@ -227,22 +238,37 @@ public class Part5 extends Part
_bossSnowmen.SetActive(false, 0);
_bossFloor.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
public void HurtPlayer(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
if (event.getType() != UpdateType.SEC)
return;
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
@ -258,7 +284,8 @@ public class Part5 extends Part
return;
//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())
{
@ -305,42 +332,13 @@ public class Part5 extends Part
{
_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)
else if (_state == 10)
{
_bossSnowmen.SetActive(true, 0);
_bossMob.SetActive(true, 0);
_bossFloor.SetActive(true, 0);
}
//Floor + Mobs + Snowmen (Medium)
else if (_state == 11)
else if (_state == 7)
{
_bossSnowmen.SetActive(true, 1);
_bossMob.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
@ -383,7 +381,18 @@ public class Part5 extends Part
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;
_bossDamageDelay = System.currentTimeMillis();
@ -395,12 +404,6 @@ public class Part5 extends Part
//Damage Sound
_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)
{
@ -414,4 +417,16 @@ public class Part5 extends Part
{
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");
}
}