Introduction
The CombatantManager class runs a single combat from start to finish. It has a few ‘sub tools’ that it uses: Orderers and Damagers . Orderers determine the order of combat each round. Damagers get the attack modes, process effects, and deal damage back to the combatants. See their pages for more details.
Documentation
Because Combat Managers are wrappers, they don’t have much in themselves. A combat round process the following:
- Get a new order from the Orderer
- Pass that order to the Damager
- Return the result
The Combat manager is created by passing two Combatant class objects. The processcombat method runs the processround method until the fight is over.
Instance Attributes
The CombatManager class uses the following instance attributes:
- coms -- list object of the combatants
- log -- part ofthe play-by-play system
- round -- current round of combat
- playbyplay -- boolean value to report on the combat
- winner -- name of the winning combatant
- tie -- boolean value if both combatants are dead
Class Methods
CombatManagers have the following methods:
setOrderer (ordereritem)
If the ordereritem is not an instance of the Orderer class an BadOrderManager error is raised.
setDamageManager (damageritem)
If the damageritem is not an instance of the Orderer class an BadDamageManager error is raised.
processround
This method processes one round: Get the order, pass that order to the Damager, and determine if there’s a winner.
processcombat
All this method does is call the processround if the is no declared winner.
addlog (s)
Adds the string to the log list. This is used for writing up play-by-plays of fights
dumplog
Returns the log as a list of strings. This is used in the play-by-play generation
Future Plans
Here are a few ideas I have about the next revision:
- The play-by-play mechanism is all or nothing. This will be adjusted to rules similar to the following:
- 0 -- Absolutly no logging
- 1 -- Just the introduction line and results
- 2 -- Introduction, result, and a report of which attacks are thrown each round
- 3 -- Introduction, result, attack reports each turn, color commentary
- 4 -- Debugging Information
- Some sort of debugger needs to be designed. It’s easy enough to write a script that does this, but I’d like to make the debuggers a pre-made object.
- The combat manager will eventually also report the winning attack move
- There should be a WrapUP or EndCombat procedure that is called automatically, something that can be overridden by the user.