Package horizons :: Package ai :: Package aiplayer :: Package combat :: Module combatmanager :: Class CombatManager
[hide private]
[frames] | no frames]

Class CombatManager

source code

CombatManager object is responsible for handling close combat in game. It scans the environment (lookout) and requests certain actions from behavior

Instance Methods [hide private]
 
__init__(self, owner) source code
 
__init(self, owner) source code
 
save(self, db) source code
 
set_ship_state(self, ship, state) source code
 
get_ship_state(self, ship) source code
 
add_new_unit(self, ship, state=None) source code
 
remove_unit(self, ship) source code
 
_load(self, db, owner) source code
 
_init_fake_tile(self)
Sets the _fake_tile_obj class variable with a ready to use fife object.
source code
 
_add_fake_tile(self, x, y, layer, renderer, color)
Adds a fake tile to the position.
source code
 
_add_tile(self, tile, renderer, color) source code
 
_clear_fake_tiles(self) source code
 
_highlight_points(self, points, color) source code
 
_highlight_circle(self, position, radius, color) source code
 
display(self)
Display combat ranges.
source code
 
handle_mission_combat(self, mission)
Routine for handling combat in mission that requests for it.
source code
 
handle_uncertain_combat(self, mission)
Handles fleets that may way to be in combat.
source code
 
handle_casual_combat(self)
Handles combat for ships wandering around the map (not assigned to any fleet/mission).
source code
 
lookout(self)
Basically do 3 things: 1.
source code
 
tick(self) source code
Class Methods [hide private]
 
close_range(cls, ship)
Range used when wanting to get close to ships.
source code
 
fallback_range(cls, ship)
Range used when wanting to get away from ships.
source code
 
load(cls, db, owner) source code
Class Variables [hide private]
  log = logging.getLogger("ai.aiplayer.combat.combatmanager")
  shipStates = Enum('idle', 'moving')
  combat_range = 18
Method Details [hide private]

_init_fake_tile(self)

source code 

Sets the _fake_tile_obj class variable with a ready to use fife object. To create a new fake tile, use _add_fake_tile()

_add_fake_tile(self, x, y, layer, renderer, color)

source code 

Adds a fake tile to the position. Requires 'self._fake_tile_obj' to be set.

lookout(self)

source code 

Basically do 3 things:
1. Handle combat for missions that explicitly request for it.
2. Check whether any of current missions may want to be interrupted to resolve potential
        combat that was not planned (e.g. hostile ships nearby fleet on a mission)
3. Handle combat for ships currently not used in any mission.