# BlackjackRules

### Overview

The **Blackjack Rules** component provides a fully configurable rule system for Blackjack tables in *uVegas*.\
It allows you to define all relevant gameplay parameters - from dealer behavior to payout structure - through a single **ScriptableObject**.\
These rule assets can be assigned to different table prefabs to create custom game variants (e.g., “Classic 21”, “Vegas Strip”, or “High Roller” tables).

***

### Key Features

* **Modular Configuration** - Each table can have its own rule asset.
* **Authentic Gameplay** - Supports traditional Blackjack conventions such as splits, double downs, insurance, and surrender.
* **Dynamic Adjustments** - Modify rules in the Inspector without changing code.
* **Payout Customization** - Configure winnings and insurance multipliers for various styles of play.

***

### Rule Parameters

#### Hand Values

| Property             | Description                                                  |
| -------------------- | ------------------------------------------------------------ |
| `blackjackTotal`     | The total card value required for a Blackjack (default: 21). |
| `blackjackCardCount` | Number of cards that define a natural Blackjack (usually 2). |
| `bustTotal`          | Maximum value before a hand busts (typically 21).            |

#### Dealer Rules

| Property           | Description                                                        |
| ------------------ | ------------------------------------------------------------------ |
| `dealerHitsSoft17` | Determines if the dealer must hit on soft 17 (true = dealer hits). |

#### Player Options

| Property                        | Description                                      |
| ------------------------------- | ------------------------------------------------ |
| `allowDoubleDown`               | Enables the option to double down.               |
| `doubleDownOnTotalsMin` / `Max` | Range of totals eligible for doubling down.      |
| `allowSplit`                    | Allows players to split identical cards.         |
| `maxSplits`                     | Maximum number of times a player can split.      |
| `allowResplitAces`              | Whether aces can be resplit after a split.       |
| `allowInsurance`                | Enables insurance bets when dealer shows an ace. |
| `allowSurrender`                | Allows players to surrender their hand early.    |

#### Win & Payout Settings

| Property                            | Description                                       |
| ----------------------------------- | ------------------------------------------------- |
| `winPayoutUnits`                    | Standard win payout ratio (e.g., 1:1).            |
| `blackjackPayoutUnits` / `BetUnits` | Defines the Blackjack win multiplier (e.g., 3:2). |
| `insurancePayoutUnits` / `BetUnits` | Defines the insurance win multiplier (e.g., 2:1). |

***

### Usage

1. Create a new **Blackjack Rules** asset via\
   **Assets → Create → uVegas → Blackjack → Rules**.
2. Adjust the parameters as needed in the Inspector.
3. Assign the rules asset to a **Blackjack Table** prefab via the *BaseTable* component.
4. At runtime, the server enforces the rules for all players at that table.

***

### Example Configuration

| Variant     | Dealer Hits Soft 17 | Allow Surrender | Blackjack Payout |
| ----------- | ------------------- | --------------- | ---------------- |
| Classic 21  | ✅                   | ❌               | 3:2              |
| Vegas Strip | ❌                   | ✅               | 3:2              |
| High Roller | ✅                   | ✅               | 6:5              |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uvegas.online/games/blackjack/components/blackjackrules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
