X-Git-Url: https://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;ds=inline;f=web%2Fbriskin5%2FObj%2Frules_together17.phh;h=75c84c3367f585b9929f57dae3d85b0d79d30003;hb=bc153c9a2cba5babc8a1748ec85bd00ed2167328;hp=c5221ef1747b492ae6c59ba596f211f8d44cf08c;hpb=6a939415c569cb6b078b3dab42be2d35c7238d4f;p=brisk.git
diff --git a/web/briskin5/Obj/rules_together17.phh b/web/briskin5/Obj/rules_together17.phh
index c5221ef..75c84c3 100644
--- a/web/briskin5/Obj/rules_together17.phh
+++ b/web/briskin5/Obj/rules_together17.phh
@@ -25,6 +25,17 @@
require_once("briskin5.phh");
require_once("rules_base.phh");
+
+$mlang_bin5_toge17_rules =
+ array(
+ // br, hr, b, /b, win, fri
+ 'info_part' => array( 'it' => 'Ha chiamato %3$s%5$s%4$s (punti torneo %7$d), il socio era %3$s%6$s%4$s,%1$s',
+ 'en' => 'The declarer was %3$s%5$s%4$s (tournment points %7$d), the partner was %3$s%6$s%4$s,%1$s'),
+ // br, hr, b, /b, win_name
+ 'info_alon' => array( 'it' => '%3$s%5$s%4$s si è chiamato in mano (punti torneo %6$d),%1$s',
+ 'en' => '%3$s%5$s%4$s play alone against each other (tournment points %6$d),%1$s')
+ );
+
class Rules_together17 extends Rules_no_draw {
function __construct($table)
{
@@ -37,7 +48,10 @@ class Rules_together17 extends Rules_no_draw {
$card = $this->table->card;
unset($user->asta_tourn_pts);
$user->asta_tourn_pts = array(0, 0, 0, 0);
- $tourn_values = array(11, 10, 4,3,2, 1,1,1,1,1);
+ if (BIN5_CARD_HAND == 8)
+ $tourn_values = array(11, 10, 4,3,2, 1,1,1,1,1);
+ else
+ $tourn_values = array(33, 30, 12,9,6, 3,3,3,3,3);
for ($i = 0 ; $i < BIN5_PLAYERS_N * BIN5_CARD_HAND ; $i++) {
@@ -49,11 +63,8 @@ class Rules_together17 extends Rules_no_draw {
function tourn_points_max($user)
{
-
$mx = 0;
for ($i = 0 ; $i < 4 ; $i++) {
- error_log("tourn_pts_max ");
- error_log(print_r($user->asta_tourn_pts, TRUE));
if ($user->asta_tourn_pts[$i] > $mx) {
$mx = $user->asta_tourn_pts[$i];
}
@@ -62,6 +73,37 @@ class Rules_together17 extends Rules_no_draw {
return $mx;
}
+ function min_tourn_points($a_pnt)
+ {
+ if ($a_pnt < 62)
+ $min_pts = 0;
+ else if ($a_pnt < 71)
+ $min_pts = 13;
+ else if ($a_pnt < 80)
+ $min_pts = 19;
+ else if ($a_pnt < 90)
+ $min_pts = 23;
+ else if ($a_pnt < 100)
+ $min_pts = 25;
+ else
+ $min_pts = 28;
+
+ return $min_pts;
+ }
+
+ function check_tourn_points($hand_pts, $a_pnt, $a_seed, &$ret_s) {
+ $min_pts = $this->min_tourn_points($a_pnt);
+
+ if ($hand_pts < $min_pts) {
+ // FIXME_LANG
+ $seeds = array('coppe', 'ori', 'spade', 'bastoni');
+ $ret_s = sprintf("Hai chiamato un due di %s a %d ma in mano per quel seme hai %d punti-torneo, non puoi.",
+ $seeds[$a_seed], $a_pnt, $hand_pts);
+ return FALSE;
+ }
+ return TRUE;
+ }
+
function rules_asta(&$bri, $curtime, $action, $user, &$ret_s, $a_card, $a_pnt) {
/*
Per le chiamate da 62 a 70 bisognerà avere 13 punti ( esempi.: asso e fante oppure tre
@@ -85,6 +127,12 @@ oppure asso, tre, cavallo, 7, 6, 5 e 4 ).
$user->asta_card = -1;
$this->table->asta_pla_n--;
+ if ($this->table->asta_card == -1 && $this->table->asta_pla_n == 1) {
+ // all abandon auction except one => move next bid to two and 71 points
+ $this->table->asta_card = 9;
+ $this->table->asta_pnt = 70;
+ }
+
return TRUE;
}
else if ($a_card <= 9) {
@@ -92,21 +140,12 @@ oppure asso, tre, cavallo, 7, 6, 5 e 4 ).
do {
if ($a_card >= 0 && $a_card < 9 && $a_card > $this->table->asta_card) {
- return TRUE;
+ ;
}
else if ($a_card == 9 &&
$a_pnt > ($this->table->asta_pnt >= 61 ? $this->table->asta_pnt : 60)
&& $a_pnt <= 120) {
- if ($a_pnt < 71)
- $min_pts = 13;
- else if ($a_pnt < 80)
- $min_pts = 19;
- else if ($a_pnt < 90)
- $min_pts = 23;
- else if ($a_pnt < 100)
- $min_pts = 25;
- else
- $min_pts = 28;
+ $min_pts = $this->min_tourn_points($a_pnt);
$max_hand_pts = $this->tourn_points_max($user);
if ($max_hand_pts < $min_pts) {
@@ -134,6 +173,142 @@ oppure asso, tre, cavallo, 7, 6, 5 e 4 ).
return FALSE;
}
+ function rules_nextauct(&$bri, $curtime, $action, $user, $maxcard)
+ {
+ if (($this->table->asta_pla_n > ($maxcard > -1 ? 1 : 0)) &&
+ !($this->table->asta_card == 9 && $this->table->asta_pnt == 120)) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+
+ }
+
+ function rules_checkchoose(&$bri, $curtime, $action, $user, &$ret_s, $a_brisco)
+ {
+ if (! parent::rules_checkchoose($bri, $curtime, $action, $user, $ret_s, $a_brisco)) {
+ return FALSE;
+ }
+
+ if ($this->table->asta_card == 9) {
+ $bri_seed = (int)($a_brisco / 10);
+ return $this->check_tourn_points($user->asta_tourn_pts[$bri_seed],
+ $this->table->asta_pnt, $bri_seed, $ret_s);
+ }
+
+ return TRUE;
+ }
+
+
+ static function game_description($act, $form, $old_mult, $win = -1, $win_name = "?1?", $fri = -1, $fri_name = "?2?",
+ $old_pnt = -1, $old_asta_pnt = -1, $old_tourn_pts = -1)
+ {
+ GLOBAL $G_lang, $mlang_bin5_rules, $mlang_bin5_toge17_rules;
+
+ if ($form == 'html') {
+ $tg_br = "
";
+ $tg_hr = "