~rabbits/donsol

ef2107da10234110d84dfd315c0710294cd501de — neauoire 1 year, 4 months ago 8f4e1d8
Added deck shuffling
2 files changed, 58 insertions(+), 17 deletions(-)

A README.md
M src/main.tal
A README.md => README.md +19 -0
@@ 0,0 1,19 @@
# DONSOL

Donsol is a solitary card game, designed by John Eternal in which you must go through the deck in sequences of 4 cards. A standard deck, jokers included, is a dungeon. Shuffle the deck and draw 4 cards, display them before you, this is a room. A room ends when all the cards are folded.

## ♥︎ Hearts are Potions

Potion give you health points equal to their value, up to a maximum of 21 health points. Drinking multiple potions in a row will make you sick and result in no extra healing, only the first potion's value will be gained in HP. Potions are equal to their value and face cards (J,Q,K,A) each are equal to 11.

## ♦ Diamonds are Shields

Shields absorb the damage difference from a monster's value. Shields can only defend against monsters in descending value and if you use a shield on a monster with higher or equal value to the previous, it will break. Broken shields leave you unarmored, and taking full damage. A shield card will replace a previously folded shield card. Shields are equal to their value and face cards (J,Q,K,A) each are equal to 11.

## ♣♠ Clubs and Spades are Monster Cards

Monster cards are equal to their value, and face cards are as follows J is 11, Q is 13, K is 15, A is 17; Jokers are both equal to 21. You may escape a room, if you have not escaped the previous one or have handled all the monsters in the current room. When escaping, the remaining cards are shuffled back into the deck.

- [Guide](https://100r.co/site/donsol.html) 
- [Video Tutorial](https://www.youtube.com/watch?v=GNoZrr56GqA) 
- [Community](https://hundredrabbits.itch.io/donsol/community)

M src/main.tal => src/main.tal +39 -17
@@ 40,6 40,7 @@
|80 @Controller [ &vector $2 &button  $1 &key    $1 ]
|90 @Mouse      [ &vector $2 &x       $2 &y      $2 &state $1 &chord $1 ]
|a0 @File       [ &vector $2 &success $2 &offset $2 &pad   $2 &name  $2 &length $2 &load $2 &save $2 ]
|b0 @DateTime   [ &year   $2 &month    $1 &day    $1 &hour  $1 &minute $1 &second $1 &dotw $1 &doty   $2 &isdst $1 ]

( variables )



@@ 162,7 163,7 @@ BRK
@start-game ( -- )

	( reset player )
	#10 DUP .player/hp STZ .player/hp-tween STZ
	#15 DUP .player/hp STZ .player/hp-tween STZ
	#0000 .player/sp STZ2
	#00 .player/xp STZ



@@ 170,9 171,9 @@ BRK
	;init-deck JSR2
	;shuffle-deck JSR2
	;pull-card JSR2 #00 ;put-card JSR2
	#27 #01 ;put-card JSR2
	#15 #02 ;put-card JSR2
	#21 #03 ;put-card JSR2
	;pull-card JSR2 #01 ;put-card JSR2
	;pull-card JSR2 #02 ;put-card JSR2
	;pull-card JSR2 #03 ;put-card JSR2

	;redraw JSR2
	;dialogs/entered ;draw-dialog JSR2


@@ 192,6 193,25 @@ RTN

@shuffle-deck ( -- )

	( first shuffle )
	#3600
	&a
		DUPk
			( seed ) .DateTime/month DEI2 + * .DateTime/day DEI2 + + #36 MOD
			( a b ) OVR .deck/cards + LDZ OVR .deck/cards + LDZ
			( b a ) SWP2 STH .deck/cards + STZ STHr .deck/cards + STZ
		INC GTHk ,&a JCN
	POP2
	( second shuffle )
	#3600
	&b
		DUPk
			( seed ) .DateTime/hour DEI2 + * .DateTime/minute DEI2 + + #36 MOD
			( a b ) OVR .deck/cards + LDZ OVR .deck/cards + LDZ
			( b a ) SWP2 STH .deck/cards + STZ STHr .deck/cards + STZ
		INC GTHk ,&b JCN
	POP2

RTN

@pull-card ( -- card )


@@ 333,15 353,6 @@ RTN

RTN

@flip-card ( table -- )

	DUP .table + LDZ #36 = ,&skip JCN
		#36 SWP .table + STZ
		;draw-table JSR2
	&skip

RTN

@select ( id state -- )

	SWP 


@@ 363,11 374,22 @@ RTN
	#01 ;draw-selection JSR2
	POP

	( TODO; End deck )
RTN

@flip-card ( table -- )

	DUP .table + LDZ #36 = ,&skip JCN
		#36 SWP .table + STZ
		;draw-table JSR2

		( TODO; End deck )
	
	( TODO: End room )
	;count-table JSR2 #04 ,&no-room-complete JCN
		&no-room-complete
		( TODO: End room )
		;count-table JSR2 #04 ! ,&no-room-complete JCN
			#aa DEBUG
			&no-room-complete

	&skip

RTN