Files

514 lines
17 KiB
Markdown

# Gameplay Rules (Current Scope)
This file captures confirmed gameplay rules so far.
It is intentionally incomplete and will be expanded in later passes.
## 1) Match Entry and Deck Selection
1. Players create decks of cards.
2. Deck size has no minimum and no maximum.
3. Every deck must contain at least one `Tier 1` `ArchSpirit`.
4. Players can enter either:
- Ranked match
- Custom match (join or create)
5. Before match start, each player selects:
- The deck they will use
- The `Tier 1 ArchSpirit` they will start with
## 2) Match Size and Battlefield
1. Matches support `2..N` players.
2. Battlefield size scales based on player count.
3. Each player has a defined starting side.
4. Grid styles supported:
- `Square`
- `Hex`
## 3) Opening Placement
1. Each player places their selected `Tier 1 ArchSpirit` on a tile in the first row of their side.
2. On placement, the `ArchSpirit` affinity is pushed to the placement tile itself and all valid adjacent tiles:
- Square grid (non-corner): the placement tile + `3` adjacent tiles = `4` tiles total.
- Square grid (corner): the placement tile + `2` adjacent tiles = `3` tiles total.
- Hex grid (non-corner edge): the placement tile + `4` adjacent tiles = `5` tiles total.
3. Edge-side explanation:
- On a square edge, the tile behind the ArchSpirit is off the board, so only 3 adjacent tiles are valid.
- On a hex edge, two sides face off the board, leaving four valid adjacent tiles.
- Example (square, 5,0 placement): tiles `4,0`, `5,0`, `5,1`, `6,0` all receive the affinity push.
## 3.1 Opening Draw
1. At game start, each player draws `7` cards.
2. This value is the default and may be overridden by custom match settings.
## 4) Turn Order
## 4.1 Free-for-All
Turn order is randomized among all players.
## 4.2 Team Play
1. Team order alternates by team.
2. Within each team slot, player order is randomized among that team's players.
3. Example:
- Team 1 Player A
- Team 2 Player C
- Team 1 Player B
- Team 2 Player D
## 5) Turn Economy
1. Base SP gain per turn is driven by game settings:
- Ranked: static/default ranked setting
- Custom: defined by custom rules
2. Effects may modify SP gained per turn.
3. SP currently has no enforced cap.
4. SP cap should be supported by settings in the future.
5. Default per-turn card draw is `1`; may be modified by effects.
## 5.1 Resource Rules
1. `Sacrifice Tokens` are a separate resource from `SP`.
2. `Sacrifice Tokens` do not accumulate automatically per turn.
3. `Sacrifice Tokens` are obtained by other game effects/systems and spent to pay card costs.
## 6) Turn Flow (Current High-Level)
1. Active player takes actions during their turn.
2. Active player clicks "end turn" when finished; `UntilEndOfTurn` effects expire at this point.
3. Turn advances to next player in current turn order.
## 6.0 Start-of-Turn Phase
At the start of each turn, the following resolve in order:
1. MP replenishment — all friendly `ArchSpirit` and `Spirit` units restore movement points.
2. Defense restoration — all friendly `ArchSpirit` and `Spirit` units restore defense to max.
3. SP gain — the active player gains their current SP accumulation amount.
4. Start-of-turn triggered abilities resolve.
5. Card draw — the active player draws their current per-turn card count.
6. Draw-triggered abilities resolve.
7. Ruin activations — one ability activates at random for each Ruin tile occupied by a friendly unit.
## 6.1 Hand Rules
1. There is no enforced hand size limit.
## 6.2 Turn-Timing Rule (Current)
During the active player's turn, they may channel:
- `Spirit`
- `Ruins`
- `Terramorpha`
- `Repentance`
- `Instinct`
The active player may continue channeling cards while they can still pay all required costs.
Channeling cards and taking unit actions (move, attack, ability, sacrifice) may be freely interleaved with no required ordering.
Special timing exception:
- `Instinct` cards may also be played during other players' turns.
- `Instinct` cards may also be played as non-play interrupts.
## 6.2.1 Card Resolution and Interrupt Windows
1. Card resolution follows play order (first played, first resolved in sequence).
2. Between each card played and between each unit action (move, attack, ability use), there is a `10` second interrupt window.
3. During that window, opponents may interrupt by playing an `Instinct`.
4. An ability's actions resolve in full sequence without interrupt windows between individual actions — the window opens only after the entire ability has resolved.
## 6.3 Channeling Spirits
1. A player may channel Spirit cards to tiles in the active `ArchSpirit`'s channeling range.
2. Channeling range is an `ArchSpirit`-specific property with `min` and `max` values.
3. Range rules:
- `min` can never be less than `1` in normal cases.
- If channeling range is set to `0`, that `ArchSpirit` cannot channel.
4. Channeling requires:
- Paying the channel cost
- Affinity validity on the target tile
5. Affinity validation:
- If the card has a basic affinity, `Base1` or `Base2` on the target tile must match that basic affinity.
- If the card has a non-basic affinity, the target tile must match that final resolved affinity exactly.
## 6.4 Channeling Terramorpha
1. Players may channel `Terramorpha` cards by paying their cost.
2. Terramorpha pushes affinity to target tiles.
3. Terramorpha can target any tile on the battlefield.
4. Terramorpha types:
- `Mono`: pushes affinity to one target tile.
- `Di-morpha`: target one tile, then target one adjacent tile.
- `Tri-morpha`: target one tile, then target one adjacent tile, then target one adjacent tile.
## 6.5 Unit Actions Per Turn
1. A player may move their `ArchSpirit` and `Spirit` units until each unit is out of movement points.
2. `ArchSpirit` can attack once per turn, unless modified by an ability/effect.
3. `Spirit` can attack once per turn, unless modified by an ability/effect.
4. `ArchSpirit` can use one activated ability per turn, unless modified by an ability/effect.
5. `Spirit` can use one activated ability per turn, unless modified by an ability/effect.
## 6.6 Cost Types (Channeling and Activated Abilities)
Supported costs include:
- `Spirit Points`
- `Sacrifice Tokens`
- Discard card from hand (with optional restrictions such as specific card, card type, or card cost)
- Move card from top of deck to discard
- Move card from bottom of deck to discard
- Send a controlled `Spirit` from battlefield to discard
- Deal damage to own `ArchSpirit`
- Deal damage to own `Spirit`
## 6.7 ArchSpirit Tier Actions
## 6.7.1 Transition
1. `Transition` swaps the `ArchSpirit` in play with a `Tier 1 ArchSpirit` from that player's hand.
2. `Transition` can only be performed during that player's turn.
3. The outgoing `ArchSpirit` goes to discard.
4. The incoming `ArchSpirit` enters with full health and defense.
5. `Transition` uses the incoming `ArchSpirit`'s channeling cost.
6. The incoming `ArchSpirit` may move, attack, and use abilities during the turn it enters.
## 6.7.2 Ascend
1. `Ascend` upgrades the in-play `ArchSpirit` by exactly one tier (for example `Tier 1 -> Tier 2`).
2. `Ascend` can only be performed during that player's turn.
3. The target higher-tier `ArchSpirit` must be the direct predecessor/successor line of the in-play `ArchSpirit`.
4. Valid example:
- `ArchSpirit A Tier 1 -> ArchSpirit A Tier 2`
5. Invalid examples:
- `ArchSpirit A Tier 1 -> ArchSpirit B Tier 2`
- `ArchSpirit A Tier 1 -> ArchSpirit A Tier 3+`
6. `Ascend` uses the incoming (higher-tier) `ArchSpirit`'s channeling cost.
7. The higher-tier `ArchSpirit` source zone is not restricted (hand, deck, or other).
8. The incoming `ArchSpirit` may move, attack, and use abilities during the turn it enters.
## 6.8 Movement Rules (Spirit and ArchSpirit)
1. Movement is `1-to-1`: moving one tile spends one MP.
3. A tile can contain at most one `Spirit` or `ArchSpirit` at a time.
4. Movement can be obstructed by other `Spirit`/`ArchSpirit` units.
5. Each `Spirit` defines:
- Whether its own movement can be obstructed
- Whether it obstructs movement for others
6. Supported movement styles include:
- `Walk`
- `Flight`
- `Jump`
- `Teleport`
7. Movement style behavior:
- `Walk`: can be obstructed by any `Spirit` or `ArchSpirit` occupying a tile.
- `Flight`: can only be obstructed by units with `Flight`.
- `Jump`: cannot be obstructed. Has a min/max movement range. Costs `1 MP` per tile landed on (not per tile traversed in path).
- `Teleport`: cannot be obstructed. Same min/max range model as `Jump`. Costs `1 MP` per tile landed on.
8. Line-of-sight (`LOS`) requirements:
- `Walk` and `Flight` do not require LOS (path-based movement).
- `Jump` does not require LOS.
- `Teleport` requires LOS.
9. Pathing:
- Movement pathing is built through adjacent tiles.
- On `Square` grids, diagonal movement is not allowed.
- On `Hex` grids, pathing uses standard BFS over adjacent tiles with 1-to-1 tile movement cost.
## 6.9 ArchSpirit/Spirit Shared Properties
## 6.9.1 Genus
1. `Genus` is an array of type tags (examples: `Goblin`, `Undead`, `Warrior`).
2. A unit is affected by any effect that matches any of its genus tags.
## 6.9.2 Health
1. A unit with `Health <= 0` is dead.
2. Dead units go to the discard unless an ability/effect specifies otherwise.
## 6.9.3 Defense
1. Defense restores to max at the start of each turn (see §6.0).
2. Incoming damage is applied to `Defense` first.
3. Damage is applied to `Health` only after `Defense` reaches `0`.
4. Example:
- Start: `Health = 5`, `Defense = 2`
- Take `1` damage -> `Health = 5`, `Defense = 1`
- Before defense restore, take `2` damage -> `Defense` goes to `0`, remaining `1` damage applies to health -> `Health = 4`
- At next turn start, defense restores to its full value (`2` in this example)
## 6.10 Attack System (Spirit and ArchSpirit)
1. `Spirit` and `ArchSpirit` units define:
- `attackStyle`
- `minAttackRange`
- `maxAttackRange`
- `damage`
2. Units can target friendly units (`Spirit`/`ArchSpirit`) with attacks, but friendly-target attack attempts require confirmation.
3. Damage normally applies through defense first, unless an ability/effect specifies defense bypass.
4. Attack style may define whether line-of-sight (`LOS`) is required.
5. Attack definitions may be:
- Single target
- Multi-target (`N` targets)
6. Attacks may include dynamic damage modifiers that decrease or increase damage based on defined factors.
7. Attacks may be `AOE`.
8. Attack range behavior may be constrained to linear-only targeting.
9. Attack range behavior may be constrained to diagonal-only targeting.
## 6.11 Ability System
See **abilities.md** for the full ability model (types, action model, effect types, conditions, durations).
## 6.12 Mutable Properties
See **object-context.md** for the canonical mutable property inventory and **card-design.md** for card-specific state properties.
## 6.13 Card Instance Rule
Gameplay operates on card instances.
There is no permanent card loss/gain of base definitions during play.
## 6.14 Stateful Mutation Model (Object-by-Object)
All mutable changes support duration metadata so effects can expire or be undone.
Duration model (applies to all objects):
- `Instant` (one-time change, no ongoing state)
- `UntilEndOfTurn`
- `UntilStartOfOwnerTurn`
- `UntilStartOfSourceOwnerTurn`
- `ForNTurns`
- `WhileCondition`
- `PermanentInMatch`
For reversible/temporary effects, the game must retain source + modifier context so rollback can be resolved correctly when duration ends.
## 6.14.1 PlayerState (Mutable Properties)
- `SPTotal`
- `SPAccumulationAmount`
- `AccumulatesSP` (bool)
- `STTotal`
- `CardsDrawnPerTurn`
- `CanDrawCards` (bool)
- `CanAscendArchSpirit` (bool)
- `CanTransitionArchSpirit` (bool)
- `CanChannelSpirit` (bool)
- `CanSacrificeSpirit` (bool)
- `CanChannelRepentance` (bool)
- `CanChannelInstinct` (bool)
- `CanChannelRuin` (bool)
- `CanChannelTerramorphaMono` (bool)
- `CanChannelTerramorphaDi` (bool)
- `CanChannelTerramorphaTri` (bool)
## 6.14.2 TileState (Mutable Properties)
- `BaseAffinitySlot1`
- `BaseAffinitySlot2`
- `PushAffinity` (push basic affinity into Base2 with slot shift)
- `PushFinalAffinity` (set Base1/Base2 to the pair required for a target final affinity)
- Occupancy-driven behavior/effects
- Occupant-targeting behavior/effects
Current occupant classes that tile behavior can reference:
- `Spirit`
- `ArchSpirit`
- `SpiritToken` (temporary spirit/summon)
- `Ruin`
## 6.14.3 Canonical Object Property Inventory (WIP)
This section is the normalized source for object properties.
## 6.14.3.1 Player
Non-mutable:
- `Id`
- `Name`
- `SelectedDeck`
- `SelectedArchSpirit`
Mutable:
- See `PlayerState` in `6.14.1`.
## 6.14.3.2 Tile
Non-mutable:
- `Id`
- `Coords`
Mutable:
- `CanBeOccupiedBy`: `Spirit`, `ArchSpirit`, `Ruin`
- `BaseAffinitySlot1`
- `BaseAffinitySlot2`
- `PushAffinity`
- `PushFinalAffinity`
- Occupancy-based effects
- Occupant-targeting effects
## 6.14.3.3 Battlefield
Non-mutable:
- Battlefield is a collection of tiles.
Mutable:
- Derived from tile state mutations and battlefield-level effects/rules.
## 6.14.3.4 CardState
See **card-design.md** for full CardState definitions (Shared, ArchSpirit, Spirit, Repentance, Terramorpha, Ruin, Instinct).
## 6.14.3.5 Deck / Hand / Discard Mutable Operations
Deck:
- Return card from `Hand`/`Discard`/`Battlefield` to deck
- Shuffle deck
- Place card from source zone to top or bottom of deck
- Draw `X` cards
- Place `X` cards from deck into discard
Hand:
- Discard `N` cards
- Reveal cards to `N` players
- Discard random cards
- Target player selects card(s) to discard
- Put `N` cards from hand on top/bottom of deck
- Put `N` cards from hand to battlefield as Instinct
- Play `N` cards from hand for modified cost `X`
Discard:
- Return cards from discard to deck
- Return cards from discard to hand
- Return cards from discard to battlefield
## 6.14.4 Global Targeting Filters and Location Scopes
Additional target filters:
- `Owner`
- `Ally`
- `Enemy`
- `Any`
- `Random`
Location scopes:
- `Hand`
- `Deck`
- `Discard`
- `Battlefield`
## 6.14.5 Duration Rule Primitives
Supported duration timing patterns:
- `UntilEndOfTurn`
- `UntilStartOfTurn`
- Duration anchors can be scoped to specific player turns:
- Until end of `X` player's turn
- Until start of `X` player's turn
- Delayed start/end:
- Effect starts after `X` turns
- Effect ends after `X` turns
- Conditional durations:
- While condition `X` is true
- While condition `X` is false
## 6.14.6 Summon and Occupancy Limits
1. There are no summon limits.
2. If a tile is in valid range and meets summon requirements, it is a valid summon target.
3. Every tile on the battlefield can be occupied.
## 6.15 Sacrifice Action
1. Sacrifice is a free action (does not consume an attack or ability use).
2. A player may sacrifice a `Spirit` only if that `Spirit` is adjacent to the player's `ArchSpirit`.
3. The sacrificed `Spirit` goes to discard.
4. Sacrifice value is computed first:
- `SpiritSacValue = (CardSTCost * 3) + CardSPCost`
5. Sacrifice Token (`ST`) return is computed from current `ST` and `SpiritSacValue`.
6. Sacrifice return function:
```csharp
public int GetSTReturn(int CurrentST, int SpiritSacValue)
{
int STReturn = 0;
if (CurrentST == 0)
{
if (SpiritSacValue <= 15)
{
STReturn = 1;
}
if (SpiritSacValue >= 16)
{
STReturn = 2;
}
}
if (CurrentST == 1)
{
if (SpiritSacValue <= 2)
{
STReturn = 0;
}
if (SpiritSacValue >= 3 && SpiritSacValue <= 15)
{
STReturn = 1;
}
if (SpiritSacValue >= 16)
{
STReturn = 2;
}
}
if (CurrentST == 2)
{
if (SpiritSacValue <= 6)
{
STReturn = 0;
}
if (SpiritSacValue >= 7 && SpiritSacValue <= 15)
{
STReturn = 1;
}
if (SpiritSacValue >= 16)
{
STReturn = 2;
}
}
if (CurrentST == 3)
{
if (SpiritSacValue <= 9)
{
STReturn = 0;
}
if (SpiritSacValue >= 10 && SpiritSacValue <= 15)
{
STReturn = 1;
}
if (SpiritSacValue >= 16)
{
STReturn = 2;
}
}
if (CurrentST >= 4)
{
STReturn = 0;
}
return STReturn;
}
```
## 7) Win Condition (Current)
Last `ArchSpirit` standing wins.
## 8) Deferred Rules (To Be Added Next)
The following are intentionally not defined yet:
- Full timing windows and reaction timing
- Affinity push timing and replacement edge cases
- Elimination timing details for team modes
- Mulligan rules
- Status effects, death checks, and simultaneous resolution order
- Ranked ruleset constants and custom rules schema
- Full adjacent-tile targeting constraints for `Di-morpha`/`Tri-morpha`