Exemple #1
0
 def ability(self, Pieces, Board, *args):
     [targets,
      directions] = All_Straight_Line_Intersections(self.pos, Pieces, Board)
     while True:
         for event in pg.event.get():
             if event.type == pg.QUIT:
                 quit()
             elif event.type == pg.KEYDOWN:
                 if event.key == pg.K_ESCAPE:
                     self.unselect(Pieces, Board)
                     return False
             elif event.type == pg.MOUSEBUTTONDOWN and event.button == 1:
                 mouse_pos = pg.mouse.get_pos()
                 target_piece = Get_Current_Piece(mouse_pos, Pieces)
                 if target_piece != None:
                     if target_piece in targets:
                         direction = directions[targets.index(target_piece)]
                         target_loc = Cell_To_Pix([
                             target_piece.pos[0] + direction[0],
                             target_piece.pos[1] + direction[1]
                         ], Board)
                         if self.legal_target(target_piece, direction,
                                              Pieces, Board):
                             target_piece.move(target_loc, Pieces, Board)
                             self.unselect(Pieces, Board)
                             return True
Exemple #2
0
 def ability(self, Pieces, Board, *args):
     while True:
         for event in pg.event.get():
             if event.type == pg.QUIT:
                 quit()
             elif event.type == pg.KEYDOWN:
                 if event.key == pg.K_ESCAPE:
                     self.unselect(Pieces)
                     return False
             elif event.type == pg.MOUSEBUTTONDOWN and event.button == 1:
                 mouse_pos = pg.mouse.get_pos()
                 current_piece = Get_Current_Piece(mouse_pos, Pieces)
                 if current_piece != None:
                     if (current_piece.controller != self.controller
                             and not (current_piece.loc_type in [
                                 'hand', 'draft', 'goal', 'nutral_zone'
                             ]) and White_Lotus_Check(
                                 Pieces, self, self.loc, current_piece.loc)
                             and White_Lotus_Check(Pieces, current_piece,
                                                   current_piece.loc,
                                                   self.loc)):
                         temp_loc = self.loc
                         self.loc = current_piece.loc
                         self.loc_type = current_piece.loc_type
                         current_piece.move(temp_loc, Pieces, Board)
                         self.unselect(Pieces, Board)
                         return True
Exemple #3
0
 def ability(self, Pieces, Board, *args):
     while True:
         for event in pg.event.get():
             if event.type == pg.QUIT:
                 quit()
             elif event.type == pg.KEYDOWN:
                 if event.key == pg.K_ESCAPE:
                     self.unselect(Pieces, Board)
                     return False
             elif event.type == pg.MOUSEBUTTONDOWN and event.button == 1:
                 mouse_pos = pg.mouse.get_pos()
                 current_piece = Get_Current_Piece(mouse_pos, Pieces)
                 if current_piece != None:
                     if self.legal_shot(current_piece, Pieces, Board):
                         current_piece.remove(Pieces)
                         self.unselect(Pieces, Board)
                         return True
Exemple #4
0
 def ability(self, Pieces, Board, *args):
     self.select()
     while True:
         for event in pg.event.get():
             if event.type == pg.QUIT:
                 quit()
             elif event.type == pg.KEYDOWN:
                 if event.key == pg.K_ESCAPE:
                     self.unselect(Pieces)
                     return False
             elif event.type == pg.MOUSEBUTTONDOWN and event.button == 1:
                 mouse_pos = pg.mouse.get_pos()
                 current_piece = Get_Current_Piece(mouse_pos, Pieces)
                 if current_piece != None:
                     if (current_piece.controller == self.controller
                             and not (current_piece.loc_type in [
                                 'hand', 'draft', 'goal', 'nutral_zone'
                             ])):
                         current_piece.select()
                         if self.ability2(Pieces, current_piece, Board):
                             self.unselect(Pieces)
                             return True
Exemple #5
0
 def ability(self, Pieces, Board):
     self.active = True
     while True:
         for event in pg.event.get():
             if event.type == pg.QUIT:
                 quit()
             elif event.type == pg.KEYDOWN:
                 if event.key == pg.K_ESCAPE:
                     self.unselect(Pieces)
                     return False
             elif event.type == pg.MOUSEBUTTONDOWN and event.button == 1:
                 mouse_pos = pg.mouse.get_pos()
                 current_piece = Get_Current_Piece(mouse_pos, Pieces)
                 if current_piece != None:
                     if current_piece.controller == self.controller:
                         if move_ability_action(current_piece,
                                                self.controller, Pieces,
                                                Turn_Indicator, pop_up):
                             self.unselect(Pieces)
                             return True