use of am2.spell.components.Summon in project ArsMagica2 by Mithion.
the class TileEntityCraftingAltar method matchCurrentRecipe.
private boolean matchCurrentRecipe() {
ISpellPart part = SpellRecipeManager.instance.getPartByRecipe(currentAddedItems);
if (part == null)
return false;
ArrayList<KeyValuePair<ISpellPart, byte[]>> currentShapeGroupList = getShapeGroupToAddTo();
if (part instanceof Summon)
handleSummonShape();
if (part instanceof Binding)
handleBindingShape();
byte[] metaData = new byte[0];
if (part instanceof ISpellModifier) {
metaData = ((ISpellModifier) part).getModifierMetadata(currentAddedItems.toArray(new ItemStack[currentAddedItems.size()]));
if (metaData == null) {
metaData = new byte[0];
}
}
//we're now creating the body of the spell
if (currentShapeGroupList == null) {
spellDef.add(new KeyValuePair<ISpellPart, byte[]>(part, metaData));
} else {
currentShapeGroupList.add(new KeyValuePair<ISpellPart, byte[]>(part, metaData));
}
return true;
}
use of am2.spell.components.Summon in project ArsMagica2 by Mithion.
the class SpellValidator method validateStage.
private StageValidations validateStage(ArrayList<ISpellPart> stageDefinition, boolean isFinalStage) {
boolean terminus = false;
boolean principum = false;
boolean one_component = !isFinalStage;
boolean one_shape = false;
for (ISpellPart part : stageDefinition) {
if (part instanceof Summon)
return StageValidations.TERMINUS;
if (part instanceof ISpellShape) {
one_shape = true;
if (((ISpellShape) part).isTerminusShape())
terminus = true;
if (((ISpellShape) part).isPrincipumShape())
principum = true;
continue;
}
if (part instanceof ISpellComponent) {
one_component = true;
continue;
}
}
if (principum)
return StageValidations.PRINCIPUM;
if (!one_component || !one_shape)
return StageValidations.NOT_VALID;
if (terminus)
return StageValidations.TERMINUS;
return StageValidations.VALID;
}
use of am2.spell.components.Summon in project ArsMagica2 by Mithion.
the class TileEntityCraftingAltar method AddSpecialMetadata.
private void AddSpecialMetadata(ItemStack craftStack) {
if (addedPhylactery != null) {
Summon summon = (Summon) SkillManager.instance.getSkill("Summon");
summon.setSummonType(craftStack, addedPhylactery);
}
if (addedBindingCatalyst != null) {
Binding binding = (Binding) SkillManager.instance.getSkill("Binding");
binding.setBindingType(craftStack, addedBindingCatalyst);
}
}
use of am2.spell.components.Summon 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.spell.components.Summon in project ArsMagica2 by Mithion.
the class TileEntitySummoner method summonCreature.
private void summonCreature() {
if (worldObj.isRemote || this.summonEntityID != -1)
return;
if (dummyCaster == null) {
dummyCaster = new DummyEntityPlayer(worldObj);
}
EntityLiving summon = ((Summon) SkillManager.instance.getSkill("Summon")).summonCreature(inventory[SUMMON_SLOT], dummyCaster, dummyCaster, worldObj, xCoord, yCoord, zCoord);
if (summon != null) {
if (summon instanceof EntityCreature)
EntityUtilities.setGuardSpawnLocation((EntityCreature) summon, xCoord, yCoord, zCoord);
this.summonEntityID = summon.getEntityId();
PowerNodeRegistry.For(this.worldObj).consumePower(this, PowerNodeRegistry.For(this.worldObj).getHighestPowerType(this), summonCost);
this.summonCooldown = this.maxSummonCooldown;
EntityUtilities.setTileSpawned(summon, this);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
Aggregations