Added the hardmode gaia guardian.

This commit is contained in:
Lizbeth Rika committed 2015-01-30 21:06:28 +00:00
1 parent afb1b87db3
commit b901f1a9d1
18 files changed
+207 -64

No files matched your search

@@ -80,6 +80,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
private static final String TAG_SOURCE_Y = "sourceY";
private static final String TAG_SOURCE_Z = "sourcesZ";
private static final String TAG_MOB_SPAWN_TICKS = "mobSpawnTicks";
private static final String TAG_HARD_MODE = "hardMode";
private static final int[][] PYLON_LOCATIONS = new int[][] {
{ 4, 1, 4 },
@@ -102,7 +103,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
experienceValue = 825;
}
public static boolean spawn(EntityPlayer player, ItemStack par1ItemStack, World par3World, int par4, int par5, int par6) {
public static boolean spawn(EntityPlayer player, ItemStack par1ItemStack, World par3World, int par4, int par5, int par6, boolean hard) {
Block block = par3World.getBlock(par4, par5, par6);
if(block == Blocks.beacon && !par3World.isRemote) {
if(par3World.difficultySetting == EnumDifficulty.PEACEFUL) {
@@ -130,6 +131,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
e.setHealth(1F);
e.setSource(par4, par5, par6);
e.setMobSpawnTicks(MOB_SPAWN_TICKS);
e.setHardMode(hard);
par3World.playSoundAtEntity(e, "mob.enderdragon.growl", 10F, 0.1F);
par3World.spawnEntityInWorld(e);
return true;
@@ -153,6 +155,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
dataWatcher.addObject(24, 0); // Source Y
dataWatcher.addObject(25, 0); // Source Z
dataWatcher.addObject(26, 0); // Ticks spawning mobs
dataWatcher.addObject(27, (byte) 0); // Hard Mode
}
public int getInvulTime() {
@@ -178,6 +181,10 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
return dataWatcher.getWatchableObjectInt(26);
}
public boolean isHardMode() {
return dataWatcher.getWatchableObjectByte(27) == 1;
}
public void setInvulTime(int time) {
dataWatcher.updateObject(20, time);
}
@@ -200,6 +207,10 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
dataWatcher.updateObject(26, ticks);
}
public void setHardMode(boolean hardMode) {
dataWatcher.updateObject(27, (byte) (hardMode ? 1 : 0));
}
@Override
public void writeEntityToNBT(NBTTagCompound par1nbtTagCompound) {
super.writeEntityToNBT(par1nbtTagCompound);
@@ -211,6 +222,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
par1nbtTagCompound.setInteger(TAG_SOURCE_X, source.posX);
par1nbtTagCompound.setInteger(TAG_SOURCE_Y, source.posY);
par1nbtTagCompound.setInteger(TAG_SOURCE_Z, source.posZ);
par1nbtTagCompound.setBoolean(TAG_HARD_MODE, isHardMode());
}
@Override
@@ -224,12 +237,14 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
int y = par1nbtTagCompound.getInteger(TAG_SOURCE_Y);
int z = par1nbtTagCompound.getInteger(TAG_SOURCE_Z);
setSource(x, y, z);
setHardMode(par1nbtTagCompound.getBoolean(TAG_HARD_MODE));
}
@Override
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) {
if((par1DamageSource.damageType.equals("player") || par1DamageSource.getEntity() instanceof EntityPixie) && par1DamageSource.getEntity() != null && !(par1DamageSource.getEntity() instanceof FakePlayer) && getInvulTime() == 0)
return super.attackEntityFrom(par1DamageSource, par2);
return super.attackEntityFrom(par1DamageSource, par2 * (isHardMode() ? 0.6F : 1F));
return false;
}
@@ -254,16 +269,16 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
setAggroed(true);
}
}
@Override
public void onDeath(DamageSource p_70645_1_) {
super.onDeath(p_70645_1_);
EntityLivingBase entitylivingbase = this.func_94060_bK();
if(entitylivingbase instanceof EntityPlayer) {
((EntityPlayer) entitylivingbase).addStat(ModAchievements.gaiaGuardianKill, 1);
if(!anyWithArmor)
((EntityPlayer) entitylivingbase).addStat(ModAchievements.gaiaGuardianNoArmor, 1);
}
EntityLivingBase entitylivingbase = this.func_94060_bK();
if(entitylivingbase instanceof EntityPlayer) {
((EntityPlayer) entitylivingbase).addStat(ModAchievements.gaiaGuardianKill, 1);
if(!anyWithArmor)
((EntityPlayer) entitylivingbase).addStat(ModAchievements.gaiaGuardianNoArmor, 1);
}
}
@Override
@@ -281,8 +296,28 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
@Override
protected void dropFewItems(boolean par1, int par2) {
if(par1)
entityDropItem(new ItemStack(ModItems.manaResource, 8, 5), 1F);
if(par1) {
boolean hard = isHardMode();
entityDropItem(new ItemStack(ModItems.manaResource, hard ? 16 : 8, 5), 1F);
if(hard) {
// TODO Add Will Drops
if(Math.random() < 0.25)
entityDropItem(new ItemStack(ModItems.overgrowthSeed, rand.nextInt(3) + 1), 1F);
if(Math.random() < 0.5) {
boolean voidLotus = Math.random() < 0.3F;
entityDropItem(new ItemStack(ModItems.blackLotus, voidLotus ? 1 : rand.nextInt(3) + 1, voidLotus ? 1 : 0), 1F);
}
if(Math.random() < 0.9)
entityDropItem(new ItemStack(ModItems.manaResource, 16 + rand.nextInt(12)), 1F);
if(Math.random() < 0.7)
entityDropItem(new ItemStack(ModItems.manaResource, 8 + rand.nextInt(6), 1), 1F);
if(Math.random() < 0.5)
entityDropItem(new ItemStack(ModItems.manaResource, 4 + rand.nextInt(3), 1), 1F);
if(Math.random() < 0.3)
entityDropItem(new ItemStack(ModItems.rune, 2 + rand.nextInt(3), rand.nextInt(16)), 1F);
}
}
}
@Override
@@ -293,7 +328,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
setDead();
ChunkCoordinates source = getSource();
boolean hard = isHardMode();
float range = 32F;
List<EntityPlayer> players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(source.posX + 0.5 - range, source.posY + 0.5 - range, source.posZ + 0.5 - range, source.posX + 0.5 + range, source.posY + 0.5 + range, source.posZ + 0.5 + range));
@@ -311,33 +347,34 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
double z = source.posZ - 0.5 - Math.sin(rad) * range;
Botania.proxy.wispFX(worldObj, x, y, z, r, g, b, 0.5F, (float) (Math.random() - 0.5F) * m, (float) (Math.random() - 0.5F) * mv, (float) (Math.random() - 0.5F) * m);
}
if(players.isEmpty() && !worldObj.playerEntities.isEmpty())
setDead();
else for(EntityPlayer player : players) {
if(player.inventory.armorInventory[0] != null || player.inventory.armorInventory[1] != null || player.inventory.armorInventory[2] != null || player.inventory.armorInventory[3] != null)
anyWithArmor = true;
List<PotionEffect> remove = new ArrayList();
Collection<PotionEffect> active = player.getActivePotionEffects();
for(PotionEffect effect : active)
if(effect.getDuration() < 200 && !ReflectionHelper.<Boolean, Potion>getPrivateValue(Potion.class, Potion.potionTypes[effect.getPotionID()], LibObfuscation.IS_BAD_EFFECT))
remove.add(effect);
else {
for(EntityPlayer player : players) {
if(player.inventory.armorInventory[0] != null || player.inventory.armorInventory[1] != null || player.inventory.armorInventory[2] != null || player.inventory.armorInventory[3] != null)
anyWithArmor = true;
active.removeAll(remove);
List<PotionEffect> remove = new ArrayList();
Collection<PotionEffect> active = player.getActivePotionEffects();
for(PotionEffect effect : active)
if(effect.getDuration() < 200 && !ReflectionHelper.<Boolean, Potion>getPrivateValue(Potion.class, Potion.potionTypes[effect.getPotionID()], LibObfuscation.IS_BAD_EFFECT))
remove.add(effect);
player.capabilities.isFlying = player.capabilities.isFlying && player.capabilities.isCreativeMode;
active.removeAll(remove);
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5) >= range) {
Vector3 sourceVector = new Vector3(source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5);
Vector3 playerVector = Vector3.fromEntityCenter(player);
Vector3 motion = sourceVector.copy().sub(playerVector).copy().normalize();
player.capabilities.isFlying = player.capabilities.isFlying && player.capabilities.isCreativeMode;
player.motionX = motion.x;
player.motionY = 0.2;
player.motionZ = motion.z;
if(vazkii.botania.common.core.helper.MathHelper.pointDistanceSpace(player.posX, player.posY, player.posZ, source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5) >= range) {
Vector3 sourceVector = new Vector3(source.posX + 0.5, source.posY + 0.5, source.posZ + 0.5);
Vector3 playerVector = Vector3.fromEntityCenter(player);
Vector3 motion = sourceVector.copy().sub(playerVector).copy().normalize();
player.motionX = motion.x;
player.motionY = 0.2;
player.motionZ = motion.z;
}
}
}
@@ -346,7 +383,8 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
int invul = getInvulTime();
int mobTicks = getMobSpawnTicks();
boolean spawnMissiles = hard && ticksExisted % 15 < 4;
if(invul > 0 && mobTicks == MOB_SPAWN_TICKS) {
if(invul < SPAWN_TICKS && invul > SPAWN_TICKS / 2 && worldObj.rand.nextInt(SPAWN_TICKS - invul + 1) == 0)
for(int i = 0; i < 2; i++)
@@ -375,7 +413,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
switch(worldObj.rand.nextInt(2)) {
case 0 : {
entity = new EntityZombie(worldObj);
if(worldObj.rand.nextInt(12) == 0)
if(worldObj.rand.nextInt(hard ? 9 : 12) == 0)
entity = new EntityWitch(worldObj);
break;
@@ -385,12 +423,12 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
((EntitySkeleton) entity).setCurrentItemOrArmor(0, new ItemStack(Items.bow));
if(worldObj.rand.nextInt(8) == 0) {
((EntitySkeleton) entity).setSkeletonType(1);
((EntitySkeleton) entity).setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword));
((EntitySkeleton) entity).setCurrentItemOrArmor(0, new ItemStack(hard ? ModItems.elementiumSword : Items.stone_sword));
}
break;
}
case 3 : {
for(int j = 0; j < 1 + worldObj.rand.nextInt(5); j++) {
for(int j = 0; j < 1 + worldObj.rand.nextInt(hard ? 8 : 5); j++) {
EntityPixie pixie = new EntityPixie(worldObj);
pixie.setProps(players.get(rand.nextInt(players.size())), this, 1, 8);
pixie.setPosition(posX + width / 2, posY + 2, posZ + width / 2);
@@ -405,6 +443,11 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
worldObj.spawnEntityInWorld(entity);
}
}
if(hard && ticksExisted % 3 < 2) {
spawnMissile();
spawnMissiles = false;
}
}
setMobSpawnTicks(mobTicks - 1);
@@ -433,18 +476,21 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
worldObj.spawnEntityInWorld(landmine);
}
for(int i = 0; i < (spawnPixies ? worldObj.rand.nextInt(3) : 1); i++) {
for(int i = 0; i < (spawnPixies ? worldObj.rand.nextInt(hard ? 6 : 3) : 1); i++) {
EntityPixie pixie = new EntityPixie(worldObj);
pixie.setProps(players.get(rand.nextInt(players.size())), this, 1, 8);
pixie.setPosition(posX + width / 2, posY + 2, posZ + width / 2);
worldObj.spawnEntityInWorld(pixie);
}
setTPDelay(dying ? 40 : 60);
setTPDelay(hard ? dying ? 20 : 45 : dying ? 40 : 60);
spawnLandmines = true;
spawnPixies = false;
}
}
if(spawnMissiles)
spawnMissile();
} else {
range = 3F;
players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - range, posY - range, posZ - range, posX + range, posY + range, posZ + range));
@@ -453,6 +499,17 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
}
}
}
void spawnMissile() {
if(!worldObj.isRemote) {
EntityMagicMissile missile = new EntityMagicMissile(this, true);
missile.setPosition(posX + (Math.random() - 0.5 * 0.1), posY + 2.4 + (Math.random() - 0.5 * 0.1), posZ + (Math.random() - 0.5 * 0.1));
if(missile.getTarget()) {
worldObj.playSoundAtEntity(this, "botania:missile", 0.6F, 0.8F + (float) Math.random() * 0.2F);
worldObj.spawnEntityInWorld(missile);
}
}
}
// EntityEnderman code below ============================================================================
@@ -579,7 +636,7 @@ public class EntityDoppleganger extends EntityCreature implements IBotaniaBossWi
int hpFractUniform = ARBShaderObjects.glGetUniformLocationARB(shader, "hpFract");
float time = getInvulTime();
float grainIntensity = time > 20 ? 1F : time / 20F;
float grainIntensity = time > 20 ? 1F : Math.max(isHardMode() ? 0.5F : 0F, time / 20F);
ARBShaderObjects.glUniform1fARB(grainIntensityUniform, grainIntensity);
ARBShaderObjects.glUniform1fARB(hpFractUniform, getHealth() / getMaxHealth());