Merge remote-tracking branch 'origin/clans-beta' into clans-beta
This commit is contained in:
commit
16d807db2e
@ -42,7 +42,7 @@ public class UtilAlg
|
||||
|
||||
public static Vector getTrajectory(Vector from, Vector to)
|
||||
{
|
||||
return to.subtract(from).normalize();
|
||||
return to.clone().subtract(from).normalize();
|
||||
}
|
||||
|
||||
public static Vector getTrajectory2d(Entity from, Entity to)
|
||||
@ -57,7 +57,7 @@ public class UtilAlg
|
||||
|
||||
public static Vector getTrajectory2d(Vector from, Vector to)
|
||||
{
|
||||
return to.subtract(from).setY(0).normalize();
|
||||
return to.clone().subtract(from).setY(0).normalize();
|
||||
}
|
||||
|
||||
public static boolean HasSight(Location from, Player to)
|
||||
|
@ -1,4 +1,4 @@
|
||||
package mineplex.minecraft.game.core.boss.ironwizard.abilities;
|
||||
package mineplex.minecraft.game.core.boss;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
@ -16,9 +16,9 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public abstract class GolemAbility implements Listener
|
||||
public abstract class BossAbility<T extends EventCreature, Y extends Entity> implements Listener
|
||||
{
|
||||
private GolemCreature _creature;
|
||||
private T _creature;
|
||||
private HashMap<UUID, Long> _damaged = new HashMap<UUID, Long>();
|
||||
|
||||
public boolean canDamage(Entity player)
|
||||
@ -36,7 +36,7 @@ public abstract class GolemAbility implements Listener
|
||||
return true;
|
||||
}
|
||||
|
||||
public GolemAbility(GolemCreature creature)
|
||||
public BossAbility(T creature)
|
||||
{
|
||||
_creature = creature;
|
||||
}
|
||||
@ -50,12 +50,12 @@ public abstract class GolemAbility implements Listener
|
||||
return 60;
|
||||
}
|
||||
|
||||
public IronGolem getEntity()
|
||||
public Y getEntity()
|
||||
{
|
||||
return getGolem().getEntity();
|
||||
return (Y) getBoss().getEntity();
|
||||
}
|
||||
|
||||
public GolemCreature getGolem()
|
||||
public T getBoss()
|
||||
{
|
||||
return _creature;
|
||||
}
|
||||
@ -70,7 +70,7 @@ public abstract class GolemAbility implements Listener
|
||||
return getTarget(30);
|
||||
}
|
||||
|
||||
public Player getTarget(double maxDistance)
|
||||
public Player getTarget(double minDistance, double maxDistance)
|
||||
{
|
||||
Player target = null;
|
||||
double dist = 0;
|
||||
@ -84,6 +84,11 @@ public abstract class GolemAbility implements Listener
|
||||
|
||||
double d = player.getLocation().distance(getLocation());
|
||||
|
||||
if (d < minDistance)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (target == null || dist > d)
|
||||
{
|
||||
target = player;
|
||||
@ -94,6 +99,11 @@ public abstract class GolemAbility implements Listener
|
||||
return target;
|
||||
}
|
||||
|
||||
public Player getTarget(double maxDistance)
|
||||
{
|
||||
return getTarget(0, maxDistance);
|
||||
}
|
||||
|
||||
public abstract boolean hasFinished();
|
||||
|
||||
public abstract void setFinished();
|
@ -56,7 +56,7 @@ public abstract class EventCreature<T extends LivingEntity> implements Listener
|
||||
return getEvent().getDifficulty();
|
||||
}
|
||||
|
||||
protected final void spawnEntity()
|
||||
protected void spawnEntity()
|
||||
{
|
||||
Location spawnLocation = _entity == null ? _spawnLocation : _entity.getLocation();
|
||||
T entity = _spawnLocation.getWorld().spawn(spawnLocation, getEntityClass());
|
||||
|
@ -279,6 +279,11 @@ public abstract class WorldEvent implements Listener
|
||||
_lastActive = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public EventMap getEventMap()
|
||||
{
|
||||
return _map;
|
||||
}
|
||||
|
||||
public void setMap(EventMap map, final Runnable onComplete)
|
||||
{
|
||||
_map = map;
|
||||
|
@ -15,8 +15,8 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemBlockHail;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemBlockShot;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemCaveIn;
|
||||
@ -35,6 +35,7 @@ import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class GolemCreature extends EventCreature<IronGolem>
|
||||
@ -49,7 +50,7 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
private HashMap<Class, Class[]> _preferedCombos = new HashMap<Class, Class[]>();
|
||||
private Class _lastAttack;
|
||||
private boolean _usedFinalAttack;
|
||||
private ArrayList<GolemAbility> _currentAbilities = new ArrayList<GolemAbility>();
|
||||
private ArrayList<BossAbility> _currentAbilities = new ArrayList<BossAbility>();
|
||||
private double _canCaveIn = 450;
|
||||
private Vector _afkWalk = new Vector();
|
||||
private long _lastSlam;
|
||||
@ -108,12 +109,12 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
|
||||
// if (_currentAbility == null || _currentAbility.hasFinished())
|
||||
// {
|
||||
Iterator<GolemAbility> itel = _currentAbilities.iterator();
|
||||
Iterator<BossAbility> itel = _currentAbilities.iterator();
|
||||
boolean canDoNew = _currentAbilities.size() < 3;
|
||||
|
||||
while (itel.hasNext())
|
||||
{
|
||||
GolemAbility ability = itel.next();
|
||||
BossAbility ability = itel.next();
|
||||
|
||||
if (ability.hasFinished())
|
||||
{
|
||||
@ -179,9 +180,9 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
}
|
||||
|
||||
{ // Wall explode
|
||||
if (!getPlayers(dist, 12).isEmpty() && getPlayers(dist, 4).isEmpty())
|
||||
if (!getPlayers(dist, 13).isEmpty() && getPlayers(dist, 4).isEmpty())
|
||||
{
|
||||
weight.put(GolemWallExplode.class, 5);
|
||||
weight.put(GolemWallExplode.class, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,7 +221,7 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
{
|
||||
ArrayList<Player> players = getPlayers(dist, 30);
|
||||
|
||||
for (GolemAbility ability : _currentAbilities)
|
||||
for (BossAbility ability : _currentAbilities)
|
||||
{
|
||||
if (ability instanceof GolemExplodingAura)
|
||||
{
|
||||
@ -270,12 +271,12 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
}
|
||||
}
|
||||
|
||||
for (GolemAbility ability : _currentAbilities)
|
||||
for (BossAbility ability : _currentAbilities)
|
||||
{
|
||||
weight.remove(ability.getClass());
|
||||
}
|
||||
|
||||
GolemAbility ability = null;
|
||||
BossAbility ability = null;
|
||||
|
||||
if (!weight.isEmpty())
|
||||
{
|
||||
@ -298,7 +299,7 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
{
|
||||
try
|
||||
{
|
||||
ability = (GolemAbility) entry.getKey().getConstructor(GolemCreature.class).newInstance(this);
|
||||
ability = (BossAbility) entry.getKey().getConstructor(GolemCreature.class).newInstance(this);
|
||||
|
||||
if (ability.getTarget() == null)
|
||||
{
|
||||
@ -350,7 +351,7 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
|
||||
boolean canMove = true;
|
||||
|
||||
for (GolemAbility ability : _currentAbilities)
|
||||
for (BossAbility ability : _currentAbilities)
|
||||
{
|
||||
ability.tick();
|
||||
|
||||
@ -527,7 +528,7 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
|
||||
private void endAbility()
|
||||
{
|
||||
for (GolemAbility ability : _currentAbilities)
|
||||
for (BossAbility ability : _currentAbilities)
|
||||
{
|
||||
ability.setFinished();
|
||||
HandlerList.unregisterAll(ability);
|
||||
@ -548,4 +549,25 @@ public class GolemCreature extends EventCreature<IronGolem>
|
||||
endAbility();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (!(event.GetDamageeEntity() instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.GetCause() != DamageCause.FALL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!getEvent().getEventMap().isInMap(event.GetDamageeEntity().getLocation()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
event.AddMod("Fall negation", 0.5);
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R4.EntityIronGolem;
|
||||
@ -46,7 +47,7 @@ import org.bukkit.util.Vector;
|
||||
* Rumble is where the golem picks a target then starts playing a animation for a second where its obviously preparing to use it.
|
||||
* Copy this from Wizards
|
||||
*/
|
||||
public class GolemBlockHail extends GolemAbility
|
||||
public class GolemBlockHail extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private int _currentBlock;
|
||||
private int _currentLevel;
|
||||
@ -221,14 +222,14 @@ public class GolemBlockHail extends GolemAbility
|
||||
|
||||
// if (canDamage(victim))
|
||||
{
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 6 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Block Hail",
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Block Hail",
|
||||
"Iron Wizard Block Hail");
|
||||
}
|
||||
|
||||
if (victim instanceof Player)
|
||||
{
|
||||
getGolem().getEvent().getCondition().Factory().Slow("Iron Wizard Block Hail", (LivingEntity) victim,
|
||||
getBoss().getEvent().getCondition().Factory().Slow("Iron Wizard Block Hail", (LivingEntity) victim,
|
||||
getEntity(), 3, 2, false, false, false, false);
|
||||
}
|
||||
|
||||
@ -304,8 +305,8 @@ public class GolemBlockHail extends GolemAbility
|
||||
{
|
||||
if (canDamage(player))
|
||||
{
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null,
|
||||
DamageCause.CONTACT, 6 * getGolem().getDifficulty(), true, true, false,
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null,
|
||||
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false,
|
||||
"Iron Wizard Protection", "Iron Wizard Protection");
|
||||
|
||||
loc.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, Material.OBSIDIAN.getId());
|
||||
|
@ -20,6 +20,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R4.EntityIronGolem;
|
||||
@ -43,13 +44,14 @@ import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftIronGolem;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class GolemBlockShot extends GolemAbility
|
||||
public class GolemBlockShot extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private HashMap<Integer, Location> _blockLoc = new HashMap<Integer, Location>();
|
||||
private HashMap<Integer, Material> _blockType = new HashMap<Integer, Material>();
|
||||
@ -225,8 +227,8 @@ public class GolemBlockShot extends GolemAbility
|
||||
{
|
||||
cur.getWorld().playEffect(victim.getEyeLocation().subtract(0, 0.5, 0), Effect.STEP_SOUND, cur.getBlockId());
|
||||
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 6 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Block Shot",
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Block Shot",
|
||||
"Iron Wizard Block Shot");
|
||||
|
||||
cur.remove();
|
||||
|
@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
@ -27,10 +28,12 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -38,7 +41,7 @@ import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class GolemCaveIn extends GolemAbility
|
||||
public class GolemCaveIn extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private ArrayList<Block> _blocks = new ArrayList<Block>();
|
||||
private ArrayList<FallingBlock> _fallingBlocks = new ArrayList<FallingBlock>();
|
||||
@ -165,8 +168,8 @@ public class GolemCaveIn extends GolemAbility
|
||||
|
||||
if (canDamage(victim))
|
||||
{
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 6 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Cave In",
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Cave In",
|
||||
"Iron Wizard Cave In");
|
||||
}
|
||||
|
||||
@ -216,15 +219,6 @@ public class GolemCaveIn extends GolemAbility
|
||||
block.setType(Material.AIR);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPhysics(BlockPhysicsEvent event)
|
||||
{
|
||||
if (_blocks.contains(event.getBlock()))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
@ -289,7 +283,7 @@ public class GolemCaveIn extends GolemAbility
|
||||
|
||||
List<Player> players = UtilPlayer.getNearby(getLocation(), 50, true);
|
||||
|
||||
for (int i = 0; i < players.size(); i++)
|
||||
for (int i = 0; i < players.size() * 4; i++)
|
||||
{
|
||||
int dist = UtilMath.r(10);
|
||||
|
||||
@ -317,7 +311,7 @@ public class GolemCaveIn extends GolemAbility
|
||||
{
|
||||
if (l.getBlock().getType() == Material.AIR)
|
||||
{
|
||||
if (UtilAlg.HasSight(l, getLocation().add(0, 8, 0)))
|
||||
if (UtilAlg.HasSight(l, getLocation().add(0, 4, 0)))
|
||||
{
|
||||
FallingBlock block = b.getWorld().spawnFallingBlock(b.getLocation().add(0.5, -1, 0.5), b.getTypeId(),
|
||||
b.getData());
|
||||
|
@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
@ -17,12 +18,13 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class GolemEarthquake extends GolemAbility
|
||||
public class GolemEarthquake extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private Location _center;
|
||||
private float _range;
|
||||
@ -138,11 +140,11 @@ public class GolemEarthquake extends GolemAbility
|
||||
{
|
||||
_damaged.add(player.getUniqueId());
|
||||
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) player, getEntity(), null,
|
||||
DamageCause.CONTACT, 12 * getGolem().getDifficulty(), false, true, false, "Iron Wizard Earthquake",
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) player, getEntity(), null,
|
||||
DamageCause.CONTACT, 14 * getBoss().getDifficulty(), false, true, false, "Iron Wizard Earthquake",
|
||||
"Iron Wizard Earthquake");
|
||||
|
||||
getGolem().getEvent().getCondition().Factory().Slow("Earthquake", (LivingEntity) player, getEntity(), 3, 1, false,
|
||||
getBoss().getEvent().getCondition().Factory().Slow("Earthquake", (LivingEntity) player, getEntity(), 3, 1, false,
|
||||
false, false, false);
|
||||
|
||||
// Velocity
|
||||
@ -150,7 +152,7 @@ public class GolemEarthquake extends GolemAbility
|
||||
1.8, true, 0, 0.5, 0.5, true);
|
||||
|
||||
// Condition
|
||||
getGolem().getEvent().getCondition().Factory().Falling("Earthquake", player, getEntity(), 10, false, true);
|
||||
getBoss().getEvent().getCondition().Factory().Falling("Earthquake", player, getEntity(), 10, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -44,10 +45,11 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
public class GolemExplodingAura extends GolemAbility
|
||||
public class GolemExplodingAura extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
|
||||
private HashMap<Integer, Integer> _blocks = new HashMap<Integer, Integer>();
|
||||
@ -105,7 +107,7 @@ public class GolemExplodingAura extends GolemAbility
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
if (_tick < 25 * 25 && getGolem().getHealth() > 30)
|
||||
if (_tick < 25 * 25 && getBoss().getHealth() > 30)
|
||||
{
|
||||
double angle = (2 * Math.PI) / UtilMath.random.nextDouble();
|
||||
double x = 1.7 * Math.cos(angle);
|
||||
@ -117,8 +119,8 @@ public class GolemExplodingAura extends GolemAbility
|
||||
|
||||
for (Player player : UtilPlayer.getNearby(getLocation(), 3, true))
|
||||
{
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null, DamageCause.CONTACT,
|
||||
2 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Protection", "Iron Wizard Protection");
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null, DamageCause.CONTACT,
|
||||
6 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Protection", "Iron Wizard Protection");
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory(getEntity(), player), 1, true, 0.3, 0, 0.3, false);
|
||||
}
|
||||
}
|
||||
@ -346,17 +348,11 @@ public class GolemExplodingAura extends GolemAbility
|
||||
|
||||
// if (canDamage(victim))
|
||||
{
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 6 * getGolem().getDifficulty(), true, true, false, "Blocky Iron Wizard Aura",
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 6 * getBoss().getDifficulty(), true, true, false, "Blocky Iron Wizard Aura",
|
||||
"Blocky Iron Wizard Aura");
|
||||
}
|
||||
|
||||
if (victim instanceof Player)
|
||||
{
|
||||
getGolem().getEvent().getCondition().Factory().Slow("Blocky Iron Wizard Aura", (LivingEntity) victim,
|
||||
getEntity(), 3, 2, false, false, false, false);
|
||||
}
|
||||
|
||||
fallingIterator.remove();
|
||||
cur.remove();
|
||||
|
||||
|
@ -17,6 +17,7 @@ import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||
@ -52,7 +53,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class GolemExplosiveBlock extends GolemAbility
|
||||
public class GolemExplosiveBlock extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private HashMap<Integer, Vector> _blocksLocation = new HashMap<Integer, Vector>();
|
||||
private Location _center;
|
||||
@ -170,7 +171,7 @@ public class GolemExplosiveBlock extends GolemAbility
|
||||
{
|
||||
_explosionsLeft++;
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getGolem().getEvent().getPlugin(), new Runnable()
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(getBoss().getEvent().getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
|
@ -3,16 +3,18 @@ package mineplex.minecraft.game.core.boss.ironwizard.abilities;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import net.minecraft.server.v1_7_R4.EntityIronGolem;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftIronGolem;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class GolemMeleeAttack extends GolemAbility
|
||||
public class GolemMeleeAttack extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private boolean _attacked;
|
||||
|
||||
@ -64,15 +66,15 @@ public class GolemMeleeAttack extends GolemAbility
|
||||
|
||||
UtilEnt.CreatureLook(getEntity(), target);
|
||||
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent(target, getEntity(), null, DamageCause.ENTITY_ATTACK,
|
||||
6 * getGolem().getDifficulty(), false, true, false, "Iron Wizard Melee Attack", "Iron Wizard Melee Attack");
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent(target, getEntity(), null, DamageCause.ENTITY_ATTACK,
|
||||
10 * getBoss().getDifficulty(), false, true, false, "Iron Wizard Melee Attack", "Iron Wizard Melee Attack");
|
||||
|
||||
Vector vec = getLocation().getDirection();
|
||||
vec.setY(0).normalize().setY(0.5).multiply(2.4);
|
||||
|
||||
UtilAction.velocity(target, vec);
|
||||
|
||||
getGolem().getEvent().getCondition().Factory().Falling("Iron Wizard Throw", target, getEntity(), 3, false, false);
|
||||
getBoss().getEvent().getCondition().Factory().Falling("Iron Wizard Throw", target, getEntity(), 3, false, false);
|
||||
|
||||
target.getWorld().playSound(target.getLocation(), Sound.IRONGOLEM_THROW, 3, 0.9F);
|
||||
|
||||
|
@ -8,6 +8,7 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import net.minecraft.server.v1_7_R4.EntityIronGolem;
|
||||
|
||||
@ -28,7 +29,7 @@ import org.bukkit.util.Vector;
|
||||
* Rumble is where the golem picks a target then starts playing a animation for a second where its obviously preparing to use it.
|
||||
* Copy this from Wizards
|
||||
*/
|
||||
public class GolemRumble extends GolemAbility
|
||||
public class GolemRumble extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private Location _loc;
|
||||
private int _ticks;
|
||||
@ -185,8 +186,8 @@ public class GolemRumble extends GolemAbility
|
||||
|
||||
if (canDamage(entity))
|
||||
{
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) entity, getEntity(), null,
|
||||
DamageCause.CONTACT, 4 * getGolem().getDifficulty(), false, true, false, "Iron Wizard Rumble",
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) entity, getEntity(), null,
|
||||
DamageCause.CONTACT, 8 * getBoss().getDifficulty(), false, true, false, "Iron Wizard Rumble",
|
||||
"Iron Wizard Rumble");
|
||||
}
|
||||
|
||||
@ -194,7 +195,7 @@ public class GolemRumble extends GolemAbility
|
||||
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
getGolem().getEvent().getCondition().Factory().Slow("Rumble", (LivingEntity) entity, getEntity(), 3, 1,
|
||||
getBoss().getEvent().getCondition().Factory().Slow("Rumble", (LivingEntity) entity, getEntity(), 3, 1,
|
||||
false, false, false, false);
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftIronGolem;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -36,10 +37,11 @@ import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import net.minecraft.server.v1_7_R4.EntityIronGolem;
|
||||
|
||||
public class GolemRupture extends GolemAbility
|
||||
public class GolemRupture extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private ArrayList<Entry<Location, Location>> _ruptures = new ArrayList<Entry<Location, Location>>();
|
||||
private HashMap<Location, Long> _ruptureTime = new HashMap<Location, Long>();
|
||||
@ -287,11 +289,11 @@ public class GolemRupture extends GolemAbility
|
||||
0.8 + 0.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.4, true);
|
||||
|
||||
// Condition
|
||||
getGolem().getEvent().getCondition().Factory().Falling("Rupture", cur, getEntity(), 10, false, true);
|
||||
getBoss().getEvent().getCondition().Factory().Falling("Rupture", cur, getEntity(), 10, false, true);
|
||||
|
||||
// Damage Event
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent(cur, getEntity(), null, DamageCause.CUSTOM,
|
||||
4 * getGolem().getDifficulty(), false, true, false, "Iron Wizard", "Rupture");
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent(cur, getEntity(), null, DamageCause.CUSTOM,
|
||||
8 * getBoss().getDifficulty(), false, true, false, "Iron Wizard", "Rupture");
|
||||
}
|
||||
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
@ -19,6 +20,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -28,7 +30,7 @@ import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class GolemSlam extends GolemAbility
|
||||
public class GolemSlam extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private ArrayList<Item> _items = new ArrayList<Item>();
|
||||
private int _ticksFinished;
|
||||
@ -190,11 +192,11 @@ public class GolemSlam extends GolemAbility
|
||||
0.8 + 0.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.4, true);
|
||||
|
||||
// Condition
|
||||
getGolem().getEvent().getCondition().Factory().Falling("Rupture", cur, getEntity(), 10, false, true);
|
||||
getBoss().getEvent().getCondition().Factory().Falling("Rupture", cur, getEntity(), 10, false, true);
|
||||
|
||||
// Damage Event
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent(cur, getEntity(), null, DamageCause.CUSTOM,
|
||||
4 * getGolem().getDifficulty(), false, true, false, "Iron Wizard", "Rupture");
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent(cur, getEntity(), null, DamageCause.CUSTOM,
|
||||
8 * getBoss().getDifficulty(), false, true, false, "Iron Wizard", "Rupture");
|
||||
}
|
||||
|
||||
ArrayList<Block> blocks = new ArrayList<Block>();
|
||||
|
@ -18,6 +18,7 @@ import mineplex.core.common.util.UtilShapes;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.BossAbility;
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
|
||||
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_7_R4.MathHelper;
|
||||
@ -34,13 +35,14 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class GolemWallExplode extends GolemAbility
|
||||
public class GolemWallExplode extends BossAbility<GolemCreature, IronGolem>
|
||||
{
|
||||
private HashMap<BlockFace, ArrayList<Block>> _blockWalls = new HashMap<BlockFace, ArrayList<Block>>();
|
||||
private ArrayList<String> _dontTarget = new ArrayList<String>();
|
||||
@ -192,8 +194,8 @@ public class GolemWallExplode extends GolemAbility
|
||||
|
||||
if (canDamage(victim))
|
||||
{
|
||||
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 6 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Wall Explosion",
|
||||
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
|
||||
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Wall Explosion",
|
||||
"Iron Wizard Wall Explosion");
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,61 @@
|
||||
package mineplex.minecraft.game.core.boss.snake;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
import mineplex.minecraft.game.core.boss.EventState;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
|
||||
public class SnakeBoss extends WorldEvent
|
||||
{
|
||||
|
||||
public SnakeBoss(DamageManager damageManager, BlockRestore blockRestore, ConditionManager conditionManager,
|
||||
Location cornerLocation)
|
||||
{
|
||||
super(damageManager, blockRestore, conditionManager, "Snaaaake", cornerLocation, "schematic/Golem.schematic");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void customStart()
|
||||
{
|
||||
Bukkit.broadcastMessage("Custom Start");
|
||||
spawn(getCenterLocation());
|
||||
setState(EventState.LIVE);
|
||||
announceStart();
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this slime boss has been defeated
|
||||
*/
|
||||
private void checkDeath()
|
||||
{
|
||||
if (getCreatures().size() == 0)
|
||||
{
|
||||
setState(EventState.COMPLETE);
|
||||
Bukkit.broadcastMessage("FINISHED!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCreature(EventCreature creature)
|
||||
{
|
||||
super.removeCreature(creature);
|
||||
|
||||
if (creature instanceof SnakeCreature)
|
||||
{
|
||||
checkDeath();
|
||||
}
|
||||
}
|
||||
|
||||
private SnakeCreature spawn(Location location)
|
||||
{
|
||||
SnakeCreature slimeCreature = new SnakeCreature(this, location);
|
||||
registerCreature(slimeCreature);
|
||||
return slimeCreature;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,179 @@
|
||||
package mineplex.minecraft.game.core.boss.snake;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Silverfish;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
||||
|
||||
public class SnakeCreature extends EventCreature<Silverfish>
|
||||
{
|
||||
private ArrayList<SnakeSegment> _segments = new ArrayList<SnakeSegment>();
|
||||
private double _seperator = 0.5;
|
||||
private ArrayList<Player> _canSee = new ArrayList<Player>();
|
||||
|
||||
private Location _waypoint;
|
||||
|
||||
public SnakeCreature(WorldEvent event, Location spawnLocation)
|
||||
{
|
||||
super(event, spawnLocation, "Serpent Lord", false, 2000, Silverfish.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void spawnCustom()
|
||||
{
|
||||
getEntity().addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 10000, 0));
|
||||
UtilEnt.Vegetate(getEntity());
|
||||
Vector dir = new Vector(UtilMath.rr(1, true), 0, UtilMath.rr(1, true)).normalize().multiply(_seperator);
|
||||
|
||||
getNewWaypoint();
|
||||
|
||||
for (int i = 0; i < getHealth() / 50; i++)
|
||||
{
|
||||
SnakeSegment tail = new SnakeSegment(getSpawnLocation().toVector().subtract(dir.clone().multiply(-i)),
|
||||
new ItemStack(i == 0 ? Material.COBBLESTONE : Material.STONE));
|
||||
|
||||
_segments.add(tail);
|
||||
}
|
||||
}
|
||||
|
||||
private void getNewWaypoint()
|
||||
{
|
||||
_waypoint = getSpawnLocation().clone().add(Math.random() * 40 - 20, Math.random() * 24 - 8, Math.random() * 40 - 20);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = _segments.get(0).getLocation().toLocation(getSpawnLocation().getWorld());
|
||||
|
||||
ArrayList<Player> canSee = new ArrayList<Player>();
|
||||
|
||||
for (Player player : loc.getWorld().getPlayers())
|
||||
{
|
||||
if (player.getLocation().distance(loc) < 120)
|
||||
{
|
||||
canSee.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
Iterator<Player> iter2 = _canSee.iterator();
|
||||
|
||||
int[] ids = new int[_segments.size()];
|
||||
|
||||
for (int a = 0; a < _segments.size(); a++)
|
||||
{
|
||||
ids[a] = _segments.get(a).getId();
|
||||
}
|
||||
|
||||
Packet destroy = new PacketPlayOutEntityDestroy(ids);
|
||||
|
||||
while (iter2.hasNext())
|
||||
{
|
||||
Player player = iter2.next();
|
||||
if (!canSee.contains(player))
|
||||
{
|
||||
iter2.remove();
|
||||
UtilPlayer.sendPacket(player, destroy);
|
||||
}
|
||||
}
|
||||
for (Player player : canSee)
|
||||
{
|
||||
if (!_canSee.contains(player))
|
||||
{
|
||||
_canSee.add(player);
|
||||
|
||||
for (SnakeSegment tail : _segments)
|
||||
{
|
||||
UtilPlayer.sendPacket(player, tail.getSpawn());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dieCustom()
|
||||
{
|
||||
int[] ids = new int[_segments.size()];
|
||||
|
||||
for (int a = 0; a < _segments.size(); a++)
|
||||
{
|
||||
ids[a] = _segments.get(a).getId();
|
||||
}
|
||||
|
||||
Packet destroy = new PacketPlayOutEntityDestroy(ids);
|
||||
|
||||
for (Player player : _canSee)
|
||||
{
|
||||
UtilPlayer.sendPacket(player, destroy);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onTickMove(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Packet[] packets = new Packet[_segments.size()];
|
||||
|
||||
|
||||
for (int i = _segments.size()-1; i>=0; i++)
|
||||
{
|
||||
SnakeSegment seg = _segments.get(i);
|
||||
|
||||
Vector vec = seg.getLocation();
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
vec.add(UtilAlg.getTrajectory(vec, _waypoint.toVector()).multiply(0.01));
|
||||
|
||||
if (UtilMath.offset(vec, _waypoint.toVector()) < 5)
|
||||
{
|
||||
getNewWaypoint();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vec = _segments.get(i-1).getLocation();
|
||||
}
|
||||
|
||||
vec.normalize().multiply(0.6);
|
||||
|
||||
packets[i] = seg.moveEntity(vec);
|
||||
}
|
||||
|
||||
for (Player player : _canSee)
|
||||
{
|
||||
UtilPlayer.sendPacket(player, packets);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package mineplex.minecraft.game.core.boss.snake;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityEquipment;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMoveLook;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
public class SnakeSegment
|
||||
{
|
||||
private int _entityId = UtilEnt.getNewEntityId();
|
||||
private Vector _entityLocation;
|
||||
private ItemStack _item;
|
||||
|
||||
public SnakeSegment(Vector location, ItemStack item)
|
||||
{
|
||||
_entityLocation = location.clone();
|
||||
_item = item;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
return _entityId;
|
||||
}
|
||||
|
||||
public Packet moveEntity(Vector newLocation)
|
||||
{
|
||||
Vector toMove = newLocation.clone().subtract(_entityLocation);
|
||||
|
||||
int x = (int) Math.floor(32 * toMove.getX());
|
||||
int y = (int) Math.floor(32 * toMove.getY());
|
||||
int z = (int) Math.floor(32 * toMove.getZ());
|
||||
|
||||
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
|
||||
{
|
||||
_entityLocation.add(new Vector(x / 32D, y / 32D, z / 32D));
|
||||
|
||||
PacketPlayOutRelEntityMoveLook relMove = new PacketPlayOutRelEntityMoveLook();
|
||||
|
||||
relMove.a = getId();
|
||||
relMove.b = (byte) x;
|
||||
relMove.c = (byte) y;
|
||||
relMove.d = (byte) z;
|
||||
relMove.e = (byte) (int) (UtilAlg.GetYaw(toMove) * 256.0F / 360.0F);
|
||||
relMove.f = (byte) (int) (UtilAlg.GetPitch(toMove) * 256.0F / 360.0F);
|
||||
|
||||
return relMove;
|
||||
}
|
||||
else
|
||||
{
|
||||
_entityLocation = newLocation.clone();
|
||||
|
||||
x = (int) Math.floor(_entityLocation.getX() * 32);
|
||||
y = (int) Math.floor(_entityLocation.getY() * 32);
|
||||
z = (int) Math.floor(_entityLocation.getZ() * 32);
|
||||
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
|
||||
teleportPacket.a = getId();
|
||||
teleportPacket.b = x;
|
||||
teleportPacket.c = y;
|
||||
teleportPacket.d = z;
|
||||
teleportPacket.e = (byte) (int) (UtilAlg.GetYaw(toMove) * 256.0F / 360.0F);
|
||||
teleportPacket.f = (byte) (int) (UtilAlg.GetPitch(toMove) * 256.0F / 360.0F);
|
||||
|
||||
return teleportPacket;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector getLocation()
|
||||
{
|
||||
return _entityLocation;
|
||||
}
|
||||
|
||||
public Packet[] getSpawn()
|
||||
{
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
|
||||
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 0);
|
||||
watcher.a(1, 0);
|
||||
|
||||
watcher.a(10, (byte) 0);
|
||||
|
||||
for (int i = 11; i < 17; i++)
|
||||
{
|
||||
watcher.a(i, new Vector(0, 0, 0));
|
||||
}
|
||||
|
||||
packet.a = getId();
|
||||
packet.b = 30;
|
||||
packet.c = (int) Math.floor(_entityLocation.getX() * 32);
|
||||
packet.d = (int) Math.floor(_entityLocation.getY() * 32);
|
||||
packet.e = (int) Math.floor(_entityLocation.getZ() * 32);
|
||||
packet.l = watcher;
|
||||
|
||||
PacketPlayOutEntityEquipment packet2 = new PacketPlayOutEntityEquipment();
|
||||
|
||||
packet2.a = getId();
|
||||
packet2.b = 4;
|
||||
packet2.c = CraftItemStack.asNMSCopy(_item);
|
||||
|
||||
return new Packet[]
|
||||
{
|
||||
packet, packet2
|
||||
};
|
||||
}
|
||||
}
|
@ -2,30 +2,27 @@ package nautilus.game.arcade.game.games.bossbattles;
|
||||
|
||||
import mineplex.minecraft.game.core.boss.ironwizard.GolemBoss;
|
||||
import mineplex.minecraft.game.core.boss.slimeking.SlimeBoss;
|
||||
import nautilus.game.arcade.game.games.bossbattles.displays.BossDisplay;
|
||||
import nautilus.game.arcade.game.games.bossbattles.displays.IronWizardDisplay;
|
||||
import nautilus.game.arcade.game.games.bossbattles.displays.SlimeKingDisplay;
|
||||
import mineplex.minecraft.game.core.boss.snake.SnakeBoss;
|
||||
import nautilus.game.arcade.game.games.bossbattles.displays.*;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public enum BattleBoss
|
||||
{
|
||||
GOLEM(GolemBoss.class, IronWizardDisplay.class, new ItemStack(
|
||||
Material.IRON_BLOCK)),
|
||||
GOLEM(GolemBoss.class, IronWizardDisplay.class),
|
||||
|
||||
SLIME(SlimeBoss.class, SlimeKingDisplay.class, new ItemStack(
|
||||
Material.EMERALD_BLOCK));
|
||||
SNAKE(SnakeBoss.class, SnakeDisplay.class),
|
||||
|
||||
SLIME(SlimeBoss.class, SlimeKingDisplay.class);
|
||||
|
||||
private Class _bossClass;
|
||||
private ItemStack _bossHead;
|
||||
private Class<? extends BossDisplay> _bossDisplay;
|
||||
|
||||
private BattleBoss(Class bossClass,
|
||||
Class<? extends BossDisplay> displayClass, ItemStack bossHead)
|
||||
Class<? extends BossDisplay> displayClass)
|
||||
{
|
||||
_bossClass = bossClass;
|
||||
_bossHead = bossHead;
|
||||
_bossDisplay = displayClass;
|
||||
}
|
||||
|
||||
@ -39,8 +36,4 @@ public enum BattleBoss
|
||||
return _bossDisplay;
|
||||
}
|
||||
|
||||
public ItemStack getItem()
|
||||
{
|
||||
return _bossHead;
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
@ -52,6 +53,16 @@ public class BossBattles extends TeamGame
|
||||
{
|
||||
"Fight some bosses"
|
||||
});
|
||||
|
||||
HungerSet = 20;
|
||||
CreatureAllowOverride = true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSpawn(CreatureSpawnEvent event)
|
||||
{
|
||||
if (event.getSpawnReason() != event.getSpawnReason().CUSTOM)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -110,12 +121,10 @@ public class BossBattles extends TeamGame
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureAllowOverride = false;
|
||||
|
||||
HandlerList.unregisterAll(_currentBoss);
|
||||
|
||||
// If the event was cancelled, we don't need to run a cleanup
|
||||
if (_currentBoss.getState() == EventState.COMPLETE)
|
||||
if (_currentBoss.getState() != EventState.CANCELLED)
|
||||
_currentBoss.cleanup();
|
||||
}
|
||||
|
||||
@ -224,7 +233,7 @@ public class BossBattles extends TeamGame
|
||||
int i = 0;
|
||||
ArrayList<Location> locations = UtilShapes.getPointsInCircle(
|
||||
new Location(UtilWorld.getWorld("world"), 0, 104, 0),
|
||||
BattleBoss.values().length, 5);
|
||||
BattleBoss.values().length, 4.5);
|
||||
|
||||
for (BattleBoss boss : BattleBoss.values())
|
||||
{
|
||||
@ -242,12 +251,12 @@ public class BossBattles extends TeamGame
|
||||
BossDisplay bossDisplay = constructor.newInstance(this,
|
||||
BattleBoss.values()[i], loc);
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(bossDisplay,
|
||||
getArcadeManager().getPlugin());
|
||||
|
||||
bossDisplay.start();
|
||||
bossDisplay.spawnHologram();
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(bossDisplay,
|
||||
getArcadeManager().getPlugin());
|
||||
|
||||
_displays.add(bossDisplay);
|
||||
|
||||
System.out.print(
|
||||
@ -281,14 +290,10 @@ public class BossBattles extends TeamGame
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureAllowOverride = true;
|
||||
|
||||
_currentBoss.start();
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(_currentBoss,
|
||||
getArcadeManager().getPlugin());
|
||||
|
||||
CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
public WorldEvent createInstance(Class clazz, Location centerLocation)
|
||||
|
@ -0,0 +1,74 @@
|
||||
package nautilus.game.arcade.game.games.bossbattles.displays;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import nautilus.game.arcade.game.games.bossbattles.BattleBoss;
|
||||
import nautilus.game.arcade.game.games.bossbattles.BossBattles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
|
||||
public class SnakeDisplay extends BossDisplay
|
||||
{
|
||||
private Sheep _sheep;
|
||||
|
||||
public SnakeDisplay(BossBattles plugin, BattleBoss boss,
|
||||
Location location)
|
||||
{
|
||||
super(plugin, boss, location);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (!event.getRightClicked().equals(_sheep))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
setChosen(event.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start()
|
||||
{
|
||||
Plugin.CreatureAllowOverride = true;
|
||||
|
||||
_sheep = (Sheep) getLocation().getWorld().spawnEntity(getLocation(),
|
||||
EntityType.SHEEP);
|
||||
|
||||
_sheep.teleport(getLocation());
|
||||
|
||||
UtilEnt.Vegetate(_sheep);
|
||||
|
||||
Plugin.CreatureAllowOverride = false;
|
||||
|
||||
addEntity(_sheep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName()
|
||||
{
|
||||
return C.cDGreen + "SNAAAAAAAAAAAAAAAAAKE";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnHologram()
|
||||
{
|
||||
super.spawnHologram();
|
||||
|
||||
getHologram().setFollowEntity(_sheep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getHologramLocation()
|
||||
{
|
||||
return _sheep.getEyeLocation().add(0, 0.1, 0);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user