Commit for merge

This commit is contained in:
Shaun Bennett 2015-06-08 14:59:06 -05:00
parent 8c7faf27dd
commit aa9aba92cd
3 changed files with 97 additions and 2 deletions

View File

@ -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<T extends LivingEntity> implements Listener
{
private T _entity;
// Creature Data
private String _name;
private double _health;
private double _maxHealth;
public EventCreature(Location spawnLocation, Class<T> clazz)
{
_entity = spawnLocation.getWorld().spawn(spawnLocation, clazz);
}
}

View File

@ -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);
}

View File

@ -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);
}
}
}
}
}
}