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.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTime.TimeUnit;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
@ -45,8 +46,7 @@ public class Halloween extends SoloGame
|
||||
private int _wave = 0;
|
||||
|
||||
private int _maxMobs = 80;
|
||||
private HashSet<CreatureBase> _mobs = new HashSet<CreatureBase>();
|
||||
private PumpkinKing _king;
|
||||
private ArrayList<CreatureBase> _mobs = new ArrayList<CreatureBase>();
|
||||
|
||||
public Halloween(ArcadeManager manager)
|
||||
{
|
||||
@ -89,11 +89,11 @@ public class Halloween extends SoloGame
|
||||
_spawns.add(WorldData.GetDataLocs("BLUE"));
|
||||
|
||||
_waves = new ArrayList<WaveBase>();
|
||||
_waves.add(new Wave1(this));
|
||||
_waves.add(new Wave2(this));
|
||||
_waves.add(new Wave3(this));
|
||||
_waves.add(new Wave4(this));
|
||||
_waves.add(new Wave5(this));
|
||||
//_waves.add(new Wave1(this));
|
||||
//_waves.add(new Wave2(this));
|
||||
//_waves.add(new Wave3(this));
|
||||
//_waves.add(new Wave4(this));
|
||||
//_waves.add(new Wave5(this));
|
||||
_waves.add(new WaveBoss(this));
|
||||
_waves.add(new WaveVictory(this));
|
||||
}
|
||||
@ -156,11 +156,32 @@ public class Halloween extends SoloGame
|
||||
_mobs.add(mob);
|
||||
}
|
||||
|
||||
public HashSet<CreatureBase> GetCreatures()
|
||||
public ArrayList<CreatureBase> GetCreatures()
|
||||
{
|
||||
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
|
||||
public void CreatureUpdate(UpdateEvent event)
|
||||
{
|
||||
|
@ -1,11 +1,15 @@
|
||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
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.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
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 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;
|
||||
|
||||
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.Creeper;
|
||||
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)
|
||||
{
|
||||
@ -26,6 +21,8 @@ public class MobCreeper extends CreatureBase<Creeper>
|
||||
public void SpawnCustom(Creeper ent)
|
||||
{
|
||||
ent.setCustomName("Creeper");
|
||||
|
||||
Move();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,14 +40,16 @@ public class MobCreeper extends CreatureBase<Creeper>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
public 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))
|
||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||
{
|
||||
SetTarget(GetRoamTarget());
|
||||
return;
|
||||
@ -67,21 +66,7 @@ public class MobCreeper extends CreatureBase<Creeper>
|
||||
//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(), 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
||||
}
|
||||
DefaultMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,8 +13,6 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class MobGhast extends CreatureBase<Ghast>
|
||||
{
|
||||
private Location _loc;
|
||||
|
||||
public MobGhast(Game game, Location loc)
|
||||
{
|
||||
super(game, null, Ghast.class, loc);
|
||||
@ -23,9 +21,6 @@ public class MobGhast extends CreatureBase<Ghast>
|
||||
@Override
|
||||
public void SpawnCustom(Ghast ent)
|
||||
{
|
||||
//UtilEnt.Vegetate(ent);
|
||||
_loc = ent.getLocation();
|
||||
|
||||
ent.setMaxHealth(80);
|
||||
ent.setHealth(80);
|
||||
|
||||
|
@ -1,22 +1,17 @@
|
||||
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.UtilTime;
|
||||
import mineplex.core.disguise.disguises.DisguisePigZombie;
|
||||
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.Zombie;
|
||||
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)
|
||||
{
|
||||
@ -32,6 +27,8 @@ public class MobPigZombie extends CreatureBase<Zombie>
|
||||
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 1, false, false, false);
|
||||
|
||||
ent.setCustomName("Nether Zombie");
|
||||
|
||||
Move();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -49,11 +46,10 @@ public class MobPigZombie extends CreatureBase<Zombie>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
Move();
|
||||
|
||||
}
|
||||
|
||||
private void Move()
|
||||
public void Move()
|
||||
{
|
||||
//New Target via Distance
|
||||
if (GetTarget() == null ||
|
||||
@ -76,21 +72,7 @@ public class MobPigZombie extends CreatureBase<Zombie>
|
||||
//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(), 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
||||
}
|
||||
DefaultMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,18 @@
|
||||
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.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.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
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)
|
||||
{
|
||||
@ -31,6 +26,8 @@ public class MobSkeletonArcher extends CreatureBase<Skeleton>
|
||||
ent.setCustomName("Skeleton Archer");
|
||||
|
||||
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 0, false, false, false);
|
||||
|
||||
Move();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,14 +45,16 @@ public class MobSkeletonArcher extends CreatureBase<Skeleton>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
public 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))
|
||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||
{
|
||||
SetTarget(GetRoamTarget());
|
||||
return;
|
||||
@ -72,21 +71,7 @@ public class MobSkeletonArcher extends CreatureBase<Skeleton>
|
||||
//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(), 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
||||
}
|
||||
DefaultMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,19 @@
|
||||
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.UtilTime;
|
||||
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.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.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
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)
|
||||
{
|
||||
@ -35,6 +29,8 @@ public class MobSkeletonWarrior extends CreatureBase<Zombie>
|
||||
ent.getEquipment().setItemInHand(new ItemStack(Material.WOOD_HOE));
|
||||
|
||||
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 0, false, false, false);
|
||||
|
||||
Move();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -52,14 +48,16 @@ public class MobSkeletonWarrior extends CreatureBase<Zombie>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOW)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
public 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))
|
||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||
{
|
||||
SetTarget(GetRoamTarget());
|
||||
return;
|
||||
@ -76,21 +74,7 @@ public class MobSkeletonWarrior extends CreatureBase<Zombie>
|
||||
//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(), 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
||||
}
|
||||
DefaultMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,15 +9,12 @@ 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.CaveSpider;
|
||||
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)
|
||||
{
|
||||
@ -30,6 +27,8 @@ public class MobSpiderLeaper extends CreatureBase<CaveSpider>
|
||||
ent.setCustomName("Leaping Spider");
|
||||
|
||||
Host.Manager.GetCondition().Factory().Speed("Speed", GetEntity(), GetEntity(), 99999, 1, false, false, false);
|
||||
|
||||
Move();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -47,9 +46,6 @@ public class MobSpiderLeaper extends CreatureBase<CaveSpider>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
Move();
|
||||
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
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);
|
||||
}
|
||||
|
||||
private void Move()
|
||||
public void Move()
|
||||
{
|
||||
//New Target via Distance
|
||||
if (GetTarget() == null ||
|
||||
@ -94,21 +90,7 @@ public class MobSpiderLeaper extends CreatureBase<CaveSpider>
|
||||
//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);
|
||||
}
|
||||
DefaultMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
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.UtilTime;
|
||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||
@ -8,17 +7,14 @@ 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.Zombie;
|
||||
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);
|
||||
}
|
||||
@ -29,6 +25,8 @@ public class MobSpiderWebber extends CreatureBase<Zombie>
|
||||
DisguiseSpider spider = new DisguiseSpider(ent);
|
||||
Host.Manager.GetDisguise().disguise(spider);
|
||||
ent.setCustomName("Smashing Spider");
|
||||
|
||||
Move();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,14 +44,11 @@ public class MobSpiderWebber extends CreatureBase<Zombie>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
Move();
|
||||
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
Speed();
|
||||
}
|
||||
|
||||
private void Move()
|
||||
public void Move()
|
||||
{
|
||||
//New Target via Distance
|
||||
if (GetTarget() == null ||
|
||||
@ -76,21 +71,7 @@ public class MobSpiderWebber extends CreatureBase<Zombie>
|
||||
//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);
|
||||
}
|
||||
DefaultMove();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
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.Zombie;
|
||||
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)
|
||||
{
|
||||
@ -38,14 +34,11 @@ public class MobZombie extends CreatureBase<Zombie>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
Move();
|
||||
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
Speed();
|
||||
}
|
||||
|
||||
private void Move()
|
||||
public void Move()
|
||||
{
|
||||
//New Target via Distance
|
||||
if (GetTarget() == null ||
|
||||
@ -68,21 +61,7 @@ public class MobZombie extends CreatureBase<Zombie>
|
||||
//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(), 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
||||
}
|
||||
DefaultMove();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,8 +56,9 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||
|
||||
private ArrayList<Skeleton> _minions = new ArrayList<Skeleton>();
|
||||
private int _minionsMax = 12; //12
|
||||
private HashMap<Entity, Player> _minionTargets = new HashMap<Entity, Player>();
|
||||
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 int _shieldsMax = 6; //6
|
||||
@ -175,7 +176,13 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||
|
||||
//Minions
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
MinionControl();
|
||||
MinionOrbit();
|
||||
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
MinionAttack();
|
||||
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
MinionAttackDamage();
|
||||
|
||||
if (event.getType() == UpdateType.FASTEST)
|
||||
MinionArrow();
|
||||
@ -207,6 +214,8 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||
ShieldSpawn();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void KingTrail()
|
||||
{
|
||||
if (GetState() >= 4)
|
||||
@ -323,79 +332,138 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||
if (!_minionSpawn)
|
||||
return;
|
||||
|
||||
if (_minions.size() >= _minionsMax)
|
||||
for (int i=0 ; i<_minionsMax ; i++)
|
||||
{
|
||||
_minionSpawn = false;
|
||||
return;
|
||||
Host.CreatureAllowOverride = true;
|
||||
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);
|
||||
|
||||
skel.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
|
||||
skel.getEquipment().setItemInHand(new ItemStack(Material.BOW));
|
||||
|
||||
skel.setMaxHealth(50);
|
||||
skel.setHealth(skel.getMaxHealth());
|
||||
|
||||
_minions.add(skel);
|
||||
|
||||
UtilEnt.Vegetate(skel);
|
||||
}
|
||||
|
||||
Host.CreatureAllowOverride = true;
|
||||
Skeleton skel = GetEntity().getWorld().spawn(GetEntity().getLocation(), Skeleton.class);
|
||||
Host.Manager.GetCondition().Factory().Invisible("Cloak", skel, skel, 999999, 0, false, false, false);
|
||||
|
||||
skel.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
|
||||
skel.getEquipment().setItemInHand(new ItemStack(Material.BOW));
|
||||
|
||||
skel.setMaxHealth(50);
|
||||
skel.setHealth(skel.getMaxHealth());
|
||||
|
||||
_minions.add(skel);
|
||||
|
||||
Host.CreatureAllowOverride = false;
|
||||
_minionSpawn = false;
|
||||
}
|
||||
|
||||
public void MinionControl()
|
||||
public void MinionOrbit()
|
||||
{
|
||||
if (GetState() != 0 && GetState() != 1 && GetState() != 2)
|
||||
return;
|
||||
|
||||
for (int i=0 ; i<_minions.size() ; 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
|
||||
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
|
||||
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;
|
||||
public void MinionAttack()
|
||||
{
|
||||
if (GetState() != 3)
|
||||
return;
|
||||
|
||||
Location loc = GetEntity().getLocation().add(oX, oY, oZ);
|
||||
if (UtilMath.offset(loc, minion.getLocation()) > 16)
|
||||
if (_minions.isEmpty())
|
||||
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.teleport(loc);
|
||||
continue;
|
||||
minion.getEquipment().setHelmet(new ItemStack(Material.PUMPKIN));
|
||||
}
|
||||
}, 4);
|
||||
|
||||
//Move
|
||||
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);
|
||||
}
|
||||
_minionAttack.put(minion, System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
||||
@ -599,8 +667,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||
{
|
||||
Skeleton minion = _minions.get(i);
|
||||
|
||||
minion.getEquipment().setHelmet(new ItemStack(Material.JACK_O_LANTERN));
|
||||
minion.getEquipment().setItemInHand(new ItemStack(Material.WOOD_AXE));
|
||||
minion.getEquipment().setItemInHand(null);
|
||||
|
||||
//Speed
|
||||
Host.Manager.GetCondition().Factory().Speed("Minion Speed", minion, minion, 15, 0, false, false, false);
|
||||
@ -614,6 +681,8 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||
|
||||
//Announce
|
||||
Host.Announce(C.cAqua + C.Bold + "Kill the Pumpkin Minions!");
|
||||
|
||||
MinionAttack();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.halloween.waves;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
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.MobSpiderWebber;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderSmasher;
|
||||
|
||||
public class Wave3 extends WaveBase
|
||||
{
|
||||
@ -19,7 +19,7 @@ public class Wave3 extends WaveBase
|
||||
return;
|
||||
|
||||
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))
|
||||
Host.AddCreature(new MobSpiderLeaper(Host, GetSpawn()));
|
||||
|
@ -12,7 +12,7 @@ public class WaveVictory extends WaveBase
|
||||
{
|
||||
public WaveVictory(Halloween host)
|
||||
{
|
||||
super(host, "Celebration!", 0, host.GetSpawnSet(3));
|
||||
super(host, "Celebration!", 15000, host.GetSpawnSet(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -28,7 +28,7 @@ public class WaveVictory extends WaveBase
|
||||
|
||||
//Mobs
|
||||
for (CreatureBase mob : Host.GetCreatures())
|
||||
mob.GetEntity().damage(1);
|
||||
mob.GetEntity().damage(5);
|
||||
|
||||
//Time
|
||||
if (Host.WorldTimeSet != 6000)
|
||||
@ -37,10 +37,4 @@ public class WaveVictory extends WaveBase
|
||||
Host.WorldData.World.setTime(Host.WorldTimeSet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanEnd()
|
||||
{
|
||||
return Host.WorldTimeSet == 6000;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user