use of am2.entities.ai.EntityAIRangedAttackSpell in project ArsMagica2 by Mithion.
the class EntityLightMage method initAI.
private void initAI() {
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
this.tasks.addTask(7, new EntityAILookIdle(this));
this.tasks.addTask(5, new EntityAIWander(this, MovementSpeed()));
this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityManaVortex.class, 10, MovementSpeed(), ActionSpeed()));
this.tasks.addTask(3, new EntityAIAllyManaLink(this));
this.tasks.addTask(4, new EntityAIRangedAttackSpell(this, MovementSpeed(), 20, NPCSpells.instance.lightMage_DiminishedAttack));
//Retaliation to attacks
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityDarkMage.class, 0, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntitySlime.class, 0, true));
this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityMob.class, 0, true, false, LightMageEntitySelector.instance));
}
use of am2.entities.ai.EntityAIRangedAttackSpell in project ArsMagica2 by Mithion.
the class EntityDarkMage method initAI.
private void initAI() {
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityLightMage.class, 8.0F));
this.tasks.addTask(7, new EntityAILookIdle(this));
this.tasks.addTask(5, new EntityAIWander(this, MovementSpeed()));
this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityManaVortex.class, 10, MovementSpeed(), ActionSpeed()));
this.tasks.addTask(4, new EntityAIRangedAttackSpell(this, MovementSpeed(), 40, NPCSpells.instance.darkMage_DiminishedAttack));
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLightMage.class, 0, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityLivingBase.class, 0, true, false, DarkMageEntitySelector.instance));
}
use of am2.entities.ai.EntityAIRangedAttackSpell in project ArsMagica2 by Mithion.
the class EntityDarkMage method getCanSpawnHere.
@Override
public boolean getCanSpawnHere() {
if (!SpawnBlacklists.entityCanSpawnHere(this.posX, this.posZ, worldObj, this))
return false;
if (getAverageNearbyPlayerMagicLevel() < 8) {
return false;
}
ExtendedProperties.For(this).setMagicLevelWithMana(5);
int avgLevel = getAverageNearbyPlayerMagicLevel();
if (avgLevel == 0) {
if (rand.nextInt(100) < 10) {
this.tasks.addTask(3, new EntityAIRangedAttackSpell(this, MovementSpeed(), 80, NPCSpells.instance.darkMage_NormalAttack));
this.dataWatcher.updateObject(DW_MAGE_BOOK, 1);
}
} else {
int levelRand = rand.nextInt(avgLevel * 2);
if (levelRand > 60) {
this.tasks.addTask(2, new EntityAIRangedAttackSpell(this, MovementSpeed(), 160, NPCSpells.instance.darkMage_AugmentedAttack));
this.dataWatcher.updateObject(DW_MAGE_BOOK, 2);
} else if (levelRand > 30) {
this.tasks.addTask(3, new EntityAIRangedAttackSpell(this, MovementSpeed(), 80, NPCSpells.instance.darkMage_NormalAttack));
this.dataWatcher.updateObject(DW_MAGE_BOOK, 1);
}
}
ExtendedProperties.For(this).setFullSync();
hasUpdated = true;
return super.getCanSpawnHere();
}
use of am2.entities.ai.EntityAIRangedAttackSpell in project ArsMagica2 by Mithion.
the class EntityLightMage method getCanSpawnHere.
@Override
public boolean getCanSpawnHere() {
if (!SpawnBlacklists.entityCanSpawnHere(this.posX, this.posZ, worldObj, this))
return false;
if (getAverageNearbyPlayerMagicLevel() < 8) {
return false;
}
int avgLevel = getAverageNearbyPlayerMagicLevel();
IAttributeInstance attributeinstance = this.getEntityAttribute(SharedMonsterAttributes.maxHealth);
if (avgLevel == 0) {
ExtendedProperties.For(this).setMagicLevelWithMana(10);
if (rand.nextInt(100) < 10) {
this.tasks.addTask(3, new EntityAIRangedAttackSpell(this, MovementSpeed(), 40, NPCSpells.instance.lightMage_NormalAttack));
this.dataWatcher.updateObject(DW_MAGE_BOOK, 1);
}
} else {
ExtendedProperties.For(this).setMagicLevelWithMana(10 + rand.nextInt(avgLevel));
int levelRand = rand.nextInt(avgLevel * 2);
if (levelRand > 60) {
this.tasks.addTask(2, new EntityAIRangedAttackSpell(this, MovementSpeed(), 100, NPCSpells.instance.lightMage_AugmentedAttack));
this.dataWatcher.updateObject(DW_MAGE_BOOK, 2);
}
if (levelRand > 30) {
this.tasks.addTask(3, new EntityAIRangedAttackSpell(this, MovementSpeed(), 40, NPCSpells.instance.lightMage_NormalAttack));
this.dataWatcher.updateObject(DW_MAGE_BOOK, 1);
}
}
if (!worldObj.isRemote)
ExtendedProperties.For(this).setFullSync();
hasUpdated = true;
return isValidLightLevel() && super.getCanSpawnHere();
}
use of am2.entities.ai.EntityAIRangedAttackSpell in project ArsMagica2 by Mithion.
the class EntityMageVillager method initAI.
private void initAI() {
this.tasks.taskEntries.clear();
this.setAIMoveSpeed(0.5F);
this.actionSpeed = 0.7f;
this.getNavigator().setBreakDoors(true);
this.getNavigator().setAvoidsWater(true);
this.tasks.addTask(0, new EntityAISwimming(this));
this.tasks.addTask(1, new EntityAITradePlayer(this));
this.tasks.addTask(1, new EntityAILookAtTradePlayer(this));
this.tasks.addTask(4, new EntityAIRangedAttackSpell(this, actionSpeed, 60, NPCSpells.instance.darkMage_DiminishedAttack));
this.tasks.addTask(4, new EntityAIRangedAttackSpell(this, actionSpeed, 140, NPCSpells.instance.healSelf));
this.tasks.addTask(4, new EntityAIRangedAttackSpell(this, actionSpeed, 40, NPCSpells.instance.fireBolt));
this.tasks.addTask(4, new EntityAIRangedAttackSpell(this, actionSpeed, 100, NPCSpells.instance.arcaneBolt));
this.tasks.addTask(4, new EntityAIRangedAttackSpell(this, actionSpeed, 120, NPCSpells.instance.lightMage_NormalAttack));
this.tasks.addTask(2, new EntityAIMoveIndoors(this));
this.tasks.addTask(3, new EntityAIRestrictOpenDoor(this));
this.tasks.addTask(4, new EntityAIOpenDoor(this, true));
this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 0.3F));
this.tasks.addTask(7, new EntityAIFollowGolem(this));
this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityPlayer.class, 3.0F, 1.0F));
this.tasks.addTask(9, new EntityAIWatchClosest2(this, EntityVillager.class, 5.0F, 0.02F));
this.tasks.addTask(9, new EntityAIWander(this, 0.3F));
this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityLiving.class, 8.0F));
this.targetTasks.taskEntries.clear();
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityMob.class, 5, false));
}
Aggregations