Package schlachtfeld :: Module schlachtfeld :: Class BattleField
[hide private]
[frames] | no frames]

Class BattleField

source code

Instance Methods [hide private]
  __init__(self, armies)
Create a new battle with armies, groups, leaders, soldiers and characters.
  battle(self)
Execute a single round of the battle together with organization of Armies, Groups and Characters.
  auto_enemy(self)
Automatically assign enemies to groups / armies.
  char_preparations(self)
Make all the characters still involved do their preparations: Leader(): .plan, .speak and .checkmorale Hero(): .motivate and .checkmorale Char(): .checkmorale
  group_preparations(self)
Make all non-empty groups do their preparations for battle:
  group_pairings(self, groups)
Take selected pairs of groups to calculate their powerratio/aliveratio and evaluate their relative bias.
  char_pairings(self, groups)
Pair the Characters from two Groups to fight each other.
  fight_rows(self)
  __repr__(self)
Nice printout of current situation on the BattleField().
  auto_battle(self, infolevel=0)
Automatically executes battles plus intermediate output until the battle ends (flight, extermination, resignation).
  supplies(self)
Give one of the Armies/Groups additional support in form of new soldiers, leaders, heroes or entire groups.

Instance Variables [hide private]
  output
The output of the battlefield calculations for use in other programs.

Method Details [hide private]

__init__(self, armies)
(Constructor)

source code 
Create a new battle with armies, groups, leaders, soldiers and characters. Contains of several consecutive battle-rounds. armies should be a list of combattants (usually 2) containing in a list:
  1. their army settings - (name,resignratio,fleeratio)
  2. a list of settings for the contained groups - (name,resignratio,fleeratio)
  3. a dictionary containing the template-nameswith a tuple containing template-switch and a list of corresponding tuples (number of soldiers, index number of host(0 is army),chartype) - {'template_name_1':(True, [(number_count_1a,host#1a,Typus1a),(number_count_1b,host#1b,Typus1b)]), 'template_name_2':(False,[(number_count_2,host#2,Typus2)]), ...}

battle(self)

source code 
Execute a single round of the battle together with organization of Armies, Groups and Characters. Performs the following steps:
  1. Enemy finding for single groups
  2. Characters prepare themselves
  3. Groups prepare themselves
  4. Pairs of groups evaluate their combat modifiers
  5. Pairs of soldiers are formed
  6. They fight each other

auto_enemy(self)

source code 
Automatically assign enemies to groups / armies.

char_preparations(self)

source code 
Make all the characters still involved do their preparations: Leader(): .plan, .speak and .checkmorale Hero(): .motivate and .checkmorale Char(): .checkmorale

group_preparations(self)

source code 
Make all non-empty groups do their preparations for battle:
  1. find enemies
  2. count numbers

group_pairings(self, groups)

source code 
Take selected pairs of groups to calculate their powerratio/aliveratio and evaluate their relative bias.

char_pairings(self, groups)

source code 
Pair the Characters from two Groups to fight each other. Only the Characters from the front line are taken into account. groups: should be a tuple of two Group() or Army() instances.

fight_rows(self)

source code 
None

__repr__(self)
(Representation operator)

source code 
Nice printout of current situation on the BattleField().

auto_battle(self, infolevel=0)

source code 
Automatically executes battles plus intermediate output until the battle ends (flight, extermination, resignation).

supplies(self)

source code 
Give one of the Armies/Groups additional support in form of new soldiers, leaders, heroes or entire groups.

Instance Variable Details [hide private]

output

The output of the battlefield calculations for use in other programs.