def select_attack(self, opponent):
        next_available = 100000
        for attack in self.attacks:
            available = attack.available
            if available > 0:
                next_available = min(available, next_available)
                continue
            try:
                self.me.check_costs(attack.costs)
                attack.validate(self.me, opponent)
            except ActionError:
                continue
            self.me.last_opponent = opponent
            self.me.start_action(attack, {'target': opponent, 'source': self.me, 'target_method': opponent.attacked})
            return
            # Try again when another skill because available
        if next_available < 10000:
            register_once(self.me.check_fight, next_available)
dataset/ETHPy150Open genzgd/Lampost-Mud/lampost/lpmud/fight.py/Fight.select_attack/original