Search in sources :

Example 1 with BuffEffectShrink

use of am2.buffs.BuffEffectShrink 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)

Aggregations

BuffEffectMagicShield (am2.buffs.BuffEffectMagicShield)1 BuffEffectShrink (am2.buffs.BuffEffectShrink)1 Constructor (java.lang.reflect.Constructor)1 EntityCreature (net.minecraft.entity.EntityCreature)1 PotionEffect (net.minecraft.potion.PotionEffect)1