From 35687ace49ce0b41b1380603513d1f04cd6b458f Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Fri, 29 Jun 2007 19:18:51 +0200 Subject: NEW FEATURE+BUGFIX: changed calling re/contra you can call re/contra, etc. now even if it is not your turn. Also fixed rule where you can say 90 with 9 cards, etc. so that you need to say 120 to say 90, 90 to say 60, etc. --- functions.php | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'functions.php') diff --git a/functions.php b/functions.php index 66cc57f..af34345 100644 --- a/functions.php +++ b/functions.php @@ -526,10 +526,16 @@ function can_call($what,$hash) { global $RULES; - /*TODO: check if this already has been call by teammate */ - $gameid = DB_get_gameid_by_hash($hash); $gametype = DB_get_gametype_by_gameid($gameid); + $oldcall = DB_get_call_by_hash($hash); + $pcall = DB_get_partner_call_by_hash($hash); + + if( ($pcall!=NULL && $what >= $pcall) || + ($oldcall!=NULL && $what >=$oldcall) ) + { + return 0; + } $NRcards = count(DB_get_hand($hash)); @@ -560,8 +566,40 @@ function can_call($what,$hash) return 1; break; case "9-cards": - if( ($what/10) <= $NRcards + $offset) - return 1; + + if($oldcall!=NULL && $pcall!=NULL) + $mincall = ($oldcall>$pcall) ? $pcall : $oldcall; + else if($oldcall!=NULL) + $mincall = $oldcall; + else if ($pcall!=NULL) + $mincall = $pcall; + else + $mincall = -1; + + if( 12 <= ($NRcards + $offset)) + { + return 1; + } + else if ( 9 <= ($NRcards + $offset)) + { + if( ($mincall>=0 && $mincall==120) ) + return 1; + } + else if ( 6 <= ($NRcards + $offset)) + { + if( ($mincall>=0 && $mincall<=90 && $what<=60 ) ) + return 1; + } + else if ( 3 <= ($NRcards + $offset)) + { + if( ($mincall>=0 && $mincall<=60 && $what<=30 ) ) + return 1; + } + else if ( 0 <= ($NRcards + $offset)) + { + if( ($mincall>=0 && $mincall<=30 && $what==0 ) ) + return 1; + }; break; } -- cgit v1.2.3-18-g5258