|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.combat.BodyPart wyvern.kernel.combat.AttackingBodyPart
Subclass of BodyPart that implements the Attack interface.
Field Summary | |
protected java.util.ArrayList |
dtypes_
|
protected int |
tohit_
|
Fields inherited from class wyvern.kernel.combat.BodyPart |
hitWeight_, name_, pluralName_, slots_, uniqueName_ |
Constructor Summary | |
AttackingBodyPart()
|
Method Summary | |
void |
addDamageType(DamageType dtype)
Adds a DamageType object to the list of damage types this attack does. |
void |
addMethodHook(MethodHookCallback callback,
java.lang.String methodName)
Registers for the specified method-hook. |
abstract void |
addWCs()
Instructs the subclass to add one DamageType object for each damage type the body-part does when it strikes. |
void |
didDamage(DamageEvent event)
Notification that the weapon just did some damage. |
int |
getToHit()
Returns the base chance to hit for the weapon, against all attackers. |
java.util.List |
getWC(GameObject opponent)
Returns the weapon-class(es) of this weapon, versus the passed opponent. |
java.lang.String |
getWeaponSkill()
Returns the weapon skill for this attack type. |
BodyPart |
makeClone()
Clones this body part. |
void |
recomputeWCs()
Recomputes cached WC(s) for this attack. |
void |
removeMethodHook(MethodHookCallback callback,
java.lang.String methodName)
Unregisters for the specified method-hook. |
void |
runMethodHook(java.lang.String hookName,
java.lang.Object data)
Runs the specified method hook on this object. |
void |
setShowAttackerMessage(boolean show)
Toggles showing the attacker message for the damage event. |
void |
setToHit(int tohit)
Sets the base chance to hit for the weapon, against all attackers. |
void |
setWC(int wc)
Sets the (primary) WC value for this attacking body part. |
void |
setWC(java.lang.String name,
int wc)
Adds a new wc for this attack. |
boolean |
showAttackerMessage()
Returns true if we show the attacker message. |
java.lang.String |
toString()
Prints String rep. |
Methods inherited from class wyvern.kernel.combat.BodyPart |
equals, getName, getPluralName, getProbability, getSlots, getTotalAC, getUniqueName, makeSingleSlot, setName, setPluralName, setProbability, setUniqueName |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int tohit_
protected java.util.ArrayList dtypes_
Constructor Detail |
public AttackingBodyPart()
Method Detail |
public abstract void addWCs()
public java.util.List getWC(GameObject opponent)
getWC
in interface Attack
opponent
- the thing being attacked. Can be null! The
weapon should check for this case. The weapon is free to
ignore the opponent and return the same wc for every opponent.
public java.lang.String getWeaponSkill()
getWeaponSkill
in interface Attack
public void setShowAttackerMessage(boolean show)
Attack
setShowAttackerMessage
in interface Attack
show
- true to show the attacker message, false to
hide it.public boolean showAttackerMessage()
Attack
showAttackerMessage
in interface Attack
public int getToHit()
Attack
getToHit
in interface Attack
public void setToHit(int tohit)
Attack
setToHit
in interface Attack
tohit
- the weapon's base chance to hitpublic void setWC(java.lang.String name, int wc)
setWC
in interface Attack
name
- the name of the damage type, e.g. "fire", "cut", "smash"wc
- the new wc for this damage typepublic void setWC(int wc)
public void addDamageType(DamageType dtype)
public void recomputeWCs()
recomputeWCs
in interface Attack
public void didDamage(DamageEvent event)
Attack
This method runs a method hook called "didDamage", and passes the event along as the data parameter.
didDamage
in interface Attack
event
- the damage-event associated with the damage.
The event will have parameters set by the combat system
(by the DamageCommand, in particular), including the hit
location, attacker, defender, total damage, and others.public void runMethodHook(java.lang.String hookName, java.lang.Object data)
runMethodHook
in interface MethodHookable
hookName
- the hook to run, e.g. "add", "remove"data
- any data for the method hookpublic void addMethodHook(MethodHookCallback callback, java.lang.String methodName)
MethodHookable
addMethodHook
in interface MethodHookable
methodName
- the name of the method to hook intocallback
- the MethodHookCallback object to notify on the hookpublic void removeMethodHook(MethodHookCallback callback, java.lang.String methodName)
MethodHookable
removeMethodHook
in interface MethodHookable
methodName
- the name of the methodcallback
- the MethodHookCallback object to notify on the hookpublic BodyPart makeClone() throws java.lang.Exception
BodyPart
makeClone
in class BodyPart
java.lang.Exception
public java.lang.String toString()
BodyPart
toString
in class BodyPart
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |