The Incomplete Works of Josh English

A Polymath in Pursuit of Publication

On this page: Introduction | Documentation | Instance Attributes | Class Methods | Future Plans

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:

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:

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: