Esempio n. 1
0
    def end_turn(self):
        for c in self.conditions.values():
            if c['cond_type'] == 's':
                r = None
                if self.pc:
                    print '{}: save against {}.'.format(self, c['name'])
                    r = easyinput.input_int('saving throw')
                else:
                    save_die = Dice.from_str('1d20')
                    r = save_die.roll()['total']

                if r >= 10:
                    self.remove_condition(c['index'])
                    print '{} successfully saved against {}.'.format(self, c['name'])
                else:
                    print '{} failed a save against {}.'.format(self, c['name'])

            elif c['cond_type'] == 't' and c['end_type'] == 'e':
                if c['duration'] <= 0:
                    self.remove_condition(c['index'])
                else:
                    print '{} is still affected by {} ({} round{} left).'.format(self, c['name'], c['duration'], 's'[c['duration']==1:])

        for r in self.recharges.values():
            if r['used']:
                if r['just_used']:
                    r['just_used'] = False
                    continue

                # Roll to recharge
                d = Dice.from_str('1d6')
                n = d.roll()['total']
                if n >= r['value']:
                    r['used'] = False
                    print '{} can use {} again!'.format(self, r['name'])
Esempio n. 2
0
def parse_input(args):
    dice_list = []
    for arg in args:
        dice_list.append(Dice.from_str(arg))

    return dice_list
Esempio n. 3
0
 def roll_init(self):
     d = Dice.from_str('1d20+{}'.format(self.init_mod))
     self.set_init(d.roll()['total'])