diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/creature/EventCreature.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/creature/EventCreature.java new file mode 100644 index 000000000..34b0e60a2 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/creature/EventCreature.java @@ -0,0 +1,26 @@ +package mineplex.game.clans.clans.worldevent.creature; + +import org.bukkit.Location; +import org.bukkit.entity.LivingEntity; +import org.bukkit.event.Listener; + +public abstract class EventCreature implements Listener +{ + private T _entity; + + // Creature Data + private String _name; + private double _health; + private double _maxHealth; + + + + public EventCreature(Location spawnLocation, Class clazz) + { + + + _entity = spawnLocation.getWorld().spawn(spawnLocation, clazz); + } + + +} diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/boss/slime/SlimePart.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/boss/slime/SlimePart.java index de3391ba5..a0f8b2b0e 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/boss/slime/SlimePart.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/boss/slime/SlimePart.java @@ -5,6 +5,7 @@ import org.bukkit.entity.MagmaCube; import org.bukkit.entity.Slime; import mineplex.game.clans.clans.worldevent.event.boss.slime.ability.AbsorbAbility; +import mineplex.game.clans.clans.worldevent.event.boss.slime.ability.LeapAbility; import mineplex.game.clans.clans.worldevent.event.boss.slime.ability.RocketAbility; import mineplex.game.clans.clans.worldevent.event.boss.slime.ability.SlamAbility; import mineplex.game.clans.clans.worldevent.event.boss.slime.ability.SlimeAbility; @@ -59,11 +60,15 @@ public class SlimePart { double rand = Math.random(); - if (rand <= 0.33) + if (rand <= 0.25) + { + _currentAbility = new LeapAbility(this); + } + else if (rand <= 0.50) { _currentAbility = new AbsorbAbility(this); } - else if (rand <= 0.66) + else if (rand <= 0.75) { _currentAbility = new RocketAbility(this); } diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/boss/slime/ability/LeapAbility.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/boss/slime/ability/LeapAbility.java new file mode 100644 index 000000000..4efaebbc6 --- /dev/null +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/worldevent/event/boss/slime/ability/LeapAbility.java @@ -0,0 +1,64 @@ +package mineplex.game.clans.clans.worldevent.event.boss.slime.ability; + +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilPlayer; +import mineplex.game.clans.clans.worldevent.event.boss.slime.SlimePart; + +public class LeapAbility extends SlimeAbility +{ + private Player _target; + private int _jumpTick; + + public LeapAbility(SlimePart slime) + { + super(slime); + + _target = UtilPlayer.getRandomTarget(slime.getEntity().getLocation(), 10); + _jumpTick = 20; + + // Only attempt to find a target once for this ability! + if (_target == null) + { + setIdle(true); + } + } + + @Override + public void tickCustom() + { + if (_target != null) + { + if (getTicks() == _jumpTick) + { + // Jump + Vector dir = UtilAlg.getTrajectory2d(getSlime().getEntity(), _target); + UtilAction.velocity(getSlime().getEntity(), dir, 1, false, 0, 1, 1, true); + } + else if (getTicks() > _jumpTick) + { + if (getSlime().getEntity().isOnGround()) + { + setIdle(true); + } + else if (getSlime().isEnraged()) + { + World world = getSlime().getEntity().getWorld(); + Block block = world.getHighestBlockAt(getSlime().getEntity().getLocation()).getRelative(BlockFace.UP); + + if (block.getType() == Material.AIR) + { + block.setType(Material.FIRE); + } + } + } + } + } +}