summaryrefslogtreecommitdiffstats
path: root/include/game.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2008-10-18 16:46:59 -0700
committerArun Persaud <arun@nubati.net>2008-10-18 16:46:59 -0700
commit567f0d615194566c629887a315cd864bbe84fde9 (patch)
treeea973a9c3afc86b4ce4c76cce581628bb5890267 /include/game.php
parenteb20bf1a0cae1192eb50c19220e72df8d971d8e7 (diff)
downloade-DoKo-567f0d615194566c629887a315cd864bbe84fde9.tar.gz
e-DoKo-567f0d615194566c629887a315cd864bbe84fde9.tar.bz2
e-DoKo-567f0d615194566c629887a315cd864bbe84fde9.zip
NEW FEATURE: implement Lance's Schweinchen rule
new rule that only allows Schweinchen in case one of the teammembers called re/contra. Signed-off-by: Arun Persaud <arun@nubati.net>
Diffstat (limited to 'include/game.php')
-rw-r--r--include/game.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/game.php b/include/game.php
index 49957b1..afe6144 100644
--- a/include/game.php
+++ b/include/game.php
@@ -1324,7 +1324,11 @@ switch($mystatus)
else
$GAME['schweinchen-second'] = 1; /* this must be the second fox */
- if( ($GAME['schweinchen-second']==1 && $RULES['schweinchen']=='second') || $RULES['schweinchen']=='both')
+ if( $RULES['schweinchen']=='both' ||
+ ($RULES['schweinchen']=='second' && $GAME['schweinchen-second']==1 )||
+ ($RULES['schweinchen']=='secondaftercall' && $GAME['schweinchen-second']==1 &&
+ (DB_get_call_by_hash($GAME['schweinchen-who']) || DB_get_partner_call_by_hash($GAME['schweinchen-who']) ))
+ )
{
DB_insert_comment('Schweinchen! ',$playid,$myid);
$commentSchweinchen = 'Schweinchen! ';
@@ -1871,9 +1875,15 @@ switch($mystatus)
foreach($mycards as $card)
{
+ /* display only cards that the player is allowed to play as links, the rest just display normal
+ * also check if we have both schweinchen, in that case only display on of them as playable
+ */
if( ($followsuit && !same_type($card,$firstcard)) ||
- ( (int)($card)==19 && ($RULES['schweinchen']=='second'||$RULES['schweinchen']=='secondaftercall')
- && $GAME['schweinchen-who']==$me && !$GAME['schweinchen-first'] )
+ ( (int)($card)==19 && !$GAME['schweinchen-first'] &&
+ ($RULES['schweinchen']=='second'||
+ ( $RULES['schweinchen']=='secondaftercall' &&
+ (DB_get_call_by_hash($GAME['schweinchen-who']) || DB_get_partner_call_by_hash($GAME['schweinchen-who']) )))
+ && $GAME['schweinchen-who']==$me )
)
display_card($card,$PREF['cardset']);
else