Tweaked Monolith Aggro Rate #162
@@ -22,6 +22,7 @@ import StevenDimDoors.mod_pocketDim.world.PocketProvider;
|
|||||||
public class MobMonolith extends EntityFlying implements IMob
|
public class MobMonolith extends EntityFlying implements IMob
|
||||||
{
|
{
|
||||||
private static final short MAX_AGGRO = 200;
|
private static final short MAX_AGGRO = 200;
|
||||||
|
private static final short MAX_AGGRO_CAP = 100;
|
||||||
private static final int MAX_TEXTURE_STATE = 18;
|
private static final int MAX_TEXTURE_STATE = 18;
|
||||||
private static final int MAX_SOUND_COOLDOWN = 200;
|
private static final int MAX_SOUND_COOLDOWN = 200;
|
||||||
private static final int MAX_AGGRO_RANGE = 35;
|
private static final int MAX_AGGRO_RANGE = 35;
|
||||||
@@ -34,6 +35,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
public float pitchLevel;
|
public float pitchLevel;
|
||||||
private short aggro = 0;
|
private short aggro = 0;
|
||||||
private int soundTime = 0;
|
private int soundTime = 0;
|
||||||
|
private final short aggroCap;
|
||||||
|
|
||||||
private static DDProperties properties = null;
|
private static DDProperties properties = null;
|
||||||
|
|
||||||
@@ -42,6 +44,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
super(world);
|
super(world);
|
||||||
this.setSize(WIDTH, HEIGHT);
|
this.setSize(WIDTH, HEIGHT);
|
||||||
this.noClip = true;
|
this.noClip = true;
|
||||||
|
this.aggroCap = (short) (this.rand.nextInt(MAX_AGGRO_CAP + 1)+20);
|
||||||
if (properties == null)
|
if (properties == null)
|
||||||
properties = DDProperties.instance();
|
properties = DDProperties.instance();
|
||||||
}
|
}
|
||||||
@@ -55,7 +58,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
@Override
|
@Override
|
||||||
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
|
||||||
{
|
{
|
||||||
if (!(par1DamageSource == DamageSource.inWall))
|
if (par1DamageSource != DamageSource.inWall)
|
||||||
{
|
{
|
||||||
this.aggro = MAX_AGGRO;
|
this.aggro = MAX_AGGRO;
|
||||||
}
|
}
|
||||||
@@ -90,7 +93,7 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
protected void applyEntityAttributes()
|
protected void applyEntityAttributes()
|
||||||
{
|
{
|
||||||
super.applyEntityAttributes();
|
super.applyEntityAttributes();
|
||||||
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setAttribute(10);
|
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth).setAttribute(57005);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -174,30 +177,32 @@ public class MobMonolith extends EntityFlying implements IMob
|
|||||||
// If we're working on the client side, retrieve aggro level from dataWatcher
|
// If we're working on the client side, retrieve aggro level from dataWatcher
|
||||||
if (!this.worldObj.isRemote)
|
if (!this.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
//Server side..
|
// Server side...
|
||||||
//aggro constantly decreases at a rate that varies with the current amount of aggro.
|
// Rapidly increase the aggro level if this Monolith can see the player
|
||||||
if(aggro > 0)
|
|
||||||
{
|
|
||||||
this.aggro -= (short)(this.aggro/(this.MAX_AGGRO/4));
|
|
||||||
}
|
|
||||||
if(player != null)
|
|
||||||
{
|
|
||||||
//monoliths increase aggro slightly if the player is near, but slowly and to a cap.
|
|
||||||
aggro+= 1.5-(this.getDistanceToEntity(player)/this.MAX_AGGRO_RANGE);
|
|
||||||
|
|
||||||
//rapidly increase aggro if the monolith has line of sight to the player.
|
|
||||||
if (visibility)
|
if (visibility)
|
||||||
{
|
{
|
||||||
//reduce the rate at which aggro increases in limbo
|
|
||||||
if (this.worldObj.provider instanceof LimboProvider)
|
if (this.worldObj.provider instanceof LimboProvider)
|
||||||
{
|
{
|
||||||
aggro+=1.5;
|
aggro++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
aggro+=3;
|
// Aggro increases faster outside of Limbo
|
||||||
|
aggro += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (aggro > aggroCap)
|
||||||
|
{
|
||||||
|
// Decrease aggro over time
|
||||||
|
aggro--;
|
||||||
|
}
|
||||||
|
else if (player != null && (aggro < aggroCap))
|
||||||
|
{
|
||||||
|
// Increase aggro if a player is within range and aggro < aggroCap
|
||||||
|
aggro++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Clamp the aggro level
|
// Clamp the aggro level
|
||||||
aggro = (short) MathHelper.clamp_int(aggro, 0, MAX_AGGRO);
|
aggro = (short) MathHelper.clamp_int(aggro, 0, MAX_AGGRO);
|
||||||
|
|||||||
Reference in New Issue
Block a user