Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '''
- [Success: 65 Roll: 41] You miss Bobby with your stave!
- Current time is 1564882188.8737004 and last command was 1564882188.5313141
- You need to wait 2 more seconds.
- Current time is 1564882189.2390356 and last command was 1564882188.5313141
- You need to wait 2 more seconds.
- Current time is 1564882189.6005547 and last command was 1564882188.5313141
- You need to wait 1 more seconds.
- Current time is 1564882189.9060621 and last command was 1564882188.5313141
- You need to wait 1 more seconds.
- Current time is 1564882190.20256 and last command was 1564882188.5313141
- You need to wait 1 more seconds.
- Current time is 1564882190.5381482 and last command was 1564882188.5313141
- You need to wait 0 more seconds.
- Current time is 1564882190.879274 and last command was 1564882188.5313141
- You need to wait 0 more seconds.
- Current time is 1564882191.2101352 and last command was 1564882188.5313141
- You need to wait 0 more seconds.
- Current time is 1564882191.517049 and last command was 1564882188.5313141
- You need to wait 0 more seconds.
- Current time is 1564882191.8005927 and last command was 1564882188.5313141
- [Success: 80 Roll: 17] You miss Bobby with your stave!
- '''
- class CmdStaveBash(BaseCommand):
- '''
- Use your staff to bash an enemy.
- Usage:
- bash <target>
- '''
- key = 'bash'
- help_category = 'combat'
- def func(self):
- if not self.args:
- self.caller.msg('Usage: bash <target>')
- return
- attacker = self.caller
- target = self.caller.search(self.args)
- if not target:
- self.caller.msg('That target does not exist.')
- return
- now = time.time()
- lastcast = self.caller.db.stave_bash
- cooldown = lastcast + 3
- time_remaining = cooldown - now
- self.caller.msg(f'Current time is {now} and last command was {lastcast}')
- if lastcast and now - lastcast < 3:
- message = f"You need to wait {int(time_remaining)} more seconds."
- self.caller.msg(message)
- return
- roll = random.randint(1, 100)
- success = random.randint(5, 95)
- if roll > success:
- self.caller.msg(f'[Success: {success} Roll: {roll}] You bash {target} with your stave!')
- else:
- self.caller.msg(f'[Success: {success} Roll: {roll}] You miss {target} with your stave!')
- self.caller.db.stave_bash = now
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement