//checks to see if you have your fortune counter running
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
string CheckFortune(boolean autoeat)
{
string outstring="";
string RelayCounters=get_property("relayCounters");
int [int] FortuneCounter;
int count=1;
int Counters=0;
matcher FortuneFinder=create_matcher("(\\d+):Fortune Cookie", RelayCounters);
//get how many turns left until counter(s) expires
while (FortuneFinder.find())
{
FortuneCounter [count] = FortuneFinder.group( 1 ).to_int() -my_turncount();
count=count+1;
}
Counters=count(FortuneCounter);
//Debug:
//print (get_property("relayCounters"),"red");
//print(get_property("relayCounters").to_int(),"red");
//print(Counters,"red");
switch
{
case Counters==1 && FortuneCounter[1]>0:
outstring=outstring+"<B><FONT color=#365f91>Your Next SemiRare occurs in <FONT color=#00b0f0>"+FortuneCounter[1]+"</FONT> turns. <br /></B></FONT>";
break;
case Counters==2 && FortuneCounter[2]>0:
outstring=outstring+"<B><FONT color=#365f91>You have two SemiRare counters active:<br /></B></FONT>";
outstring=outstring+"<B><FONT color=#365f91>Your Next SemiRare occurs in <FONT color=#00b0f0>"+FortuneCounter[2]+"</FONT> turns. <br /></B></FONT>";
outstring=outstring+"<B><FONT color=#365f91>Your Next SemiRare occurs in <FONT color=#00b0f0>"+FortuneCounter[1]+"</FONT> turns. <br /></B></FONT>";
break;
case Counters==3 && FortuneCounter[3]>0:
outstring=outstring+"<B><FONT color=#365f91>You have three SemiRare counters active:<br /></B></FONT>";
outstring=outstring+"<B><FONT color=#365f91>Your Next SemiRare occurs in <FONT color=#00b0f0>"+FortuneCounter[3]+"</FONT> turns. <br /></B></FONT>";
outstring=outstring+"<B><FONT color=#365f91>Your Next SemiRare occurs in <FONT color=#00b0f0>"+FortuneCounter[2]+"</FONT> turns. <br /></B></FONT>";
outstring=outstring+"<B><FONT color=#365f91>Your Next SemiRare occurs in <FONT color=#00b0f0>"+FortuneCounter[1]+"</FONT> turns. <br /></B></FONT>";
break;
case my_fullness() != fullness_limit() && my_meat()>40 && autoeat:
eat(1, $item[fortune cookie]);
outstring=CheckFortune(true);
break;
case my_fullness() != fullness_limit() && my_meat()>40 && user_confirm("Do you want to eat a Fortune Cookie?"):
eat(1, $item[fortune cookie]);
outstring=CheckFortune(false);
break;
case my_fullness() == fullness_limit():
outstring="<B><FONT color=#ff0000>You need to eat a Fortune Cookie but you are too full :(<br /></Font></B>";
break;
default:outstring="<B><FONT color=#ff0000>You need to eat a Fortune Cookie! <br /></Font></B>";
}
return outstring;
}