Package horizons :: Package world :: Module diplomacy :: Class Diplomacy
[hide private]
[frames] | no frames]

Class Diplomacy

source code


Diplomacy class
handles diplomacy between players
two players can be allies, neutral or enemies
        allies: set of (a, b) tuples of player instances meaning a and b are allies
                 for making the relationship symmetrical a has a lower worldid than b
        enemies: set of (a, b) tuples of player instances meaning a and b are enemies
        if to players are not allies nore enemies, they are neutral

        for listeners that are not Callback instances, the arguments must be:
                caller, old_state, new_state, a, b
                old_state and new_state are a strings that can be 'ally', 'neutral' or 'enemy'
                a is first player
                b is second player

Instance Methods [hide private]
 
__init__(self) source code
 
add_ally_pair(self, a, b) source code
 
add_enemy_pair(self, a, b) source code
 
add_neutral_pair(self, a, b) source code
 
remove_enemy_pair(self, a, b) source code
 
remove_ally_pair(self, a, b) source code
 
are_allies(self, a, b) source code
 
are_enemies(self, a, b) source code
 
are_neutral(self, a, b) source code
 
can_trade(self, a, b) source code
 
_get_state_string(self, tup) source code
 
load(self, world, db) source code
 
save(self, db) source code