X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=db27bde601dd75d743c62d99c0674f4ea07df303;hp=93ab461415012df85d05094e4f78e5af93a44e1a;hb=c581cd05476d07f0fd17dab41cbb211a443fd57f;hpb=f0e93ad1feb9ba47dc1db80354b5f28d29b5ab27 diff --git a/include/game.php b/include/game.php index 93ab461..db27bde 100644 --- a/include/game.php +++ b/include/game.php @@ -223,6 +223,7 @@ if($session) echo " 10ofhearts : {$RULES['dullen']}
\n"; echo " schweinchen: {$RULES['schweinchen']}
\n"; echo " call: {$RULES['call']}
\n"; + echo " lowtrump: {$RULES['lowtrump']}
\n"; echo " \n \n"; /* show score */ @@ -400,7 +401,7 @@ switch($mystatus) $mycards = DB_get_hand($me); $mycards = mysort($mycards,$gametype); - if(!myisset('solo','wedding','poverty','nines') ) + if(!myisset('solo','wedding','poverty','nines','lowtrump') ) { /* output sickness of other playes, in case the already selected and are sitting in front of the current player */ echo "\n\n\n"; /* end div trick, end li trick , end ul tricks */ } /* end output pre-game trick */ @@ -919,7 +950,7 @@ switch($mystatus) $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); $userparty = DB_get_party_by_hash($userhash); - if($usersick=='poverty' && !$userparty) + if(($usersick=='poverty'|| ($RULES['lowtrump']=='poverty' && $usersick=='lowtrump')) && !$userparty) { $hash = DB_get_hash_from_gameid_and_userid($gameid,$user); $cards = DB_get_hand($hash); @@ -927,7 +958,10 @@ switch($mystatus) $nrtrump = 0; foreach($cards as $card) if($card<27) $nrtrump++; - echo "Player $name has $nrtrump trump. Do you want to take them?". + $low=''; + if($usersick=='lowtrump') + $low='low'; + echo "Player $name has $nrtrump $low trump. Do you want to take them?". "Yes
\n"; } } @@ -956,9 +990,9 @@ switch($mystatus) /* don't ask people who have poverty */ $next=1; - if($firstsick=='poverty') + if($firstsick=='poverty' || ($RULES['lowtrump']=='poverty' && $firstsick=='lowtrump')) { - if($secondsick=='poverty') + if($secondsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $secondsick=='lowtrump')) $next=3; else $next=2; @@ -1073,8 +1107,8 @@ switch($mystatus) $secondsick = (string) DB_get_sickness_by_pos_and_gameid($mypos+2,$gameid); $next=1; - if($firstsick=='poverty') - if($secondsick=='poverty') + if($firstsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $firstsick=='lowtrump')) + if($secondsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $secondsick=='lowtrump')) $next=3; else $next=2; @@ -1097,7 +1131,7 @@ switch($mystatus) echo "
Please, continue here.
\n"; } } - echo ""; + echo "\n"; break; case 'play': @@ -1116,9 +1150,11 @@ switch($mystatus) echo "

The game has been canceled because one player wasn't responding.

If this was a mistake all 4 players need to send an Email to $ADMIN_NAME at $ADMIN_EMAIL requesting that the game should be restarted.

"; break; case 'cancel-nines': - case 'cancel-timedout': echo "

The game has been canceled because one player had too many nines.

"; break; + case 'cancel-lowtrump': + echo "

The game has been canceled because one player had low trump.

"; + break; case 'cancel-trump': echo "

The game has been canceled because nobody wanted to take the trump.

"; break; @@ -1488,28 +1524,31 @@ switch($mystatus) /* same as for foxes, karlchen doesn't always make sense * check what kind of game it is and set karlchen accordingly */ - $ok = 1; /* default: karlchen should be accounted for */ - if($tricknr != 12 ) - $ok = 0; /* Karlchen works only in the last trick */ - if($ok && DB_get_gametype_by_gameid($gameid)=='solo' ) + + if($tricknr == 12 ) /* Karlchen works only in the last trick */ { - $solo = DB_get_solo_by_gameid($gameid); - if($solo == 'trumpless' || $solo == 'jack' || $solo == 'queen' ) - $ok = 0; /* no Karlchen in these solos */ - } + /* check for solo */ + $solo = 'none'; + if(DB_get_gametype_by_gameid($gameid)=='solo' ) + $solo = DB_get_solo_by_gameid($gameid); - if($ok) - foreach($play as $played) - if ( $played['card']==11 || $played['card']==12 ) - if ($played['pos'] == $winner ) - { - /* possible caught a fox, check party */ - $uid1 = DB_get_userid('gameid-position',$gameid,$winner); - $party1 = DB_get_party_by_gameid_and_userid($gameid,$uid1); + /* no Karlchen in these solos */ + if($solo != 'trumpless' && $solo != 'jack' && $solo != 'queen' ) + { + foreach($play as $played) + if ( $played['card']==11 || $played['card']==12 ) + if ($played['pos'] == $winner ) + { + /* save Karlchen */ + $uid1 = DB_get_userid('gameid-position',$gameid,$winner); + $party1 = DB_get_party_by_gameid_and_userid($gameid,$uid1); + + DB_query("INSERT INTO Score". + " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'karlchen')"); + }; + }; + }; /* end scoring Karlchen */ - DB_query("INSERT INTO Score". - " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'karlchen')"); - } /* * check for doppelopf (>40 points) ***********************************/