Initial 1.11.2 update
This commit is contained in:
@@ -35,16 +35,18 @@ public class Intimidate extends Spell {
|
||||
/** The NBT tag name for storing the feared entity's UUID in the target's tag compound. */
|
||||
public static final String NBT_KEY = "fearedEntity";
|
||||
|
||||
public Intimidate() {
|
||||
public Intimidate(){
|
||||
super(Tier.APPRENTICE, 20, Element.NECROMANCY, "intimidate", SpellType.ATTACK, 100, EnumAction.BOW, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers) {
|
||||
public boolean cast(World world, EntityPlayer caster, EnumHand hand, int ticksInUse, SpellModifiers modifiers){
|
||||
|
||||
if(!world.isRemote){
|
||||
|
||||
List<EntityCreature> entities = WizardryUtilities.getEntitiesWithinRadius(8*modifiers.get(WizardryItems.range_upgrade), caster.posX, caster.posY, caster.posZ, world, EntityCreature.class);
|
||||
List<EntityCreature> entities = WizardryUtilities.getEntitiesWithinRadius(
|
||||
8 * modifiers.get(WizardryItems.range_upgrade), caster.posX, caster.posY, caster.posZ, world,
|
||||
EntityCreature.class);
|
||||
|
||||
for(EntityCreature target : entities){
|
||||
|
||||
@@ -53,16 +55,17 @@ public class Intimidate extends Spell {
|
||||
NBTTagCompound entityNBT = target.getEntityData();
|
||||
if(entityNBT != null) entityNBT.setUniqueId(NBT_KEY, caster.getUniqueID());
|
||||
|
||||
((EntityLiving)target).addPotionEffect(new PotionEffect(WizardryPotions.fear, (int)(600*modifiers.get(WizardryItems.duration_upgrade)), 0));
|
||||
((EntityLiving)target).addPotionEffect(new PotionEffect(WizardryPotions.fear,
|
||||
(int)(600 * modifiers.get(WizardryItems.duration_upgrade)), 0));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
for(int i=0; i<30; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world, caster.posX - 1 + world.rand.nextDouble()*2,
|
||||
caster.getEntityBoundingBox().minY + 1.5 + world.rand.nextDouble()*0.5,
|
||||
caster.posZ - 1 + world.rand.nextDouble()*2,
|
||||
0, 0, 0, 0, 0.9f, 0.1f, 0.0f);
|
||||
for(int i = 0; i < 30; i++){
|
||||
Wizardry.proxy.spawnParticle(WizardryParticleType.DARK_MAGIC, world,
|
||||
caster.posX - 1 + world.rand.nextDouble() * 2,
|
||||
caster.getEntityBoundingBox().minY + 1.5 + world.rand.nextDouble() * 0.5,
|
||||
caster.posZ - 1 + world.rand.nextDouble() * 2, 0, 0, 0, 0, 0.9f, 0.1f, 0.0f);
|
||||
}
|
||||
}
|
||||
WizardryUtilities.playSoundAtPlayer(caster, SoundEvents.ENTITY_ENDERDRAGON_GROWL, 1.0f, 1.0f);
|
||||
@@ -72,6 +75,7 @@ public class Intimidate extends Spell {
|
||||
/**
|
||||
* Finds a random position away from the caster and sets the given target's AI path to that location. Defined here
|
||||
* so it can be used both in the spell itself and in the potion effect (event handler).
|
||||
*
|
||||
* @param target The entity running away
|
||||
* @param caster The entity that is being run away from
|
||||
* @return True if a new path was found and set, false if not.
|
||||
@@ -80,15 +84,17 @@ public class Intimidate extends Spell {
|
||||
|
||||
if(target.getDistanceToEntity(caster) < 16){
|
||||
|
||||
Vec3d Vec3d = RandomPositionGenerator.findRandomTargetBlockAwayFrom(target, 16, 7, new Vec3d(caster.posX, caster.posY, caster.posZ));
|
||||
Vec3d Vec3d = RandomPositionGenerator.findRandomTargetBlockAwayFrom(target, 16, 7,
|
||||
new Vec3d(caster.posX, caster.posY, caster.posZ));
|
||||
|
||||
if (Vec3d == null){
|
||||
if(Vec3d == null){
|
||||
return false;
|
||||
|
||||
}else{
|
||||
// In both cases it is necessary to check if the entity already has a path so it doesn't change direction
|
||||
// In both cases it is necessary to check if the entity already has a path so it doesn't change
|
||||
// direction
|
||||
// every tick, unless that path is towards the caster.
|
||||
//Path path = target.getNavigator().getPathToXYZ(Vec3d.xCoord, Vec3d.yCoord, Vec3d.zCoord);
|
||||
// Path path = target.getNavigator().getPathToXYZ(Vec3d.xCoord, Vec3d.yCoord, Vec3d.zCoord);
|
||||
|
||||
boolean flag = true;
|
||||
|
||||
@@ -99,24 +105,25 @@ public class Intimidate extends Spell {
|
||||
// Has a built in mind trick effect because for whatever reason this makes it work with skeletons.
|
||||
target.setAttackTarget(null);
|
||||
|
||||
if(flag) return target.getNavigator().tryMoveToXYZ(Vec3d.xCoord, Vec3d.yCoord, Vec3d.zCoord, 1.25);//target.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
|
||||
if(flag) return target.getNavigator().tryMoveToXYZ(Vec3d.xCoord, Vec3d.yCoord, Vec3d.zCoord, 1.25);// target.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue());
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLivingUpdateEvent(LivingUpdateEvent event){
|
||||
|
||||
if(event.getEntityLiving().isPotionActive(WizardryPotions.fear) && event.getEntityLiving() instanceof EntityCreature){
|
||||
|
||||
if(event.getEntityLiving().isPotionActive(WizardryPotions.fear)
|
||||
&& event.getEntityLiving() instanceof EntityCreature){
|
||||
|
||||
NBTTagCompound entityNBT = event.getEntityLiving().getEntityData();
|
||||
EntityCreature creature = (EntityCreature)event.getEntityLiving();
|
||||
|
||||
if(entityNBT != null && entityNBT.hasKey(NBT_KEY)){
|
||||
|
||||
Entity caster = WizardryUtilities.getEntityByUUID(creature.worldObj, entityNBT.getUniqueId(NBT_KEY));
|
||||
Entity caster = WizardryUtilities.getEntityByUUID(creature.world, entityNBT.getUniqueId(NBT_KEY));
|
||||
|
||||
if(caster instanceof EntityLivingBase){
|
||||
Intimidate.runAway(creature, (EntityLivingBase)caster);
|
||||
|
||||
Reference in New Issue
Block a user