(include "card.ddh")

(class_function Card void create (group)
	(group

	(= this.id 0)
	(dd_matrix_identity this.target)

	(= this.hidden 0)

	(= this.font 0)

	)
)

# draw the card with its transformation matrix
(class_function Card void draw (group)
	(group
	(dd_matrix_push)
	(this.applyMatrix)
	(this.drawRaw)
	(dd_matrix_pop)
	)
)

(class_function Card void clean (group)
	(group
	)
)

# apply the card's matrix
(class_function Card void applyMatrix (group)
	(group
	(dd_multMatrixf this)
	)
)

# draw the card's mesh with no transformation
(class_function Card void drawRaw (group)
	(group
	(if (== this.hidden 0)
		(this.mesh.draw)
	)
	(this.meshBack.draw)
	)
)

(class_function Card void drawText (group)
	(group

	(if (== this.id 0)
		(group
		(dd_scalef 0.7 0.7 0.7)
		(this.font.draw "move rose 1 step")
		)
	(== this.id 1)
		(group
		(dd_scalef 0.7 0.7 0.7)
		(this.font.draw "move rose 3 steps")
		)
	(== this.id 2)
		(group
		(dd_scalef 0.5 0.5 0.5)
		(dd_translatef 0 1.75 0)
		(this.font.draw "rose player grabs rose")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "give a card to the")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "rose player")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "receive a random card")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "from the rose player")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "move rose 1 step")
		)
	(== this.id 3)
		(group
		(dd_scalef 0.6 0.6 0.6)
		(dd_translatef 0 1.4 0)
		(this.font.draw "if rose is 1 step")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "before you")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "move it 1 step")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "otherwise")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "move it 3 steps")
		)
	(== this.id 4)
		(group
		(dd_scalef 0.65 0.65 0.65)
		(dd_translatef 0 1.0 0)
		(this.font.draw "draw 1 card")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "discard this card")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "plan and execute")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "another card")
		)
	(== this.id 5)
		(group
		(dd_scalef 0.55 0.55 0.55)
		(dd_translatef 0 1.5 0)
		(this.font.draw "if rose is in front of")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "you grab it otherwise")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "move rose 1 step")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "the rose player")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "grabs the rose")
		)
	(== this.id 6)
		(group
		(dd_scalef 0.7 0.7 0.7)
		(this.font.draw "the rose player")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "grabs the rose")
		)
	(== this.id 7)
		(group
		(dd_scalef 0.6 0.6 0.6)
		(dd_translatef 0 1.4 0)
		(this.font.draw "if you are not")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "the rose player")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "move rose 1 step")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "otherwise")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "move rose 3 steps")
		)
	(== this.id 8)
		(group
		(dd_scalef 0.6 0.6 0.6)
		(dd_translatef 0 1.3 0)
		(this.font.draw "if you are holding")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "the rose")
		(dd_translatef 0 -1.0 0)
		(this.font.draw "discard 1 card")
		(dd_translatef 0 -1.0 0)
		(dd_translatef 0 -1.0 0)
		(this.font.draw "move rose 1 step")
		)
	)

	)
)

(class_function Card void setId (group int givenId)
	(group

	(= this.id givenId)

	(if (== this.id 0)
		(= this.cardDescription "move the rose 1 step")
	(== this.id 1)
		(= this.cardDescription "move the rose 3 steps")
	(== this.id 2)
		(= this.cardDescription (multistring
			"The rose player grabs the rose then"
			"give a card to the rose player and "
			"receive a random card back then "
			"move the rose 1 step "
			)
		)
	(== this.id 3)
		(= this.cardDescription (multistring
			"if the rose is 1 step before you "
			"move it 1 step "
			"otherwise "
			"move it 3 steps"
			)
		)
	(== this.id 4)
		(= this.cardDescription (multistring
			"draw 1 card then "
			"discard this card to "
			"plan and execute "
			"another card"
			)
		)
	(== this.id 5)
		(= this.cardDescription (multistring
			"if the rose is in front of "
			"you grab it otherwise "
			"move the rose 1 step then "
			"the rose player "
			"grabs the rose"
			)
		)
	(== this.id 6)
		(= this.cardDescription (multistring
			"the rose player "
			"grabs the rose"
			)
		)
	(== this.id 7)
		(= this.cardDescription (multistring
			"if you are not "
			"the rose player then "
			"move the rose 1 step "
			"otherwise "
			"move the rose 3 steps"
			)
		)
	(== this.id 8)
		(= this.cardDescription (multistring
			"if you are holding "
			"the rose then "
			"discard 1 card -"
			"move the rose 1 step"
			)
		)
	# rose
	(== this.id 9)
		(= this.cardDescription (multistring
			"a beautiful red rose that smells amazing"
			)
		)
	# tutorial - initialisation
	(== this.id 10)
		(= this.cardDescription (multistring
			"During initialisation every player draws 5 cards "
			"and one player gets the rose card in front of them."
			)
		)
	# tutorial - planning
	(== this.id 11)
		(= this.cardDescription (multistring
			"In the planning phase starting with the player with the rose "
			"every player picks a card and plans it face down on the table"
			)
		)
	# tutorial - user's turn
	(== this.id 12)
		(= this.cardDescription (multistring
			"The rose always moves clockwise."
			"If a player holds the rose moving it one step will "
			"make it move in front of that player"
			)
		)
	# tutorial - execution
	(== this.id 13)
		(= this.cardDescription (multistring
			"In the execution phase starting with the player with the rose,"
			"reveal each card and execute its effect"
			)
		)
	# tutorial - end
	(== this.id 14)
		(= this.cardDescription (multistring
			"In the end phase every player draws one card except the "
			"player with the rose If a player has 2 or less cards in their hand "
			"they win"
			)
		)
	# else
		(= this.cardDescription "no description")
	)

	)
)
