|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object wyvern.kernel.combat.AbstractAttack
Utility class for special attacks that want to handle their own effects.
Field Summary | |
protected java.util.ArrayList |
dtypes_
|
protected int |
tohit_
|
protected int |
wc_
|
Constructor Summary | |
AbstractAttack()
|
Method Summary | |
void |
addMethodHook(MethodHookCallback callback,
java.lang.String methodName)
Registers for the specified method-hook. |
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 damage(s) to use against the specified opponent. |
void |
recomputeWCs()
If you set any "wc-*" property on the weapon directly, bypassing the setWC() function, you need to call this or the WC won't be recomputed. |
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 specific method hook. |
void |
setToHit(int tohit)
Sets the base chance to hit for the weapon, against all attackers. |
void |
setWC(java.lang.String name,
int wc)
Sets the base weapon-class of this weapon. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface wyvern.lib.Attack |
getWeaponSkill, setShowAttackerMessage, showAttackerMessage |
Field Detail |
protected int wc_
protected int tohit_
protected java.util.ArrayList dtypes_
Constructor Detail |
public AbstractAttack()
Method Detail |
public java.util.List getWC(GameObject opponent)
Attack
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 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)
Attack
setWC
in interface Attack
wc
- the new base wc for the weaponname
- the damage type, e.g. "cut", "smash", "fire".public void recomputeWCs()
Attack
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)
MethodHookable
runMethodHook
in interface MethodHookable
hookName
- the name of the method, e.g. "add"data
- any data to pass to the callbacks; can be nullpublic 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 hook
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |