% This file contains the predicates for the cursedie and some manipulation funktions for taomarkers and Qi points.

/**
@descr Throws the cursedie
@form curseDie(TileID)
*/
curseDie(TileID):- 
	A is random(6), %roll the die
	broadcastCurseDie(A), %broadcast the die result to gui
	curseDieAction(A,TileID).

curseDieAction(5, _) :- addQi(-1), !.
curseDieAction(4, _) :- setTaoMarkers([0,0,0,0,0]), !.
curseDieAction(3, _) :- addGhost, !.
curseDieAction(2, TileID) :- hauntVillage(TileID), !.
curseDieAction(_, _).

/*
curseDie(TileID) :-
	retract(curseCounter(X)),
	roll_curse_fake(X,A),
	XN is X + 1,
	assert(curseCounter(XN)),
	
	broadcastCurseDie(A), %broadcast the die result to gui
	(   
	   (A = 5,addQi(-1)); %lose one Qi token
	   (A = 4,setTaoMarkers([0,0,0,0,0])); %lose all Tao tokens 
	   (A = 3,addGhost); %bring a ghost into play
	   (A = 2,hauntVillage(TileID)); %haunt the given VillageID 
	   (A = 0; A = 1)
	).

:- dynamic(curseCounter/1).
curseCounter(0).

roll_curse_fake(0,5).
roll_curse_fake(1,4).

*/	







