Search in sources :

Example 11 with IArsMagicaBoss

use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.

the class EntityAIThrowRock method continueExecuting.

@Override
public boolean continueExecuting() {
    EntityLivingBase AITarget = host.getAttackTarget();
    if (AITarget == null || AITarget.isDead || (((IArsMagicaBoss) host).getCurrentAction() == BossActions.THROWING_ROCK && ((IArsMagicaBoss) host).getTicksInCurrentAction() > ((IArsMagicaBoss) host).getCurrentAction().getMaxActionTime())) {
        ((IArsMagicaBoss) host).setCurrentAction(BossActions.IDLE);
        cooldownTicks = 50;
        return false;
    }
    return true;
}
Also used : IArsMagicaBoss(am2.bosses.IArsMagicaBoss) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 12 with IArsMagicaBoss

use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.

the class EntityAIShieldBash method continueExecuting.

@Override
public boolean continueExecuting() {
    EntityLivingBase AITarget = host.getAttackTarget();
    if (AITarget == null || AITarget.isDead || (((IArsMagicaBoss) host).getCurrentAction() == BossActions.SHIELD_BASH && ((IArsMagicaBoss) host).getTicksInCurrentAction() > ((IArsMagicaBoss) host).getCurrentAction().getMaxActionTime())) {
        ((IArsMagicaBoss) host).setCurrentAction(BossActions.IDLE);
        cooldownTicks = 10;
        return false;
    }
    return true;
}
Also used : IArsMagicaBoss(am2.bosses.IArsMagicaBoss) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 13 with IArsMagicaBoss

use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.

the class EntityAIShieldBash 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.SHIELD_BASH)
            ((IArsMagicaBoss) host).setCurrentAction(BossActions.SHIELD_BASH);
    if (((IArsMagicaBoss) host).getCurrentAction() == BossActions.SHIELD_BASH && ((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;
            double speed = 4;
            double vertSpeed = 0.325;
            double deltaZ = ent.posZ - host.posZ;
            double deltaX = ent.posX - host.posX;
            double angle = Math.atan2(deltaZ, deltaX);
            double radians = angle;
            if (ent instanceof EntityPlayer) {
                AMNetHandler.INSTANCE.sendVelocityAddPacket(host.worldObj, ent, speed * Math.cos(radians), vertSpeed, speed * Math.sin(radians));
            }
            ent.motionX = (speed * Math.cos(radians));
            ent.motionZ = (speed * Math.sin(radians));
            ent.motionY = vertSpeed;
            ent.attackEntityFrom(DamageSource.causeMobDamage(host), 2);
        }
    }
}
Also used : IArsMagicaBoss(am2.bosses.IArsMagicaBoss) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer)

Example 14 with IArsMagicaBoss

use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.

the class EntityAISpawnWhirlwind method updateTask.

@Override
public void updateTask() {
    host.getLookHelper().setLookPositionWithEntity(host.getAttackTarget(), 30, 30);
    if (host.getDistanceSqToEntity(host.getAttackTarget()) > 64) {
        double deltaZ = host.getAttackTarget().posZ - host.posZ;
        double deltaX = host.getAttackTarget().posX - host.posX;
        double angle = -Math.atan2(deltaZ, deltaX);
        double newX = host.getAttackTarget().posX + (Math.cos(angle) * 6);
        double newZ = host.getAttackTarget().posZ + (Math.sin(angle) * 6);
        host.getNavigator().tryMoveToXYZ(newX, host.getAttackTarget().posY, newZ, 0.5f);
    } else if (!host.canEntityBeSeen(host.getAttackTarget())) {
        host.getNavigator().tryMoveToEntityLiving(host.getAttackTarget(), 0.5f);
    } else {
        if (((IArsMagicaBoss) host).getCurrentAction() != BossActions.CASTING)
            ((IArsMagicaBoss) host).setCurrentAction(BossActions.CASTING);
        windTicks++;
        if (windTicks == 12 && !host.worldObj.isRemote) {
            if (!host.worldObj.isRemote)
                host.worldObj.playSoundAtEntity(host, ((IArsMagicaBoss) host).getAttackSound(), 1.0f, 1.0f);
            EntityWhirlwind whirlwind = new EntityWhirlwind(host.worldObj);
            whirlwind.setPosition(host.posX, host.posY + host.getEyeHeight(), host.posZ);
            host.worldObj.spawnEntityInWorld(whirlwind);
        }
    }
    if (windTicks >= 23) {
        resetTask();
    }
}
Also used : IArsMagicaBoss(am2.bosses.IArsMagicaBoss) EntityWhirlwind(am2.entities.EntityWhirlwind)

Example 15 with IArsMagicaBoss

use of am2.bosses.IArsMagicaBoss in project ArsMagica2 by Mithion.

the class EntityAIFireRain method updateTask.

@Override
public void updateTask() {
    if (((IArsMagicaBoss) host).getCurrentAction() != BossActions.CASTING)
        ((IArsMagicaBoss) host).setCurrentAction(BossActions.CASTING);
    boltTicks++;
    if (boltTicks == 12) {
        if (!host.worldObj.isRemote) {
            EntitySpellEffect fire = new EntitySpellEffect(host.worldObj);
            fire.setPosition(host.posX, host.posY, host.posZ);
            fire.setTicksToExist(300);
            fire.setRainOfFire(true);
            fire.setRadius(10);
            fire.SetCasterAndStack(host, null);
            host.worldObj.spawnEntityInWorld(fire);
        }
    }
    if (boltTicks >= 23) {
        resetTask();
    }
}
Also used : EntitySpellEffect(am2.entities.EntitySpellEffect)

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