def select_card(): mm = MemoryModel.get_instance() mouse_left_click(417, 228) mouse_move(489, 538) sleep(0.1) mouse_left_click(489, 538) sleep(0.1) mouse_left_click(570, 233) for p in [(360, 226), (259, 297), (40, 295), (149, 158), (92, 296), (206, 363), (356, 360), (160, 226)]: mouse_left_click(*p) mouse_move(227, 567) mouse_left_click(227, 567) # 等待游戏开始 orign = mm.read_int32_from_base(0x5568) while orign == mm.read_int32_from_base(0x5568): pass
def grow_plant(self, plant_type, row, col, force=False): card = self.cards[plant_type] if not card or not card.usable: return False if not self.gridStatus[row][col] and plant_type != Plant.PUMPKIN: if force: mouse_reset() mouse_left_click(638, 41) mouse_left_click(80 + 80 * col, 130 + 85 * row) else: return False mouse_reset() mouse_left_click(card.cardX, card.cardY) mouse_left_click(80 + 80 * col, 130 + 85 * row) card.usable = False if card.type not in [Plant.PUMPKIN, Plant.LILY_PAD]: self.gridStatus[row][col] = False return True