use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.
the class EntityAIStrikeAttack method updateTask.
@Override
public void updateTask() {
host.getLookHelper().setLookPositionWithEntity(target, 30, 30);
host.getNavigator().tryMoveToEntityLiving(target, moveSpeed);
if (host.getDistanceSqToEntity(target) < 16)
if (((IArsMagicaBoss) host).getCurrentAction() != BossActions.STRIKE)
((IArsMagicaBoss) host).setCurrentAction(BossActions.STRIKE);
if (((IArsMagicaBoss) host).getCurrentAction() == BossActions.STRIKE && ((IArsMagicaBoss) host).getTicksInCurrentAction() > 12) {
if (!host.worldObj.isRemote)
host.worldObj.playSoundAtEntity(host, ((IArsMagicaBoss) host).getAttackSound(), 1.0f, 1.0f);
double offsetX = Math.cos(host.rotationYaw) * 2;
double offsetZ = Math.sin(host.rotationYaw) * 2;
List<EntityLivingBase> aoeEntities = host.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, host.boundingBox.getOffsetBoundingBox(offsetX, 0, offsetZ).expand(2.5, 2, 2.5));
for (EntityLivingBase ent : aoeEntities) {
if (ent == host)
continue;
ent.attackEntityFrom(DamageSources.causeDamage(damageType, host, true), damage);
}
}
}
use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.
the class EntityAIShieldBash method shouldExecute.
@Override
public boolean shouldExecute() {
if (cooldownTicks-- > 0 || ((IArsMagicaBoss) host).getCurrentAction() != BossActions.IDLE || !((IArsMagicaBoss) host).isActionValid(BossActions.SHIELD_BASH))
return false;
EntityLivingBase AITarget = host.getAttackTarget();
if (AITarget == null || AITarget.isDead)
return false;
this.target = AITarget;
return true;
}
use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.
the class EntityAISummonAllies method updateTask.
@Override
public void updateTask() {
if (((IArsMagicaBoss) host).getCurrentAction() != BossActions.CASTING)
((IArsMagicaBoss) host).setCurrentAction(BossActions.CASTING);
actionTicks++;
if (actionTicks == 16) {
if (!host.worldObj.isRemote)
host.worldObj.playSoundAtEntity(host, "arsmagica2:mob.lifeguardian.summon", 1.0f, host.getRNG().nextFloat() * 0.5f + 0.5f);
int numAllies = 3;
for (int i = 0; i < numAllies; ++i) {
Class summon = mobs[host.worldObj.rand.nextInt(mobs.length)];
try {
Constructor ctor = summon.getConstructor(World.class);
EntityCreature mob = (EntityCreature) ctor.newInstance(host.worldObj);
mob.setPosition(host.posX + host.worldObj.rand.nextDouble() * 2 - 1, host.posY, host.posZ + host.worldObj.rand.nextDouble() * 2 - 1);
mob.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 99999, 1));
mob.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 99999, 1));
mob.addPotionEffect(new PotionEffect(Potion.regeneration.id, 99999, 1));
mob.addPotionEffect(new BuffEffectMagicShield(99999, 1));
if (host.getHealth() < host.getMaxHealth() / 2) {
mob.addPotionEffect(new BuffEffectShrink(99999, 1));
}
EntityUtilities.makeSummon_MonsterFaction(mob, false);
EntityUtilities.setOwner(mob, host);
EntityUtilities.setSummonDuration(mob, 1800);
host.worldObj.spawnEntityInWorld(mob);
host.queued_minions.add(mob);
} catch (Throwable e) {
e.printStackTrace();
return;
}
}
}
if (actionTicks >= 23) {
resetTask();
}
}
use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.
the class EntityAIEnderbolt method updateTask.
@Override
public void updateTask() {
EntityEnderGuardian guardian = getEntity();
if (guardian.getAttackTarget() != null) {
guardian.getLookHelper().setLookPositionWithEntity(guardian.getAttackTarget(), 30, 30);
if (guardian.getTicksInCurrentAction() == 7) {
guardian.faceEntity(guardian.getAttackTarget(), 180, 180);
guardian.worldObj.playSoundAtEntity(guardian, ((IArsMagicaBoss) guardian).getAttackSound(), 1.0f, (float) (0.5 + guardian.getRNG().nextDouble() * 0.5f));
SpellHelper.instance.applyStackStage(NPCSpells.instance.enderGuardian_enderBolt, guardian, guardian, guardian.posX, guardian.posY + 0.5f, guardian.posZ, 0, guardian.worldObj, false, false, 0);
} else {
guardian.faceEntity(guardian.getAttackTarget(), 180, 180);
}
}
}
use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.
the class EntityAIEnderRush method updateTask.
@Override
public void updateTask() {
EntityEnderGuardian guardian = getEntity();
if (guardian.getAttackTarget() != null) {
guardian.getLookHelper().setLookPositionWithEntity(guardian.getAttackTarget(), 30, 30);
}
if (guardian.getTicksInCurrentAction() >= 18 && guardian.getTicksInCurrentAction() <= 30 && guardian.getAttackTarget() != null) {
AMVector3 a = new AMVector3(guardian);
AMVector3 b = new AMVector3(guardian.getAttackTarget());
if (a.distanceSqTo(b) > 4) {
AMVector3 movement = MathUtilities.GetMovementVectorBetweenPoints(a, b);
float speed = -5f;
guardian.moveEntity(movement.x * speed, movement.y * speed, movement.z * speed);
} else {
guardian.worldObj.playSoundAtEntity(guardian, ((IArsMagicaBoss) guardian).getAttackSound(), 1.0f, (float) (0.5 + guardian.getRNG().nextDouble() * 0.5f));
if (guardian.getAttackTarget().attackEntityFrom(DamageSource.causeMobDamage(guardian), 15) && guardian.getAttackTarget().getHealth() <= 0)
guardian.heal(200);
}
}
}
Aggregations