Example #1
0
    def create_events(self):
        e = [
            AfterBattleEvent(subject=self.object),
        ]
        s = random.choice(self.subject)
        e.append(
            EventSequence(
                AfterBattleBanterEvent(subject=random.choice(self.subject)),
            )
        )
        for s in self.subject:
            e.append(BecomeHappyEvent(subject=s))

        subjects = set(self.subject)
        a = random.extract(subjects)
        b = random.extract(subjects, filter=lambda x: not isinstance(x, TheOptimist))
        e.append(
            EventSequence(
                BecomeAngryEvent(subject=self.object2),  # b/c they need to have a mood assigned first!
                ObserveAfterBattleEvent(subject=a, object=self.object, object2=self.object2),
                RemindReportEvent(subject=a),
            )
        )
        if b:
            e.append(
                EventSequence(
                    BecomeSadEvent(subject=b),
                    IfWeGetHomeEvent(subject=b),
                )
            )

        return e
Example #2
0
 def simile(self):
     return 'like {} {}'.format(
         random.choice((
             'a tiger',
             'charcoal',
             'an elephant',
             'a ninja',
             'a gangster',
             'a giraffe',
             'a hurricane',
             'a samurai',
             'a rabid dog',
             'a crazed bull',
             'a baboon',
             'a gorilla',
         )),
         random.choice((
             'in a snowstorm',
             'in a rainstorm',
             'piloting a helicopter',
             'driving a race car',
             'in a gymnasium parking lot',
             'in a pet shop',
             'in a bazaar',
             'in a video arcade',
             'at a baseball game',
             'in a performance art piece',
             'in a jewellery store',
             'in a mosh pit',
             'at a square dance',
             'at a monster truck rally',
         )))
Example #3
0
 def simile(self):
     return 'like {} {}'.format(
         random.choice((
             'a tiger',
             'charcoal',
             'an elephant',
             'a ninja',
             'a gangster',
             'a giraffe',
             'a hurricane',
             'a samurai',
             'a rabid dog',
             'a crazed bull',
             'a baboon',
             'a gorilla',
         )),
         random.choice((
             'in a snowstorm',
             'in a rainstorm',
             'piloting a helicopter',
             'driving a race car',
             'in a gymnasium parking lot',
             'in a pet shop',
             'in a bazaar',
             'in a video arcade',
             'at a baseball game',
             'in a performance art piece',
             'in a jewellery store',
             'in a mosh pit',
             'at a square dance',
             'at a monster truck rally',
         ))
     )
Example #4
0
 def costume_decoration(self):
     if random.chance(75):
         return ''
     return random.choice(self.costume_decorations).format(
         colour=self.colour,
         costume_material=random.choice(self.costume_materials),
     )
Example #5
0
 def costume_decoration(self):
     if random.chance(75):
         return ''
     return random.choice(self.costume_decorations).format(
         colour=self.colour,
         costume_material=random.choice(self.costume_materials),
     )
Example #6
0
 def __init__(self, names, **kwargs):
     super(FeminineCharacter, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'small', 'perky', 'narrow', 'large',
     ))
     self.feature = random.choice((
         'nose', 'mouth', 'forehead', 'chin',
     ))
Example #7
0
 def costume_decoration(self):
     return random.choice(self.costume_decorations).format(
         colour=self.colour,
         costume_material=random.choice(self.costume_materials),
         gems=random.choice((
             'jewels', 'gems', 'rubies', 'emeralds', 'sapphires',
         )),
     )
Example #8
0
 def __init__(self, names, **kwargs):
     super(MasculineCharacter, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'strong', 'deep', 'wide', 'large',
     ))
     self.feature = random.choice((
         'nose', 'mouth', 'brow', 'chin',
     ))
Example #9
0
    def create_events(self):
        from marysue.events import get_all_event_classes

        classes = get_all_event_classes()
        z = [random.choice(classes) for x in xrange(0, 20)]
        z = [cls(subject=random.choice(subjects),
                 object=random.choice(subjects)) for cls in z]

        return z
Example #10
0
 def yet(self):
     return '{} yet {}'.format(
         random.choice((
             'smooth', 'graceful', 'gentle', 'supple', 'soft', 'exquisite',
         )),
         random.choice((
             'powerful', 'forceful', 'firm', 'masterful', 'confident', 'strong',
         ))
     )
Example #11
0
 def __init__(self, names, **kwargs):
     super(BadGal, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'ugly', 'jutting', 'overbearing', 'scarred',
     ))
     self.feature = random.choice((
         'nose', 'mouth', 'brow', 'chin',
     ))
     self.hair_colour = random.choice((
         'black', 'platinum blonde', 'white', 'green',
     ))
Example #12
0
 def costume_decoration(self):
     return random.choice(self.costume_decorations).format(
         colour=self.colour,
         costume_material=random.choice(self.costume_materials),
         gems=random.choice((
             'jewels',
             'gems',
             'rubies',
             'emeralds',
             'sapphires',
         )),
     )
Example #13
0
 def __init__(self, names, **kwargs):
     super(DreamBoat, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'handsome', 'perfect', 'beautiful', 'enthralling',
     ))
     self.feature = random.choice((
         'nose', 'mouth', 'brow', 'chin',
     ))
     self.stature = random.choice((
         'a bit on the short side, but in a cute way',
         'of perfectly normal height like a normal person should be',
         'quite tall, but really handsomely tall, not freakishly tall',
     ))
Example #14
0
 def __init__(self, names, **kwargs):
     super(FeminineCharacter, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'small',
         'perky',
         'narrow',
         'large',
     ))
     self.feature = random.choice((
         'nose',
         'mouth',
         'forehead',
         'chin',
     ))
Example #15
0
 def __init__(self, names, **kwargs):
     super(MasculineCharacter, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'strong',
         'deep',
         'wide',
         'large',
     ))
     self.feature = random.choice((
         'nose',
         'mouth',
         'brow',
         'chin',
     ))
Example #16
0
def make_costume(character, item_choices):
    adjective = character.costume_adjective
    if adjective:
        adjective = adjective + ' '
    colour = character.colour
    material = random.choice(character.costume_materials)
    (item, cls_) = random.choice(item_choices)
    with_ = character.costume_decoration

    names = (
        '{}{} {} {}{}'.format(adjective, colour, material, item, with_),
        item
    )

    return cls_(names=names)
Example #17
0
    def pick_title(self, plot):
        titles = [o.definite for o in self.suggest_title_objects(plot)]
        if not titles:
            titles = ['The Destiny of Fate']
        base_title = capitalize(random.choice(tuple(titles)))
        prefixes = [
            'The Return of ',
            'The Revenge of ',
            'The Scourge of ',
            'The Menace of ',
            'The Secret of ',
            'The Time of ',
            'The Scourge of ',
            'The Mystery of ',
            'The Phantom of ',
        ]
        multipref = []
        for a in prefixes:
            for b in prefixes:
                multipref.append(a + b)
        prefixes.extend(multipref)

        title = base_title
        while title in self.used_titles:
            title = prefixes.pop(0) + base_title
        self.used_titles.add(title)

        return title
Example #18
0
    def create_events(self):
        s = self.subject
        duty = RetrieveDuty(self.object)
        e = [
            LookAroundEvent(subject=s),
            HoldEvent(subject=s, object=self.object),
            #CommentOnItemEvent(subject=s, object=self.object),
            TripEvent(subject=s),
            DropEvent(subject=s, object=self.object),
            LoseEvent(subject=self.object),
            BecomeEmbarrassedEvent(subject=s),
            OopsEvent(subject=s),
            AcquireDutyEvent(subject=s, object=duty),
        ]
        for bystander in self.bystanders:
            e.append(BecomeSadEvent(subject=bystander))
            e.append(AcquireDutyEvent(subject=bystander, object=duty))
            e.append(
                random.choice((
                    LookAtEvent(subject=bystander, object=s),
                    GestureAtEvent(subject=bystander, object=s),
                ))
            )

        return e
Example #19
0
 def create_events(self):
     e = [BecomeHappyEvent(subject=s) for s in self.subject]
     seen = set()
     for s in self.subject:
         if not seen or random.chance(66):
             if random.chance(85):
                 e.append(PoseDescription(subject=s))
             else:
                 e.append(random.choice((
                     OutOfEggsEvent(subject=s),
                     GenericHyperCrystalUsageEvent(subject=s),
                 )))
         if seen and random.chance(66):
             e.append(GreetEvent(subject=s, object=random.choice(seen)))
         seen.add(s)
     return e
Example #20
0
 def emoted(self):
     assert self.mood, 'mood not assigned to %r' % self
     emoteds = {
         'happy': (
             'smiled',
             'whistled',
             'grinned',
             'beamed',
             'winked',
         ),
         'sad': (
             'frowned',
             'gasped',
             'blinked',
             'pouted',
         ),
         'angry': (
             'frowned',
             'grimaced',
             'blinked',
         ),
         'embarrassed': (
             'blushed',
             'frowned',
             'looked away',
         ),
     }
     return random.choice(emoteds[self.mood])
Example #21
0
    def pick_title(self, plot):
        titles = [o.definite for o in self.suggest_title_objects(plot)]
        if not titles:
            titles = ['The Destiny of Fate']
        base_title = capitalize(random.choice(tuple(titles)))
        prefixes = [
            'The Return of ',
            'The Revenge of ',
            'The Scourge of ',
            'The Menace of ',
            'The Secret of ',
            'The Time of ',
            'The Scourge of ',
            'The Mystery of ',
            'The Phantom of ',
        ]
        multipref = []
        for a in prefixes:
            for b in prefixes:
                multipref.append(a + b)
        prefixes.extend(multipref)
    
        title = base_title
        while title in self.used_titles:
            title = prefixes.pop(0) + base_title
        self.used_titles.add(title)

        return title
Example #22
0
 def wearing(self):
     return random.choice((
         'wearing',
         'sporting',
         'looking exciting in',
         'resplendent in',
         'looking ready for action in',
     ))
Example #23
0
 def wearing(self):
     return random.choice((
         'wearing',
         'looking frumpy in',
         'looking tastless in',
         'looking completely unimpressive in',
         'gotten up in',
     ))
Example #24
0
 def create_events(self):
     holder = self.subject
     asker = random.choice(self.bystanders)
     return [
         EventSequence(
             RememberMacGuffinEvent(subject=asker, object=holder, object2=self.object),
         )
     ]
Example #25
0
 def emoted(self):
     assert self.mood, "mood not assigned to %r" % self
     emoteds = {
         "happy": ("smiled", "whistled", "grinned", "beamed", "winked"),
         "sad": ("frowned", "gasped", "blinked", "pouted"),
         "angry": ("frowned", "grimaced", "blinked"),
         "embarrassed": ("blushed", "frowned", "looked away"),
     }
     return random.choice(emoteds[self.mood])
Example #26
0
 def wearing(self):
     return random.choice((
         'wearing',
         'looking menacing in',
         'looking villanous in',
         'looking impressive in',
         'gotten up in',
         'looking intimidating in',
     ))
Example #27
0
 def yet(self):
     return '{} yet {}'.format(
         random.choice((
             'smooth',
             'graceful',
             'gentle',
             'supple',
             'soft',
             'exquisite',
         )),
         random.choice((
             'powerful',
             'forceful',
             'firm',
             'masterful',
             'confident',
             'strong',
         )))
Example #28
0
 def __init__(self, names, **kwargs):
     super(DreamBoat, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'handsome',
         'perfect',
         'beautiful',
         'enthralling',
     ))
     self.feature = random.choice((
         'nose',
         'mouth',
         'brow',
         'chin',
     ))
     self.stature = random.choice((
         'a bit on the short side, but in a cute way',
         'of perfectly normal height like a normal person should be',
         'quite tall, but really handsomely tall, not freakishly tall',
     ))
Example #29
0
 def _fnite(self):
     # helper function
     if not self.first_occurrence:
         if len(self.object.names) == 1:
             return self.object.name
         else:
             r = random.choice(self.object.names[1:])
             return r.replace("{rank}", str(getattr(self.object, "rank", "")))
     else:
         return self.object.name
Example #30
0
 def create_events(self):
     holder = self.subject
     asker = random.choice(self.bystanders)
     return [
         EventSequence(
             IntroduceItemEvent(subject=holder, object=self.object),
             AskAboutItemEvent(subject=asker, object=self.object),
             ReplyAboutItemEvent(subject=holder, object=asker),
         )
     ]
Example #31
0
 def __init__(self, names, **kwargs):
     super(BadGal, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'ugly',
         'jutting',
         'overbearing',
         'scarred',
     ))
     self.feature = random.choice((
         'nose',
         'mouth',
         'brow',
         'chin',
     ))
     self.hair_colour = random.choice((
         'black',
         'platinum blonde',
         'white',
         'green',
     ))
Example #32
0
 def _fnite(self):
     # helper function
     if not self.first_occurrence:
         if len(self.object.names) == 1:
             return self.object.name
         else:
             r = random.choice(self.object.names[1:])
             return r.replace('{rank}', str(getattr(self.object, 'rank',
                                                    '')))
     else:
         return self.object.name
Example #33
0
 def __init__(self, names, **kwargs):
     super(Character, self).__init__(names, **kwargs)
     self.stature = random.choice((
         'somewhat short',
         'of average height',
         'rather tall',
     ))
     self.hair_length = random.choice((
         'long',
         'shoulder length',
         'short',
         'close cropped',
     ))
     self.hair_colour = random.choice((
         'blonde', 'brown', 'red', 'auburn', 'black',
     ))
     self.eye_colour = random.choice((
         'brown', 'blue', 'grey', 'green', 'hazel',
     ))
     self.war_cry = "BY THE " + random.choice((
         'MOONS',
         'RINGS',
         'MOUNTAINS',
         'METEORS',
     )) + " OF " + random.choice((
         'VENUS',
         'MARS',
         'JUPITER',
         'NEPTUNE',
     ))
Example #34
0
 def __init__(self, names, **kwargs):
     super(MarySue, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'wicked cute', 'perfect', 'beautiful', 'enchanting',
     ))
     self.feature = random.choice((
         'nose', 'mouth', 'forehead', 'chin',
     ))
     self.stature = random.choice((
         'enchantingly petite',
         'a bit on the short side, but in a cute way',
         'neither short nor tall but not average either',
         'sort of tall for a girl, but not in a bad way',
     ))
     self.hair_length = random.choice((
         'exceptionally long (down to her knees)',
         'wicked long (down to her knees)',
         'beautiful long',
         'perky shoulder length',
     ))
     self.hair_colour = random.choice((
         'purple', 'indigo', 'violet', 'midnight black',
         'black and purple',
         'multi coloured', 'rainbow coloured', 'multi hued',
         'rainbow hued', 'shimmering rainbow coloured',
         'shimmering multi hued', 'shimmering rainbow hued',
     ))
     self.eye_colour = random.choice((
         'purple', 'indigo', 'violet', 'icy blue',
         'multi coloured', 'rainbow coloured', 'multi hued', 'rainbow hued',
         'shimmering multi coloured', 'shimmering rainbow coloured', 'shimmering multi hued', 'shimmering rainbow hued',
         'kaleidoscope coloured', 'shimmering kaleidoscope coloured',
     ))
Example #35
0
 def __init__(self, names, **kwargs):
     super(MarySue, self).__init__(names, **kwargs)
     self.feature_adj = random.choice((
         'wicked cute',
         'perfect',
         'beautiful',
         'enchanting',
     ))
     self.feature = random.choice((
         'nose',
         'mouth',
         'forehead',
         'chin',
     ))
     self.stature = random.choice((
         'enchantingly petite',
         'a bit on the short side, but in a cute way',
         'neither short nor tall but not average either',
         'sort of tall for a girl, but not in a bad way',
     ))
     self.hair_length = random.choice((
         'exceptionally long (down to her knees)',
         'wicked long (down to her knees)',
         'beautiful long',
         'perky shoulder length',
     ))
     self.hair_colour = random.choice((
         'purple',
         'indigo',
         'violet',
         'midnight black',
         'black and purple',
         'multi coloured',
         'rainbow coloured',
         'multi hued',
         'rainbow hued',
         'shimmering rainbow coloured',
         'shimmering multi hued',
         'shimmering rainbow hued',
     ))
     self.eye_colour = random.choice((
         'purple',
         'indigo',
         'violet',
         'icy blue',
         'multi coloured',
         'rainbow coloured',
         'multi hued',
         'rainbow hued',
         'shimmering multi coloured',
         'shimmering rainbow coloured',
         'shimmering multi hued',
         'shimmering rainbow hued',
         'kaleidoscope coloured',
         'shimmering kaleidoscope coloured',
     ))
Example #36
0
 def create_events(self):
     e = []
     # maybe later a fight will have all subjects.  FOR NOW,
     s = random.choice(self.subject)
     w = s.weapon
     e.append(
         EventSequence(
             WarCryEvent(subject=s),
             UnsheathEvent(subject=s, object=w),
             LiftWeaponEvent(subject=s, object=w),
             BringDownWeaponEvent(subject=s, object=w),
             WeaponContactEvent(subject=w, object=self.object),
             FlyAcrossEvent(subject=self.object),
         )
     )
     return e
Example #37
0
 def create_events(self):
     s = self.subject
     duty = RescueDuty(self.subject)
     return [
         RumblingSoundEvent(),
         WhatWasThatNoiseEvent(subject=random.choice(self.bystanders)),
         CaveInEvent(subject=self.setting.roof),
         StunnedEvent(subject=s),
         BuriedUnderRubbleEvent(subject=s),
         BecomeSadEvent(subject=s),
     ] + [
         EventSequence(
             BecomeSadEvent(subject=bystander),
             PanicEvent(subject=bystander),
             AcquireDutyEvent(subject=bystander, object=duty),
         ) for bystander in self.bystanders
     ]
Example #38
0
 def create_events(self):
     s = self.subject
     duty = RetrieveDuty(self.object)
     return [
         LookAroundEvent(subject=s),
         HunchEvent(subject=s),
         LookBehindEvent(subject=s, object=self.setting.nearby_scenery),
         FindEvent(subject=s, object=self.object),
         RelieveDutyEvent(subject=s, object=duty),
         BecomeHappyEvent(subject=s),
     ] + [
         EventSequence(
             RelieveDutyEvent(subject=bystander, object=duty),
             BecomeHappyEvent(subject=bystander),
         ) for bystander in self.bystanders
     ] + [
         ReliefEvent(subject=random.choice(self.bystanders))
     ]
Example #39
0
 def create_events(self):
     # Note: even though this is a different Duty object than was
     # put in the character's duties list, apparently it will work
     # because we made these things immutable -- they hash the same.
     duty = RescueDuty(self.object)
     return [
         KeepMovingEvent(subject=random.choice(self.subject)),
         #WhatWasThatNoiseEvent(subject=random.choice(self.subject)),
         TurnCornerEvent(subject=self.subject),
         BehindBarsDescription(subject=self.object),
     ] + [
         RescueEvent(subject=self.subject, object=self.object),
         BecomeHappyEvent(subject=self.object),
     ] + [
         RelieveDutyEvent(subject=s, object=duty) for s in self.subject
     ] + [
         EventSequence(
             ThankEvent(subject=self.object, object=s),
             BecomeHappyEvent(subject=s),
         ) for s in self.subject
     ]
Example #40
0
 def create_events(self):
     all_protagonists = list(self.bystanders) + [self.object]
     perp = self.subject
     duty = RescueDuty(self.object)
     return [
         BecomeHappyEvent(subject=perp),
         AppearEvent(subject=perp),
     ] + [
         BecomeAngryEvent(subject=s) for s in all_protagonists
     ] + [
         NoticeAntagonistEvent(subject=random.choice(self.bystanders), object=perp),
         CackleEvent(subject=perp),
         AntagonistBanterEvent(subject=perp),
         AbductEvent(subject=perp, object=self.object),
         DisappearEvent(subject=perp, object=self.object),
     ] + [
         EventSequence(
             BecomeAngryEvent(subject=s),
             PanicEvent(subject=s),
             AcquireDutyEvent(subject=s, object=duty),
         ) for s in self.bystanders
     ]
Example #41
0
 def __init__(self, names, **kwargs):
     super(Character, self).__init__(names, **kwargs)
     self.stature = random.choice((
         'somewhat short',
         'of average height',
         'rather tall',
     ))
     self.hair_length = random.choice((
         'long',
         'shoulder length',
         'short',
         'close cropped',
     ))
     self.hair_colour = random.choice((
         'blonde',
         'brown',
         'red',
         'auburn',
         'black',
     ))
     self.eye_colour = random.choice((
         'brown',
         'blue',
         'grey',
         'green',
         'hazel',
     ))
     self.war_cry = "BY THE " + random.choice((
         'MOONS',
         'RINGS',
         'MOUNTAINS',
         'METEORS',
     )) + " OF " + random.choice((
         'VENUS',
         'MARS',
         'JUPITER',
         'NEPTUNE',
     ))
Example #42
0
 def nearby_scenery(self):
     return random.choice(tuple(x for x in self._nearby if not x.takeable))
Example #43
0
 def render(self):
     if self.subject.legs_costume:
         template = random.choice(self.two_piece_templates)
     else:
         template = random.choice(self.one_piece_templates)
     return self.render_t(template)
Example #44
0
 def nearby(self):
     return random.choice(self._nearby)
Example #45
0
 def nearby_takeable(self):
     return random.choice(tuple(x for x in self._nearby if x.takeable))
Example #46
0
 def render(self):
     if self.subject.legs_costume:
         template = random.choice(self.two_piece_templates)
     else:
         template = random.choice(self.one_piece_templates)
     return self.render_t(template)
Example #47
0
 def colour(self):
     return random.choice(self.colours)
Example #48
0
 def wearing(self):
     return random.choice(('wearing', 'sporting', 'looking fine in',
                           'looking smashing in', 'looking delightful in',
                           'looking impressive in', 'decked out in'))
Example #49
0
 def pick_one(match):
     return random.choice(tuple(match.group(1).split('|')))
Example #50
0
 def nearby_takeable(self):
     return random.choice(tuple(x for x in self._nearby if x.takeable))
Example #51
0
 def pick_duty(self):
     if self.duties:
         return random.choice(self.duties)
     else:
         return Duty(names=('uphold the code of the Star Fighters', ))
Example #52
0
 def shouted(self):
     assert self.mood, 'mood not assigned to %r' % self
     return random.choice(self.shouteds[self.mood])
Example #53
0
 def colour(self):
     return random.choice(self.colours)
Example #54
0
 def nearby_scenery(self):
     return random.choice(tuple(x for x in self._nearby if not x.takeable))
Example #55
0
 def costume_adjective(self):
     if random.chance(4):
         return 'WICKED AWESOME'
     else:
         return random.choice(self.costume_adjectives)
Example #56
0
 def adverb(self):
     assert self.mood, 'mood not assigned to %r' % self
     adverbs = {
         'happy': (
             'courageously',
             'obsequiously',
             'fawningly',
             'blissfully',
             'virtuously',
             'happily',
             'lightly',
             'energetically',
             'laughingly',
             'placidly',
             'peacefully',
             'calmly',
             'enigmatically',
             'strongly',
             'firmly',
         ),
         'sad': (
             'drily',
             'heavily',
             'irritatedly',
             'exasperatedly',
             'slowly',
             'drably',
             'unhappily',
             'sadly',
             'irksomely',
             'weakly',
             'downheartedly',
             'grumpily',
             'enigmatically',
         ),
         'angry': (
             'viciously',
             'menacingly',
             'drily',
             'gratingly',
             'heavily',
             'threateningly',
             'firmly',
             'impatiently',
             'icily',
             'acidly',
             'sternly',
             'emphatically',
             'annoyingly',
             'irritatedly',
             'exasperatedly',
             'outrageously',
             'strongly',
             'enigmatically',
             # 'cunningly', 'slyly',
         ),
         'embarrassed': (
             'awkwardly',
             'slumblingly',
             'coyly',
             'slowly',
             'carefully',
             'painfully',
             'painingly',
             'enigmatically',
             # 'cunningly', 'slyly',
         ),
     }
     return random.choice(adverbs[self.mood])
Example #57
0
 def nearby(self):
     return random.choice(self._nearby)
Example #58
0
 def costume_adjective(self):
     if random.chance(60):
         return ''
     else:
         return random.choice(self.costume_adjectives)