wyvern.kernel.combat
Interface CustomAttack

All Superinterfaces:
Attack
All Known Implementing Classes:
DefaultCustomAttack

public interface CustomAttack
extends Attack

Custom attacks like poisoning, paralysis, and petrification use this interface to implement their special damage effects.

Version:
1.0, Apr 12, 2000
Author:
Steve Yegge

Method Summary
 void performDamage(Commandable attacker, GameObject defender, CommandEvent event)
          Tells the attack to perform its special damage effect.
 
Methods inherited from interface wyvern.lib.Attack
didDamage, getToHit, getWC, getWeaponSkill, recomputeWCs, setShowAttackerMessage, setToHit, setWC, showAttackerMessage
 

Method Detail

performDamage

public void performDamage(Commandable attacker,
                          GameObject defender,
                          CommandEvent event)
Tells the attack to perform its special damage effect. Called if the attack's to-hit was successful and the attack wasn't vetoed.

The CustomAttack implementation has two options for handling this method. If it's ultimately doing physical damage (i.e., hit points), then it should probably enqueue one or more DamageEvents in the agent's combat queue. This will handle resistance/vulnerability checks, damage messages, and the defender getting killed. However, if the special attack is different enough (e.g. petrification), then the performDamage method can simply perform the effect without enqueuing any events.

Parameters:
attacker - the agent performing the attack
defender - the thing being damaged
event - the CommandEvent, if this went through the "normal" channels. It could be null, if this method is being invoked by someone who wants to skip the standard attacking sequence and just have the damage get done, so the CustomAttack should robustly handle a null value here.

If non-null, the event will have various useful properties set, such as the hit location.