From ce4b57101073b4a1f25d877cb11f39b39f3e5f02 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Mon, 24 Nov 2014 17:22:38 -0500 Subject: [PATCH] Work on demons continues. --- build.properties | 4 +- .../api/spell/SpellEffectRegistry.java | 2 - .../ai/EntityDemonAIHurtByTarget.java | 2 +- .../demonHoard/DemonHoardPacket.java | 4 +- .../demonHoard/DemonPacketAngel.java | 4 +- .../demonHoard/DemonPacketRegistry.java | 14 ++-- .../demon/EntityMinorDemonGrunt.java | 13 +++- .../tileEntity/TEDemonPortal.java | 70 ++++++++++++++++--- 8 files changed, 87 insertions(+), 26 deletions(-) diff --git a/build.properties b/build.properties index ade97d90..d6f241af 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ # -#Thu Nov 20 13:21:24 EST 2014 +#Sat Nov 22 10:17:06 EST 2014 mod_name=BloodMagic forge_version=10.13.2.1232 ccc_version=1.0.4.29 @@ -8,5 +8,5 @@ nei_version=1.0.3.64 package_group=com.wayoftime.bloodmagic mod_version=1.2.1a minetweaker_version=Dev-1.7.10-3.0.9B -build_number=1 mc_version=1.7.10 +build_number=2 diff --git a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java index 44d9aa53..f217b12a 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java @@ -63,8 +63,6 @@ public class SpellEffectRegistry public static ComplexSpellEffect getSpellEffect(Class paraClass, ComplexSpellType type, ComplexSpellModifier mod, int power, int potency, int cost) { - System.out.println("Debuging"); - if(paraClass == null || type == null || mod == null) { return null; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityDemonAIHurtByTarget.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityDemonAIHurtByTarget.java index 69e1d8ee..2bf2f6ae 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityDemonAIHurtByTarget.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/ai/EntityDemonAIHurtByTarget.java @@ -40,7 +40,7 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord); if(portal instanceof TEDemonPortal) { - ((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget()); + ((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget(), 25); } double d0 = this.getTargetDistance(); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonHoardPacket.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonHoardPacket.java index 0f544174..14dd60ef 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonHoardPacket.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonHoardPacket.java @@ -9,9 +9,9 @@ public abstract class DemonHoardPacket } - public abstract int summonDemons(World world, int x, int y, int z, DemonType type, int tier); + public abstract int summonDemons(World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian); public abstract boolean canFitType(DemonType type); - public abstract float getRelativeChance(DemonType type, int tier); + public abstract float getRelativeChance(DemonType type, int tier, boolean spawnGuardian); } diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketAngel.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketAngel.java index 68b219b4..64b1de61 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketAngel.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketAngel.java @@ -13,13 +13,13 @@ public class DemonPacketAngel extends DemonHoardPacket } @Override - public float getRelativeChance(DemonType type, int tier) + public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian) { return 1.0f; } @Override - public int summonDemons(World world, int x, int y, int z, DemonType type, int tier) + public int summonDemons(World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian) { Entity entity = new EntityFallenAngel(world); entity.setPosition(x, y, z); diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketRegistry.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketRegistry.java index 15b5205f..b7618c95 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketRegistry.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/DemonPacketRegistry.java @@ -22,7 +22,7 @@ public class DemonPacketRegistry return false; } - public static String getDemonPacketName(DemonType type, int tier) + public static String getDemonPacketName(DemonType type, int tier, boolean spawnGuardian) { float totalChance = 0; @@ -35,7 +35,7 @@ public class DemonPacketRegistry continue; } - totalChance += packet.getRelativeChance(type, tier); + totalChance += packet.getRelativeChance(type, tier, spawnGuardian); } for(Entry entry : packetMap.entrySet()) @@ -47,7 +47,7 @@ public class DemonPacketRegistry continue; } - float relativeChance = packet.getRelativeChance(type, tier); + float relativeChance = packet.getRelativeChance(type, tier, spawnGuardian); if(relativeChance >= totalChance) { @@ -61,18 +61,18 @@ public class DemonPacketRegistry return ""; } - public static int spawnDemons(World world, int x, int y, int z, DemonType type, int tier) + public static int spawnDemons(World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian) { - return spawnDemons(world, x, y, z, getDemonPacketName(type, tier), type, tier); + return spawnDemons(world, x, y, z, getDemonPacketName(type, tier, spawnGuardian), type, tier, spawnGuardian); } - public static int spawnDemons(World world, int x, int y, int z, String name, DemonType type, int tier) + public static int spawnDemons(World world, int x, int y, int z, String name, DemonType type, int tier, boolean spawnGuardian) { DemonHoardPacket packet = packetMap.get(name); if(packet != null) { - return packet.summonDemons(world, x, y, z, type, tier); + return packet.summonDemons(world, x, y, z, type, tier, spawnGuardian); } return 0; diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGrunt.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGrunt.java index 52ada58d..574152df 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGrunt.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/demonHoard/demon/EntityMinorDemonGrunt.java @@ -70,6 +70,11 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM //this.isImmuneToFire = true; } + public boolean isTameable() + { + return false; + } + @Override protected void applyEntityAttributes() { @@ -77,7 +82,6 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM //This line affects the speed of the monster this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); - //My guess is that this will alter the max health if (this.isTamed()) { this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxTamedHealth); @@ -126,6 +130,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM /** * main AI tick function, replaces updateEntityActionState */ + @Override protected void updateAITick() { this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); @@ -134,6 +139,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM /** * (abstract) Protected helper method to write subclass entity data to NBT. */ + @Override public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { super.writeEntityToNBT(par1NBTTagCompound); @@ -145,6 +151,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM /** * (abstract) Protected helper method to read subclass entity data from NBT. */ + @Override public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound); @@ -220,11 +227,13 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently * use in wolves. */ + @Override public int getVerticalFaceSpeed() { return this.isSitting() ? 20 : super.getVerticalFaceSpeed(); } + @Override public void setTamed(boolean par1) { super.setTamed(par1); @@ -286,7 +295,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); } - } else if (itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) + } else if (this.isTameable() && itemstack != null && itemstack.getItem().equals(ModItems.weakBloodOrb) && !this.isAngry()) { if (!par1EntityPlayer.capabilities.isCreativeMode) { diff --git a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java index b49415a5..5835b2c4 100644 --- a/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java +++ b/src/main/java/WayofTime/alchemicalWizardry/common/demonVillage/tileEntity/TEDemonPortal.java @@ -62,6 +62,8 @@ public class TEDemonPortal extends TileEntity public ForgeDirection nextDemonPortalDirection = ForgeDirection.DOWN; public int buildingStage = -1; + + public int lockdownTimer; public TEDemonPortal() { @@ -91,6 +93,44 @@ public class TEDemonPortal extends TileEntity this.houseCooldown = 0; this.roadCooldown = 0; this.tier = 0; + this.lockdownTimer = 0; + } + + public boolean isLockedDown() + { + return this.lockdownTimer > 0; + } + + public float getRoadChance() + { + if(isLockedDown()) + { + return 0; + } + return 0.6f; + } + + public float getHouseChance() + { + if(isLockedDown()) + { + return 0; + } + return 0.3f; + } + + public float getDemonPortalChance() + { + if(isLockedDown()) + { + return 0; + } + return 0.5f; + } + + public float getDemonHoardChance() + { + return 1.0f; } public boolean decreaseRandomCooldown(int amount) @@ -98,10 +138,10 @@ public class TEDemonPortal extends TileEntity float totalChance = 0; Map map = new HashMap(); - map.put("roadChance", 0.6f); - map.put("houseChance", 0.3f); - map.put("demonPortalChance", 0.5f); - map.put("demonHoardChance", 1.0f); + map.put("roadChance", this.getRoadChance()); + map.put("houseChance", this.getHouseChance()); + map.put("demonPortalChance", this.getDemonPortalChance()); + map.put("demonHoardChance", this.getDemonHoardChance()); String action = ""; @@ -160,7 +200,7 @@ public class TEDemonPortal extends TileEntity return true; } - public void notifyDemons(EntityLivingBase demon, EntityLivingBase target) //TODO + public void notifyDemons(EntityLivingBase demon, EntityLivingBase target, double radius) //TODO { // if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget())) for(IHoardDemon thrallDemon : this.hoardList) @@ -169,7 +209,18 @@ public class TEDemonPortal extends TileEntity { if(thrallDemon != demon && ((EntityCreature) thrallDemon).getAttackTarget() == null && !((EntityCreature) thrallDemon).isOnSameTeam(target)) { + double xf = demon.posX; + double yf = demon.posY; + double zf = demon.posZ; + double xi = ((EntityCreature) thrallDemon).posX; + double yi = ((EntityCreature) thrallDemon).posY; + double zi = ((EntityCreature) thrallDemon).posZ; + + if((xi-xf)*(xi-xf) + (yi-yf)*(yi-yf) + (zi-zf)*(zi-zf) <= radius*radius) + { + ((EntityCreature) thrallDemon).setAttackTarget(target); + } } } } @@ -225,6 +276,7 @@ public class TEDemonPortal extends TileEntity return; } + Math.max(0, this.lockdownTimer - 1); this.incrementPoints(); this.assignPoints(); @@ -260,7 +312,7 @@ public class TEDemonPortal extends TileEntity if(this.demonHoardCooldown <= 0) { - int complexityCost = this.createRandomDemonHoard(tier, DemonType.FIRE); + int complexityCost = this.createRandomDemonHoard(tier, DemonType.FIRE, this.isLockedDown()); if(complexityCost > 0) { this.demonHoardCooldown = TEDemonPortal.demonHoardDelay * complexityCost; @@ -337,6 +389,7 @@ public class TEDemonPortal extends TileEntity this.nextDemonPortalDirection = ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("nextDemonPortalDirection")); this.pointPool = par1NBTTagCompound.getFloat("pointPool"); + this.lockdownTimer = par1NBTTagCompound.getInteger("lockdownTimer"); } @Override @@ -385,9 +438,10 @@ public class TEDemonPortal extends TileEntity par1NBTTagCompound.setInteger("nextDemonPortalDirection", this.nextDemonPortalDirection.ordinal()); par1NBTTagCompound.setFloat("pointPool", pointPool); + par1NBTTagCompound.setInteger("lockdownTimer", this.lockdownTimer); } - public int createRandomDemonHoard(int tier, DemonType type) + public int createRandomDemonHoard(int tier, DemonType type, boolean spawnGuardian) { int next = rand.nextInt(4); ForgeDirection dir; @@ -416,7 +470,7 @@ public class TEDemonPortal extends TileEntity return 0; } - return DemonPacketRegistry.spawnDemons(worldObj, xCoord + road.xCoord * 5, yCoord + road.yCoord, zCoord + road.zCoord * 5, type, tier); + return DemonPacketRegistry.spawnDemons(worldObj, xCoord + road.xCoord * 5, yCoord + road.yCoord, zCoord + road.zCoord * 5, type, tier, spawnGuardian); } public int createRandomRoad() //Return the number of road spaces