Raevnos's Generic Deck of Cards

This is generic deck of cards, with functions to handle shuffling, drawing, and other such things. It's meant to be used by coded card games.

Author: Raevnos
Category: Games
Commands: @create, @lset, @set.
Compatibility: CobraMUSH, PennMUSH.

Instructions

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

MUSHCode for Raevnos's Generic Deck of Cards

@create Generic Deck Of Cards
@lock/Basic Generic Deck Of Cards==me
@lset Generic Deck Of Cards/Basic=no_inherit
@lock/Link Generic Deck Of Cards==#0
@lset Generic Deck Of Cards/Link=no_inherit
@set Generic Deck Of Cards = LINK_OK
@set Generic Deck Of Cards = VISUAL
@set Generic Deck Of Cards = NO_COMMAND
&C Generic Deck Of Cards=Club
&CODE_TO_ENGLISH Generic Deck Of Cards=switch(right(%0, 1), A, Ace, J, Jack, Q, Queen, K, King, mid(%0, 1, 2)) of [v(left(%0, 1))]s
&D Generic Deck Of Cards=Diamond
&DESCRIBE Generic Deck Of Cards=This is generic deck of cards, with functions to handle shuffling, drawing, and other such things. It's meant to be used by coded card games.
@set Generic Deck Of Cards/DESCRIBE=no_command visual public nearby
&DRAW_CARDS Generic Deck Of Cards=extract(v(current-deck), 1, %0)[set(me, current-dec:[extract(v(current-deck), %0, 52)])]
&H Generic Deck Of Cards=Heart
&LICENSE Generic Deck Of Cards=All code on this object (Raevnos's Generic Deck of Cards) is released under the Library Gnu Public License. A copy of that license is avaliable at [tagwrap(a, href="http://www.gnu.org/copyleft/lgpl.html", http://www.gnu.org/copyleft/lgpl.html)]
&MASTER-DECK Generic Deck Of Cards=DA D2 D3 D4 D5 D6 D7 D8 D9 D10 DJ DQ DK HA H2 H3 H4 H5 H6 H7 H8 H9 H10 HJ HQ HK SA S2 S3 S4 S5 S6 S7 S8 S9 S10 SJ SQ SK CA C2 C3 C4 C5 C6 C7 C8 C9 C10 CJ CQ CK
&RETURN_CARDS_TO_DECK Generic Deck Of Cards=[set(me, current-deck:[v(current-deck)] %0)]
&S Generic Deck Of Cards=Spade
&SETUP Generic Deck Of Cards=wipe(me/*-hand)[set(me, current-deck:[v(master-deck)][u(shuffle)]
&SHUFFLE_DECK Generic Deck Of Cards=set(me, current-deck:[shuffle(v(current-deck)])