Package horizons :: Package ai :: Package aiplayer :: Package strategy :: Package mission :: Module surpriseattack :: Class SurpriseAttack
[hide private]
[frames] | no frames]

Class SurpriseAttack

source code

util.changelistener.ChangeListener --+            
                                     |            
          util.worldobject.WorldObject --+        
                                         |        
                           mission.Mission --+    
                                             |    
                                  FleetMission --+
                                                 |
                                                SurpriseAttack


This is a basic attack mission.
1. Send fleet to a Point (or Circle) A
2. Break diplomacy with enemy player P if he is not hostile,
3. Begin combat phase
4. Return home (point B).

Instance Methods [hide private]
 
__init__(self, success_callback, failure_callback, ships, target_point, return_point, enemy_player) source code
 
__init(self, target_point, return_point, enemy_player) source code
 
save(self, db) source code
 
_load(self, worldid, owner, db, success_callback, failure_callback) source code
 
start(self) source code
 
sail_to_target(self) source code
 
break_diplomacy(self) source code
 
in_combat(self) source code
 
go_back(self) source code
 
flee_home(self) source code
    Inherited from FleetMission
 
__str__(self) source code
 
_dismiss_fleet(self) source code
 
_init_fleet(self, ships) source code
 
_initialize_mission(self)
Initializes mission after loading is finished.
source code
 
_setup_state_callbacks(self)
This function can be overwritten to setup mission specific callbacks
source code
 
abort_mission(self, msg) source code
 
cancel(self, msg) source code
 
continue_mission(self) source code
 
lost_ship(self) source code
 
pause_mission(self) source code
 
report_failure(self, msg) source code
 
report_success(self, msg) source code
    Inherited from mission.Mission
 
end(self) source code
    Inherited from util.worldobject.WorldObject
 
__lt__(self, other) source code
 
remove(self) source code
    Inherited from util.changelistener.ChangeListener
 
_changed(self)
Calls every listener when an object changed
source code
 
add_change_listener(self, listener, call_listener_now=False, no_duplicates=False) source code
 
add_remove_listener(self, listener, no_duplicates=False)
A listener that listens for removal of the object
source code
 
clear_change_listeners(self)
Removes all change listeners
source code
 
discard_change_listener(self, listener)
Remove listener if it's there
source code
 
discard_remove_listener(self, listener) source code
 
has_change_listener(self, listener) source code
 
has_remove_listener(self, listener) source code
 
remove_change_listener(self, listener) source code
 
remove_remove_listener(self, listener) source code
Class Methods [hide private]
 
create(cls, success_callback, failure_callback, fleet, target_point, return_point, enemy_player) source code
    Inherited from FleetMission
 
load(cls, worldid, owner, db, success_callback, failure_callback) source code
    Inherited from util.worldobject.WorldObject
 
get_object_by_id(cls, id)
Returns the worldobject with id id Throws WorldObjectNotFound with the worldid as arg.
source code
 
get_objs(cls) source code
 
reset(cls) source code
Class Variables [hide private]
  missionStates = Enum.get_extended(FleetMission.missionStates, ...
    Inherited from FleetMission
  log = logging.getLogger("ai.aiplayer.fleetmission")
Method Details [hide private]

__init__(self, success_callback, failure_callback, ships, target_point, return_point, enemy_player)
(Constructor)

source code 
Parameters:
  • worldid - worldid to assign. Use None to get an autogenerated one.
Overrides: util.changelistener.ChangeListener.__init__

save(self, db)

source code 
Overrides: util.worldobject.WorldObject.save

_load(self, worldid, owner, db, success_callback, failure_callback)

source code 
Overrides: FleetMission._load

Class Variable Details [hide private]

missionStates

Value:
Enum.get_extended(FleetMission.missionStates, 'sailing_to_target', 'in\
_combat', 'breaking_diplomacy', 'going_back')