git @ Cat's Eye Technologies MARYSUE / master src / marysue / events.py
master

Tree @master (Download .tar.gz)

events.py @masterraw · history · blame

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
import marysue.util as random
from marysue.ast import AST


# - - - -


class Event(AST):
    exciting = False
    new_para = False
    slots = (
        'subject', 'object',
        'object2',  # rarely used
    )

    @property
    def is_conjoinable(self):
        if not self.templates:
            return False
        if any([t[0] in ('"', "'") for t in self.templates]):
            return False
        return True


# - - - - mood modifier events


class MoodModifierEvent(Event):
    def __init__(self, subject, **kwargs):
        # this is just to debug where we might be constructing it with wrong args
        assert subject is not None
        super(MoodModifierEvent, self).__init__(subject=subject, **kwargs)

    def mood(self):
        raise NotImplementedError


class BecomeHappyEvent(MoodModifierEvent):
    templates = (
        '{subj.pronoun} became HAPPY',
    )

    def mood(self):
        return 'happy'


class BecomeSadEvent(MoodModifierEvent):
    templates = (
        '{subj.pronoun} became SAD',
    )

    def mood(self):
        return 'sad'


class BecomeAngryEvent(MoodModifierEvent):
    templates = (
        '{subj.pronoun} became ANGRY',
    )

    def mood(self):
        return 'angry'


class BecomeEmbarrassedEvent(MoodModifierEvent):
    templates = (
        '{subj.pronoun} became EMBARRASSED',
    )

    def mood(self):
        return 'embarrassed'


# - - - - duty acquisition events.  object is the duty acquired, subject is the character acquiring it


class AcquireDutyEvent(Event):
    templates = (
        '{subj.pronoun} acquired DUTY `{obj.name}`',
    )


class RelieveDutyEvent(Event):
    templates = (
        '{subj.pronoun} was released from DUTY `{obj.name}`',
    )


# - - - - actions and affect


class PickUpEvent(Event):
    templates = (
        '{subj.motion}{subj.pronoun} picked up {obj.pronoun} that {obj.was} nearby',
    )


class HoldEvent(Event):
    templates = (
        '{subj.pronoun} held {obj.pronoun} in {subj.possessive} hand',
        '{subj.motion}{subj.pronoun} lifted {obj.pronoun}< to eye level| into the light|>',
    )


class ContemplateEvent(Event):
    templates = (
        '"{obj.proximal} represents how I feel inside," {subj.pronoun} {subj.said} {subj.adverb}',
    )


class ApproachEvent(Event):
    templates = (
        '{subj.motion}{subj.pronoun} walked towards {obj.accusative}',
        '{subj.motion}{subj.pronoun} took two steps in {obj.possessive} direction, then stopped',
    )


class GestureAtEvent(Event):
    templates = (
        '{subj.motion}{subj.pronoun} <pointed|gestured> towards {obj.accusative}',
        '{subj.pronoun} moved {subj.her} {subj.yet} <arm|hand> in the direction of {obj.accusative}',
    )


class LookAtEvent(Event):
    templates = (
        '{subj.pronoun} looked at {obj.accusative}',
        '{subj.pronoun} glanced {subj.adverb} at {obj.accusative}',
        '{subj.pronoun} glared in the direction of {obj.accusative}',
    )


class LookAroundEvent(Event):
    templates = (
        '{subj.pronoun} looked around',
        '{subj.pronoun} surveyed the area<| with {subj.her} eyes>',
    )


class PunchPalmWithFistEvent(Event):
    # NOTUSED
    templates = (
        '{subj.pronoun} made a fist and punched {subj.his} other palm with {subj.his} fist',
    )


class RepeatForEmphasisEvent(Event):
    # NOTUSED
    templates = (
        '{subj.pronoun} did this <again|a second time>, for emphasis',
    )


class EmoteEvent(Event):
    templates = (
        '{subj.pronoun} {subj.emoted} {subj.adverb}',
    )


class CackleEvent(Event):
    templates = (
        '{subj.pronoun} cackled <evilly|wildly|maniacally|despicably|wickedly|hatefully|disdainfully>',
    )


class StateDutyEvent(Event):
    templates = (
        '"We have a duty to {subj.pick_duty.name}!" {subj.said} {subj.pronoun} {subj.adverb}',
    )


class GreetEvent(Event):
    templates = (
        '"Hello, {obj.def}," {subj.said} {subj.pronoun} {subj.adverb}',
        '"Hello, {obj.def}," {subj.said} {subj.pronoun} with an enigmatic twitch of {sub.his} <nose|mouth|ears>',
    )


class CharacterStaysHappyEvent(Event):
    templates = (
        'this was bad, but {subj.pronoun} didn`t let it <get {subj.accusative_pronoun} down|affect {subj.his} mood|cramp {subj.his} style|dampen {subj.his} cheer>',
        '{subj.pronoun} wasn`t going to let a little thing like this <get {subj.accusative_pronoun} down|affect {subj.his} mood|cramp {subj.his} style|dampen {subj.his} cheer>, though',
        '{subj.pronoun} gritted {subj.his} teeth and determined to stay <cheerful|upbeat|chipper|positive|optimistic>',
    )


# - - - - events for chekov's gun - - - -


class IntroduceItemEvent(Event):
    templates = (
        '{subj.pronoun} was cracking open <walnuts|pecans> with {obj.pronoun}',
        '{subj.pronoun} was <studiously|meticulously|intently> <polishing|cleaning|buffing> {obj.pronoun}',
    )


class AskAboutItemEvent(Event):
    templates = (
        '"{obj.distal} means a lot to you, doesn`t it?" asked {subj.pronoun}',
        '"{obj.distal}, it`s <kind of|pretty> special, isn`t it?" asked {subj.pronoun}',
    )


class ReplyAboutItemEvent(Event):
    templates = (
        '"It means a lot to all of us, {obj.def}," {subj.pronoun} {subj.said} {subj.adverb}',
        '"Space Fighters Command doesn`t entrust us with just any old thing, {obj.def}," {subj.pronoun} {subj.said} {subj.adverb}',
        '"It`s not the <sort|kind|type> of thing you can just order <on|off|from> Omnizon, {obj.def}," {subj.pronoun} {subj.said} {subj.adverb}',
    )


# - - - - events for cave-in plot - - - -


class RumblingSoundEvent(Event):
    templates = (
        'there was a rumbling sound',
    )


class WhatWasThatNoiseEvent(Event):
    templates = (
        '"What was that noise?" {subj.said} {subj.pronoun}',
        '"Did you hear something?" {subj.pronoun} {subj.said}',
    )


class CaveInEvent(Event):
    # FIXME subj.pronoun works badly here :/
    exciting = True
    templates = (
        'suddenly, {subj.def} caved in',
        'without warning, with a <tremendous|stupendous|overwhelming> <crash|boom|bang>, {subj.def} caved in',
        'too quickly for anyone to react, {subj.def} caved in',
    )


class StunnedEvent(Event):
    templates = (
        '{subj.pronoun} just stared, seemingly paralyzed',
        '{subj.pronoun} stood frozen like a deer in headlights',
    )


class BuriedUnderRubbleEvent(Event):
    templates = (
        '{subj.pronoun} was buried under rubble',
    )


class DigOutEvent(Event):
    templates = (
        '{subj.pronoun} helped dig {obj.pronoun} out from the rubble',
    )


# - - - - events for kidnapping plot - - - -


class AppearEvent(Event):
    exciting = True
    templates = (
        '<then|suddenly|all of a sudden>, out of <nowhere|thin air>, {subj.pronoun} appeared',
    )


class DisappearEvent(Event):
    templates = (
        'in a flash, {subj.pronoun} disappeared into thin air, taking {obj.pronoun} with {subj.accusative}',
    )


class NoticeAntagonistEvent(Event):
    templates = (
        '"<It`s |>YOU!" {subj.shouted} {subj.pronoun}',
        '"<It`s |>{obj.def}!" {subj.pronoun} {subj.shouted}',
    )


class AntagonistBanterEvent(Event):
    templates = (
        '"I have you now!" {subj.said} {subj.pronoun} {subj.withvoice}',
        '"What have we here!" {subj.said} {subj.pronoun} {subj.withvoice}',
        '"We meet again, <kiddies|chums|do-gooders>!" {subj.said} {subj.pronoun} {subj.withvoice}',
        '"So sorry to spoil your <little|> party, <kiddies|chums|do-gooders>!" {subj.said} {subj.pronoun} {subj.withvoice}',
    )


class AbductEvent(Event):
    templates = (
        '{subj.pronoun} <grabbed|snatched> {obj.pronoun} from behind',
    )


class WeMustFindThemEvent(Event):
    templates = (
        '"We must find out where {obj.pronoun} is being held!" {subj.said} {subj.pronoun} {subj.adverb}',
        '"We must find out where that villian has taken {obj.pronoun}!" {subj.said} {subj.pronoun} {subj.adverb}',
    )


class LocationHunchEvent(Event):
    templates = (
        '"I have a strong feeling {obj.pronoun} is in {object2.pronoun}," {subj.said} {subj.pronoun} {subj.adverb}',
    )


class SetCourseEvent(Event):
    templates = (
        '"Set course for {object.pronoun}!," {subj.shouted} {subj.pronoun} {subj.adverb}',
    )


class WeMustGoToEvent(Event):
    templates = (
        '"Quickly!  We must make our way to {object.pronoun}!," {subj.shouted} {subj.pronoun} {subj.adverb}',
    )


class RescueEvent(Event):
    templates = (
        '{subj.pronoun} together broke the cage and pulled out {obj.def}',
    )


class BumpIntoForceFieldEvent(Event):
    templates = (
        'walking along, {subj.pronoun} <suddenly|unexpectedly|surprisedly> <smacked|whacked|bonked> {subj.his} head against an invisible force field',
    )


class MustRetraceStepsEvent(Event):
    templates = (
        '"There`s no way we can get through this we`ll have to find another way in!" {subj.said} {subj.pronoun} {subj.adverb}',
    )


# - - - - events for lost item plot - - - -


class CommentOnItemEvent(Event):
    # NOTUSED
    templates = (
        '"<This is|What> a <great|superb> {obj.name} this is, <isn`t it|don`t you think|don`t you agree>?" {subj.pronoun} {subj.said} {subj.adverb}',
    )


class TripEvent(Event):
    templates = (
        "<Just then|Suddenly|All of a sudden|Without warning>, {subj.pronoun} <tripped|stumbled|lost {subj.his} balance|stubbed {subj.his} toe|was distracted>",
    )


class DropEvent(Event):
    templates = (
        "{subj.pronoun} lost {subj.his} grip on {obj.pronoun}",
        "{obj.pronoun} slipped out of {subj.possessive} <grasp|hand|grip>",
    )


class LoseEvent(Event):
    templates = (
        "{subj.pronoun} tumbled and rolled away out of sight",
        "a <drone|Space Magpie> flew by and made off with {subj.pronoun}",
    )


class OopsEvent(Event):
    templates = (
        '"<Whoops|Oops|Oopsie-daisy|Whoopsy-daisy|Uh-oh|Drat>," {subj.said} {subj.pronoun} quietly',
        'a <sheepish|embarrassed|crestfallen|sour> look crept across {subj.possessive} face',
    )


class HunchEvent(Event):
    templates = (
        '{subj.pronoun} <suddenly|all of a sudden> had a <funny|strange|unusual|odd|> <hunch|inkling|intuition>',
    )


class LookBehindEvent(Event):
    templates = (
        '{subj.pronoun} looked behind the nearby {obj.name}',
    )


class FindEvent(Event):
    templates = (
        '{subj.pronoun} found {obj.pronoun}',
    )


# - - - - events for fight plot


class AttackEvent(Event):
    templates = (
        'suddenly, {subj.indef} attacked {obj.pronoun}',
        'suddenly, {obj.pronoun} {obj.was} attacked by {subj.indef}',
    )


class EncounterEvent(Event):
    templates = (
        'suddenly, {obj.pronoun} spotted {subj.indef} in the distance',
        'suddenly, {subj.indef} came around the corner',
    )


class GoonBanterEvent(Event):
    templates = (
        '"{obj.name}!" <hissed|mouthed|squeaked> {subj.def}',
        '"<Uh oh, |>looks like <we`ve got company|they`ve spotted us|they`ve found us>," {subj.said} {subj.def} {subj.adverb}',
    )


class GoonParlayEvent(Event):
    templates = (
        '"{subj.gibberish}!!!" shouted {subj.def} in {subj.his} <weird|strange> {subj.singular} language',
    )


class AfterBattleEvent(Event):
    templates = (
        'when the dust had <cleared|settled>, <stunned|dazed> {subj.name} <littered|were strewn across> the <battlefield|area>',
    )


class AfterBattleBanterEvent(Event):
    templates = (
        '"That was a <close one|close call>!" {subj.said} {subj.pronoun} {subj.adverb}',
    )


class ObserveAfterBattleEvent(Event):
    templates = (
        '"It looked like {obj.distal} had {object2.possessive} insignia on their <uniforms|jerseys|clothes|armor>," {subj.said} {subj.pronoun} {subj.adverb}',
    )


class RemindReportEvent(Event):
    templates = (
        '"Remember to include that in the report when we get home."',
    )


class IfWeGetHomeEvent(Event):
    templates = (
        '"IF we get home," {subj.said} {subj.pronoun} {subj.adverb}',
    )


class WarCryEvent(Event):
    templates = (
        '"{subj.war_cry}!!!" {subj.shouted} {subj.pronoun}',
    )


class UnsheathEvent(Event):
    templates = (
        '{subj.pronoun} drew {obj.pronoun} out of {subj.his} <belt|equipment bag|backpack>',
    )


class LiftWeaponEvent(Event):
    templates = (
        '{subj.pronoun} <lifted|heaved|raised> {obj.pronoun} <above|over> {subj.her} head',
    )


class BringDownWeaponEvent(Event):
    templates = (
        '{subj.pronoun} brought down {obj.pronoun} with a <mighty|tremendous|awesome> <force|movement|power>',
    )


class WeaponContactEvent(Event):
    templates = (
        '{subj.pronoun} made contact with {obj.pronoun} with a <mighty|tremendous|awesome> <thud|whack|impact>',
    )


class FlyAcrossEvent(Event):
    templates = (
        '{subj.pronoun} went flying across the room',
    )


class TryToGetBehindEvent(Event):
    templates = (
        '{subj.pronoun} <ran|sprinted> to the side, <looking to|to try to|trying to> attack {obj.pronoun} from <behind|the rear>',
    )


class RushIntoFrayEvent(Event):
    templates = (
        'unperturbed, {subj.pronoun} rushed back into the <fray|melee|fight>',
    )


# - - - - romantic tension events - - - -


class PullAsideEvent(Event):
    templates = (
        '{subj.motion}{subj.pronoun} <motioned|gestured to> {obj.accusative} to step <away|aside|back> from the others for a moment',
    )


class WantToTalkToYouEvent(Event):
    templates = (
        '"There`s <something|a thing> I <wanted|need> to <talk to you about|talk about|say to you>", {subj.pronoun} <began|{subj.said}> {subj.adverb}',
    )


class WhatIsItEvent(Event):
    templates = (
        '"<Yes|What is it>, {obj.def}?" asked {subj.pronoun}',
    )


class RecallPastEventEvent(Event):
    templates = (
        '"<Uh|Um|Well|You know>, about <that time|last night|the other day> in the <mess hall|engine room|loading bay>..." {subj.said} {subj.pronoun} {subj.adverb}',
    )


class SayNoMoreEvent(Event):
    templates = (
        '"Hush, {obj.def}, there`s no need, you know that," {subj.said} {subj.pronoun} {subj.adverb}',
        '"It`s all right, {obj.def}, you don`t need to say anything," {subj.said} {subj.pronoun} {subj.adverb}',
        '"Speak not of it, {obj.def}" {subj.said} {subj.pronoun} {subj.adverb}',
        '{subj.pronoun} held {subj.her} finger up to {obj.possessive} lips',
        '"Words are not necessary, {obj.def}" {subj.said} {subj.pronoun} {subj.adverb}',
    )


class BumpIntoAwkwardlyEvent(Event):
    templates = (
        '{subj.pronoun} wasn`t <looking|watching> where {sub.pronoun} was going and bumped into {obj.pronoun} in a most embarrassing fashion',
    )


class BlushEvent(Event):
    templates = (
        '{subj.pronoun} blushed a deep red',
        '{subj.pronoun} went beet red with blushing',
    )


class PreludeToKissEvent(Event):
    templates = (
        '"<Uh|Um|Well|You know>, ... there comes a time when..." {subj.said} {subj.pronoun} {subj.adverb}',
    )


class FidgetEvent(Event):
    templates = (
        '"<Uh|Um|Well|You know>, ..." {subj.said} {subj.pronoun} {subj.adverb}',
        '{subj.pronoun} put {subj.his} hand behind {subj.his} head',
        '{subj.pronoun} scratched {subj.his} <head|knee|neck>',
        '{subj.pronoun} looked away',
    )

class FacesCloseTogetherEvent(Event):
    new_para = True
    templates = (
        'The faces of {subj.definite} and {obj.definite} moved centimeters closer',
        'The faces of {obj.definite} and {subj.definite} moved centimeters closer',
        'Their faces inched closer and closer',
    )


class MushyStuffEvent(Event):
    templates = (
        '"{obj.def}, you are so exquisitely beautiful, like a jewel," {sub.said} {subj.pronoun}. "I must kiss you!"',
    )


class KissEvent(Event):
    exciting = True
    new_para = True
    templates = (
        '{subj.def} and {obj.def} kissed',
    )


class AndTheyKissedEvent(Event):
    exciting = True
    templates = (
        ('And they kissed' + (' and they kissed' * 20)),
    )


# - - - - events for drone "plot" - - - -


class DroneEvent(Event):
    templates = (
        '<Suddenly|From out of nowhere|Out of the blue>, a <courier|messenger|delivery|security|surveillance|cooking|cleaning> drone <whizzed past|buzzed by|flew close by> {subj.possessive} head',
    )


class WhatWasThatEvent(Event):
    templates = (
        '"What <in blazes|in Sam Hill|in the world|the devil|> was that?" {subj.said} {subj.pronoun} {subj.adverb}',
    )


# - - - - generic plot-related events - - - -


class KeepMovingEvent(Event):
    templates = (
        '"Let`s keep moving," {subj.pronoun} {subj.said} {subj.adverb}',
    )


class TurnCornerEvent(Event):
    templates = (
        '{subj.pronoun} <went around|turned> a corner',
    )


class PanicEvent(Event):
    templates = (
        '{subj.pronoun} {subj.shouted} "<OH NO|NOOO|Nooooooooooooo>!"',
        '"<OH NO|NOOO|Nooooooooooooo>!" {subj.shouted} {subj.pronoun} <{subj.adverb}|{subj.withvoice}>',
        '{subj.pronoun} <put|clapped> {subj.her} hands '
          '<on|to> <the sides of {subj.her} face|{subj.her} cheeks> in <disbelief|surprise|shock>',
        '{subj.possessive} mouth <opened|gaped|gawped> wide in <disbelief|surprise|shock>',
        '{subj.pronoun} made <motions|gestures> of <disbelief|surprise|shock> with {subj.her} <arms|hands>',
    )


class WasteNoTimeEvent(Event):
    templates = (
        '{subj.pronoun} wasted no time',
        '"There`s no time to lose!" {subj.pronoun} {subj.shouted}',
        '"We must <act quickly|hurry>!" {subj.pronoun} {subj.said}',
        '"Hurry!" {subj.pronoun} {subj.said}',
    )


class ThankEvent(Event):
    templates = (
        '"Thank you, {obj.def}," {subj.said} {subj.pronoun} {subj.adverb}',
        '"I would have been <lost|a goner|toast> without you, {obj.def}," {subj.said} {subj.pronoun} {subj.adverb}',
        '"I am <indebted|in debt> to you, {obj.def}," {subj.said} {subj.pronoun} {subj.adverb}',
    )


class ReliefEvent(Event):
    templates = (
        '"<What|That`s> a relief!" {subj.shouted} {subj.pronoun}',
    )


# - - - - end-of-story events


class ComplimentActionEvent(Event):
    templates = (
        '"<That|there> was some <quick|top notch|ace> <thinking|action> <I saw|> from you today, {obj.def}!" {subj.said} {subj.pronoun} {subj.adverb}',
        '"<You displayed|I saw you display> some <quick|top notch|ace> <thinking|action> today, {obj.def}!" {subj.said} {subj.pronoun} {subj.adverb}',
    )


class OfferPromotionEvent(Event):
    templates = (
        '"I think I should promote you to {obj.next_rank}, {obj.def}!" {subj.said} {subj.pronoun} {subj.adverb}',
        '"How would you like a promotion to the rank of {obj.next_rank}, {obj.def}!" {subj.said} {subj.pronoun} {subj.adverb}',
    )


class OhYouEvent(Event):
    templates = (
        '"Oh, {obj.def}!" <{subj.said}|blushed> {subj.pronoun} {subj.adverb}',
        '"Oh, {obj.def}!" {subj.said} {subj.pronoun}, blushing fiercely like <a tiger|a bonfire>',
    )


class RefusePromotionEvent(Event):
    templates = (
        '"I`m too modest, I like being a {subj.rank} too!"',
        '"I`m not in this for rank, I do it out of love!"',
        '"it`s enough to know I`m fighting on the side of good!"',
    )


class ConvalesceEvent(Event):
    templates = (
        '"What an adventure that was!" exclaimed {subj.pronoun}',
        '"I could really go for a <curry|pizza|hamburger|hot dog|soda|parmo> <after that|right now>," {subj.said} {subj.pronoun} {subj.adverb}',
        '"I think we all learned a valuable lesson today," {subj.said} {subj.pronoun} {subj.adverb}',
        '"All in a day`s work for the Space Fighters!" {subj.said} {subj.pronoun} {subj.adverb}',
        '{subj.motion}{subj.pronoun} <slumped|flumped> down on the <couch|sofa|bean bag chair>',
    )


class RememberMacGuffinEvent(Event):
    templates = (
        '"Maybe next time you`ll be more careful with {object2.distal}, {obj.def}," {subj.said} {subj.pronoun} {subj.adverb}',
    )


class AllLaughEvent(Event):
    templates = (
        "they all laughed",
        "everyone laughed",
    )


# - - - - travel events


class TravelToEvent(Event):
    templates = (
        '{subj.pronoun} travelled to {obj.pronoun}',
    )


class CommentOnPlaceEvent(Event):
    templates = (
        '"I don`t like the look of this place," {subj.said} {subj.pronoun} {subj.adverb}',
        '"This place gives me the <creeps|chills|willies>," {subj.said} {subj.pronoun} {subj.adverb}',
    )


class TakeReadingsEvent(Event):
    templates = (
        '"Enviro <readings|measurements|metrics> look normal," {subj.said} {subj.pronoun}, <looking|peering|gazing> down at <the enviro probe app on {subj.his} hyper crystal|{subj.his} hyper crystal`s enviro probe app>',
        '{subj.motion}{subj.pronoun} <dialed up|opened up|started|launched> the enviro probe app on {subj.his} hyper crystal. "Enviro <readings|measurements|metrics> look normal," {subj.said} {subj.pronoun} {subj.adverb}',
    )


class ReadingsBanterEvent(Event):
    templates = (
        '"<Yeah, normal|Sure, normal|Normal, yeah|Normal, sure|>... for a <PIT|DUMP|DISASTER AREA|TOXIC WASTE SITE>!!" {subj.said} {subj.pronoun} {subj.adverb}',
    )


class BlastOfHotAirEvent(Event):
    templates = (
        '{subj.pronoun} close {subj.his} eyes as a <blast|gust> of warm fetid air rushed through the passage',
    )


# - - - - misc


class OutOfEggsEvent(Event):
    templates = (
        '"I have just come back from the <kitchen|pantry> and it looks like we are <fresh|plum> out of <eggs|Space Sugar|nutri worms>," {subj.said} {subj.pronoun} {subj.adverb}',
    )


class GenericHyperCrystalUsageEvent(Event):
    templates = (
        '{subj.pronoun} was playing that new match three game on {subj.her} hyper crystal',
    )


# - - - - descriptions, not events - - - -


class PoseDescription(Event):
    templates = (
        '{subj.pronoun} {subj.was} leaning on {obj.pronoun}',
        '{subj.pronoun} {subj.was} standing near {obj.pronoun}',
        '{subj.pronoun} {subj.was} standing near {obj.pronoun}',
    )


class SettingDescription(Event):
    templates = (
        'all was quiet {subj.preposition} {subj.def}',
        '{subj.def} was a sight to behold',
        "{subj.def} was pretty much what you'd expect",
    )


class NearbyDescription(Event):
    # subject is the setting, so it joins up with SettingDescription
    templates = (
        '<Nearby|Not too far away|In the centre of the area> {obj.was} {obj.indef}',
        'there {obj.was} {obj.indef} off in the <corner|distance>',
        '{obj.indef} seemed to dominate the environment',
        '{obj.indef} gleamed in the {obj.location.light}',
    )


class GenericSettingDescription(Event):
    # subject is the setting, so it joins up with SettingDescription
    templates = (
        'a Space Mouse scurried by',
        'a few Space <Bees|Gnats|Mosquitoes> <flew|buzzed> around',
        'there seemed to be electricity in the air',
        'it was truly an unusual sight',
    )


class CharacterDescription(Event):
    is_conjoinable = False
    templates = (
        '{subj.pronoun} was {subj.stature}, with {subj.hair_length} {subj.hair_colour} hair and {subj.eye_colour} eyes',
    )


class CharacterFeaturesDescription(Event):
    templates = (
        '{subj.pronoun} had a {subj.feature_adj} {subj.feature}, the <sort|kind|type> you only see in old movies',
        '{subj.pronoun} had a {subj.feature_adj} {subj.feature}, the <sort|kind|type> you only see in Westerns',
        '{subj.pronoun} had a {subj.feature_adj} {subj.feature}, the <sort|kind|type> you only see in comic books',
        '{subj.pronoun} had a {subj.feature_adj} {subj.feature}, the <sort|kind|type> you only see in the Outer Colonies',
        '{subj.pronoun} had a {subj.feature_adj} {subj.feature} that {subj.she} <inherited|inherited from|got> from {subj.her} <mother|father><`s side|`s side of the family|>',
        '{subj.pronoun} had a {subj.feature_adj} {subj.feature} that the other kids <teased|made fun of> back when {subj.he} <was in school|was a kid>',
        '{subj.her} {subj.feature_adj} {subj.feature} complemented {subj.her} other features <well|strongly|nicely|perfectly|highly>',
    )


class CharacterReminder(Event):
    templates = (
        '{subj.pronoun} put {subj.his} hand up to {subj.his} {subj.feature_adj} {subj.feature}',
        '{subj.his} {subj.feature_adj} {subj.feature} seemed to <gleam|glow|shine> in the {subj.location.light}',
        '{subj.his} {subj.hair_length} {subj.hair_colour} hair seemed to <gleam|glow|shine> in the {subj.location.light}',
        'the {subj.location.light} of {subj.location.definite} cast highlights on {subj.his} {subj.hair_length} {subj.hair_colour} <hair|locks>',
        '{subj.his} {subj.feature_adj} {subj.feature} in profile cast a shadow against {subj.location.nearby_scenery.definite}',
        '{subj.his} {subj.feature_adj} {subj.feature} in profile threw a shadow on {subj.location.nearby_scenery.definite}',
    )


class TorsoCostumeDescription(Event):
    two_piece_templates = (
        '{subj.pronoun} {subj.was} {subj.wearing} {subj.torso_costume.indef} and {subj.legs_costume.indef}',
    )

    one_piece_templates = (
        '{subj.pronoun} {subj.was} {subj.wearing} {subj.torso_costume.indef}',
    )

    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)


class FeetCostumeDescription(Event):
    templates = (
        'on {subj.her} feet {subj.pronoun} wore {subj.feet_costume.indef}',
        '{subj.feet_costume.indef} <graced|were on> {subj.her} feet',
        '{subj.his} feet were shod <with|in> {subj.feet_costume.indef}',
        '{subj.feet_costume.def} that <were on {subj.his} feet|{subj.pronoun} had on> looked almost new',
    )


class TorsoCostumeReminder(Event):
    two_piece_templates = (
        '{subj.torso_costume.definite} {subj.pronoun} {subj.was} {subj.wearing} seemed to <gleam|glow|shine> in the {subj.location.light}',
    )

    one_piece_templates = (
        '{subj.torso_costume.definite} {subj.pronoun} {subj.was} {subj.wearing} seemed to <gleam|glow|shine> in the {subj.location.light}',
    )

    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)


class FeetCostumeReminder(Event):
    templates = (
        '{subj.feet_costume.definite} {subj.pronoun} {subj.was} {subj.wearing} seemed to <gleam|glow|shine> in the {subj.location.light}',
        '{subj.feet_costume.definite} on {subj.her} feet seemed to <gleam|glow|shine> in the {subj.location.light}',
    )


class BehindBarsDescription(Event):
    exciting = True
    new_para = True
    templates = (
        '{subj.pronoun} was there, locked in a cage',
    )


class GenericBattleDescription(Event):
    exciting = True
    new_para = True
    templates = (
        'a <fierce|intense|harrowing|epic> <battle|skirmish> <ensued|took place|began|had begun|commenced|started>',
    )


# - - - -


class ConjoinedEvent(Event):
    slots = (
        'subject', 'object', 'object2',  # MEH
        'event1', 'event2',
    )

    def render(self):
        return self.event1.render() + ", and " + self.event2.render()


# - - - -


def get_event_class(name):
    cls = globals().get(name)
    return cls


def get_all_event_classes():
    return [c for c in globals().values() if c.__class__ == type and issubclass(c, Event)]