
    Ii                        % S r SSKJrJr  SSKJr  SSKrSSKJr   " S S\	\5      r
 " S S	\	\5      r " S
 S\	\5      r " S S\	\5      r\R                  \R                  \R                   \R"                  \R$                  \R&                  \R(                  \R*                  \R,                  \R.                  0r\\	\	4   \S'   \R                  \R6                  \R                   \R8                  \R$                  \R:                  \R(                  \R<                  \R,                  \R<                  0r\\	\	4   \S'   \R6                  \R                  \R8                  \R                   \R:                  \R$                  \R<                  \R,                  0r \\	\	4   \S'   \R                  S\R                   S\R$                  S\R(                  S\R,                  S\R                  S\R"                  S\R&                  S\R*                  S\R.                  S\R6                  S\R8                  S\R:                  S\R<                  SSS 0r!\\	\	4   \S!'   \ " S" S#\5      5       r"\ " S$ S%\5      5       r#g)&z6Card definitions and deck management for Mile by Mile.    )	dataclassfield)EnumN)DataClassJSONMixinc                   ,    \ rS rSrSrSrSrSrSrSr	Sr
g	)
CardType
   zCard type enumeration.distancehazardremedysafetyspecial N)__name__
__module____qualname____firstlineno____doc__DISTANCEHAZARDREMEDYSAFETYSPECIAL__static_attributes__r       <c:\Users\dbart\PlayPalace11\server\games\milebymile\cards.pyr   r   
   s     HFFFGr   r   c                   ,    \ rS rSrSrSrSrSrSrSr	Sr
g	)

HazardType   zHazard card types.
out_of_gas	flat_tireaccidentspeed_limitstopr   N)r   r   r   r   r   
OUT_OF_GAS	FLAT_TIREACCIDENTSPEED_LIMITSTOPr   r   r   r   r   r      s    JIHKDr   r   c                   ,    \ rS rSrSrSrSrSrSrSr	Sr
g	)

RemedyType   zRemedy card types.gasoline
spare_tirerepairsend_of_limitrollr   N)r   r   r   r   r   GASOLINE
SPARE_TIREREPAIRSEND_OF_LIMITROLLr   r   r   r   r+   r+      s    HJG!LDr   r+   c                   (    \ rS rSrSrSrSrSrSrSr	g)	
SafetyType(   zSafety card types.
extra_tankpuncture_proofdriving_aceright_of_wayr   N)
r   r   r   r   r   
EXTRA_TANKPUNCTURE_PROOFDRIVING_ACERIGHT_OF_WAYr   r   r   r   r8   r8   (   s    J%NK!Lr   r8   HAZARD_TO_REMEDYHAZARD_TO_SAFETYSAFETY_TO_HAZARDz
Out of Gasz	Flat TireAccidentzSpeed LimitStopGasolinez
Spare TireRepairszEnd of LimitzGreen Lightz
Extra TankzPuncture ProofzDriving AcezRight of Wayfalse_virtuezFalse Virtue
CARD_NAMESc                   h    \ rS rSr% Sr\\S'   \\S'   \\S'   \S\4S j5       r	\S\4S j5       r
S	rg
)Cardc   zA single card in Mile by Mile.id	card_typevaluereturnc                     U R                   [        R                  :X  a  U R                   S3$ [        R                  U R                  U R                  5      $ )z#Get the display name for this card.z miles)rO   r   r   rP   rJ   getselfs    r   name	Card.namek   s@     >>X...jj\((~~djj$**55r   c                 j    U R                   [        R                  :X  a  [        U R                  5      $ g)z3Get distance value (only valid for distance cards).r   )rO   r   r   intrP   rT   s    r   r
   Card.distancer   s'     >>X...tzz?"r   r   N)r   r   r   r   r   rY   __annotations__strpropertyrV   r
   r   r   r   r   rL   rL   c   sH    (GNJ6c 6 6 #  r   rL   c            	           \ rS rSr% Sr\" \S9r\\   \	S'   Sr
\\	S'   S\S\S	\4S
 jr   SS\S\S\S	S4S jjrSS jrS	\S-  4S jrS\\   S	\S-  4S jrS\S	S4S jrS\\   S	S4S jrS	\4S jrS	\4S jrSrg)Deckz   z4A deck of cards with draw and shuffle functionality.)default_factorycardsr   _next_idrO   rP   rQ   c                 X    [        U R                  XS9nU =R                  S-  sl        U$ )zCreate a card with a unique ID.)rN   rO   rP      )rL   rc   )rU   rO   rP   cards       r   _create_cardDeck._create_card   s%    t}}	Gr   attack_multiplierdefense_multiplierinclude_karma_cardsNc                    / U l         [        S5       H<  nU R                   R                  U R                  [        R
                  S5      5        M>     [        S5       H<  nU R                   R                  U R                  [        R
                  S5      5        M>     [        S5       H<  nU R                   R                  U R                  [        R
                  S5      5        M>     [        S5       H<  nU R                   R                  U R                  [        R
                  S5      5        M>     [        S5       H<  nU R                   R                  U R                  [        R
                  S5      5        M>     [        S	U-  5       HJ  nU R                   R                  U R                  [        R                  [        R                  5      5        ML     [        S	U-  5       HJ  nU R                   R                  U R                  [        R                  [        R                  5      5        ML     [        S	U-  5       HJ  nU R                   R                  U R                  [        R                  [        R                  5      5        ML     [        SU-  5       HJ  nU R                   R                  U R                  [        R                  [        R                  5      5        ML     [        S
U-  5       HJ  nU R                   R                  U R                  [        R                  [        R                  5      5        ML     [        SU-  5       HJ  nU R                   R                  U R                  [        R                  [        R                  5      5        ML     [        SU-  5       HJ  nU R                   R                  U R                  [        R                  [        R                   5      5        ML     [        SU-  5       HJ  nU R                   R                  U R                  [        R                  [        R"                  5      5        ML     [        SU-  5       HJ  nU R                   R                  U R                  [        R                  [        R$                  5      5        ML     [        SU-  5       HJ  nU R                   R                  U R                  [        R                  [        R&                  5      5        ML     U R                   R                  U R                  [        R(                  [*        R,                  5      5        U R                   R                  U R                  [        R(                  [*        R.                  5      5        U R                   R                  U R                  [        R(                  [*        R0                  5      5        U R                   R                  U R                  [        R(                  [*        R2                  5      5        U(       aL  [        S5       H<  nU R                   R                  U R                  [        R4                  S5      5        M>     gg)z#Build a standard Mile by Mile deck.r	   255075   100   200               rI   N)rb   rangeappendrg   r   r   r   r   r%   r&   r'   r(   r)   r   r+   r2   r3   r4   r5   r6   r   r8   r>   r?   r@   rA   r   )rU   ri   rj   rk   _s        r   build_standard_deckDeck.build_standard_deck   s[    
 rAJJd//0A0A4HI rAJJd//0A0A4HI rAJJd//0A0A4HI rAJJd//0A0A5IJ qAJJd//0A0A5IJ  q,,-AJJd//AVAVWX .q,,-AJJd//AUAUVW .q,,-AJJd//ATATUV .q,,-AJJd//AWAWXY .q,,-AJJd//QR . q--.AJJd//ATATUV /q--.AJJd//AVAVWX /q--.AJJd//ASASTU /q--.AJJd//AXAXYZ /r../AJJd//QR 0 	

$++HOOZ=R=RST

$++HOOZ=V=VWX

$++HOOZ=S=STU

$++HOOZ=T=TUV 1X

!!$"3"3H4D4Dn"UV  r   c                 D    [         R                  " U R                  5        g)z$Shuffle the deck using Fisher-Yates.N)randomshufflerb   rT   s    r   r   Deck.shuffle   s    tzz"r   c                 \    U R                   (       a  U R                   R                  S5      $ g)z%Draw a card from the top of the deck.r   N)rb   poprT   s    r   draw	Deck.draw   s    ::::>>!$$r   handc                    ^ [        U R                  5       H=  u  nm[        U4S jU 5       5      (       a  M"  U R                  R                  U5      s  $    U R	                  5       $ )zJDraw a card that isn't already in the hand (for disallow duplicates mode).c              3      >#    U  H=  oR                   TR                   :H  =(       a    UR                  TR                  :H  v   M?     g 7f)N)rO   rP   ).0crf   s     r   	<genexpr>*Deck.draw_non_duplicate.<locals>.<genexpr>   s4     ]X\ST{{dnn4NDJJ9NNX\s   AA)	enumeraterb   anyr   r   )rU   r   irf   s      @r   draw_non_duplicateDeck.draw_non_duplicate   sO     !,GAt]X\]]]zz~~a(( - yy{r   rf   c                 :    U R                   R                  U5        g)z%Add a card to the bottom of the deck.N)rb   rz   )rU   rf   s     r   addDeck.add   s    

$r   c                 :    U R                   R                  U5        g)zAdd multiple cards to the deck.N)rb   extend)rU   rb   s     r   add_allDeck.add_all   s    

% r   c                 2    [        U R                  5      S:H  $ )zCheck if the deck is empty.r   lenrb   rT   s    r   is_emptyDeck.is_empty   s    4::!##r   c                 ,    [        U R                  5      $ )z$Get the number of cards in the deck.r   rT   s    r   size	Deck.size   s    4::r   )rb   )re   re   F)rQ   N)r   r   r   r   r   r   listrb   rL   r[   rc   rY   r\   rg   boolr|   r   r   r   r   r   r   r   r   r   r   r   r_   r_   z   s    >d3E4:3Hcc # $  "#"#$)	6W6W  6W "	6W
 
6Wp#dTk tDz dTk      !T$Z !D !$$ $c r   r_   )$r   dataclassesr   r   enumr   r   mashumaro.mixins.jsonr   r\   r   r   r+   r8   r%   r2   r&   r3   r'   r4   r(   r5   r)   r6   rB   dictr[   r>   r?   r@   rA   rC   rD   rJ   rL   r_   r   r   r   <module>r      sl   < (   4sD d d "d " :..*//++J33OOZ__$ $sCx.  :00*33//J33OOZ,,$ $sCx.  :00z33J//Z__	$ $sCx.  <+MOOV<	^OO]</M^N'
DcN .   , e e er   