Work on demons continues.

This commit is contained in:
WayofTime 2014-11-24 17:22:38 -05:00
parent b661d72f88
commit ce4b571010
8 changed files with 87 additions and 26 deletions

View file

@ -1,5 +1,5 @@
# #
#Thu Nov 20 13:21:24 EST 2014 #Sat Nov 22 10:17:06 EST 2014
mod_name=BloodMagic mod_name=BloodMagic
forge_version=10.13.2.1232 forge_version=10.13.2.1232
ccc_version=1.0.4.29 ccc_version=1.0.4.29
@ -8,5 +8,5 @@ nei_version=1.0.3.64
package_group=com.wayoftime.bloodmagic package_group=com.wayoftime.bloodmagic
mod_version=1.2.1a mod_version=1.2.1a
minetweaker_version=Dev-1.7.10-3.0.9B minetweaker_version=Dev-1.7.10-3.0.9B
build_number=1
mc_version=1.7.10 mc_version=1.7.10
build_number=2

View file

@ -63,8 +63,6 @@ public class SpellEffectRegistry
public static ComplexSpellEffect getSpellEffect(Class<? extends SpellParadigm> paraClass, ComplexSpellType type, ComplexSpellModifier mod, int power, int potency, int cost) public static ComplexSpellEffect getSpellEffect(Class<? extends SpellParadigm> paraClass, ComplexSpellType type, ComplexSpellModifier mod, int power, int potency, int cost)
{ {
System.out.println("Debuging");
if(paraClass == null || type == null || mod == null) if(paraClass == null || type == null || mod == null)
{ {
return null; return null;

View file

@ -40,7 +40,7 @@ public class EntityDemonAIHurtByTarget extends EntityAIHurtByTarget
TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord); TileEntity portal = this.taskOwner.worldObj.getTileEntity(portalPosition.xCoord, portalPosition.yCoord, portalPosition.zCoord);
if(portal instanceof TEDemonPortal) if(portal instanceof TEDemonPortal)
{ {
((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget()); ((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget(), 25);
} }
double d0 = this.getTargetDistance(); double d0 = this.getTargetDistance();

View file

@ -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 boolean canFitType(DemonType type);
public abstract float getRelativeChance(DemonType type, int tier); public abstract float getRelativeChance(DemonType type, int tier, boolean spawnGuardian);
} }

View file

@ -13,13 +13,13 @@ public class DemonPacketAngel extends DemonHoardPacket
} }
@Override @Override
public float getRelativeChance(DemonType type, int tier) public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian)
{ {
return 1.0f; return 1.0f;
} }
@Override @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 entity = new EntityFallenAngel(world);
entity.setPosition(x, y, z); entity.setPosition(x, y, z);

View file

@ -22,7 +22,7 @@ public class DemonPacketRegistry
return false; return false;
} }
public static String getDemonPacketName(DemonType type, int tier) public static String getDemonPacketName(DemonType type, int tier, boolean spawnGuardian)
{ {
float totalChance = 0; float totalChance = 0;
@ -35,7 +35,7 @@ public class DemonPacketRegistry
continue; continue;
} }
totalChance += packet.getRelativeChance(type, tier); totalChance += packet.getRelativeChance(type, tier, spawnGuardian);
} }
for(Entry<String, DemonHoardPacket> entry : packetMap.entrySet()) for(Entry<String, DemonHoardPacket> entry : packetMap.entrySet())
@ -47,7 +47,7 @@ public class DemonPacketRegistry
continue; continue;
} }
float relativeChance = packet.getRelativeChance(type, tier); float relativeChance = packet.getRelativeChance(type, tier, spawnGuardian);
if(relativeChance >= totalChance) if(relativeChance >= totalChance)
{ {
@ -61,18 +61,18 @@ public class DemonPacketRegistry
return ""; 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); DemonHoardPacket packet = packetMap.get(name);
if(packet != null) if(packet != null)
{ {
return packet.summonDemons(world, x, y, z, type, tier); return packet.summonDemons(world, x, y, z, type, tier, spawnGuardian);
} }
return 0; return 0;

View file

@ -70,6 +70,11 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
//this.isImmuneToFire = true; //this.isImmuneToFire = true;
} }
public boolean isTameable()
{
return false;
}
@Override @Override
protected void applyEntityAttributes() protected void applyEntityAttributes()
{ {
@ -77,7 +82,6 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
//This line affects the speed of the monster //This line affects the speed of the monster
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
//My guess is that this will alter the max health
if (this.isTamed()) if (this.isTamed())
{ {
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxTamedHealth); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(this.maxTamedHealth);
@ -126,6 +130,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
/** /**
* main AI tick function, replaces updateEntityActionState * main AI tick function, replaces updateEntityActionState
*/ */
@Override
protected void updateAITick() protected void updateAITick()
{ {
this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth())); 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. * (abstract) Protected helper method to write subclass entity data to NBT.
*/ */
@Override
public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
{ {
super.writeEntityToNBT(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. * (abstract) Protected helper method to read subclass entity data from NBT.
*/ */
@Override
public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
{ {
super.readEntityFromNBT(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 * The speed it takes to move the entityliving's rotationPitch through the faceEntity method. This is only currently
* use in wolves. * use in wolves.
*/ */
@Override
public int getVerticalFaceSpeed() public int getVerticalFaceSpeed()
{ {
return this.isSitting() ? 20 : super.getVerticalFaceSpeed(); return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
} }
@Override
public void setTamed(boolean par1) public void setTamed(boolean par1)
{ {
super.setTamed(par1); super.setTamed(par1);
@ -286,7 +295,7 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IRangedAttackM
this.sendSittingMessageToPlayer(par1EntityPlayer, !this.isSitting()); 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) if (!par1EntityPlayer.capabilities.isCreativeMode)
{ {

View file

@ -62,6 +62,8 @@ public class TEDemonPortal extends TileEntity
public ForgeDirection nextDemonPortalDirection = ForgeDirection.DOWN; public ForgeDirection nextDemonPortalDirection = ForgeDirection.DOWN;
public int buildingStage = -1; public int buildingStage = -1;
public int lockdownTimer;
public TEDemonPortal() public TEDemonPortal()
{ {
@ -91,6 +93,44 @@ public class TEDemonPortal extends TileEntity
this.houseCooldown = 0; this.houseCooldown = 0;
this.roadCooldown = 0; this.roadCooldown = 0;
this.tier = 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) public boolean decreaseRandomCooldown(int amount)
@ -98,10 +138,10 @@ public class TEDemonPortal extends TileEntity
float totalChance = 0; float totalChance = 0;
Map<String, Float> map = new HashMap(); Map<String, Float> map = new HashMap();
map.put("roadChance", 0.6f); map.put("roadChance", this.getRoadChance());
map.put("houseChance", 0.3f); map.put("houseChance", this.getHouseChance());
map.put("demonPortalChance", 0.5f); map.put("demonPortalChance", this.getDemonPortalChance());
map.put("demonHoardChance", 1.0f); map.put("demonHoardChance", this.getDemonHoardChance());
String action = ""; String action = "";
@ -160,7 +200,7 @@ public class TEDemonPortal extends TileEntity
return true; 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())) // if (this.taskOwner != entitycreature && entitycreature.getAttackTarget() == null && !entitycreature.isOnSameTeam(this.taskOwner.getAITarget()))
for(IHoardDemon thrallDemon : this.hoardList) 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)) 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; return;
} }
Math.max(0, this.lockdownTimer - 1);
this.incrementPoints(); this.incrementPoints();
this.assignPoints(); this.assignPoints();
@ -260,7 +312,7 @@ public class TEDemonPortal extends TileEntity
if(this.demonHoardCooldown <= 0) if(this.demonHoardCooldown <= 0)
{ {
int complexityCost = this.createRandomDemonHoard(tier, DemonType.FIRE); int complexityCost = this.createRandomDemonHoard(tier, DemonType.FIRE, this.isLockedDown());
if(complexityCost > 0) if(complexityCost > 0)
{ {
this.demonHoardCooldown = TEDemonPortal.demonHoardDelay * complexityCost; this.demonHoardCooldown = TEDemonPortal.demonHoardDelay * complexityCost;
@ -337,6 +389,7 @@ public class TEDemonPortal extends TileEntity
this.nextDemonPortalDirection = ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("nextDemonPortalDirection")); this.nextDemonPortalDirection = ForgeDirection.getOrientation(par1NBTTagCompound.getInteger("nextDemonPortalDirection"));
this.pointPool = par1NBTTagCompound.getFloat("pointPool"); this.pointPool = par1NBTTagCompound.getFloat("pointPool");
this.lockdownTimer = par1NBTTagCompound.getInteger("lockdownTimer");
} }
@Override @Override
@ -385,9 +438,10 @@ public class TEDemonPortal extends TileEntity
par1NBTTagCompound.setInteger("nextDemonPortalDirection", this.nextDemonPortalDirection.ordinal()); par1NBTTagCompound.setInteger("nextDemonPortalDirection", this.nextDemonPortalDirection.ordinal());
par1NBTTagCompound.setFloat("pointPool", pointPool); 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); int next = rand.nextInt(4);
ForgeDirection dir; ForgeDirection dir;
@ -416,7 +470,7 @@ public class TEDemonPortal extends TileEntity
return 0; 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 public int createRandomRoad() //Return the number of road spaces