From e03584c986979bad9c4d469abe3e60c37911e002 Mon Sep 17 00:00:00 2001 From: "Matteo Nastasi (mop)" Date: Mon, 13 Mar 2017 08:25:06 +0100 Subject: [PATCH] finalize 'two at 71 when first 4 pass' rule for together17 rules --- web/briskin5/Obj/rules.phh | 1 + web/briskin5/Obj/rules_together17.phh | 26 ++++++++++++++++++++++++-- web/briskin5/index_wr.php | 8 ++++++-- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/web/briskin5/Obj/rules.phh b/web/briskin5/Obj/rules.phh index 9618bf7..f0d5ef7 100644 --- a/web/briskin5/Obj/rules.phh +++ b/web/briskin5/Obj/rules.phh @@ -24,6 +24,7 @@ define('BIN5_TOURNAMENT_OLDRULES', 1); define('BIN5_TOURNAMENT_NO_DRAW', 2); +define('BIN5_TOURNAMENT_TOGETHER17', 4); define('BIN5_RULES_OLDSCHEMA', -1); define('BIN5_RULES_FINISH', 0); diff --git a/web/briskin5/Obj/rules_together17.phh b/web/briskin5/Obj/rules_together17.phh index 3613398..c57c03e 100644 --- a/web/briskin5/Obj/rules_together17.phh +++ b/web/briskin5/Obj/rules_together17.phh @@ -37,7 +37,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++) { @@ -84,6 +87,13 @@ 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) { + error_log('table_asta_card: ' . $this->table->asta_card); + // 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) { @@ -91,7 +101,7 @@ 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) @@ -133,6 +143,18 @@ 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; + } + + } + } // class Rules_no_draw ?> \ No newline at end of file diff --git a/web/briskin5/index_wr.php b/web/briskin5/index_wr.php index 8a5cd79..9c57361 100644 --- a/web/briskin5/index_wr.php +++ b/web/briskin5/index_wr.php @@ -229,7 +229,7 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) * asta_pla_n > 0 if someone NOT bet) * THEN advance auction */ - if ($table->rules->engine(&$bin5, $curtime, BIN5_RULES_NEXTAUCT, $maxcard)) { + if ($table->rules->engine(&$bin5, $curtime, BIN5_RULES_NEXTAUCT, $user, $maxcard)) { /* search the next player in auction and put it in gstart field */ for ($i = 1 ; $i < BIN5_PLAYERS_N ; $i++) { $index_next = ($table->gstart + $i) % BIN5_PLAYERS_N; @@ -331,7 +331,11 @@ function bin5_index_wr_main(&$bin5, $remote_addr_full, $get, $post, $cookie) if ($a_brisco >= 0 && $a_brisco < (BIN5_CARD_HAND * BIN5_PLAYERS_N)) { $table->briscola = $a_brisco; - $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); + $table->tourn_pts = 0; $seed = $a_brisco - ($a_brisco % 10); for ($i = $seed ; $i < ($seed + min(10, BIN5_CARD_HAND * BIN5_PLAYERS_N)) ; $i++) { -- 2.17.1