Movie screen

This bad joke requires Tracery.
This commit is contained in:
Alexander Yakovlev 2023-01-24 21:21:38 +06:00
parent c644f274ff
commit 839b4431a2
1 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,31 @@
"""
Movie Screen
This is a joke object that changes its description every time you look at it.
Requires installing pytracery as a pip dependency.
"""
from typeclasses.objects import Object
import tracery
from tracery.modifiers import base_english
class MovieScreen(Object):
rules = {
'origin': ['This is #genre.a# #movie# about #subject.s#.', '#subject.s.capitalize# #sequel#: The #family.capitalize# Of All #movie.s.capitalize#!'],
'sequel': ['from hell #number#','#number#','the Resurrection','Origins','Rebooted','Reimagined','Again'],
'family': ['mother','father','aunt','xyther','grunkle','grandpa','grandma'],
'number': ['2','3','4','5','6','II','III','IV','V','VI','XXIII','MCMXCIII'],
'movie': ['movie', 'flick', 'animation', 'anime', 'moving picture', 'picture'],
'genre': ['action', 'romance', 'thriller', 'horror', 'abstract', 'slice-of-life', 'comedy', 'documentary'],
'subject': ['wombat', 'stoner', '#pair# love #polycule#', 'smartphone', 'astronaut', 'explosion'],
'pair': ['gay','aromantic','nonbinary','clueless','crazy'],
'polycule': ['triange', 'pair', '3D icosahedron', 'polycule']
}
"""
Can't be a self.db.desc because we *need* a function here.
"""
def get_display_desc(self, looker, **kwargs):
grammar = tracery.Grammar(self.rules)
grammar.add_modifiers(base_english)
return grammar.flatten("#origin#")
pass