Skip to content

Commit cdf1cbd

Browse files
committed
Add suit-following variant for bomb policy
Expand BombPolicy from a simple on/off toggle to three options: - NoBombs: bombs disabled (default) - AllowBombs: bombs can be played regardless of suit - AllowBombsSuitFollowing: bombs must follow suit (same suit as led, trump bombs always allowed, off-suit only when void in led suit) This gives players the choice between house rules (any suit) and standard Chinese rules (must follow suit) for bomb plays. https://claude.ai/code/session_01E543mMXuFZfstF526sWFy1
1 parent 20cb13b commit cdf1cbd

File tree

5 files changed

+343
-11
lines changed

5 files changed

+343
-11
lines changed

core/src/message.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ impl MessageVariant {
390390
format!("{} required tractors to be at least {} cards wide by {} tuples long", n?, tractor_requirements.min_count, tractor_requirements.min_length),
391391
GameVisibilitySet { visibility: GameVisibility::Public} => format!("{} listed the game publicly", n?),
392392
GameVisibilitySet { visibility: GameVisibility::Unlisted} => format!("{} unlisted the game", n?),
393-
BombPolicySet { bomb_policy: BombPolicy::AllowBombs } => format!("{} enabled bomb cards", n?),
393+
BombPolicySet { bomb_policy: BombPolicy::AllowBombs } => format!("{} enabled bomb cards (any suit)", n?),
394+
BombPolicySet { bomb_policy: BombPolicy::AllowBombsSuitFollowing } => format!("{} enabled bomb cards (must follow suit)", n?),
394395
BombPolicySet { bomb_policy: BombPolicy::NoBombs } => format!("{} disabled bomb cards", n?),
395396
})
396397
}

frontend/src/Initialize.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,12 @@ const UncommonSettings = (props: IUncommonSettings): JSX.Element => {
587587
onChange={props.setBombPolicy}
588588
>
589589
<option value="NoBombs">Disabled</option>
590-
<option value="AllowBombs">Enabled</option>
590+
<option value="AllowBombs">
591+
Enabled (any suit, no suit-following required)
592+
</option>
593+
<option value="AllowBombsSuitFollowing">
594+
Enabled (must follow suit)
595+
</option>
591596
</select>
592597
</label>
593598
</div>

frontend/src/gen-types.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* eslint-disable */
1+
22
/**
33
* This file was automatically generated by json-schema-to-typescript.
44
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
@@ -217,7 +217,7 @@ export type KittyTheftPolicy = "AllowKittyTheft" | "NoKittyTheft";
217217
export type GameShadowingPolicy = "AllowMultipleSessions" | "SingleSessionOnly";
218218
export type GameStartPolicy = "AllowAnyPlayer" | "AllowLandlordOnly";
219219
export type BackToTwoSetting = "Disabled" | "SingleJack";
220-
export type BombPolicy = "NoBombs" | "AllowBombs";
220+
export type BombPolicy = "NoBombs" | "AllowBombs" | "AllowBombsSuitFollowing";
221221
export type GameVisibility = "Public" | "Unlisted";
222222
export type Card = string;
223223
export type TrickUnit =

frontend/src/gen-types.schema.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,22 @@
719719
"enum": ["AllowBidTakeback", "NoBidTakeback"]
720720
},
721721
"BombPolicy": {
722-
"type": "string",
723-
"enum": ["NoBombs", "AllowBombs"]
722+
"oneOf": [
723+
{
724+
"type": "string",
725+
"enum": ["NoBombs"]
726+
},
727+
{
728+
"description": "Bombs allowed; a bomb can be played regardless of suit when following.",
729+
"type": "string",
730+
"enum": ["AllowBombs"]
731+
},
732+
{
733+
"description": "Bombs allowed, but standard suit-following rules apply: a bomb must be in the led suit, or a trump bomb if the player is void in the led suit.",
734+
"type": "string",
735+
"enum": ["AllowBombsSuitFollowing"]
736+
}
737+
]
724738
},
725739
"BonusLevelPolicy": {
726740
"type": "string",

0 commit comments

Comments
 (0)