Ejemplo n.º 1
0
def setup_app(config):
    bottle.response.headers['Content-Type'] = 'application/json'

    Resource.set_config(config)

    session_inst = Session()
    users_inst = Users()
    channels_inst = Channels(session_inst, users_inst)
    static_inst = Static()
    client_inst = Client()
    session_inst.set_users_resource(users_inst)
    users_inst.set_session_resource(session_inst)

    add_resource('/' + Api.api + '/' + Api.server, Resource)
    add_resource('/' + Api.api + '/' + Api.session, session_inst)
    add_resource('/' + Api.api + '/' + Api.users, users_inst)
    add_resource('/' + Api.api + '/' + Api.channels, channels_inst)
    add_resource('/web', static_inst)
    add_resource('', client_inst)
Ejemplo n.º 2
0
 def start_turn(self):
     """ Start my turn """
     if self._phase is not PHASE_NOTMYTURN:
         logger.warn('Player %s starts his turn, ' % self.name
                     + ' but his phase was %s' % self._phase)
     self._phase = PHASE_STARTING
     start_rsrc = Resource(action=1, buy=1)
     self.set_resources_no_broadcast(start_rsrc)
     logger.info('turn of: %s' % self.name)
     self._game.bc_start_phase(self, start_rsrc)
     # TODO: check for start phase actions and bonuses
     self._phase = PHASE_ACTION
     self._game.bc_action_phase(self)
Ejemplo n.º 3
0
 def do_effect(self):
     self._game.cur_player.add_resources(Resource(coins=self.coins))
Ejemplo n.º 4
0
 def do_effect(self):
     self._game.cur_player.add_resources(Resource(buy=1))
Ejemplo n.º 5
0
 def do_effect(self):
     self._game.cur_player.add_resources(Resource(actions=2))
Ejemplo n.º 6
0
 def do_effect(self):
     self._game.cur_player.draw_cards(2)
     self._game.cur_player.add_resources(Resource(buys=2))
Ejemplo n.º 7
0
 def do_effect(self):
     self._game.cur_player.draw_cards(1)
     self._game.cur_player.add_resources(Resource(coins=1, actions=1))
Ejemplo n.º 8
0
 def do_effect(self):
     self._game.cur_player.add_resources(Resource(buy=1, coins=3))
     for p in self._game.table:
         if p != self._game.cur_player:
             p.draw_cards(1)