Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Once Upon a Time Card Game

@@ Project walkerOnceUponATime
@@ Version 3
@@
@@ Description:
@@ Once Upon a Time - A storytelling game based around cards.
@@ Can you get rid of all your cards?
@@
@@ Version log:
@@ Author: Walker <Mush>
@@ Date: Wed Dec 10 18:04:47 2008 -0800
@@ v3v
@@
@@ Now ignoring the PLAY tree, for active games.
@@
@@ Readme:
@@ This creates Once Upon A Time parent: It is intended to be
@@ parented to, not directly used.
@@
@@ Language: MushCode
@@ Installer file created by RubySVC (Softcode Version Control)
@@
@@
@@
@@ Creating Rooms, Things and Exits.
@@
@@
@set me=SVC`Tb1229d45e4233bba6d42:[default(SVC`Tb1229d45e4233bba6d42,create(Tb1229d45e4233bba6d42))]
@set me=SVC`Tb64254f2839937ed3091:[default(SVC`Tb64254f2839937ed3091,create(Tb64254f2839937ed3091))]
@set me=SVC`Tcab4976d21cb0af63681:[default(SVC`Tcab4976d21cb0af63681,create(Tcab4976d21cb0af63681))]
@set me=SVC`T01645c003eb33c520362:[default(SVC`T01645c003eb33c520362,create(T01645c003eb33c520362))]
@@
@@
@@ Objects created, now setting attributes, locks, etc.
@@
@@
@@
@@ Filling out Classic Fairy Tale Deck
@@
@name [v(SVC`Tb1229d45e4233bba6d42)]=Classic Fairy Tale Deck
@tel [v(SVC`Tb1229d45e4233bba6d42)]=v(SVC`T01645c003eb33c520362)
@set [v(SVC`Tb1229d45e4233bba6d42)]=iter(setdiff(lflags([v(SVC`Tb1229d45e4233bba6d42)]),NO_COMMAND VISUAL),!##) [setdiff(NO_COMMAND VISUAL,lflags([v(SVC`Tb1229d45e4233bba6d42)]))]
&ENDINGS [v(SVC`Tb1229d45e4233bba6d42)]=and so the prophecy was fulfilled|which proves that one should be more careful in choosing companions|and they lived happily ever after|and s/he never doubted his/her mother again|and the village returned to prosperity|and the land had a new king|and the land had a new queen|which proves that one should be careful what one wishes for|and it never troubled them again|and it has been like that to this day|which is why you never see them any more|but it was all a dream|and she resolved never to tell a lie again|and he never stole again|and so the riddle was finally answered|but it vanished as mysteriously as it had appeared|and everything returned to the way it was|which is why everyone should pay attention to details|and they had many fine children|and the tree still stands there as a reminder|and the river dried up|but they never saw their friend again|but they always remembered what they had learned|and so justice prevailed|and so mercy prevailed|and so love conquered all|which shows that the pen is mightier than the sword|which shows that the sword is mightier than the pen|which proves that if you can't beat them, join them|and s/he great up and became a great hero|and s/he returned home at last|and no one ever found out why|and the great danger was averted|the long Winter ended and Spring arrived at last|and parents still tell their children of the great sacrifice that saved us|which is why you should always doublecheck your figures|and the forest became a good place to live again|and people came from miles around to see it|and hope was restored|so they threw a huge party to celebrate|and a new age of peace and joy began|and so they built a new dam and saved the town|and that's why you should never rush things|and s/he smiled and walked off into the sunset|and now the minstrels sing of the mighty battle|and s/he lived meekly forever after
&COLORS.PLACE [v(SVC`Tb1229d45e4233bba6d42)]=g
&COLORS.ITEM [v(SVC`Tb1229d45e4233bba6d42)]=bh
&COLORS.EVENT [v(SVC`Tb1229d45e4233bba6d42)]=gh
&COLORS.ENDING [v(SVC`Tb1229d45e4233bba6d42)]=h
&COLORS.CHARACTER [v(SVC`Tb1229d45e4233bba6d42)]=ch
&COLORS.ASPECT [v(SVC`Tb1229d45e4233bba6d42)]=yh
&CARDS.PLACE [v(SVC`Tb1229d45e4233bba6d42)]=castle|cave|tower|forest|ruin|prison|ocean|river|mountain|valley|village|city|kingdom|foothills|tavern|chapel|stairs|hovel|palace|market|secret passage
&CARDS.ITEM [v(SVC`Tb1229d45e4233bba6d42)]=sword|boat|tree|ball|window|door|bird|lamp|sack|axe|shoes|hat|dress|knife|potion|ring|crown|stone|necklace|spinning wheel|food
&CARDS.EVENT [v(SVC`Tb1229d45e4233bba6d42)]=two people fall in love|people meet|a fight|a storm|this animal can talk|it grants a wish|it can fly|someone gets hurt|a spell is cast|an enchantment is broken|a journey|someone gets lost|something gets lost|a secret is revealed|a promise is made|help arrives|something surprising happens|an object breaks|it disappears|a group divides|a dream
&CARDS.CHARACTER [v(SVC`Tb1229d45e4233bba6d42)]=prince|frog|old man|old woman|witch/wizard|shepherdess|giant|wolf|stepmother|stepfather|fairy|monster|mother|father|thief|enemy|child|horse|king|queen|princess
&CARDS.ASPECT [v(SVC`Tb1229d45e4233bba6d42)]=ugly|beautiful|wise|foolish|rich|poor|fast|slow|hidden|loud|quiet|angry|happy|sad|frightened|golden|silver|evil|good|false|true
@@
@@ Filling out Science Fiction Deck
@@
@name [v(SVC`Tb64254f2839937ed3091)]=Science Fiction Deck
@tel [v(SVC`Tb64254f2839937ed3091)]=v(SVC`T01645c003eb33c520362)
@link [v(SVC`Tb64254f2839937ed3091)]=v(SVC`T01645c003eb33c520362)
@set [v(SVC`Tb64254f2839937ed3091)]=iter(setdiff(lflags([v(SVC`Tb64254f2839937ed3091)]),NO_COMMAND VISUAL),!##) [setdiff(NO_COMMAND VISUAL,lflags([v(SVC`Tb64254f2839937ed3091)]))]
&TYPE [v(SVC`Tb64254f2839937ed3091)]=Parent game
&ENDINGS [v(SVC`Tb64254f2839937ed3091)]=and so the legends came true|which proves that one should be more careful in choosing companions|and they lived happily ever after|and s/he never doubted his/her teacher again|and the planet returned to prosperity|and the galaxy had a new ruler|which proves that one should be careful what one wishes for|and it never troubled them again|and it has been like that to this day|which is why you never see them any more|but it was all destroyed in an apocalypse, and is now just a memory|and she boarded her ship and flew off|and he never stole again|and so the riddle was finally answered|but it vanished as mysteriously as it had appeared|and everything returned to the way it was|which is why everyone should pay attention to details|and they had many fine children|and so the revolt was put down and freedom triumphed|and so the government was overthrown and freedom triumphed|but they never saw their friend again|but they always remembered what they had learned|and so justice prevailed|and so mercy prevailed|and so love conquered all|which shows that the pen is mightier than the blaster|which shows that the blaster is mightier than the pen|which proves that if you can't beat them, join them|and s/he grew up and became a great hero|and s/he returned home at last|and no one ever found out why|and the great danger was averted|and the universe returned to peace|and parents still tell their children of the great sacrifice that saved us|which is why you should always doublecheck your figures|and people and machines never warred again|and the galactic economy was restored|and hope was restored|so they threw a huge party to celebrate|and a new age of peace and joy began|and a new star was born|and that's why you should never rush things|so they signed the Accords instead|and there was induced pleasure for all|and the humans triumphed...or did they?|which is why you should obey the Prime Directive
&COLORS.PLACE [v(SVC`Tb64254f2839937ed3091)]=g
&COLORS.ITEM [v(SVC`Tb64254f2839937ed3091)]=bh
&COLORS.EVENT [v(SVC`Tb64254f2839937ed3091)]=gh
&COLORS.ENDING [v(SVC`Tb64254f2839937ed3091)]=h
&COLORS.CHARACTER [v(SVC`Tb64254f2839937ed3091)]=ch
&COLORS.ASPECT [v(SVC`Tb64254f2839937ed3091)]=yh
&CARDS.PLACE [v(SVC`Tb64254f2839937ed3091)]=aboard a spaceship|on a planet|wormhole|nebula|canals|alien city|space station|on a moon|in space|office|bedroom|city|continent|desert|palace|cantina|holodeck|slum|headquarters|hangar|secret passage
&CARDS.ITEM [v(SVC`Tb64254f2839937ed3091)]=laser|spaceship|analyzer|computer|tool|uniform|ritual object|light source|waldo/robot|time machine|sword|sensor|map|monolith|food|spacesuit|robotic body part|transporter|viewscreen|communicator|drug
&CARDS.EVENT [v(SVC`Tb64254f2839937ed3091)]=two people fall in love|people meet|a fight between people|a space battle|this creature/object is sapient|something explodes|it can fly|someone gets hurt|a computer is programmed|something breaks down|a journey|someone gets lost|something gets lost|a secret is revealed|a promise is made|help arrives|something surprising happens|an object is built|a new civilization is found|a group divides|a dream
&CARDS.CHARACTER [v(SVC`Tb64254f2839937ed3091)]=pilot|captain|officer|ensign|alien|android|robot|monster|governor|computer|AI|Martian|Terran|enemy|rebel|emperor/empress|telepath|scientist|engineer|creature|hacker
&CARDS.ASPECT [v(SVC`Tb64254f2839937ed3091)]=hyperspace/faster-than-light|psychic|automatic|subspace|gleaming|dull|fast|slow|hidden|loud|quiet|angry|happy|sad|frightened|silicon-based|carbon-based|evil|good|false|true
@@
@@ Filling out Horror/Slasher Movie Deck
@@
@name [v(SVC`Tcab4976d21cb0af63681)]=Horror/Slasher Movie Deck
@tel [v(SVC`Tcab4976d21cb0af63681)]=v(SVC`T01645c003eb33c520362)
@set [v(SVC`Tcab4976d21cb0af63681)]=iter(setdiff(lflags([v(SVC`Tcab4976d21cb0af63681)]),NO_COMMAND VISUAL),!##) [setdiff(NO_COMMAND VISUAL,lflags([v(SVC`Tcab4976d21cb0af63681)]))]
&TYPE [v(SVC`Tcab4976d21cb0af63681)]=parent game
&ENDINGS [v(SVC`Tcab4976d21cb0af63681)]=Moral: If a house tells you to "GO AWAY", do so immediately.|Moral: Never take a bath or shower with a maniac/creature in the house.|Moral: Never check to see if something you killed is really dead. |Moral: Whatever you do, DO NOT check upstairs! For any reason.|Moral: If plumbing fixtures spew body fluids, it's time to move out.|Moral: Never read a book of demon summoning aloud, even as a joke.|Moral: Don't look under the bed.|Moral: Do not search the basement if the power has just gone out.|Moral: If relatives or pets come back from the dead, stay as far away from them as possible.|Moral: If inanimate objects such as dolls, toys, or furniture attack you, be prudent and leave the area.|Moral: When you hide, don't peek out.|Moral: Never believe that a companion is truly "dispossessed"|Moral: Never back into a room.|Moral: If children speak to you in a language or voice they should not have, destroy them immediately.|Moral: When you have the benefit of numbers, *NEVER* pair off or go it alone!!!|Moral: Never get into a car without first checking the back seat for occupants.|Moral: Don't solve puzzles that open portals to Hell.|Moral: Don't fall asleep if you have a history of homicidal/suicidal nightmares.|Moral: Never stand in, on, above, below, beside, or near a grave, tomb, crypt, mausoleum, etc.|Moral: If you're searching for something which caused a noise and find out that it's just the cat, LEAVE THE ROOM IMMEDIATELY ELSE YOU WILL QUICKLY DIE.|Moral: Do not take anything from the dead.|Moral: If you find a town which looks deserted, it's probably for a reason.|Moral: Don't fool with recombinant DNA technology unless you're sure you know what you are doing.|Moral: Never take the dare to spend a night in a haunted house.|Moral: Beware of transvestite doctors that sing.|Moral: Avoid secluded mountain resorts.|Moral: Fooling around leads to gruesome death.|Moral: Curiosity killed the cat, and its owner too.|Moral: Stay out of the woods.|Moral: Don't accept gifts from thousand-year-old strangers.|Moral: Luck, and a weapon, will see you through most events.|Moral: The devil is in the details.|Moral: Everyone makes mistakes.|Moral: Haste makes waste.|Moral: People who live in glass houses should expect to bleed. A lot.|Moral: Once bitten, twice shy.|Moral: Measure twice, cut once.
&COLORS.PLACE [v(SVC`Tcab4976d21cb0af63681)]=g
&COLORS.ITEM [v(SVC`Tcab4976d21cb0af63681)]=bh
&COLORS.EVENT [v(SVC`Tcab4976d21cb0af63681)]=gh
&COLORS.ENDING [v(SVC`Tcab4976d21cb0af63681)]=h
&COLORS.CHARACTER [v(SVC`Tcab4976d21cb0af63681)]=ch
&COLORS.ASPECT [v(SVC`Tcab4976d21cb0af63681)]=yh
&CARDS.PLACE [v(SVC`Tcab4976d21cb0af63681)]=schoolyard|cave|old house|forest|ruin|prison|street|campsite|crypt|churchyard|village|city|in a church|hotel|pub|under a bridge|stairs|underground|behind the curtain|THERE! RIGHT THERE, OH MY GOD!|secret passage
&CARDS.ITEM [v(SVC`Tcab4976d21cb0af63681)]=bible|chainsaw|knife|silver bullet|cross|garlic|raven|torch|sack|axe|shoes|hat|mask|book|food|drink|poison|stone|fire|secret ingredient|bandages
&CARDS.EVENT [v(SVC`Tcab4976d21cb0af63681)]=two people make out|people meet|a fight|a storm|its eyes glow red|it rises from the dead|someone takes a shower|someone gets hurt|a spell is cast|an enchantment is broken|the power goes out|someone gets lost|something gets lost|a secret is revealed|someone is possessed|help arrives|something surprising happens|an object shatters|it disappears|a group divides|a nightmare
&CARDS.CHARACTER [v(SVC`Tcab4976d21cb0af63681)]=teenager|child|old man|old woman|ghost|spirit|demon|monster|werewolf|mummy|zombie|witch|sorceror|cheerleader|camper|jason/freddy/etc|vampire|cat|cultist|alien|victim
&CARDS.ASPECT [v(SVC`Tcab4976d21cb0af63681)]=ugly|beautiful|helpless|shrieking|bloody|painful|disembodied|fleeing|hidden|loud|quiet|angry|happy|sad|frightened|mangled|whole/complete|evil|good|false|true
@@
@@ Filling out Once Upon a Time parent
@@
@name [v(SVC`T01645c003eb33c520362)]=Once Upon a Time parent
@lock/USER:Basic [v(SVC`T01645c003eb33c520362)]==%!
@set [v(SVC`T01645c003eb33c520362)]=iter(setdiff(lflags([v(SVC`T01645c003eb33c520362)]),LINK_OK OPAQUE),!##) [setdiff(LINK_OK OPAQUE,lflags([v(SVC`T01645c003eb33c520362)]))]
&VB.HELP [v(SVC`T01645c003eb33c520362)]=@@(%vb: The currently chosen deck of cards)
@set [v(SVC`T01645c003eb33c520362)]=VB:[v(SVC`Tb1229d45e4233bba6d42)]
&VA.HELP [v(SVC`T01645c003eb33c520362)]=@@(%va: The dbref of the object containing the card decks)
@set [v(SVC`T01645c003eb33c520362)]=VA:[v(SVC`T01645c003eb33c520362)]
&USE [v(SVC`T01645c003eb33c520362)]=[ansi(h,Once Upon a Time ...)]%rSetup:%r%b%b[ansi(h,join)] - Join the game.%r%b%b[ansi(h,quit)] - Quit the game.%r%b%b[ansi(h,deal)] - Clear and re-deal the game with the most recently chosen deck.%r%b%b[ansi(h,decks)] - List decks available for playing.%r%b%b[ansi(h,deal <deckname>)] - Deal out cards, but using the chosen deck.%r%rGameplay:%r%b%b[ansi(h,cards)] - See the cards in your hand.%r%b%b[ansi(h,play <name|number>)] - Plays the chosen playing card. (In turn)%r%tIf you're out of playing cards, it'll test against the endings.%r%b%b[ansi(h,interject <name|number>)] - Take over storytelling with your card. (Out of turn)%r%b%b[ansi(h,pass <name|number)] - Passes your turn, discarding the selected card. (In turn)%r%b%b[ansi(h,refute)] - Refute the most recent play; normal or interjection.%r%b%b[ansi(h,interrupt <name|number>)] - Plays an interrupt card. (Out of turn)%r%rAdditional commands (in or out of turn):%r%b%b[ansi(h,draw)]%r%b%b[ansi(h,discard <name|number)] - Discard a card.%r%b%b[ansi(h,draw ending)] - Draw an (additional) ending. Good for easier games or newbies.%r
&TYPE [v(SVC`T01645c003eb33c520362)]=Parent game
&S`RIGHT [v(SVC`T01645c003eb33c520362)]=[edit(wrap(iter(v(play`words),u(fun`display_name,itext(0)),|,\,%b),48),%r,if(gte(words(edit(v(play`words),|,%b)),35),%r,%r%r))]
&S`LINE [v(SVC`T01645c003eb33c520362)]=|%b[ljust(left(%0,19),19)]%b|%b[ljust(left(%1,50),50)]%b||
&S`LEFT [v(SVC`T01645c003eb33c520362)]=[iter(v(play`players),strcat(ansi([if(strmatch(##,v(play`turn)),h)]g,name(##)),%r,ljust(if(words(v(play`##.cards),|),ansi(r,\[[repeat(\],words(v(play`##.cards),|))])),10),rjust(if(words(v(play`##.ending),|),ansi(ch,\[\])),5),if(lt(words(v(play`players)),6),%r)),%b,%r)
&S`HEADER [v(SVC`T01645c003eb33c520362)]=%b%b______%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%r|¨%b%b%b%b%b%b¨¨¨¨---..__%b%b%b%b%b%b%b%b%b%b%b______________________%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%r|%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b¨-.%b.-¨¨¨¨¨%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b¨¨¨¨¨¨¨¨¨¨¨¨-------...._%b
&S`FOOTER [v(SVC`T01645c003eb33c520362)]=|%b______%b%b%b%b%b%b%b%b%b%b%b%b%b%b|%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b||%r%b=---___¨¨¨¨---..__%b%b%b|%b%b%b%b%b%b%b______________________%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b||%r%b%b%b%b%b%b%b%b¨¨¨---___%b%b¨-.|.-¨¨¨¨¨%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b¨¨¨¨¨¨¨¨¨¨¨¨-------....||%r%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b%b¨¨¨¨¨%b¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨%b%r
&SVC`IGNORE [v(SVC`T01645c003eb33c520362)]=PLAY
&SVC [v(SVC`T01645c003eb33c520362)]=
&S [v(SVC`T01645c003eb33c520362)]=String attributes
&PEMIT [v(SVC`T01645c003eb33c520362)]=pemit(%0,Storybook: %1)
&FUN`START_CARDS [v(SVC`T01645c003eb33c520362)]=switch(words(v(play`players)),1,10,2,10,3,8,4,7,5,6,5)
&FUN`SHUFFLE [v(SVC`T01645c003eb33c520362)]=strcat(set(me,play`cards:[shuffle(iter(edit(lattr(%vb/cards.*),CARDS.,),strcat(setq(c,ceil(fdiv(words(squish(xget(%vb,CARDS.##),|),|),10))),iter(shuffle(squish(xget(%vb,cards.##),|),|),##:[itext(0)][if(lte(inum(0),%qc),~)],|,|)),%b,|),|)]))
&FUN`POPCARD [v(SVC`T01645c003eb33c520362)]=localize(null(strcat(switch(1,isnum(3),
&FUN`NEXT [v(SVC`T01645c003eb33c520362)]=set(me,play`turn:[elements(v(play`players),inc(mod(match(v(play`players),v(play`turn)),words(v(play`players)))))])
&FUN`FINDDECK [v(SVC`T01645c003eb33c520362)]=if(num(%0),num(%0),locate(%va,%0,iT))
&FUN`FINDCARD [v(SVC`T01645c003eb33c520362)]=localize(switch(1,cand(isnum(%1),gte(%1,1),lte(%1,words(v(play`%0.cards),|))),CARD:[squish(%1)],cand(isnum(%1),eq(words(v(play`%0.cards),|),0),gte(%1,1),lte(%1,words(v(play`%0.ending),|))),ENDING:[squish(%1)],t(setr(0,matchall(v(play`%0.cards),*:*%1*,|))),if(eq(words(%q0,|),1),CARD:%q0,ERROR:Multiple playing cards matching '%1'.),cand(neq(words(v(play`%0.cards),|),0),not(strlen(%2))),ERROR:Cannot find playing card named '%1'.,strmatch(%1,ending),ENDING:1,t(setr(0,matchall(v(play`%0.ending),*:*%1*,|))),if(eq(words(%q0,|),1),ENDING:%q0,ERROR:Multiple endings matching '%1'.),ERROR:Cannot find ending card named '%1'.)
&FUN`DRAWENDING [v(SVC`T01645c003eb33c520362)]=localize(strcat(setq(1,v(play`%0.ending)),setq(0,shuffle(v(play`endings),|)),set(me,play`%0.ending:[setunion(%0.ENDING:[first(%q0,|)],%q1,|)]),set(me,play`endings:[rest(%q0,|)])))
&FUN`DRAW [v(SVC`T01645c003eb33c520362)]=localize(strcat(setq(0,v(play`%0.cards)),setq(1,shuffle(v(play`cards),|)),set(me,play`%0.cards:[setunion(%q0,[iter(extract(%q1,1,%1,|),%0.[itext(0)],|,|)],|)]),set(me,play`cards:[extract(%q1,inc(%1),10000,|)])))
&FUN`DISPLAY_NAME [v(SVC`T01645c003eb33c520362)]=localize(strcat(setq(0,after(%0,.)),setq(a,xget(%vb,colors.[before(%q0,:)])[if(strmatch(~,right(%q0,1)),u)]),iter(before(after(%q0,:),~),ansi(%qa,capstr(itext(0))),%b,%b)))
&FUN`DISCARD [v(SVC`T01645c003eb33c520362)]=switch(%1,CARD:*,set(me,play`%0.cards:[ldelete(v(play`%0.cards),after(%1,:),|)]),ENDING:*,set(me,play`%0.ending:[ldelete(v(play`%0.ending),after(%1,:),|)]))
&FUN`DEAL [v(SVC`T01645c003eb33c520362)]=strcat(setq(0,shuffle(v(play`players))),set(me,play:Current Game Tree),wipe(me/play`**),set(me,play`players:%q0),set(me,play`turn:[first(%q0)]),u(fun`shuffle),set(me,play`endings:[xget(%vb,endings)]),iter(%q0,strcat(set(me,play`##.cards:),u(fun`drawending,##),u(fun`draw,##,u(fun`start_cards))),%b,))
&FUN [v(SVC`T01645c003eb33c520362)]=Functions, no_command
&EMIT [v(SVC`T01645c003eb33c520362)]=emit(Storybook: %0)
&DESCRIBE [v(SVC`T01645c003eb33c520362)]=strcat(setq(l,u(s`left)),setq(r,u(s`right)),u(s`header),%r,iter(lnum(1,16),u(s`line,elements(%ql,##,%r),elements(%qr,##,%r)),%b,%r)%r,u(s`footer))
&CMD`REFUTE [v(SVC`T01645c003eb33c520362)]=$refute:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't playing!),strmatch(setr(r,v(play`refuted)),passed),u(pemit,%#,You can't refute a player passing!),strmatch(%qr,refuted),u(pemit,%#,Sorry\, I only support one level of refutation),strmatch(%qr,interrupted),u(pemit,%#,Interrupt cards are inviolate),eq(words(v(play`words),|),0),u(pemit,%#,The game hasn't even started yet!),strcat(u(emit,%N refutes the play.),set(me,play`refutes:[setunion(v(play`refutes),%#)]),if(cor(strmatch(%#,v(play`turn)),gte(words(v(play`refutes)),ceil(fdiv(words(v(play`players)),2)))),switch(1,t(strlen(setr(0,v(play`interrupt)))),strcat(u(emit,The interjection has been refuted. [name(v(play`turn))] draws 2 cards\, and [name(before(%q0,.))] shuffles [aposs(before(%q0,.))] new card back into the deck.),u(fun`draw,v(play`turn),2),set(me,play`cards:[v(play`cards)]|[after(%q0,.)]),set(me,play`words:[revwords(rest(revwords(v(play`words),|),|),|)]),set(me,play`turn:[before(%q0,.)]),set(me,play`[v(play`turn)].cards:[setdiff(v(play`[v(play`turn)].cards),%q0,|)])),strcat(setq(0,v(play`turn)),u(fun`next),setq(1,v(play`turn)),u(emit,[name(%q0)]'s play has been refuted. [capstr(subj(%q0))] draws two cards and play passes to [name(%q1)].),u(fun`draw,%q0,2),set(me,play`words:[revwords(rest(revwords(v(play`words),|),|),|)])))
&CMD`QUIT [v(SVC`T01645c003eb33c520362)]=$quit:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't playing!),strcat(wipe(me/play`%#.*),set(me,play`players:[remove(v(play`players),%#)]),if(strmatch(v(play`turn),%#),u(fun`next)),u(emit,%N stops playing "Once Upon A Time" and discards all of %p cards.))
&CMD`PLAY [v(SVC`T01645c003eb33c520362)]=$play *:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't playing.),strmatch(v(play`words),*ENDING*),u(pemit,%#,The game is over.),not(strmatch(v(play`turn),%#)),u(pemit,%#,It's not your turn.),lte(secs(),add(10,v(play`secs))),u(pemit,%#,Too late),strmatch(setr(0,u(fun`findcard,%#,%0)),ERROR:*),u(pemit,%#,after(%q0,:)),strmatch(%q0,CARD:*),strcat(set(me,play`secs:[secs()]),wipe(me/play`refuted),wipe(me/play`refutes),wipe(me/play`interrupt),set(me,play`words:[v(play`words)][if(hasattrval(me,play`words),|)][setr(1,elements(v(play`%#.cards),after(%q0,:),|))]),u(emit,%N plays [art(setr(2,before(after(%q1,.),:)))] [ansi(xget(%vb,colors.%q2),capstr(lcstr(%q2)))]: [u(fun`display_name,%q1)].),u(fun`discard,%#,%q0)),strmatch(%q0,ENDING:*),strcat(set(me,play`secs:[secs()]),wipe(me/play`refuted),wipe(me/play`refutes),wipe(me/play`interrupt),set(me,play`words:[v(play`words)][if(hastrval(me,play`words),|)][setr(1,elements(v(play`%#.ending),after(%q0,:),|))]),u(emit,%N plays %p ending card: [u(fun`display_name,%q1)]),u(fun`discard,%#,%q0))
&CMD`PASS [v(SVC`T01645c003eb33c520362)]=$pass *:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't a player!),strmatch(v(play`words),*ENDING*),u(pemit,%#,The game is over!),not(strmatch(v(play`turn),%#)),u(pemit,%#,It's not your turn!),strmatch(setr(0,u(fun`findcard,%#,%0)),ERROR:*),u(pemit,%#,after(%q0,:)),cor(strmatch(%q0,CARD:*),strmatch(%q0,ENDING:*)),strcat(set(me,play`refuted:passed),wipe(me/play`secs),wipe(me/play`interrupt),u(fun`next),u(emit,%N passes\, discarding [switch(%q0,CARD:*,a playing card,an ending)] and drawing a new one. It is now [name(v(play`turn))]'s turn.),u(fun`discard,%#,%q0),switch(%q0,CARD:*,u(fun`draw,%#,1),ENDING:*,u(fun`drawending,%#)),wipe(me/play`refutes))
&CMD`JOIN [v(SVC`T01645c003eb33c520362)]=$join:think switch(1,t(member(v(play`players),%#)),u(pemit,%#,You are already playing!),gte(words(v(play`players)),8),u(pemit,%#,Sorry, the game is full.),strmatch(v(play`words),*ENDING:*),strcat(u(emit,%N joins the game.),set(me,play`players:[v(play`players)] %#),if(not(hasattrval(me,play`turn)),set(me,play`turn:%#))),strcat(set(me,play`players:[v(play`players)] %#),u(fun`draw,%#,u(fun`start_cards)),u(fun`drawending,%#),u(emit,%N joins the game and draws [words(v(play`%#.cards),|)] cards and an ending.),if(strmatch(v(play`turn),),set(me,play`turn:%#)))
&CMD`INTERRUPT [v(SVC`T01645c003eb33c520362)]=$interrupt *:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't playing.),strmatch(v(play`words),*ENDING*),u(pemit,%#,The game is over.),strmatch(v(play`turn),%#),u(pemit,%#,But it's your turn!),lt(secs(),add(0[v(play`secs)],10)),u(pemit,%#,Too late.),strmatch(v(play`refuted),interrupted),u(pemit,%#,You can't interrupt an interrupt!),strmatch(v(play`refuted),passed),u(pemit,%#,The player of the last card has already passed\, you can't interrupt now.),strmatch(setr(0,u(fun`findcard,%#,%0)),ERROR:*),u(pemit,%#,after(%q0,:)),not(strmatch(%q0,CARD:*)),u(pemit,%#,You can't interrupt with an ending!),not(strmatch(right(setr(c,elements(v(play`%#.cards),after(%q0,:),|)),1),~)),u(pemit,%#,That card isn't an interrupt!),not(strmatch(setr(1,before(after(last(v(play`words),|),.),:)),setr(2,before(after(%qc,.),:)))),u(pemit,%#,You can't interrupt a [capstr(lcstr(%q1))] with a [capstr(lcstr(%q2))]!),strcat(set(me,play`refuted:interrupted),set(me,play`secs:[secs()]),setq(i,v(play`turn)),set(me,play`turn:%#),u(emit,%N interrupts with [art(setr(2,before(after(%qc,.),:)))] [ansi(xget(%vb,colors.%q2),capstr(lcstr(%q2)))] interrupt \, and [name(%qi)] draws a card.),u(fun`discard,%#,%q0),u(fun`draw,%qi,1)))
&CMD`INTERJECT [v(SVC`T01645c003eb33c520362)]=$interject *:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't playing.),strmatch(v(play`words),*ENDING*),u(pemit,%#,The game is over.),lt(secs(),add(0[v(play`secs)],10)),u(pemit,%#,Too late.),strmatch(v(play`turn),%#),u(pemit,%#,But it's your turn!),strmatch(setr(0,u(fun`findcard,%#,%0)),ERROR:*),u(pemit,%#,after(%q0,:)),strmatch(%q0,CARD:*),strcat(wipe(me/play`refuted),set(me,play`secs:[secs()]),wipe(me/play`refutes),setq(i,v(play`turn)),setq(o,v(play`%qi.cards)),u(fun`draw,%qi,1),setq(n,v(play`%qi.cards)),set(me,play`interrupt:[setdiff(%qn,%qo,|)]),set(me,play`turn:%#),set(me,play`words:[squish([v(play`words)]|[setr(1,elements(v(play`%#.cards),after(%q0,:),|))],|)]),u(emit,%N interjects with [art(setr(2,before(after(%q1,.),:)))] [ansi(xget(%vb,colors.%q2),capstr(lcstr(%q2)))]: [u(fun`display_name,%q1)]\, and [name(%qi)] draws a card..),u(fun`discard,%#,%q0)),strmatch(%q0,ENDING:*),strcat(wipe(me/play`refuted),set(me,play`secs:[secs()]),wipe(me/play`refutes),setq(i,v(play`turn)),setq(o,v(play`%qi.cards)),u(fun`draw,%qi,1),setq(n,v(play`%qi.cards)),set(me,play`interrupt:[setdiff(%qn,%qo,|)]),set(me,play`words:[v(play`words)][if(hastrval(me,play`words),|)][setr(1,elements(v(play`%#.ending),after(%q0,:),|))]),u(emit,%N interjects with %p ending card: [u(fun`display_name,%q1)]\, and [name(v(play`interrupt))] draws a card.),u(fun`discard,%#,%q0),set(me,play`turn:%#))
&CMD`DRAWENDING [v(SVC`T01645c003eb33c520362)]=$draw ending:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't a player!),strmatch(v(play`words),*ENDING*),u(pemit,%#,The game is over!),strcat(u(emit,%N draws an ending card.),u(fun`drawending,%#)))
&CMD`DRAW [v(SVC`T01645c003eb33c520362)]=$draw:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't a player!),strmatch(v(play`words),*ENDING*),u(pemit,%#,The game is over!),strcat(u(emit,%N draws a playing card.),u(fun`draw,%#,1)))
&CMD`DISCARD [v(SVC`T01645c003eb33c520362)]=$discard *:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't a player!),strmatch(v(play`words),*ENDING*),u(pemit,%#,The game is over!),strmatch(setr(0,u(fun`findcard,%#,%0,true)),ERROR:*),u(pemit,%#,after(%q0,:)),cor(strmatch(%q0,CARD:*),strmatch(%q0,ENDING:*)),strcat(u(emit,%N discards [switch(%q0,CARD:*,a playing card,an ending)].),u(fun`discard,%#,%q0)))
&CMD`DECKS [v(SVC`T01645c003eb33c520362)]=$decks:think u(pemit,%#,[ansi(g,%rAvailable decks:)]%r[iter(setunion(lcon(me),lcon(%va)),%b%b[name(##)],%b,%r)
&CMD`DEAL_DECK [v(SVC`T01645c003eb33c520362)]=$deal *:th switch(0,t(member(v(play`players),%#)),u(pemit,%#,You aren't playing!),t(setr(d,u(fun`finddeck,%0))),u(pemit,%#,I can't find that deck!),u(emit,%N deals a new game with [set(me,vb:%qd)][name(%vb)].[null(u(fun`deal))] It is now [name(v(play`turn))]'s turn.)
&CMD`DEAL [v(SVC`T01645c003eb33c520362)]=$deal:think switch(1,not(member(v(play`players),%#)),u(pemit,%#,You aren't playing!),u(emit,%N deals a new game with [name(%vb)].[null(u(fun`deal))] It is now [name(v(play`turn))]'s turn.)
&CMD`CARDS [v(SVC`T01645c003eb33c520362)]=$cards:think u(pemit,%#,switch(1,not(member(v(play`players),%#)),You aren't playing the game!,strmatch(v(play`words),*ENDING*),The game is over.,strcat(%r,if(hasattrval(me,play`%#.cards),Your cards:%r[iter(v(play`%#.cards),strcat(%b%b,rjust(#@,3),rjust(capstr(lcstr(after(before(setr(0,itext(0)),:),.))):%b,13),u(fun`display_name,%q0),if(strmatch(right(%q0,1),~),\, Interrupt)),|,%r)]%r),if(hasattrval(me,play`%#.ending),The ending[if(gt(words(v(play`%#.ending),|),1),s)] you want:%r[iter(v(play`%#.ending),[rjust(#@,5)]%b%b[u(fun`display_name,itext(0))],|,%r)])
&CMD [v(SVC`T01645c003eb33c520362)]=Commands, not set no_command
&AUTHOR [v(SVC`T01645c003eb33c520362)]=Walker @ M*U*S*H with help from Viila and Javelin. OUaT deck created by Javelin @ M*U*S*H
@set [v(SVC`T01645c003eb33c520362)]/USE=no_command prefixmatch
@set [v(SVC`T01645c003eb33c520362)]/S=no_command
@set [v(SVC`T01645c003eb33c520362)]/FUN=no_command
@set [v(SVC`T01645c003eb33c520362)]/DESCRIBE=no_command visual public nearby
@@
@@ Triggering all startups, oncreates, onupdates.
@@