public class CombatBehavior extends Behavior implements MessageCallback
Behavior.CommandMessage, Behavior.EventMessage, Behavior.LinkedAggroMessage
Modifier and Type | Field and Description |
---|---|
protected boolean |
activated |
protected Point |
centerLoc |
Point |
combatStartLoc |
protected Point |
combatStartTargetLoc |
protected OID |
currentTarget |
protected java.util.HashMap<OID,java.lang.Integer> |
damageMap |
protected java.lang.Float |
defaultSpeed |
boolean |
evade |
boolean |
goreturn |
protected OID |
lastDamage |
protected java.util.HashMap<java.lang.Integer,MobLootTable> |
lootTables |
protected java.lang.Integer |
reactionRadius |
protected java.util.List<OID> |
reactionTargets |
protected float |
speed |
protected OID |
tagOwner |
protected PerceptionFilter |
targetFilter |
protected long |
targetFilterId |
protected java.util.HashMap<OID,java.lang.Integer> |
threatMap |
LINKED_AGGRO_GET, LINKED_AGGRO_RADIUS, LINKED_AGGRO_SEND, LINKED_CHASING_DISTANCE, lock, MSG_TYPE_COMMAND, MSG_TYPE_EVENT, MSG_TYPE_LINKED_AGGRO, obj
NO_FLAGS, RESPONSE_EXPECTED
Constructor and Description |
---|
CombatBehavior() |
CombatBehavior(SpawnData data) |
Modifier and Type | Method and Description |
---|---|
void |
activate()
Called when a mob respawns, clear all behaviour variables here or they will carry over to new spawns
|
void |
addDamageToMap(OID targetOid,
int amount) |
protected void |
addTargetToThreatMap(OID targetOid,
int threatAmount)
Add the amount of threat for the given oid to the threatMap.
|
void |
alertMobDeathStateChange(OID targetOid,
boolean dead) |
void |
alertMobOfDespawn(OID targetOid) |
protected void |
attackTarget(OID targetOid)
Tells the mob to attack the specified target (or to stop attacking if there is none).
|
void |
deactivate() |
int |
getAggroRange() |
float |
getAttackDistance() |
Point |
getCenterLoc() |
int |
getchaseDistance() |
java.util.HashMap<OID,java.lang.Integer> |
getDamageMap() |
float |
getHitBoxRange() |
boolean |
getInCombat() |
int |
getLinkedAggroRadius() |
float |
getMovementSpeed() |
int |
getReactionRadius() |
boolean |
getReciveLinkedAggro() |
boolean |
getSendLinkedAggro() |
java.util.HashMap<OID,java.lang.Integer> |
getThreatMap() |
protected void |
handleDeath(OID killer)
Handles the dead of the mob.
|
void |
handleMessage(Message msg,
int flags)
Handle message.
|
void |
initialize() |
protected void |
removeTargetFromThreatMap(OID targetOid)
Removes the target from the threatMap, then runs the threatUpdated() function again.
|
void |
setAggroRange(int radius) |
void |
setAttackDistance(float radius) |
void |
setCenterLoc(Point loc) |
void |
setchaseDistance(int distance) |
void |
setDamageMap(java.util.HashMap<OID,java.lang.Integer> damageMap) |
void |
setDeactivateOutOfCombat(boolean deactivate) |
void |
setDefaultMovementSpeed(float speed) |
void |
setHitBoxRange(float radius) |
void |
setLinkedAggroRadius(int radius) |
void |
setLootTables(java.util.HashMap<java.lang.Integer,MobLootTable> tables) |
void |
setMovementSpeed(float speed) |
void |
setReactionRadius(int radius) |
void |
setReciveLinkedAggro(boolean value) |
void |
setSendLinkedAggro(boolean value) |
protected void |
setTarget(OID targetOid)
Sets the current target for the mob.
|
void |
setTargetThreat(OID targetOid,
int amount)
Use when a player has died to set threat to -1.
|
void |
setThreatMap(java.util.HashMap<OID,java.lang.Integer> threatMap) |
protected void |
subscribeForTarget(OID oid) |
protected void |
unsubscribeForTarget(OID oid) |
dispatchMessage, getObjectStub, SendCommand, SendLinkedAggro, setObjectStub
protected PerceptionFilter targetFilter
protected long targetFilterId
protected float speed
protected java.lang.Float defaultSpeed
protected java.lang.Integer reactionRadius
protected Point centerLoc
public Point combatStartLoc
protected Point combatStartTargetLoc
protected java.util.HashMap<OID,java.lang.Integer> threatMap
protected java.util.HashMap<OID,java.lang.Integer> damageMap
protected java.util.HashMap<java.lang.Integer,MobLootTable> lootTables
protected java.util.List<OID> reactionTargets
public boolean evade
public boolean goreturn
protected OID currentTarget
protected OID lastDamage
protected OID tagOwner
protected boolean activated
public CombatBehavior()
public CombatBehavior(SpawnData data)
public void initialize()
initialize
in class Behavior
protected void subscribeForTarget(OID oid)
protected void unsubscribeForTarget(OID oid)
public void activate()
public void deactivate()
deactivate
in class Behavior
public void handleMessage(Message msg, int flags)
MessageCallback
handleMessage
in interface MessageCallback
handleMessage
in class Behavior
msg
- Message sent from other agent.flags
- Bitwise OR of MessageCallback.NO_FLAGS
, MessageCallback.RESPONSE_EXPECTED
.protected void attackTarget(OID targetOid)
targetOid
- protected void setTarget(OID targetOid)
targetOid
- protected void handleDeath(OID killer)
killer
- public void alertMobDeathStateChange(OID targetOid, boolean dead)
public void alertMobOfDespawn(OID targetOid)
public void setMovementSpeed(float speed)
public float getMovementSpeed()
public void setDefaultMovementSpeed(float speed)
public void setReactionRadius(int radius)
public int getReactionRadius()
public void setCenterLoc(Point loc)
public Point getCenterLoc()
public void setchaseDistance(int distance)
public int getchaseDistance()
public void setAggroRange(int radius)
public int getAggroRange()
public void setHitBoxRange(float radius)
public float getHitBoxRange()
public void setAttackDistance(float radius)
public float getAttackDistance()
public void setSendLinkedAggro(boolean value)
public boolean getSendLinkedAggro()
public void setReciveLinkedAggro(boolean value)
public boolean getReciveLinkedAggro()
public void setLinkedAggroRadius(int radius)
public int getLinkedAggroRadius()
protected void addTargetToThreatMap(OID targetOid, int threatAmount)
targetOid
- threatAmount
- protected void removeTargetFromThreatMap(OID targetOid)
targetOid
- public void setTargetThreat(OID targetOid, int amount)
targetOid
- amount
- public void addDamageToMap(OID targetOid, int amount)
public void setThreatMap(java.util.HashMap<OID,java.lang.Integer> threatMap)
public java.util.HashMap<OID,java.lang.Integer> getThreatMap()
public void setDamageMap(java.util.HashMap<OID,java.lang.Integer> damageMap)
public java.util.HashMap<OID,java.lang.Integer> getDamageMap()
public void setLootTables(java.util.HashMap<java.lang.Integer,MobLootTable> tables)
public boolean getInCombat()
public void setDeactivateOutOfCombat(boolean deactivate)