use of am2.entities.EntityLightMage in project ArsMagica2 by Mithion.
the class RenderMage method getEntityTexture.
@Override
protected ResourceLocation getEntityTexture(Entity ent) {
String tex = "unknown";
if (ent instanceof EntityLightMage) {
tex = ((EntityLightMage) ent).getTexture();
} else if (ent instanceof EntityDarkMage) {
tex = ((EntityDarkMage) ent).getTexture();
}
if (resourceLocations.containsKey(tex)) {
return resourceLocations.get(tex);
} else {
ResourceLocation rLoc = new ResourceLocation("arsmagica2", tex);
resourceLocations.put(tex, rLoc);
return rLoc;
}
}
use of am2.entities.EntityLightMage in project ArsMagica2 by Mithion.
the class SpellHelper method attackTargetSpecial.
public boolean attackTargetSpecial(ItemStack spellStack, Entity target, DamageSource damagesource, float magnitude) {
if (target.worldObj.isRemote)
return true;
EntityPlayer dmgSrcPlayer = null;
if (damagesource.getSourceOfDamage() != null) {
if (damagesource.getSourceOfDamage() instanceof EntityLivingBase) {
EntityLivingBase source = (EntityLivingBase) damagesource.getSourceOfDamage();
if ((source instanceof EntityLightMage || source instanceof EntityDarkMage) && target.getClass() == EntityCreeper.class) {
return false;
} else if (source instanceof EntityLightMage && target instanceof EntityLightMage) {
return false;
} else if (source instanceof EntityDarkMage && target instanceof EntityDarkMage) {
return false;
} else if (source instanceof EntityPlayer && target instanceof EntityPlayer && !target.worldObj.isRemote && (!MinecraftServer.getServer().isPVPEnabled() || ((EntityPlayer) target).capabilities.isCreativeMode)) {
return false;
}
if (source.isPotionActive(BuffList.fury))
magnitude += 4;
}
if (damagesource.getSourceOfDamage() instanceof EntityPlayer) {
dmgSrcPlayer = (EntityPlayer) damagesource.getSourceOfDamage();
int armorSet = ArmorHelper.getFullArsMagicaArmorSet(dmgSrcPlayer);
if (armorSet == ArsMagicaArmorMaterial.MAGE.getMaterialID()) {
magnitude *= 1.05f;
} else if (armorSet == ArsMagicaArmorMaterial.BATTLEMAGE.getMaterialID()) {
magnitude *= 1.025f;
} else if (armorSet == ArsMagicaArmorMaterial.ARCHMAGE.getMaterialID()) {
magnitude *= 1.1f;
}
ItemStack equipped = (dmgSrcPlayer).getCurrentEquippedItem();
if (equipped != null && equipped.getItem() == ItemsCommonProxy.arcaneSpellbook) {
magnitude *= 1.1f;
}
}
}
if (target instanceof EntityLivingBase) {
if (EntityUtilities.isSummon((EntityLivingBase) target) && damagesource.damageType.equals("magic")) {
magnitude *= 3.0f;
}
}
magnitude *= AMCore.config.getDamageMultiplier();
ItemStack oldItemStack = null;
boolean success = false;
if (target instanceof EntityDragon) {
success = ((EntityDragon) target).attackEntityFromPart(((EntityDragon) target).dragonPartBody, damagesource, magnitude);
} else {
success = target.attackEntityFrom(damagesource, magnitude);
}
if (dmgSrcPlayer != null) {
if (spellStack != null && target instanceof EntityLivingBase) {
if (!target.worldObj.isRemote && ((EntityLivingBase) target).getHealth() <= 0 && SpellUtils.instance.modifierIsPresent(SpellModifiers.DISMEMBERING_LEVEL, spellStack, 0)) {
double chance = SpellUtils.instance.getModifiedDouble_Add(0, spellStack, dmgSrcPlayer, target, dmgSrcPlayer.worldObj, 0, SpellModifiers.DISMEMBERING_LEVEL);
if (dmgSrcPlayer.worldObj.rand.nextDouble() <= chance) {
dropHead(target, dmgSrcPlayer.worldObj);
}
}
}
}
return success;
}
use of am2.entities.EntityLightMage in project ArsMagica2 by Mithion.
the class Disarm method applyEffectEntity.
@Override
public boolean applyEffectEntity(ItemStack stack, World world, EntityLivingBase caster, Entity target) {
if (target instanceof EntityLightMage || target instanceof EntityDarkMage)
return false;
if (target instanceof EntityPlayer && (!AMCore.config.getDisarmAffectsPlayers() || (!world.isRemote && !MinecraftServer.getServer().isPVPEnabled())))
return false;
if (target instanceof EntityPlayer && ((EntityPlayer) target).getHeldItem() != null && !target.worldObj.isRemote) {
if (EnchantmentHelper.getEnchantmentLevel(AMEnchantments.soulbound.effectId, ((EntityPlayer) target).getHeldItem()) > 0)
return true;
((EntityPlayer) target).dropOneItem(true);
return true;
} else if (target instanceof EntityMob && ((EntityMob) target).getHeldItem() != null) {
if (EnchantmentHelper.getEnchantmentLevel(AMEnchantments.soulbound.effectId, ((EntityMob) target).getHeldItem()) > 0)
return true;
if (!world.isRemote) {
EntityItem item = new EntityItem(world);
ItemStack dropstack = ((EntityMob) target).getHeldItem().copy();
if (dropstack.getMaxDamage() > 0)
dropstack.setItemDamage((int) Math.floor(dropstack.getMaxDamage() * (0.8f + (world.rand.nextFloat() * 0.19f))));
item.setEntityItemStack(dropstack);
item.setPosition(target.posX, target.posY, target.posZ);
world.spawnEntityInWorld(item);
}
((EntityMob) target).setCurrentItemOrArmor(0, null);
((EntityMob) target).setAttackTarget(caster);
Iterator it = ((EntityMob) target).tasks.taskEntries.iterator();
boolean removed = false;
while (it.hasNext()) {
EntityAITaskEntry task = (EntityAITaskEntry) it.next();
if (task.action instanceof EntityAIArrowAttack) {
it.remove();
removed = true;
break;
}
}
if (removed) {
((EntityMob) target).tasks.addTask(5, new EntityAIAttackOnCollide((EntityCreature) target, 0.5, true));
((EntityMob) target).setCanPickUpLoot(true);
}
} else if (target instanceof EntityEnderman) {
int blockID = ((EntityEnderman) target).getCarryingData();
int meta = ((EntityEnderman) target).getCarryingData();
if (blockID > 0) {
((EntityEnderman) target).setCarryingData(0);
ItemStack dropstack = new ItemStack(Block.getBlockById(blockID), 1, meta);
EntityItem item = new EntityItem(world);
item.setEntityItemStack(dropstack);
item.setPosition(target.posX, target.posY, target.posZ);
world.spawnEntityInWorld(item);
}
((EntityMob) target).setAttackTarget(caster);
}
return false;
}
Aggregations