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
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

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)
{
System.out.println("Debuging");
if(paraClass == null || type == null || mod == 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);
if(portal instanceof TEDemonPortal)
{
((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget());
((TEDemonPortal) portal).notifyDemons(taskOwner, this.taskOwner.getAITarget(), 25);
}
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 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
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);

View file

@ -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<String, DemonHoardPacket> 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;

View file

@ -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)
{

View file

@ -63,6 +63,8 @@ public class TEDemonPortal extends TileEntity
public int buildingStage = -1;
public int lockdownTimer;
public TEDemonPortal()
{
super();
@ -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<String, Float> 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