HH CPU fixes
This commit is contained in:
parent
505dd57715
commit
1d4f902298
|
@ -23,6 +23,7 @@ import mineplex.core.common.util.UtilBlock;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
|
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||||
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;
|
||||||
|
@ -40,14 +41,13 @@ public class Halloween extends SoloGame
|
||||||
{
|
{
|
||||||
//Wave Data
|
//Wave Data
|
||||||
private ArrayList<ArrayList<Location>> _spawns;
|
private ArrayList<ArrayList<Location>> _spawns;
|
||||||
|
|
||||||
private ArrayList<WaveBase> _waves;
|
private ArrayList<WaveBase> _waves;
|
||||||
private int _wave = 0;
|
private int _wave = 0;
|
||||||
|
|
||||||
private int _maxMobs = 80;
|
private int _maxMobs = 80;
|
||||||
private HashSet<CreatureBase> _mobs = new HashSet<CreatureBase>();
|
private ArrayList<CreatureBase> _mobs = new ArrayList<CreatureBase>();
|
||||||
private PumpkinKing _king;
|
|
||||||
|
|
||||||
public Halloween(ArcadeManager manager)
|
public Halloween(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
super(manager, GameType.Halloween,
|
super(manager, GameType.Halloween,
|
||||||
|
@ -68,14 +68,14 @@ public class Halloween extends SoloGame
|
||||||
});
|
});
|
||||||
|
|
||||||
this.DamagePvP = false;
|
this.DamagePvP = false;
|
||||||
|
|
||||||
this.WorldTimeSet = 16000;
|
this.WorldTimeSet = 16000;
|
||||||
|
|
||||||
this.ItemDrop = false;
|
this.ItemDrop = false;
|
||||||
this.ItemPickup = false;
|
this.ItemPickup = false;
|
||||||
|
|
||||||
this.PrepareFreeze = false;
|
this.PrepareFreeze = false;
|
||||||
|
|
||||||
this.HungerSet = 20;
|
this.HungerSet = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ public class Halloween extends SoloGame
|
||||||
_spawns.add(WorldData.GetDataLocs("YELLOW"));
|
_spawns.add(WorldData.GetDataLocs("YELLOW"));
|
||||||
_spawns.add(WorldData.GetDataLocs("GREEN"));
|
_spawns.add(WorldData.GetDataLocs("GREEN"));
|
||||||
_spawns.add(WorldData.GetDataLocs("BLUE"));
|
_spawns.add(WorldData.GetDataLocs("BLUE"));
|
||||||
|
|
||||||
_waves = new ArrayList<WaveBase>();
|
_waves = new ArrayList<WaveBase>();
|
||||||
_waves.add(new Wave1(this));
|
//_waves.add(new Wave1(this));
|
||||||
_waves.add(new Wave2(this));
|
//_waves.add(new Wave2(this));
|
||||||
_waves.add(new Wave3(this));
|
//_waves.add(new Wave3(this));
|
||||||
_waves.add(new Wave4(this));
|
//_waves.add(new Wave4(this));
|
||||||
_waves.add(new Wave5(this));
|
//_waves.add(new Wave5(this));
|
||||||
_waves.add(new WaveBoss(this));
|
_waves.add(new WaveBoss(this));
|
||||||
_waves.add(new WaveVictory(this));
|
_waves.add(new WaveVictory(this));
|
||||||
}
|
}
|
||||||
|
@ -106,19 +106,19 @@ public class Halloween extends SoloGame
|
||||||
|
|
||||||
GetTeamList().add(new GameTeam("Pumpkin King", ChatColor.RED, WorldData.GetDataLocs("RED")));
|
GetTeamList().add(new GameTeam("Pumpkin King", ChatColor.RED, WorldData.GetDataLocs("RED")));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void SoundUpdate(UpdateEvent event)
|
public void SoundUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
if (event.getType() != UpdateType.SLOW)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!IsLive())
|
if (!IsLive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Math.random() > 0.85)
|
if (Math.random() > 0.85)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (Player player : UtilServer.getPlayers())
|
for (Player player : UtilServer.getPlayers())
|
||||||
player.playSound(player.getLocation(), Sound.AMBIENCE_CAVE, 3f, 1f);
|
player.playSound(player.getLocation(), Sound.AMBIENCE_CAVE, 3f, 1f);
|
||||||
}
|
}
|
||||||
|
@ -135,32 +135,53 @@ public class Halloween extends SoloGame
|
||||||
if (_waves.get(_wave).Update(_wave+1))
|
if (_waves.get(_wave).Update(_wave+1))
|
||||||
{
|
{
|
||||||
_wave++;
|
_wave++;
|
||||||
|
|
||||||
EndCheck();
|
EndCheck();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<Location> GetSpawnSet(int i)
|
public ArrayList<Location> GetSpawnSet(int i)
|
||||||
{
|
{
|
||||||
return _spawns.get(i);
|
return _spawns.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location GetRandomSpawn()
|
public Location GetRandomSpawn()
|
||||||
{
|
{
|
||||||
ArrayList<Location> locSet = GetSpawnSet(UtilMath.r(_spawns.size()));
|
ArrayList<Location> locSet = GetSpawnSet(UtilMath.r(_spawns.size()));
|
||||||
return locSet.get(UtilMath.r(locSet.size()));
|
return locSet.get(UtilMath.r(locSet.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddCreature(CreatureBase mob)
|
public void AddCreature(CreatureBase mob)
|
||||||
{
|
{
|
||||||
_mobs.add(mob);
|
_mobs.add(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashSet<CreatureBase> GetCreatures()
|
public ArrayList<CreatureBase> GetCreatures()
|
||||||
{
|
{
|
||||||
return _mobs;
|
return _mobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void CreatureMoveUpdate(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.TICK)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (_mobs.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
CreatureBase base = _mobs.remove(0);
|
||||||
|
|
||||||
|
if (base instanceof InterfaceMove)
|
||||||
|
{
|
||||||
|
InterfaceMove move = (InterfaceMove)base;
|
||||||
|
|
||||||
|
move.Move();
|
||||||
|
}
|
||||||
|
|
||||||
|
_mobs.add(base);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void CreatureUpdate(UpdateEvent event)
|
public void CreatureUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
|
@ -177,21 +198,21 @@ public class Halloween extends SoloGame
|
||||||
mobIterator.remove();
|
mobIterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void CreatureDamage(CustomDamageEvent event)
|
public void CreatureDamage(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
for (CreatureBase base : _mobs)
|
for (CreatureBase base : _mobs)
|
||||||
base.Damage(event);
|
base.Damage(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void CreatureTarget(EntityTargetEvent event)
|
public void CreatureTarget(EntityTargetEvent event)
|
||||||
{
|
{
|
||||||
for (CreatureBase base : _mobs)
|
for (CreatureBase base : _mobs)
|
||||||
base.Target(event);
|
base.Target(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST)
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
public void EntityDeath(EntityDeathEvent event)
|
public void EntityDeath(EntityDeathEvent event)
|
||||||
{
|
{
|
||||||
|
@ -212,7 +233,7 @@ public class Halloween extends SoloGame
|
||||||
Manager.GetGame().AddGems(player, 30, "Killing the Pumpkin King", false);
|
Manager.GetGame().AddGems(player, 30, "Killing the Pumpkin King", false);
|
||||||
Manager.GetGame().AddGems(player, 10, "Participation", false);
|
Manager.GetGame().AddGems(player, 10, "Participation", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetState(GameState.End);
|
SetState(GameState.End);
|
||||||
SetCustomWinLine("You earned Pumpkin Kings Head!");
|
SetCustomWinLine("You earned Pumpkin Kings Head!");
|
||||||
AnnounceEnd(this.GetTeamList().get(0));
|
AnnounceEnd(this.GetTeamList().get(0));
|
||||||
|
@ -224,66 +245,66 @@ public class Halloween extends SoloGame
|
||||||
{
|
{
|
||||||
Manager.GetGame().AddGems(player, 10, "Participation", false);
|
Manager.GetGame().AddGems(player, 10, "Participation", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetState(GameState.End);
|
SetState(GameState.End);
|
||||||
SetCustomWinLine("You lost...");
|
SetCustomWinLine("You lost...");
|
||||||
AnnounceEnd(this.GetTeamList().get(1));
|
AnnounceEnd(this.GetTeamList().get(1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST)
|
@EventHandler(priority = EventPriority.LOWEST)
|
||||||
public void Explosion(EntityExplodeEvent event)
|
public void Explosion(EntityExplodeEvent event)
|
||||||
{
|
{
|
||||||
if (event.getEntity() instanceof Fireball)
|
if (event.getEntity() instanceof Fireball)
|
||||||
{
|
{
|
||||||
event.blockList().clear();
|
event.blockList().clear();
|
||||||
|
|
||||||
Collection<Block> blocks = UtilBlock.getInRadius(event.getLocation(), 3.5d).keySet();
|
Collection<Block> blocks = UtilBlock.getInRadius(event.getLocation(), 3.5d).keySet();
|
||||||
|
|
||||||
Iterator<Block> blockIterator = blocks.iterator();
|
Iterator<Block> blockIterator = blocks.iterator();
|
||||||
|
|
||||||
while (blockIterator.hasNext())
|
while (blockIterator.hasNext())
|
||||||
{
|
{
|
||||||
Block block = blockIterator.next();
|
Block block = blockIterator.next();
|
||||||
|
|
||||||
if (block.getY() < 4)
|
if (block.getY() < 4)
|
||||||
blockIterator.remove();
|
blockIterator.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager.GetExplosion().BlockExplosion(blocks, event.getLocation(), false);
|
Manager.GetExplosion().BlockExplosion(blocks, event.getLocation(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void ItemSpawn(ItemSpawnEvent event)
|
public void ItemSpawn(ItemSpawnEvent event)
|
||||||
{
|
{
|
||||||
Material type = event.getEntity().getItemStack().getType();
|
Material type = event.getEntity().getItemStack().getType();
|
||||||
|
|
||||||
if (type == Material.DIAMOND_AXE || type == Material.FIRE || type == Material.SNOW_BALL)
|
if (type == Material.DIAMOND_AXE || type == Material.FIRE || type == Material.SNOW_BALL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void GemAward(CustomDamageEvent event)
|
public void GemAward(CustomDamageEvent event)
|
||||||
{
|
{
|
||||||
if (event.IsCancelled())
|
if (event.IsCancelled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player player = event.GetDamagerPlayer(true);
|
Player player = event.GetDamagerPlayer(true);
|
||||||
if (player == null) return;
|
if (player == null) return;
|
||||||
|
|
||||||
for (int i=0 ; i<event.GetDamage() ; i++)
|
for (int i=0 ; i<event.GetDamage() ; i++)
|
||||||
Manager.GetGame().AddGems(player, 0.02, "Damage", true);
|
Manager.GetGame().AddGems(player, 0.02, "Damage", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetMaxMobs()
|
public int GetMaxMobs()
|
||||||
{
|
{
|
||||||
return _maxMobs;
|
return _maxMobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private long _helpTimer = 0;
|
private long _helpTimer = 0;
|
||||||
private int _helpIndex = 0;
|
private int _helpIndex = 0;
|
||||||
private String[] _help = new String[]
|
private String[] _help = new String[]
|
||||||
|
@ -298,23 +319,23 @@ public class Halloween extends SoloGame
|
||||||
C.cAqua + "Stick together to survive.",
|
C.cAqua + "Stick together to survive.",
|
||||||
C.cGreen + "The Pumpkin King gets harder over time!",
|
C.cGreen + "The Pumpkin King gets harder over time!",
|
||||||
};
|
};
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void StateUpdate(UpdateEvent event)
|
public void StateUpdate(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SEC)
|
if (event.getType() != UpdateType.SEC)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.GetState() != GameState.Recruit)
|
if (this.GetState() != GameState.Recruit)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!UtilTime.elapsed(_helpTimer, 8000))
|
if (!UtilTime.elapsed(_helpTimer, 8000))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_helpTimer = System.currentTimeMillis();
|
_helpTimer = System.currentTimeMillis();
|
||||||
|
|
||||||
Announce(C.cWhite + C.Bold + "TIP " + ChatColor.RESET + _help[_helpIndex]);
|
Announce(C.cWhite + C.Bold + "TIP " + ChatColor.RESET + _help[_helpIndex]);
|
||||||
|
|
||||||
_helpIndex = (_helpIndex + 1)%_help.length;
|
_helpIndex = (_helpIndex + 1)%_help.length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilAlg;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
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;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
|
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||||
|
import net.minecraft.server.v1_6_R3.Navigation;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
@ -106,4 +110,23 @@ public abstract class CreatureBase<T extends LivingEntity>
|
||||||
public abstract void Damage(CustomDamageEvent event);
|
public abstract void Damage(CustomDamageEvent event);
|
||||||
|
|
||||||
public abstract void Target(EntityTargetEvent event);
|
public abstract void Target(EntityTargetEvent event);
|
||||||
|
|
||||||
|
public void DefaultMove()
|
||||||
|
{
|
||||||
|
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
||||||
|
Navigation nav = ec.getNavigation();
|
||||||
|
|
||||||
|
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 16)
|
||||||
|
{
|
||||||
|
Location target = GetEntity().getLocation();
|
||||||
|
|
||||||
|
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(16));
|
||||||
|
|
||||||
|
nav.a(target.getX(), target.getY(), target.getZ(), 1f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||||
|
|
||||||
|
public interface InterfaceMove
|
||||||
|
{
|
||||||
|
public void Move();
|
||||||
|
}
|
|
@ -1,21 +1,16 @@
|
||||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
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;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
|
||||||
import org.bukkit.entity.Creeper;
|
import org.bukkit.entity.Creeper;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
|
||||||
public class MobCreeper extends CreatureBase<Creeper>
|
public class MobCreeper extends CreatureBase<Creeper> implements InterfaceMove
|
||||||
{
|
{
|
||||||
public MobCreeper(Game game, Location loc)
|
public MobCreeper(Game game, Location loc)
|
||||||
{
|
{
|
||||||
|
@ -26,6 +21,8 @@ public class MobCreeper extends CreatureBase<Creeper>
|
||||||
public void SpawnCustom(Creeper ent)
|
public void SpawnCustom(Creeper ent)
|
||||||
{
|
{
|
||||||
ent.setCustomName("Creeper");
|
ent.setCustomName("Creeper");
|
||||||
|
|
||||||
|
Move();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -43,14 +40,16 @@ public class MobCreeper extends CreatureBase<Creeper>
|
||||||
@Override
|
@Override
|
||||||
public void Update(UpdateEvent event)
|
public void Update(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
public void Move()
|
||||||
|
{
|
||||||
//New Target via Distance
|
//New Target via Distance
|
||||||
if (GetTarget() == null ||
|
if (GetTarget() == null ||
|
||||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||||
{
|
{
|
||||||
SetTarget(GetRoamTarget());
|
SetTarget(GetRoamTarget());
|
||||||
return;
|
return;
|
||||||
|
@ -67,21 +66,7 @@ public class MobCreeper extends CreatureBase<Creeper>
|
||||||
//Move
|
//Move
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
DefaultMove();
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
|
|
||||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
|
||||||
{
|
|
||||||
Location target = GetEntity().getLocation();
|
|
||||||
|
|
||||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
|
||||||
|
|
||||||
nav.a(target.getX(), target.getY(), target.getZ(), 1f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,6 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
|
|
||||||
public class MobGhast extends CreatureBase<Ghast>
|
public class MobGhast extends CreatureBase<Ghast>
|
||||||
{
|
{
|
||||||
private Location _loc;
|
|
||||||
|
|
||||||
public MobGhast(Game game, Location loc)
|
public MobGhast(Game game, Location loc)
|
||||||
{
|
{
|
||||||
super(game, null, Ghast.class, loc);
|
super(game, null, Ghast.class, loc);
|
||||||
|
@ -23,9 +21,6 @@ public class MobGhast extends CreatureBase<Ghast>
|
||||||
@Override
|
@Override
|
||||||
public void SpawnCustom(Ghast ent)
|
public void SpawnCustom(Ghast ent)
|
||||||
{
|
{
|
||||||
//UtilEnt.Vegetate(ent);
|
|
||||||
_loc = ent.getLocation();
|
|
||||||
|
|
||||||
ent.setMaxHealth(80);
|
ent.setMaxHealth(80);
|
||||||
ent.setHealth(80);
|
ent.setHealth(80);
|
||||||
|
|
||||||
|
|
|
@ -1,22 +1,17 @@
|
||||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.disguise.disguises.DisguisePigZombie;
|
import mineplex.core.disguise.disguises.DisguisePigZombie;
|
||||||
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;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
|
||||||
public class MobPigZombie extends CreatureBase<Zombie>
|
public class MobPigZombie extends CreatureBase<Zombie> implements InterfaceMove
|
||||||
{
|
{
|
||||||
public MobPigZombie(Game game, Location loc)
|
public MobPigZombie(Game game, Location loc)
|
||||||
{
|
{
|
||||||
|
@ -32,6 +27,8 @@ public class MobPigZombie extends CreatureBase<Zombie>
|
||||||
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 1, false, false, false);
|
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 1, false, false, false);
|
||||||
|
|
||||||
ent.setCustomName("Nether Zombie");
|
ent.setCustomName("Nether Zombie");
|
||||||
|
|
||||||
|
Move();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,11 +46,10 @@ public class MobPigZombie extends CreatureBase<Zombie>
|
||||||
@Override
|
@Override
|
||||||
public void Update(UpdateEvent event)
|
public void Update(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.SLOW)
|
|
||||||
Move();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Move()
|
public void Move()
|
||||||
{
|
{
|
||||||
//New Target via Distance
|
//New Target via Distance
|
||||||
if (GetTarget() == null ||
|
if (GetTarget() == null ||
|
||||||
|
@ -76,21 +72,7 @@ public class MobPigZombie extends CreatureBase<Zombie>
|
||||||
//Move
|
//Move
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
DefaultMove();
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
|
|
||||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
|
||||||
{
|
|
||||||
Location target = GetEntity().getLocation();
|
|
||||||
|
|
||||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
|
||||||
|
|
||||||
nav.a(target.getX(), target.getY(), target.getZ(), 1f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,18 @@
|
||||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
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;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class MobSkeletonArcher extends CreatureBase<Skeleton>
|
public class MobSkeletonArcher extends CreatureBase<Skeleton> implements InterfaceMove
|
||||||
{
|
{
|
||||||
public MobSkeletonArcher(Game game, Location loc)
|
public MobSkeletonArcher(Game game, Location loc)
|
||||||
{
|
{
|
||||||
|
@ -31,6 +26,8 @@ public class MobSkeletonArcher extends CreatureBase<Skeleton>
|
||||||
ent.setCustomName("Skeleton Archer");
|
ent.setCustomName("Skeleton Archer");
|
||||||
|
|
||||||
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 0, false, false, false);
|
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 0, false, false, false);
|
||||||
|
|
||||||
|
Move();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,14 +45,16 @@ public class MobSkeletonArcher extends CreatureBase<Skeleton>
|
||||||
@Override
|
@Override
|
||||||
public void Update(UpdateEvent event)
|
public void Update(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
public void Move()
|
||||||
|
{
|
||||||
//New Target via Distance
|
//New Target via Distance
|
||||||
if (GetTarget() == null ||
|
if (GetTarget() == null ||
|
||||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||||
{
|
{
|
||||||
SetTarget(GetRoamTarget());
|
SetTarget(GetRoamTarget());
|
||||||
return;
|
return;
|
||||||
|
@ -72,21 +71,7 @@ public class MobSkeletonArcher extends CreatureBase<Skeleton>
|
||||||
//Move
|
//Move
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
DefaultMove();
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
|
|
||||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
|
||||||
{
|
|
||||||
Location target = GetEntity().getLocation();
|
|
||||||
|
|
||||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
|
||||||
|
|
||||||
nav.a(target.getX(), target.getY(), target.getZ(), 1f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,25 +1,19 @@
|
||||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
|
||||||
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;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class MobSkeletonWarrior extends CreatureBase<Zombie>
|
public class MobSkeletonWarrior extends CreatureBase<Zombie> implements InterfaceMove
|
||||||
{
|
{
|
||||||
public MobSkeletonWarrior(Game game, Location loc)
|
public MobSkeletonWarrior(Game game, Location loc)
|
||||||
{
|
{
|
||||||
|
@ -35,6 +29,8 @@ public class MobSkeletonWarrior extends CreatureBase<Zombie>
|
||||||
ent.getEquipment().setItemInHand(new ItemStack(Material.WOOD_HOE));
|
ent.getEquipment().setItemInHand(new ItemStack(Material.WOOD_HOE));
|
||||||
|
|
||||||
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 0, false, false, false);
|
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 0, false, false, false);
|
||||||
|
|
||||||
|
Move();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,14 +48,16 @@ public class MobSkeletonWarrior extends CreatureBase<Zombie>
|
||||||
@Override
|
@Override
|
||||||
public void Update(UpdateEvent event)
|
public void Update(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() != UpdateType.SLOW)
|
|
||||||
return;
|
}
|
||||||
|
|
||||||
|
public void Move()
|
||||||
|
{
|
||||||
//New Target via Distance
|
//New Target via Distance
|
||||||
if (GetTarget() == null ||
|
if (GetTarget() == null ||
|
||||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||||
{
|
{
|
||||||
SetTarget(GetRoamTarget());
|
SetTarget(GetRoamTarget());
|
||||||
return;
|
return;
|
||||||
|
@ -76,21 +74,7 @@ public class MobSkeletonWarrior extends CreatureBase<Zombie>
|
||||||
//Move
|
//Move
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
DefaultMove();
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
|
|
||||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
|
||||||
{
|
|
||||||
Location target = GetEntity().getLocation();
|
|
||||||
|
|
||||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
|
||||||
|
|
||||||
nav.a(target.getX(), target.getY(), target.getZ(), 1f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,12 @@ 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;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
|
||||||
import org.bukkit.entity.CaveSpider;
|
import org.bukkit.entity.CaveSpider;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
|
||||||
public class MobSpiderLeaper extends CreatureBase<CaveSpider>
|
public class MobSpiderLeaper extends CreatureBase<CaveSpider> implements InterfaceMove
|
||||||
{
|
{
|
||||||
public MobSpiderLeaper(Game game, Location loc)
|
public MobSpiderLeaper(Game game, Location loc)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +27,8 @@ public class MobSpiderLeaper extends CreatureBase<CaveSpider>
|
||||||
ent.setCustomName("Leaping Spider");
|
ent.setCustomName("Leaping Spider");
|
||||||
|
|
||||||
Host.Manager.GetCondition().Factory().Speed("Speed", GetEntity(), GetEntity(), 99999, 1, false, false, false);
|
Host.Manager.GetCondition().Factory().Speed("Speed", GetEntity(), GetEntity(), 99999, 1, false, false, false);
|
||||||
|
|
||||||
|
Move();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -47,9 +46,6 @@ public class MobSpiderLeaper extends CreatureBase<CaveSpider>
|
||||||
@Override
|
@Override
|
||||||
public void Update(UpdateEvent event)
|
public void Update(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.SLOW)
|
|
||||||
Move();
|
|
||||||
|
|
||||||
if (event.getType() == UpdateType.SEC)
|
if (event.getType() == UpdateType.SEC)
|
||||||
Leap();
|
Leap();
|
||||||
}
|
}
|
||||||
|
@ -71,7 +67,7 @@ public class MobSpiderLeaper extends CreatureBase<CaveSpider>
|
||||||
UtilAction.velocity(GetEntity(), UtilAlg.getTrajectory2d(GetEntity().getLocation(), GetTarget()), 1, true, 0.6, 0, 10, true);
|
UtilAction.velocity(GetEntity(), UtilAlg.getTrajectory2d(GetEntity().getLocation(), GetTarget()), 1, true, 0.6, 0, 10, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Move()
|
public void Move()
|
||||||
{
|
{
|
||||||
//New Target via Distance
|
//New Target via Distance
|
||||||
if (GetTarget() == null ||
|
if (GetTarget() == null ||
|
||||||
|
@ -94,21 +90,7 @@ public class MobSpiderLeaper extends CreatureBase<CaveSpider>
|
||||||
//Move
|
//Move
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
DefaultMove();
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
|
|
||||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
|
||||||
{
|
|
||||||
Location target = GetEntity().getLocation();
|
|
||||||
|
|
||||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
|
||||||
|
|
||||||
nav.a(target.getX(), target.getY(), target.getZ(), 1.6f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1.2f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||||
|
@ -8,17 +7,14 @@ 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;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
|
||||||
public class MobSpiderWebber extends CreatureBase<Zombie>
|
public class MobSpiderSmasher extends CreatureBase<Zombie> implements InterfaceMove
|
||||||
{
|
{
|
||||||
public MobSpiderWebber(Game game, Location loc)
|
public MobSpiderSmasher(Game game, Location loc)
|
||||||
{
|
{
|
||||||
super(game, null, Zombie.class, loc);
|
super(game, null, Zombie.class, loc);
|
||||||
}
|
}
|
||||||
|
@ -29,6 +25,8 @@ public class MobSpiderWebber extends CreatureBase<Zombie>
|
||||||
DisguiseSpider spider = new DisguiseSpider(ent);
|
DisguiseSpider spider = new DisguiseSpider(ent);
|
||||||
Host.Manager.GetDisguise().disguise(spider);
|
Host.Manager.GetDisguise().disguise(spider);
|
||||||
ent.setCustomName("Smashing Spider");
|
ent.setCustomName("Smashing Spider");
|
||||||
|
|
||||||
|
Move();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,14 +44,11 @@ public class MobSpiderWebber extends CreatureBase<Zombie>
|
||||||
@Override
|
@Override
|
||||||
public void Update(UpdateEvent event)
|
public void Update(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.SLOW)
|
|
||||||
Move();
|
|
||||||
|
|
||||||
if (event.getType() == UpdateType.SLOW)
|
if (event.getType() == UpdateType.SLOW)
|
||||||
Speed();
|
Speed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Move()
|
public void Move()
|
||||||
{
|
{
|
||||||
//New Target via Distance
|
//New Target via Distance
|
||||||
if (GetTarget() == null ||
|
if (GetTarget() == null ||
|
||||||
|
@ -76,21 +71,7 @@ public class MobSpiderWebber extends CreatureBase<Zombie>
|
||||||
//Move
|
//Move
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
DefaultMove();
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
|
|
||||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
|
||||||
{
|
|
||||||
Location target = GetEntity().getLocation();
|
|
||||||
|
|
||||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
|
||||||
|
|
||||||
nav.a(target.getX(), target.getY(), target.getZ(), 1.6f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1.2f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,106 +0,0 @@
|
||||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAction;
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
|
||||||
import mineplex.core.common.util.UtilTime;
|
|
||||||
import mineplex.core.updater.UpdateType;
|
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
|
||||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
|
||||||
import nautilus.game.arcade.game.Game;
|
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
|
||||||
import org.bukkit.entity.ThrownPotion;
|
|
||||||
import org.bukkit.entity.Witch;
|
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
|
||||||
|
|
||||||
public class MobWitch extends CreatureBase<Witch>
|
|
||||||
{
|
|
||||||
public MobWitch(Game game, Location loc)
|
|
||||||
{
|
|
||||||
super(game, null, Witch.class, loc);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void SpawnCustom(Witch ent)
|
|
||||||
{
|
|
||||||
Move();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Damage(CustomDamageEvent event)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Update(UpdateEvent event)
|
|
||||||
{
|
|
||||||
if (event.getType() == UpdateType.SEC)
|
|
||||||
Move();
|
|
||||||
|
|
||||||
if (event.getType() == UpdateType.SLOW)
|
|
||||||
Potion();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Potion()
|
|
||||||
{
|
|
||||||
if (GetEntity().getTarget() == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ThrownPotion pot = GetEntity().launchProjectile(ThrownPotion.class);
|
|
||||||
|
|
||||||
Host.Announce("THROWN");
|
|
||||||
UtilAction.velocity(pot, UtilAlg.getTrajectory(GetEntity(), GetEntity().getTarget()), 1.2, false, 0, 0.3, 10, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Move()
|
|
||||||
{
|
|
||||||
//New Target via Distance
|
|
||||||
if (GetTarget() == null ||
|
|
||||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
|
||||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
|
||||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
|
||||||
{
|
|
||||||
SetTarget(GetRoamTarget());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Untarget
|
|
||||||
if (GetEntity().getTarget() != null)
|
|
||||||
{
|
|
||||||
if (UtilMath.offset2d(GetEntity(), GetEntity().getTarget()) > 10)
|
|
||||||
{
|
|
||||||
GetEntity().setTarget(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//Move
|
|
||||||
else
|
|
||||||
{
|
|
||||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
|
|
||||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
|
||||||
{
|
|
||||||
Location target = GetEntity().getLocation();
|
|
||||||
|
|
||||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
|
||||||
|
|
||||||
nav.a(target.getX(), target.getY(), target.getZ(), 1.6f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1.2f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void Target(EntityTargetEvent event)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,21 +1,17 @@
|
||||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilAlg;
|
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
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;
|
||||||
import nautilus.game.arcade.game.Game;
|
import nautilus.game.arcade.game.Game;
|
||||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
|
||||||
import net.minecraft.server.v1_6_R3.Navigation;
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
|
||||||
import org.bukkit.entity.Zombie;
|
import org.bukkit.entity.Zombie;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
|
|
||||||
public class MobZombie extends CreatureBase<Zombie>
|
public class MobZombie extends CreatureBase<Zombie> implements InterfaceMove
|
||||||
{
|
{
|
||||||
public MobZombie(Game game, Location loc)
|
public MobZombie(Game game, Location loc)
|
||||||
{
|
{
|
||||||
|
@ -38,14 +34,11 @@ public class MobZombie extends CreatureBase<Zombie>
|
||||||
@Override
|
@Override
|
||||||
public void Update(UpdateEvent event)
|
public void Update(UpdateEvent event)
|
||||||
{
|
{
|
||||||
if (event.getType() == UpdateType.SLOW)
|
|
||||||
Move();
|
|
||||||
|
|
||||||
if (event.getType() == UpdateType.SLOW)
|
if (event.getType() == UpdateType.SLOW)
|
||||||
Speed();
|
Speed();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Move()
|
public void Move()
|
||||||
{
|
{
|
||||||
//New Target via Distance
|
//New Target via Distance
|
||||||
if (GetTarget() == null ||
|
if (GetTarget() == null ||
|
||||||
|
@ -68,21 +61,7 @@ public class MobZombie extends CreatureBase<Zombie>
|
||||||
//Move
|
//Move
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
DefaultMove();
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
|
|
||||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
|
||||||
{
|
|
||||||
Location target = GetEntity().getLocation();
|
|
||||||
|
|
||||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
|
||||||
|
|
||||||
nav.a(target.getX(), target.getY(), target.getZ(), 1f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,22 +56,23 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
|
|
||||||
private ArrayList<Skeleton> _minions = new ArrayList<Skeleton>();
|
private ArrayList<Skeleton> _minions = new ArrayList<Skeleton>();
|
||||||
private int _minionsMax = 12; //12
|
private int _minionsMax = 12; //12
|
||||||
private HashMap<Entity, Player> _minionTargets = new HashMap<Entity, Player>();
|
|
||||||
private boolean _minionSpawn = true;
|
private boolean _minionSpawn = true;
|
||||||
|
private HashMap<Entity, Player> _minionTargets = new HashMap<Entity, Player>();
|
||||||
|
private HashMap<Skeleton, Long> _minionAttack = new HashMap<Skeleton, Long>();
|
||||||
|
|
||||||
private ArrayList<Slime> _shields = new ArrayList<Slime>();
|
private ArrayList<Slime> _shields = new ArrayList<Slime>();
|
||||||
private int _shieldsMax = 6; //6
|
private int _shieldsMax = 6; //6
|
||||||
private long _shieldSpawn = 0;
|
private long _shieldSpawn = 0;
|
||||||
|
|
||||||
private Location _kingLocation;
|
private Location _kingLocation;
|
||||||
private Player _kingTarget = null;
|
private Player _kingTarget = null;
|
||||||
|
|
||||||
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
|
private HashSet<Arrow> _arrows = new HashSet<Arrow>();
|
||||||
|
|
||||||
public PumpkinKing(Game game, Location loc)
|
public PumpkinKing(Game game, Location loc)
|
||||||
{
|
{
|
||||||
super(game, null, Skeleton.class, loc);
|
super(game, null, Skeleton.class, loc);
|
||||||
|
|
||||||
_kingLocation = loc;
|
_kingLocation = loc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
|
|
||||||
ent.setMaxHealth(400);
|
ent.setMaxHealth(400);
|
||||||
ent.setHealth(ent.getMaxHealth());
|
ent.setHealth(ent.getMaxHealth());
|
||||||
|
|
||||||
ent.getWorld().strikeLightningEffect(ent.getLocation());
|
ent.getWorld().strikeLightningEffect(ent.getLocation());
|
||||||
ent.getWorld().strikeLightningEffect(ent.getLocation());
|
ent.getWorld().strikeLightningEffect(ent.getLocation());
|
||||||
ent.getWorld().strikeLightningEffect(ent.getLocation());
|
ent.getWorld().strikeLightningEffect(ent.getLocation());
|
||||||
|
@ -97,7 +98,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
{
|
{
|
||||||
if (event.GetProjectile() != null)
|
if (event.GetProjectile() != null)
|
||||||
event.GetProjectile().remove();
|
event.GetProjectile().remove();
|
||||||
|
|
||||||
if (_shields.size() > 0)
|
if (_shields.size() > 0)
|
||||||
{
|
{
|
||||||
event.SetCancelled("Shielded");
|
event.SetCancelled("Shielded");
|
||||||
|
@ -108,10 +109,10 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
event.SetCancelled("Shielded");
|
event.SetCancelled("Shielded");
|
||||||
UtilPlayer.message(event.GetDamagerPlayer(true), F.main("Boss", "You must destroy " + F.elem("Pumpkin Minions") + " first!"));
|
UtilPlayer.message(event.GetDamagerPlayer(true), F.main("Boss", "You must destroy " + F.elem("Pumpkin Minions") + " first!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.GetDamagerPlayer(true) == null)
|
if (event.GetDamagerPlayer(true) == null)
|
||||||
event.SetCancelled("Non-Player");
|
event.SetCancelled("Non-Player");
|
||||||
|
|
||||||
event.SetKnockback(false);
|
event.SetKnockback(false);
|
||||||
}
|
}
|
||||||
//Attacked Minion
|
//Attacked Minion
|
||||||
|
@ -119,7 +120,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
{
|
{
|
||||||
if (event.GetProjectile() != null)
|
if (event.GetProjectile() != null)
|
||||||
event.GetProjectile().remove();
|
event.GetProjectile().remove();
|
||||||
|
|
||||||
if (_shields.size() > 0)
|
if (_shields.size() > 0)
|
||||||
{
|
{
|
||||||
event.SetCancelled("Shielded");
|
event.SetCancelled("Shielded");
|
||||||
|
@ -138,9 +139,9 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
|
|
||||||
if (event.GetCause() != DamageCause.PROJECTILE && event.GetCause() != DamageCause.LIGHTNING)
|
if (event.GetCause() != DamageCause.PROJECTILE && event.GetCause() != DamageCause.LIGHTNING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
event.GetProjectile().remove();
|
event.GetProjectile().remove();
|
||||||
|
|
||||||
if (event.GetDamagerPlayer(true) == null)
|
if (event.GetDamagerPlayer(true) == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -175,27 +176,33 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
|
|
||||||
//Minions
|
//Minions
|
||||||
if (event.getType() == UpdateType.TICK)
|
if (event.getType() == UpdateType.TICK)
|
||||||
MinionControl();
|
MinionOrbit();
|
||||||
|
|
||||||
|
if (event.getType() == UpdateType.TICK)
|
||||||
|
MinionAttack();
|
||||||
|
|
||||||
|
if (event.getType() == UpdateType.TICK)
|
||||||
|
MinionAttackDamage();
|
||||||
|
|
||||||
if (event.getType() == UpdateType.FASTEST)
|
if (event.getType() == UpdateType.FASTEST)
|
||||||
MinionArrow();
|
MinionArrow();
|
||||||
|
|
||||||
if (event.getType() == UpdateType.FAST)
|
if (event.getType() == UpdateType.FAST)
|
||||||
MinionSpawn();
|
MinionSpawn();
|
||||||
|
|
||||||
//Final
|
//Final
|
||||||
if (event.getType() == UpdateType.FAST)
|
if (event.getType() == UpdateType.FAST)
|
||||||
KingControl();
|
KingControl();
|
||||||
|
|
||||||
if (event.getType() == UpdateType.SEC)
|
if (event.getType() == UpdateType.SEC)
|
||||||
KingLeap();
|
KingLeap();
|
||||||
|
|
||||||
if (event.getType() == UpdateType.SEC)
|
if (event.getType() == UpdateType.SEC)
|
||||||
KingBomb();
|
KingBomb();
|
||||||
|
|
||||||
if (event.getType() == UpdateType.SLOW)
|
if (event.getType() == UpdateType.SLOW)
|
||||||
KingTarget();
|
KingTarget();
|
||||||
|
|
||||||
if (event.getType() == UpdateType.TICK)
|
if (event.getType() == UpdateType.TICK)
|
||||||
KingTrail();
|
KingTrail();
|
||||||
|
|
||||||
|
@ -207,6 +214,8 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
ShieldSpawn();
|
ShieldSpawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void KingTrail()
|
private void KingTrail()
|
||||||
{
|
{
|
||||||
if (GetState() >= 4)
|
if (GetState() >= 4)
|
||||||
|
@ -228,7 +237,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
{
|
{
|
||||||
if (_kingTarget == null)
|
if (_kingTarget == null)
|
||||||
_kingTarget = GetRandomPlayer();
|
_kingTarget = GetRandomPlayer();
|
||||||
|
|
||||||
GetEntity().setTarget(_kingTarget);
|
GetEntity().setTarget(_kingTarget);
|
||||||
|
|
||||||
Location loc = _kingTarget.getLocation();
|
Location loc = _kingTarget.getLocation();
|
||||||
|
@ -250,31 +259,31 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
{
|
{
|
||||||
if (GetState() < 4)
|
if (GetState() < 4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_kingTarget == null)
|
if (_kingTarget == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Math.random() > 0.4)
|
if (Math.random() > 0.4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UtilAction.velocity(GetEntity(), UtilAlg.getTrajectory2d(GetEntity(), _kingTarget), 1.2, false, 0, 0.4, 10, true);
|
UtilAction.velocity(GetEntity(), UtilAlg.getTrajectory2d(GetEntity(), _kingTarget), 1.2, false, 0, 0.4, 10, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void KingBomb()
|
private void KingBomb()
|
||||||
{
|
{
|
||||||
if (GetState() < 4)
|
if (GetState() < 4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_kingTarget == null)
|
if (_kingTarget == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Math.random() > 0.4)
|
if (Math.random() > 0.4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TNTPrimed tnt = GetEntity().getWorld().spawn(GetEntity().getEyeLocation().add(GetEntity().getLocation().getDirection()), TNTPrimed.class);
|
TNTPrimed tnt = GetEntity().getWorld().spawn(GetEntity().getEyeLocation().add(GetEntity().getLocation().getDirection()), TNTPrimed.class);
|
||||||
|
|
||||||
Player target = GetRandomPlayer();
|
Player target = GetRandomPlayer();
|
||||||
|
|
||||||
UtilAction.velocity(tnt, UtilAlg.getTrajectory(tnt, target), 1.2, false, 0, 0.4, 10, false);
|
UtilAction.velocity(tnt, UtilAlg.getTrajectory(tnt, target), 1.2, false, 0, 0.4, 10, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,79 +332,138 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
if (!_minionSpawn)
|
if (!_minionSpawn)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_minions.size() >= _minionsMax)
|
for (int i=0 ; i<_minionsMax ; i++)
|
||||||
{
|
{
|
||||||
_minionSpawn = false;
|
Host.CreatureAllowOverride = true;
|
||||||
return;
|
Skeleton skel = GetEntity().getWorld().spawn(GetEntity().getLocation(), Skeleton.class);
|
||||||
}
|
Host.CreatureAllowOverride = false;
|
||||||
|
|
||||||
|
Host.Manager.GetCondition().Factory().Invisible("Cloak", skel, skel, 999999, 0, false, false, false);
|
||||||
|
|
||||||
Host.CreatureAllowOverride = true;
|
skel.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
|
||||||
Skeleton skel = GetEntity().getWorld().spawn(GetEntity().getLocation(), Skeleton.class);
|
skel.getEquipment().setItemInHand(new ItemStack(Material.BOW));
|
||||||
Host.Manager.GetCondition().Factory().Invisible("Cloak", skel, skel, 999999, 0, false, false, false);
|
|
||||||
|
skel.setMaxHealth(50);
|
||||||
|
skel.setHealth(skel.getMaxHealth());
|
||||||
|
|
||||||
|
_minions.add(skel);
|
||||||
|
|
||||||
|
UtilEnt.Vegetate(skel);
|
||||||
|
}
|
||||||
|
|
||||||
skel.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
|
_minionSpawn = false;
|
||||||
skel.getEquipment().setItemInHand(new ItemStack(Material.BOW));
|
|
||||||
|
|
||||||
skel.setMaxHealth(50);
|
|
||||||
skel.setHealth(skel.getMaxHealth());
|
|
||||||
|
|
||||||
_minions.add(skel);
|
|
||||||
|
|
||||||
Host.CreatureAllowOverride = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MinionControl()
|
public void MinionOrbit()
|
||||||
{
|
{
|
||||||
|
if (GetState() != 0 && GetState() != 1 && GetState() != 2)
|
||||||
|
return;
|
||||||
|
|
||||||
for (int i=0 ; i<_minions.size() ; i++)
|
for (int i=0 ; i<_minions.size() ; i++)
|
||||||
{
|
{
|
||||||
Skeleton minion = _minions.get(i);
|
Skeleton minion = _minions.get(i);
|
||||||
|
|
||||||
|
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, minion.getEyeLocation(), 0.1f, 0.1f, 0.1f, 0, 1);
|
||||||
|
|
||||||
|
minion.setTarget(null);
|
||||||
|
|
||||||
|
double lead = i * ((2d * Math.PI)/_minions.size());
|
||||||
|
|
||||||
|
double sizeMod = 2 + (_minions.size() / 12);
|
||||||
|
|
||||||
//Orbit
|
//Orbit
|
||||||
if (GetState() == 0 || GetState() == 1 || GetState() == 2)
|
double speed = 20d;
|
||||||
|
double oX = Math.sin(GetEntity().getTicksLived()/speed + lead) * 2 * sizeMod;
|
||||||
|
double oY = 1;
|
||||||
|
double oZ = Math.cos(GetEntity().getTicksLived()/speed + lead) * 2 * sizeMod;
|
||||||
|
Location loc = GetEntity().getLocation().add(oX, oY, oZ);
|
||||||
|
|
||||||
|
if (UtilMath.offset(loc, minion.getLocation()) > 16)
|
||||||
{
|
{
|
||||||
minion.setTarget(null);
|
Host.Manager.GetBlood().Effects(minion.getEyeLocation(), 10, 0.2, Sound.SKELETON_HURT, 1f, 1f, Material.BONE, (byte)0, 20, false);
|
||||||
|
minion.teleport(loc);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
double lead = i * ((2d * Math.PI)/_minions.size());
|
loc.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(GetEntity(), minion)));
|
||||||
|
|
||||||
double sizeMod = 2 + (_minions.size() / 12);
|
//Move
|
||||||
|
EntityCreature ec = ((CraftCreature)minion).getHandle();
|
||||||
|
ec.getControllerMove().a(loc.getX(), loc.getY(), loc.getZ(), 1.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Orbit
|
public void MinionAttack()
|
||||||
double speed = 20d;
|
{
|
||||||
double oX = Math.sin(GetEntity().getTicksLived()/speed + lead) * 2 * sizeMod;
|
if (GetState() != 3)
|
||||||
double oY = 1;
|
return;
|
||||||
double oZ = Math.cos(GetEntity().getTicksLived()/speed + lead) * 2 * sizeMod;
|
|
||||||
|
|
||||||
Location loc = GetEntity().getLocation().add(oX, oY, oZ);
|
if (_minions.isEmpty())
|
||||||
if (UtilMath.offset(loc, minion.getLocation()) > 16)
|
return;
|
||||||
|
|
||||||
|
Skeleton minion = _minions.remove(0);
|
||||||
|
|
||||||
|
LivingEntity target = _minionTargets.get(minion);
|
||||||
|
if (target == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
minion.setTarget(target);
|
||||||
|
|
||||||
|
Location loc = target.getLocation().add(UtilAlg.getTrajectory(target, minion).multiply(1));
|
||||||
|
if (UtilMath.offset(loc, minion.getLocation()) > 12)
|
||||||
|
loc = minion.getLocation().add(UtilAlg.getTrajectory(minion.getLocation(), loc).multiply(12));
|
||||||
|
|
||||||
|
//Move
|
||||||
|
EntityCreature ec = ((CraftCreature)minion).getHandle();
|
||||||
|
Navigation nav = ec.getNavigation();
|
||||||
|
nav.a(loc.getX(), loc.getY(), loc.getZ(), 1f);
|
||||||
|
|
||||||
|
_minions.add(minion);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MinionAttackDamage()
|
||||||
|
{
|
||||||
|
if (GetState() != 3)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (int i=0 ; i<_minions.size() ; i++)
|
||||||
|
{
|
||||||
|
final Skeleton minion = _minions.get(i);
|
||||||
|
|
||||||
|
UtilParticle.PlayParticle(ParticleType.WITCH_MAGIC, minion.getEyeLocation(), 0.1f, 0.1f, 0.1f, 0, 1);
|
||||||
|
|
||||||
|
LivingEntity target = _minionTargets.get(minion);
|
||||||
|
if (target == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (UtilMath.offset(minion, target) > 2)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (_minionAttack.containsKey(minion) && !UtilTime.elapsed(_minionAttack.get(minion), 500))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//Damage Event
|
||||||
|
Host.Manager.GetDamage().NewDamageEvent(target, minion, null,
|
||||||
|
DamageCause.ENTITY_ATTACK, 3, true, true, false,
|
||||||
|
UtilEnt.getName(minion), GetName());
|
||||||
|
|
||||||
|
//Sound
|
||||||
|
minion.getWorld().playSound(minion.getLocation(), Sound.ENDERMAN_SCREAM, 2f, 2f);
|
||||||
|
minion.getWorld().playSound(minion.getLocation(), Sound.ENDERMAN_SCREAM, 2f, 2f);
|
||||||
|
|
||||||
|
//Visual Start
|
||||||
|
minion.getEquipment().setHelmet(new ItemStack(Material.JACK_O_LANTERN));
|
||||||
|
|
||||||
|
//Visual End
|
||||||
|
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Host.Manager.GetPlugin(), new Runnable()
|
||||||
|
{
|
||||||
|
public void run()
|
||||||
{
|
{
|
||||||
Host.Manager.GetBlood().Effects(minion.getLocation(), 10, 0.2, Sound.SKELETON_HURT, 1f, 1f, Material.BONE, (byte)0, 20, false);
|
minion.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
|
||||||
minion.teleport(loc);
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
}, 4);
|
||||||
|
|
||||||
//Move
|
_minionAttack.put(minion, System.currentTimeMillis());
|
||||||
EntityCreature ec = ((CraftCreature)minion).getHandle();
|
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
nav.a(loc.getX(), loc.getY(), loc.getZ(), 1.2f);
|
|
||||||
}
|
|
||||||
//Attack
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LivingEntity target = _minionTargets.get(minion);
|
|
||||||
if (target == null)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
minion.setTarget(target);
|
|
||||||
|
|
||||||
Location loc = target.getLocation();
|
|
||||||
if (UtilMath.offset(loc, minion.getLocation()) > 12)
|
|
||||||
loc = minion.getLocation().add(UtilAlg.getTrajectory(minion.getLocation(), loc).multiply(12));
|
|
||||||
|
|
||||||
//Move
|
|
||||||
EntityCreature ec = ((CraftCreature)minion).getHandle();
|
|
||||||
Navigation nav = ec.getNavigation();
|
|
||||||
nav.a(loc.getX(), loc.getY(), loc.getZ(), 1f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,7 +474,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
while (arrowIterator.hasNext())
|
while (arrowIterator.hasNext())
|
||||||
{
|
{
|
||||||
Arrow arrow = arrowIterator.next();
|
Arrow arrow = arrowIterator.next();
|
||||||
|
|
||||||
if (arrow.getLocation().getY() > 30 && arrow.getVelocity().getY() > 0)
|
if (arrow.getLocation().getY() > 30 && arrow.getVelocity().getY() > 0)
|
||||||
{
|
{
|
||||||
Player target = Host.GetPlayers(true).get(UtilMath.r(Host.GetPlayers(true).size()));
|
Player target = Host.GetPlayers(true).get(UtilMath.r(Host.GetPlayers(true).size()));
|
||||||
|
@ -414,7 +482,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
arrow.setVelocity(arrow.getVelocity().setY(-0.1));
|
arrow.setVelocity(arrow.getVelocity().setY(-0.1));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arrow.getTicksLived() > 200 || arrow.isOnGround())
|
if (arrow.getTicksLived() > 200 || arrow.isOnGround())
|
||||||
{
|
{
|
||||||
if (arrow.isValid() && Math.random() > 0.50)
|
if (arrow.isValid() && Math.random() > 0.50)
|
||||||
|
@ -436,7 +504,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
int z = fieldZ.getInt(entityArrow);
|
int z = fieldZ.getInt(entityArrow);
|
||||||
|
|
||||||
Block block = arrow.getWorld().getBlockAt(x, y, z);
|
Block block = arrow.getWorld().getBlockAt(x, y, z);
|
||||||
|
|
||||||
if (block.getY() > GetEntity().getLocation().getY())
|
if (block.getY() > GetEntity().getLocation().getY())
|
||||||
block.breakNaturally();
|
block.breakNaturally();
|
||||||
}
|
}
|
||||||
|
@ -445,12 +513,12 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
arrow.remove();
|
arrow.remove();
|
||||||
arrowIterator.remove();
|
arrowIterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Circle
|
//Circle
|
||||||
if (GetState() == 1)
|
if (GetState() == 1)
|
||||||
{
|
{
|
||||||
|
@ -466,11 +534,11 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
|
|
||||||
Arrow arrow = GetEntity().getWorld().spawnArrow(minion.getEyeLocation().add(traj), traj, 2f, 16f);
|
Arrow arrow = GetEntity().getWorld().spawnArrow(minion.getEyeLocation().add(traj), traj, 2f, 16f);
|
||||||
arrow.setShooter(minion);
|
arrow.setShooter(minion);
|
||||||
|
|
||||||
_arrows.add(arrow);
|
_arrows.add(arrow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Up
|
//Up
|
||||||
else if (GetState() == 2)
|
else if (GetState() == 2)
|
||||||
{
|
{
|
||||||
|
@ -485,7 +553,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
|
|
||||||
Arrow arrow = GetEntity().getWorld().spawnArrow(minion.getEyeLocation().add(traj), traj, 2f, 16f);
|
Arrow arrow = GetEntity().getWorld().spawnArrow(minion.getEyeLocation().add(traj), traj, 2f, 16f);
|
||||||
arrow.setShooter(minion);
|
arrow.setShooter(minion);
|
||||||
|
|
||||||
_arrows.add(arrow);
|
_arrows.add(arrow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -508,10 +576,10 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
|
|
||||||
if (!UtilTime.elapsed(_shieldSpawn, 10000))
|
if (!UtilTime.elapsed(_shieldSpawn, 10000))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_shields.size() >= _shieldsMax)
|
if (_shields.size() >= _shieldsMax)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//Delay
|
//Delay
|
||||||
_shieldSpawn = System.currentTimeMillis();
|
_shieldSpawn = System.currentTimeMillis();
|
||||||
|
|
||||||
|
@ -519,10 +587,10 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
if (_shields.size() == 0)
|
if (_shields.size() == 0)
|
||||||
{
|
{
|
||||||
toSpawn = _shieldsMax;
|
toSpawn = _shieldsMax;
|
||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_HURT, 10f, 1.5f);
|
GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_HURT, 10f, 1.5f);
|
||||||
|
|
||||||
if (GetEntity().getTicksLived() > 100)
|
if (GetEntity().getTicksLived() > 100)
|
||||||
Host.Announce(C.cAqua + C.Bold + "Flame Shield has regenerated!");
|
Host.Announce(C.cAqua + C.Bold + "Flame Shield has regenerated!");
|
||||||
}
|
}
|
||||||
|
@ -531,7 +599,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
//Sound
|
//Sound
|
||||||
GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_HURT, 1f, 2f);
|
GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_HURT, 1f, 2f);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0 ; i<toSpawn ; i++)
|
for (int i=0 ; i<toSpawn ; i++)
|
||||||
{
|
{
|
||||||
//Spawn
|
//Spawn
|
||||||
|
@ -577,7 +645,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
0.4, false, 0, 0.1, 1, true);
|
0.4, false, 0, 0.1, 1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_shields.size() > 0)
|
if (_shields.size() > 0)
|
||||||
GetEntity().getWorld().playEffect(GetEntity().getLocation().add(0, 6, 0), Effect.ENDER_SIGNAL, 0);
|
GetEntity().getWorld().playEffect(GetEntity().getLocation().add(0, 6, 0), Effect.ENDER_SIGNAL, 0);
|
||||||
}
|
}
|
||||||
|
@ -591,29 +659,30 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
{
|
{
|
||||||
_state = state;
|
_state = state;
|
||||||
_stateTime = System.currentTimeMillis();
|
_stateTime = System.currentTimeMillis();
|
||||||
|
|
||||||
if (state == 3)
|
if (state == 3)
|
||||||
{
|
{
|
||||||
//Update Gear
|
//Update Gear
|
||||||
for (int i=0 ; i<_minions.size() ; i++)
|
for (int i=0 ; i<_minions.size() ; i++)
|
||||||
{
|
{
|
||||||
Skeleton minion = _minions.get(i);
|
Skeleton minion = _minions.get(i);
|
||||||
|
|
||||||
minion.getEquipment().setHelmet(new ItemStack(Material.JACK_O_LANTERN));
|
minion.getEquipment().setItemInHand(null);
|
||||||
minion.getEquipment().setItemInHand(new ItemStack(Material.WOOD_AXE));
|
|
||||||
|
|
||||||
//Speed
|
//Speed
|
||||||
Host.Manager.GetCondition().Factory().Speed("Minion Speed", minion, minion, 15, 0, false, false, false);
|
Host.Manager.GetCondition().Factory().Speed("Minion Speed", minion, minion, 15, 0, false, false, false);
|
||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_SPAWN, 10f, 1.5f);
|
GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_SPAWN, 10f, 1.5f);
|
||||||
|
|
||||||
//Target
|
//Target
|
||||||
_minionTargets.put(minion, GetRandomPlayer());
|
_minionTargets.put(minion, GetRandomPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Announce
|
//Announce
|
||||||
Host.Announce(C.cAqua + C.Bold + "Kill the Pumpkin Minions!");
|
Host.Announce(C.cAqua + C.Bold + "Kill the Pumpkin Minions!");
|
||||||
|
|
||||||
|
MinionAttack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,7 +722,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
if (UtilTime.elapsed(_stateTime, 20000))
|
if (UtilTime.elapsed(_stateTime, 20000))
|
||||||
{
|
{
|
||||||
SetState(0);
|
SetState(0);
|
||||||
|
|
||||||
//Update Minions
|
//Update Minions
|
||||||
for (int i=0 ; i<_minions.size() ; i++)
|
for (int i=0 ; i<_minions.size() ; i++)
|
||||||
{
|
{
|
||||||
|
@ -662,13 +731,13 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
minion.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
|
minion.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
|
||||||
minion.getEquipment().setItemInHand(new ItemStack(Material.BOW));
|
minion.getEquipment().setItemInHand(new ItemStack(Material.BOW));
|
||||||
}
|
}
|
||||||
|
|
||||||
ShieldSpawn();
|
ShieldSpawn();
|
||||||
|
|
||||||
_minionTargets.clear();
|
_minionTargets.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Skeleton Scatter
|
//Skeleton Scatter
|
||||||
if (GetState() != 3 && UtilTime.elapsed(_stateTime, 2000))
|
if (GetState() != 3 && UtilTime.elapsed(_stateTime, 2000))
|
||||||
{
|
{
|
||||||
|
@ -677,23 +746,23 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
SetState(3);
|
SetState(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Final Stage
|
//Final Stage
|
||||||
if (GetState() != 4 && UtilTime.elapsed(_stateTime, 2000))
|
if (GetState() != 4 && UtilTime.elapsed(_stateTime, 2000))
|
||||||
{
|
{
|
||||||
if (_shields.size() == 0 && _minions.size() == 0)
|
if (_shields.size() == 0 && _minions.size() == 0)
|
||||||
{
|
{
|
||||||
SetState(4);
|
SetState(4);
|
||||||
|
|
||||||
//Announce
|
//Announce
|
||||||
Host.Announce(C.cAqua + C.Bold + "Kill the Pumpkin King!!!");
|
Host.Announce(C.cAqua + C.Bold + "Kill the Pumpkin King!!!");
|
||||||
|
|
||||||
//Sound
|
//Sound
|
||||||
GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_SPAWN, 10f, 1.5f);
|
GetEntity().getWorld().playSound(GetEntity().getLocation(), Sound.WITHER_SPAWN, 10f, 1.5f);
|
||||||
|
|
||||||
//Speed
|
//Speed
|
||||||
Host.Manager.GetCondition().Factory().Speed("King Speed", GetEntity(), GetEntity(), 9999, 1, false, false, false);
|
Host.Manager.GetCondition().Factory().Speed("King Speed", GetEntity(), GetEntity(), 9999, 1, false, false, false);
|
||||||
|
|
||||||
//Equip
|
//Equip
|
||||||
GetEntity().getEquipment().setItemInHand(new ItemStack(Material.IRON_SWORD));
|
GetEntity().getEquipment().setItemInHand(new ItemStack(Material.IRON_SWORD));
|
||||||
}
|
}
|
||||||
|
@ -709,7 +778,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_minions.contains(event.getEntity()))
|
if (_minions.contains(event.getEntity()))
|
||||||
{
|
{
|
||||||
if (GetState() != 3)
|
if (GetState() != 3)
|
||||||
|
@ -725,22 +794,22 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Player player = _minionTargets.get(event.getEntity());
|
Player player = _minionTargets.get(event.getEntity());
|
||||||
|
|
||||||
if (!player.equals(event.getTarget()))
|
if (!player.equals(event.getTarget()))
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
if (!Host.IsAlive(player))
|
if (!Host.IsAlive(player))
|
||||||
_minionTargets.put(event.getEntity(), GetRandomPlayer());
|
_minionTargets.put(event.getEntity(), GetRandomPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player GetRandomPlayer()
|
public Player GetRandomPlayer()
|
||||||
{
|
{
|
||||||
if (Host.GetPlayers(true).isEmpty())
|
if (Host.GetPlayers(true).isEmpty())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return Host.GetPlayers(true).get(UtilMath.r(Host.GetPlayers(true).size()));
|
return Host.GetPlayers(true).get(UtilMath.r(Host.GetPlayers(true).size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.halloween.waves;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderLeaper;
|
import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderLeaper;
|
||||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderWebber;
|
import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderSmasher;
|
||||||
|
|
||||||
public class Wave3 extends WaveBase
|
public class Wave3 extends WaveBase
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ public class Wave3 extends WaveBase
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (tick > 200 && tick % 10 == 0 && !UtilTime.elapsed(_start, 35000))
|
if (tick > 200 && tick % 10 == 0 && !UtilTime.elapsed(_start, 35000))
|
||||||
Host.AddCreature(new MobSpiderWebber(Host, GetSpawn()));
|
Host.AddCreature(new MobSpiderSmasher(Host, GetSpawn()));
|
||||||
|
|
||||||
if (tick % 8 == 0 && !UtilTime.elapsed(_start, 25000))
|
if (tick % 8 == 0 && !UtilTime.elapsed(_start, 25000))
|
||||||
Host.AddCreature(new MobSpiderLeaper(Host, GetSpawn()));
|
Host.AddCreature(new MobSpiderLeaper(Host, GetSpawn()));
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class WaveVictory extends WaveBase
|
||||||
{
|
{
|
||||||
public WaveVictory(Halloween host)
|
public WaveVictory(Halloween host)
|
||||||
{
|
{
|
||||||
super(host, "Celebration!", 0, host.GetSpawnSet(3));
|
super(host, "Celebration!", 15000, host.GetSpawnSet(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,7 +28,7 @@ public class WaveVictory extends WaveBase
|
||||||
|
|
||||||
//Mobs
|
//Mobs
|
||||||
for (CreatureBase mob : Host.GetCreatures())
|
for (CreatureBase mob : Host.GetCreatures())
|
||||||
mob.GetEntity().damage(1);
|
mob.GetEntity().damage(5);
|
||||||
|
|
||||||
//Time
|
//Time
|
||||||
if (Host.WorldTimeSet != 6000)
|
if (Host.WorldTimeSet != 6000)
|
||||||
|
@ -37,10 +37,4 @@ public class WaveVictory extends WaveBase
|
||||||
Host.WorldData.World.setTime(Host.WorldTimeSet);
|
Host.WorldData.World.setTime(Host.WorldTimeSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean CanEnd()
|
|
||||||
{
|
|
||||||
return Host.WorldTimeSet == 6000;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue