Search in sources :

Example 6 with IArsMagicaBoss

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);
        }
    }
}
Also used : IArsMagicaBoss(am2.bosses.IArsMagicaBoss) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 7 with IArsMagicaBoss

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;
}
Also used : IArsMagicaBoss(am2.bosses.IArsMagicaBoss) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 8 with IArsMagicaBoss

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();
    }
}
Also used : PotionEffect(net.minecraft.potion.PotionEffect) Constructor(java.lang.reflect.Constructor) BuffEffectShrink(am2.buffs.BuffEffectShrink) BuffEffectMagicShield(am2.buffs.BuffEffectMagicShield) EntityCreature(net.minecraft.entity.EntityCreature)

Example 9 with IArsMagicaBoss

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);
        }
    }
}
Also used : EntityEnderGuardian(am2.bosses.EntityEnderGuardian)

Example 10 with IArsMagicaBoss

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);
        }
    }
}
Also used : AMVector3(am2.api.math.AMVector3) EntityEnderGuardian(am2.bosses.EntityEnderGuardian)

Aggregations

IArsMagicaBoss (am2.bosses.IArsMagicaBoss)19 EntityLivingBase (net.minecraft.entity.EntityLivingBase)15 EntityEnderGuardian (am2.bosses.EntityEnderGuardian)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 AMVector3 (am2.api.math.AMVector3)2 BuffEffectMagicShield (am2.buffs.BuffEffectMagicShield)1 BuffEffectShrink (am2.buffs.BuffEffectShrink)1 EntityFlicker (am2.entities.EntityFlicker)1 EntityShockwave (am2.entities.EntityShockwave)1 EntitySpellEffect (am2.entities.EntitySpellEffect)1 EntityThrownRock (am2.entities.EntityThrownRock)1 EntityWhirlwind (am2.entities.EntityWhirlwind)1 Constructor (java.lang.reflect.Constructor)1 Render (net.minecraft.client.renderer.entity.Render)1 Entity (net.minecraft.entity.Entity)1 EntityCreature (net.minecraft.entity.EntityCreature)1 EntityLiving (net.minecraft.entity.EntityLiving)1 PotionEffect (net.minecraft.potion.PotionEffect)1 TileEntity (net.minecraft.tileentity.TileEntity)1 Vec3 (net.minecraft.util.Vec3)1