Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rts(girl, options):
- """
- Get a random string from a random trait that a girl has.
- girl = The girl to check the traits against.
- options = A dictionary of trait/eval -> (strings,).
- """
- default = options.pop("default", None)
- available = list()
- for trait in options.iterkeys():
- if trait in traits:
- if trait in girl.traits: available.append(options[trait])
- else:
- if eval(trait, globals(), locals()): available.append(options[trait])
- if len(available) == 0: trait = default
- else: trait = choice(available)
- if isinstance(trait, (list, tuple)): return choice(trait)
- else: return trait
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement