Skip to content

Commit

Permalink
Revert "Make honba customisable in event settings"
Browse files Browse the repository at this point in the history
This reverts commit 44fb9a9.
  • Loading branch information
Jesterboxboy committed Jan 16, 2025
1 parent 44fb9a9 commit b810064
Show file tree
Hide file tree
Showing 19 changed files with 13 additions and 129 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
.phpunit.result.cache
php-errors.log
tmp/*.log
package-lock.json

.env.e2e

Expand Down
27 changes: 0 additions & 27 deletions Common/generated/Common/RulesetConfig.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified Common/generated/GPBMetadata/Proto/Atoms.php
Binary file not shown.
1 change: 0 additions & 1 deletion Common/proto/atoms.proto
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,6 @@ message RulesetConfig {
bool with_yakitori = 36;
int32 yakitori_penalty = 37;
bool chombo_ends_game = 38;
int32 honba_value = 39;
}

// Generics
Expand Down
2 changes: 0 additions & 2 deletions Common/rulesets/ema.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Common;

require_once __DIR__ . '/../YakuMap.php';
Expand All @@ -35,7 +34,6 @@
->setEqualizeUma(true)
->setWithWinningDealerHonbaSkipped(false)
->setOka(0)
->setHonbaValue(300)
->setReplacementPlayerFixedPoints(-15000)
->setReplacementPlayerOverrideUma(-15000)
->setAllowedYaku(YakuMap::listExcept([
Expand Down
2 changes: 0 additions & 2 deletions Common/rulesets/jpmlA.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Common;

require_once __DIR__ . '/../YakuMap.php';
Expand Down Expand Up @@ -50,7 +49,6 @@
->setEqualizeUma(true)
->setWithWinningDealerHonbaSkipped(false)
->setOka(0)
->setHonbaValue(300)
->setReplacementPlayerFixedPoints(-15000)
->setReplacementPlayerOverrideUma(-15000)
->setAllowedYaku(YakuMap::listExcept([
Expand Down
2 changes: 0 additions & 2 deletions Common/rulesets/rrc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Common;

require_once __DIR__ . '/../YakuMap.php';
Expand All @@ -35,7 +34,6 @@
->setEqualizeUma(true)
->setWithWinningDealerHonbaSkipped(false)
->setOka(0)
->setHonbaValue(300)
->setReplacementPlayerFixedPoints(-15000)
->setReplacementPlayerOverrideUma(-15000)
->setAllowedYaku(YakuMap::listExcept([
Expand Down
2 changes: 0 additions & 2 deletions Common/rulesets/tenhounet.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Common;

require_once __DIR__ . '/../YakuMap.php';
Expand All @@ -35,7 +34,6 @@
->setEqualizeUma(false)
->setWithWinningDealerHonbaSkipped(false)
->setOka(20000)
->setHonbaValue(300)
->setReplacementPlayerFixedPoints(-15000)
->setReplacementPlayerOverrideUma(-15000)
->setAllowedYaku(YakuMap::listExcept([
Expand Down
2 changes: 0 additions & 2 deletions Common/rulesets/wrc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Common;

require_once __DIR__ . '/../YakuMap.php';
Expand All @@ -35,7 +34,6 @@
->setEqualizeUma(true)
->setWithWinningDealerHonbaSkipped(false)
->setOka(0)
->setHonbaValue(300)
->setReplacementPlayerFixedPoints(-15000)
->setReplacementPlayerOverrideUma(-15000)
->setAllowedYaku(YakuMap::listExcept([
Expand Down
17 changes: 0 additions & 17 deletions Forseti/app/clients/proto/atoms.pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,6 @@ export interface RulesetConfig {
withYakitori: boolean;
yakitoriPenalty: number;
chomboEndsGame: boolean;
honbaValue: number;
}

export interface GenericSuccessResponse {
Expand Down Expand Up @@ -7732,7 +7731,6 @@ export const RulesetConfig = {
withYakitori: false,
yakitoriPenalty: 0,
chomboEndsGame: false,
honbaValue: 0,
...msg,
};
},
Expand Down Expand Up @@ -7858,9 +7856,6 @@ export const RulesetConfig = {
if (msg.chomboEndsGame) {
writer.writeBool(38, msg.chomboEndsGame);
}
if (msg.honbaValue) {
writer.writeInt32(39, msg.honbaValue);
}
return writer;
},

Expand Down Expand Up @@ -8034,10 +8029,6 @@ export const RulesetConfig = {
msg.chomboEndsGame = reader.readBool();
break;
}
case 39: {
msg.honbaValue = reader.readInt32();
break;
}
default: {
reader.skipField();
break;
Expand Down Expand Up @@ -14428,7 +14419,6 @@ export const RulesetConfigJSON = {
withYakitori: false,
yakitoriPenalty: 0,
chomboEndsGame: false,
honbaValue: 0,
...msg,
};
},
Expand Down Expand Up @@ -14560,9 +14550,6 @@ export const RulesetConfigJSON = {
if (msg.chomboEndsGame) {
json["chomboEndsGame"] = msg.chomboEndsGame;
}
if (msg.honbaValue) {
json["honbaValue"] = msg.honbaValue;
}
return json;
},

Expand Down Expand Up @@ -14744,10 +14731,6 @@ export const RulesetConfigJSON = {
if (_chomboEndsGame_) {
msg.chomboEndsGame = _chomboEndsGame_;
}
const _honbaValue_ = json["honbaValue"] ?? json["honba_value"];
if (_honbaValue_) {
msg.honbaValue = protoscript.parseNumber(_honbaValue_);
}
return msg;
},
};
Expand Down
8 changes: 0 additions & 8 deletions Forseti/app/pages/OwnedEventsEdit/RulesetSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,6 @@ export const RulesetSettings: React.FC<RulesetSettingsProps> = ({ form, i18n })
min={0}
{...form.getInputProps('ruleset.oka')}
/>
<NumberInput
icon={<IconCash size='1rem' />}
label={i18n._t('Honba Value')}
description={i18n._t('Value of one honba stick')}
defaultValue={300}
min={0}
{...form.getInputProps('ruleset.honbaValue')}
/>
<UmaSelect form={form} i18n={i18n} />
<Checkbox
label={i18n._t('Equalize uma')}
Expand Down
1 change: 0 additions & 1 deletion Forseti/app/pages/OwnedEventsEdit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export const OwnedEventsEdit: React.FC<{ params: { id?: string } }> = ({ params:
endingPolicy: EndingPolicy.ENDING_POLICY_EP_UNSPECIFIED,
startRating: 0,
startPoints: 30000,
honbaValue: 300,
replacementPlayerFixedPoints: -15000, // tourn
withYakitori: false,
yakitoriPenalty: 0,
Expand Down
29 changes: 13 additions & 16 deletions Mimir/src/helpers/PointsCalc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Mimir;

class PointsCalc
Expand Down Expand Up @@ -77,7 +76,6 @@ public static function ron(
int $totalRiichiInRound = 0,
): array {
self::resetPaymentsInfo();
$honbaValue = $rules->rules()->getHonbaValue();
$pointsDiff = self::_calcPoints($rules, $han, $fu, false, $isDealer);

if (empty($winnerId) || empty($loserId)) {
Expand Down Expand Up @@ -132,14 +130,14 @@ public static function ron(
if ($rules->rules()->getDoubleronHonbaAtamahane() && $closestWinner) {
// on tenhou we had to give all honba sticks to closest winner only
if ($winnerId == $closestWinner) {
$currentScores[$winnerId] += $honbaValue * $honba;
$currentScores[$loserId] -= $honbaValue * $honba;
self::$_lastPaymentsInfo['honba'][$winnerId . '<-' . $loserId] = $honbaValue * $honba;
$currentScores[$winnerId] += 300 * $honba;
$currentScores[$loserId] -= 300 * $honba;
self::$_lastPaymentsInfo['honba'][$winnerId . '<-' . $loserId] = 300 * $honba;
}
} else {
$currentScores[$winnerId] += $honbaValue * $honba;
$currentScores[$loserId] -= $honbaValue * $honba;
self::$_lastPaymentsInfo['honba'][$winnerId . '<-' . $loserId] = $honbaValue * $honba;
$currentScores[$winnerId] += 300 * $honba;
$currentScores[$loserId] -= 300 * $honba;
self::$_lastPaymentsInfo['honba'][$winnerId . '<-' . $loserId] = 300 * $honba;
}

return $currentScores;
Expand Down Expand Up @@ -173,7 +171,6 @@ public static function tsumo(
?int $paoPlayerId
) {
self::resetPaymentsInfo();
$honbaValue = $rules->rules()->getHonbaValue();

if (empty($winnerId)) {
throw new InvalidParametersException('Tsumo must have winner');
Expand Down Expand Up @@ -204,7 +201,7 @@ public static function tsumo(
continue;
}
$currentScores[$playerId] += $pointsDiff['dealer'] ?? 0;
self::$_lastPaymentsInfo['direct'][$winnerId . '<-' . $playerId] = - ($pointsDiff['dealer'] ?? 0);
self::$_lastPaymentsInfo['direct'][$winnerId . '<-' . $playerId] = -($pointsDiff['dealer'] ?? 0);
}
} else {
foreach ($currentScores as $playerId => $value) {
Expand All @@ -213,10 +210,10 @@ public static function tsumo(
}
if ($playerId == $currentDealer) {
$currentScores[$playerId] += $pointsDiff['dealer'] ?? 0;
self::$_lastPaymentsInfo['direct'][$winnerId . '<-' . $playerId] = - ($pointsDiff['dealer'] ?? 0);
self::$_lastPaymentsInfo['direct'][$winnerId . '<-' . $playerId] = -($pointsDiff['dealer'] ?? 0);
} else {
$currentScores[$playerId] += $pointsDiff['player'] ?? 0;
self::$_lastPaymentsInfo['direct'][$winnerId . '<-' . $playerId] = - ($pointsDiff['player'] ?? 0);
self::$_lastPaymentsInfo['direct'][$winnerId . '<-' . $playerId] = -($pointsDiff['player'] ?? 0);
}
}
}
Expand All @@ -233,14 +230,14 @@ public static function tsumo(
$currentScores[$winnerId] += 1000 * count($riichiIds);
$currentScores[$winnerId] += 1000 * $riichiBetsCount;
self::$_lastPaymentsInfo['riichi'][$winnerId . '<-'] = 1000 * $riichiBetsCount;
$currentScores[$winnerId] += $honbaValue * $honba;
$currentScores[$winnerId] += 300 * $honba;

foreach ($currentScores as $playerId => $value) {
if ($playerId == $winnerId) {
continue;
}
$currentScores[$playerId] -= ($honbaValue / 3) * $honba;
self::$_lastPaymentsInfo['honba'][$winnerId . '<-' . $playerId] = ($honbaValue / 3) * $honba;
$currentScores[$playerId] -= 100 * $honba;
self::$_lastPaymentsInfo['honba'][$winnerId . '<-' . $playerId] = 100 * $honba;
}

return $currentScores;
Expand Down Expand Up @@ -525,7 +522,7 @@ public static function assignRiichiBets(array $rounds, int $loserId, int $riichi
$winners[$round->getWinnerId()] = [];
foreach ($bets as $k => $player) {
if (isset($winners[$player])) {
$winners[$player][] = $round->getWinnerId(); // winner always gets back his bet
$winners[$player] []= $round->getWinnerId(); // winner always gets back his bet
unset($bets[$k]);
}
}
Expand Down
2 changes: 0 additions & 2 deletions Mimir/tests/models/MajsoulOnlineSessionModelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace models;

use Common\PlatformType;
Expand Down Expand Up @@ -292,7 +291,6 @@ public function testAllTempaiBug()

$this->_event->getRulesetConfig()->rules()->setStartPoints(30000);
$this->_event->getRulesetConfig()->rules()->setOka(0);
$this->_event->getRulesetConfig()->rules()->setHonbaValue(300);
$this->_event->getRulesetConfig()->rules()->getUma()->setPlace1(30000);
$this->_event->getRulesetConfig()->rules()->getUma()->setPlace2(10000);
$this->_event->getRulesetConfig()->rules()->getUma()->setPlace3(-10000);
Expand Down
2 changes: 0 additions & 2 deletions Mimir/tests/models/OnlineSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Mimir;

use Common\PlatformType;
Expand Down Expand Up @@ -216,7 +215,6 @@ public function testAddOnlineGameWithChips()
$ruleset = \Common\Ruleset::instance('tenhounet');
$ruleset->rules()
->setOka(0)
->setHonbaValue(300)
->setStartRating(0)
->setStartPoints(30000)
->setUma((new Uma())
Expand Down
2 changes: 0 additions & 2 deletions Mimir/tests/primitives/SessionResultsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

namespace Mimir;

use Common\EndingPolicy;
Expand Down Expand Up @@ -77,7 +76,6 @@ protected function setUp(): void
->setPlace3(-5000)
->setPlace4(-15000))
->setOka(0)
->setHonbaValue(300)
->setChomboAmount(20000)
->setEqualizeUma(false)
->setReplacementPlayerOverrideUma(0)
Expand Down
Loading

0 comments on commit b810064

Please sign in to comment.