Refactor and move BossAbiliy

This commit is contained in:
libraryaddict 2015-08-29 12:06:57 -07:00
parent e7f861a6c2
commit 7cd98c82e9
13 changed files with 59 additions and 39 deletions

View File

@ -1,4 +1,4 @@
package mineplex.minecraft.game.core.boss.ironwizard.abilities;
package mineplex.minecraft.game.core.boss;
import java.util.HashMap;
import java.util.UUID;
@ -6,7 +6,6 @@ import java.util.UUID;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.minecraft.game.core.boss.EventCreature;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -53,10 +52,10 @@ public abstract class BossAbility<T extends EventCreature, Y extends Entity> imp
public Y getEntity()
{
return (Y) getGolem().getEntity();
return (Y) getBoss().getEntity();
}
public T getGolem()
public T getBoss()
{
return _creature;
}
@ -71,7 +70,7 @@ public abstract class BossAbility<T extends EventCreature, Y extends Entity> imp
return getTarget(30);
}
public Player getTarget(double maxDistance)
public Player getTarget(double minDistance, double maxDistance)
{
Player target = null;
double dist = 0;
@ -85,6 +84,11 @@ public abstract class BossAbility<T extends EventCreature, Y extends Entity> imp
double d = player.getLocation().distance(getLocation());
if (d < minDistance)
{
continue;
}
if (target == null || dist > d)
{
target = player;
@ -95,6 +99,11 @@ public abstract class BossAbility<T extends EventCreature, Y extends Entity> imp
return target;
}
public Player getTarget(double maxDistance)
{
return getTarget(0, maxDistance);
}
public abstract boolean hasFinished();
public abstract void setFinished();

View File

@ -15,8 +15,8 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.EventCreature;
import mineplex.minecraft.game.core.boss.ironwizard.abilities.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemBlockHail;
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemBlockShot;
import mineplex.minecraft.game.core.boss.ironwizard.abilities.GolemCaveIn;

View File

@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R4.EntityIronGolem;
@ -221,14 +222,14 @@ public class GolemBlockHail extends BossAbility<GolemCreature, IronGolem>
// if (canDamage(victim))
{
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 10 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Block Hail",
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Block Hail",
"Iron Wizard Block Hail");
}
if (victim instanceof Player)
{
getGolem().getEvent().getCondition().Factory().Slow("Iron Wizard Block Hail", (LivingEntity) victim,
getBoss().getEvent().getCondition().Factory().Slow("Iron Wizard Block Hail", (LivingEntity) victim,
getEntity(), 3, 2, false, false, false, false);
}
@ -304,8 +305,8 @@ public class GolemBlockHail extends BossAbility<GolemCreature, IronGolem>
{
if (canDamage(player))
{
getGolem().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null,
DamageCause.CONTACT, 10 * getGolem().getDifficulty(), true, true, false,
getBoss().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null,
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false,
"Iron Wizard Protection", "Iron Wizard Protection");
loc.getWorld().playEffect(player.getLocation(), Effect.STEP_SOUND, Material.OBSIDIAN.getId());

View File

@ -20,6 +20,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R4.EntityIronGolem;
@ -226,8 +227,8 @@ public class GolemBlockShot extends BossAbility<GolemCreature, IronGolem>
{
cur.getWorld().playEffect(victim.getEyeLocation().subtract(0, 0.5, 0), Effect.STEP_SOUND, cur.getBlockId());
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 10 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Block Shot",
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Block Shot",
"Iron Wizard Block Shot");
cur.remove();

View File

@ -16,6 +16,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilShapes;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R4.MathHelper;
@ -167,8 +168,8 @@ public class GolemCaveIn extends BossAbility<GolemCreature, IronGolem>
if (canDamage(victim))
{
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 10 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Cave In",
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Cave In",
"Iron Wizard Cave In");
}

View File

@ -10,6 +10,7 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilServer;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import org.bukkit.Bukkit;
@ -139,11 +140,11 @@ public class GolemEarthquake extends BossAbility<GolemCreature, IronGolem>
{
_damaged.add(player.getUniqueId());
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) player, getEntity(), null,
DamageCause.CONTACT, 14 * getGolem().getDifficulty(), false, true, false, "Iron Wizard Earthquake",
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) player, getEntity(), null,
DamageCause.CONTACT, 14 * getBoss().getDifficulty(), false, true, false, "Iron Wizard Earthquake",
"Iron Wizard Earthquake");
getGolem().getEvent().getCondition().Factory().Slow("Earthquake", (LivingEntity) player, getEntity(), 3, 1, false,
getBoss().getEvent().getCondition().Factory().Slow("Earthquake", (LivingEntity) player, getEntity(), 3, 1, false,
false, false, false);
// Velocity
@ -151,7 +152,7 @@ public class GolemEarthquake extends BossAbility<GolemCreature, IronGolem>
1.8, true, 0, 0.5, 0.5, true);
// Condition
getGolem().getEvent().getCondition().Factory().Falling("Earthquake", player, getEntity(), 10, false, true);
getBoss().getEvent().getCondition().Factory().Falling("Earthquake", player, getEntity(), 10, false, true);
}
}

View File

@ -45,6 +45,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -106,7 +107,7 @@ public class GolemExplodingAura extends BossAbility<GolemCreature, IronGolem>
@Override
public void tick()
{
if (_tick < 25 * 25 && getGolem().getHealth() > 30)
if (_tick < 25 * 25 && getBoss().getHealth() > 30)
{
double angle = (2 * Math.PI) / UtilMath.random.nextDouble();
double x = 1.7 * Math.cos(angle);
@ -118,8 +119,8 @@ public class GolemExplodingAura extends BossAbility<GolemCreature, IronGolem>
for (Player player : UtilPlayer.getNearby(getLocation(), 3, true))
{
getGolem().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null, DamageCause.CONTACT,
6 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Protection", "Iron Wizard Protection");
getBoss().getEvent().getDamageManager().NewDamageEvent(player, getEntity(), null, DamageCause.CONTACT,
6 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Protection", "Iron Wizard Protection");
UtilAction.velocity(player, UtilAlg.getTrajectory(getEntity(), player), 1, true, 0.3, 0, 0.3, false);
}
}
@ -347,8 +348,8 @@ public class GolemExplodingAura extends BossAbility<GolemCreature, IronGolem>
// if (canDamage(victim))
{
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 6 * getGolem().getDifficulty(), true, true, false, "Blocky Iron Wizard Aura",
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 6 * getBoss().getDifficulty(), true, true, false, "Blocky Iron Wizard Aura",
"Blocky Iron Wizard Aura");
}

View File

@ -17,6 +17,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
@ -170,7 +171,7 @@ public class GolemExplosiveBlock extends BossAbility<GolemCreature, IronGolem>
{
_explosionsLeft++;
Bukkit.getScheduler().scheduleSyncDelayedTask(getGolem().getEvent().getPlugin(), new Runnable()
Bukkit.getScheduler().scheduleSyncDelayedTask(getBoss().getEvent().getPlugin(), new Runnable()
{
public void run()
{

View File

@ -3,6 +3,7 @@ package mineplex.minecraft.game.core.boss.ironwizard.abilities;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import net.minecraft.server.v1_7_R4.EntityIronGolem;
@ -65,15 +66,15 @@ public class GolemMeleeAttack extends BossAbility<GolemCreature, IronGolem>
UtilEnt.CreatureLook(getEntity(), target);
getGolem().getEvent().getDamageManager().NewDamageEvent(target, getEntity(), null, DamageCause.ENTITY_ATTACK,
10 * getGolem().getDifficulty(), false, true, false, "Iron Wizard Melee Attack", "Iron Wizard Melee Attack");
getBoss().getEvent().getDamageManager().NewDamageEvent(target, getEntity(), null, DamageCause.ENTITY_ATTACK,
10 * getBoss().getDifficulty(), false, true, false, "Iron Wizard Melee Attack", "Iron Wizard Melee Attack");
Vector vec = getLocation().getDirection();
vec.setY(0).normalize().setY(0.5).multiply(2.4);
UtilAction.velocity(target, vec);
getGolem().getEvent().getCondition().Factory().Falling("Iron Wizard Throw", target, getEntity(), 3, false, false);
getBoss().getEvent().getCondition().Factory().Falling("Iron Wizard Throw", target, getEntity(), 3, false, false);
target.getWorld().playSound(target.getLocation(), Sound.IRONGOLEM_THROW, 3, 0.9F);

View File

@ -8,6 +8,7 @@ import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import net.minecraft.server.v1_7_R4.EntityIronGolem;
@ -185,8 +186,8 @@ public class GolemRumble extends BossAbility<GolemCreature, IronGolem>
if (canDamage(entity))
{
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) entity, getEntity(), null,
DamageCause.CONTACT, 8 * getGolem().getDifficulty(), false, true, false, "Iron Wizard Rumble",
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) entity, getEntity(), null,
DamageCause.CONTACT, 8 * getBoss().getDifficulty(), false, true, false, "Iron Wizard Rumble",
"Iron Wizard Rumble");
}
@ -194,7 +195,7 @@ public class GolemRumble extends BossAbility<GolemCreature, IronGolem>
if (entity instanceof Player)
{
getGolem().getEvent().getCondition().Factory().Slow("Rumble", (LivingEntity) entity, getEntity(), 3, 1,
getBoss().getEvent().getCondition().Factory().Slow("Rumble", (LivingEntity) entity, getEntity(), 3, 1,
false, false, false, false);
}
}

View File

@ -37,6 +37,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.common.util.UtilTime;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import net.minecraft.server.v1_7_R4.EntityIronGolem;
@ -288,11 +289,11 @@ public class GolemRupture extends BossAbility<GolemCreature, IronGolem>
0.8 + 0.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.4, true);
// Condition
getGolem().getEvent().getCondition().Factory().Falling("Rupture", cur, getEntity(), 10, false, true);
getBoss().getEvent().getCondition().Factory().Falling("Rupture", cur, getEntity(), 10, false, true);
// Damage Event
getGolem().getEvent().getDamageManager().NewDamageEvent(cur, getEntity(), null, DamageCause.CUSTOM,
8 * getGolem().getDifficulty(), false, true, false, "Iron Wizard", "Rupture");
getBoss().getEvent().getDamageManager().NewDamageEvent(cur, getEntity(), null, DamageCause.CUSTOM,
8 * getBoss().getDifficulty(), false, true, false, "Iron Wizard", "Rupture");
}
ArrayList<Block> blocks = new ArrayList<Block>();

View File

@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import org.bukkit.Effect;
@ -191,11 +192,11 @@ public class GolemSlam extends BossAbility<GolemCreature, IronGolem>
0.8 + 0.8 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.4, true);
// Condition
getGolem().getEvent().getCondition().Factory().Falling("Rupture", cur, getEntity(), 10, false, true);
getBoss().getEvent().getCondition().Factory().Falling("Rupture", cur, getEntity(), 10, false, true);
// Damage Event
getGolem().getEvent().getDamageManager().NewDamageEvent(cur, getEntity(), null, DamageCause.CUSTOM,
8 * getGolem().getDifficulty(), false, true, false, "Iron Wizard", "Rupture");
getBoss().getEvent().getDamageManager().NewDamageEvent(cur, getEntity(), null, DamageCause.CUSTOM,
8 * getBoss().getDifficulty(), false, true, false, "Iron Wizard", "Rupture");
}
ArrayList<Block> blocks = new ArrayList<Block>();

View File

@ -18,6 +18,7 @@ import mineplex.core.common.util.UtilShapes;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.boss.BossAbility;
import mineplex.minecraft.game.core.boss.ironwizard.GolemCreature;
import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R4.MathHelper;
@ -193,8 +194,8 @@ public class GolemWallExplode extends BossAbility<GolemCreature, IronGolem>
if (canDamage(victim))
{
getGolem().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 10 * getGolem().getDifficulty(), true, true, false, "Iron Wizard Wall Explosion",
getBoss().getEvent().getDamageManager().NewDamageEvent((LivingEntity) victim, getEntity(), null,
DamageCause.CONTACT, 10 * getBoss().getDifficulty(), true, true, false, "Iron Wizard Wall Explosion",
"Iron Wizard Wall Explosion");
}