Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #crib sheet:
- #realm.write = echoing
- #realm.send = send to Achaea
- #wib = wield bow
- #sh TARGET DIR = aim and snipe
- from mudpyl.modules import EarlyInitialisingModule
- from mudpyl.aliases import binding_alias
- from mudpyl.triggers import binding_trigger
- class MultiArcher(EarlyInitialisingModule):
- def __init__(self, targets):
- self.targets = targets
- self.direction = None
- self.index = None
- self.aliases = [self.shoot]
- self.triggers = [self.no_target, self.hit]
- @binding_alias("^ms(n|ne|e|se|s|sw|w|nw|i|o|u|d|m)$")
- def shoot(self, match, realm):
- realm.send_to_mud = False
- if not self.targets:
- realm.write("No target to shoot!")
- return
- self.direction = match.group(1)
- self.index = 0
- realm.send("wib")
- self.next_shot(realm)
- @binding_trigger("^(You are prevented from doing that by the magical shield around \w+|You detect nothing here by that name|Nothing can be seen here by that name|Ahh, I am truly sorry, but I do not see anyone by that name here|I do not recognise anything called that here|You cannot see that being here)\.$")
- def no_target(self, match, realm):
- if self.index is None:
- return
- if self.index < len(self.targets):
- self.next_shot(realm)
- else:
- self.index = None
- self.direction = None
- def next_shot(self, realm):
- realm.write("Trying to shoot " + self.targets[self.index])
- realm.send("sh %s %s" % (self.targets[self.index], self.direction))
- self.index += 1
- @binding_trigger("^You train your expert eye on \w+ and let fly an arrow with breathtaking precision\.$")
- def hit(self, match, realm):
- self.index = None
- self.direction = None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement