From 66e7f7515536e3eabde88c8b9c8f03f68e7990b2 Mon Sep 17 00:00:00 2001 From: dingo Date: Fri, 20 Mar 2026 20:22:53 -0400 Subject: [PATCH] Tile seeding: compound tiles, void collapse, PerfectAether wildcard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Board.Create(): - Base1 pool: {Lake, Hill, Forest, Field, Aether} (no Void) - Base2 pool: Base1 pool + Void; same pct roll independently - If Base2 draws Void → both slots stay Void (no random Gateway tiles) - Random tiles are now either fully compound or fully void AffinitySystem.IsAffinityValid(): - PerfectAether tile (Aether+Aether) accepts any of the four elemental basics {Lake, Hill, Forest, Field} as valid channeling targets Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- Server/src/SOR.Game/Grid/AffinitySystem.cs | 15 +++++++++ Server/src/SOR.Game/Grid/Board.cs | 37 ++++++++++++++++++---- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/Server/src/SOR.Game/Grid/AffinitySystem.cs b/Server/src/SOR.Game/Grid/AffinitySystem.cs index 111852e..bbb1eac 100644 --- a/Server/src/SOR.Game/Grid/AffinitySystem.cs +++ b/Server/src/SOR.Game/Grid/AffinitySystem.cs @@ -19,6 +19,12 @@ public static class AffinitySystem Affinity.Lake, Affinity.Hill, Affinity.Forest, Affinity.Field, ]; + // The four elemental basics that a PerfectAether tile accepts for channeling. + private static readonly HashSet ElementalBasics = + [ + Affinity.Lake, Affinity.Hill, Affinity.Forest, Affinity.Field, + ]; + /// /// Resolve the effective affinity of a tile from its two base slots. /// Base1 = older slot, Base2 = newer slot. @@ -96,9 +102,18 @@ public static class AffinitySystem /// /// Basic affinity card: tile.Base1 or tile.Base2 must match the card's affinity. /// Non-basic affinity card: the resolved tile affinity must match exactly. + /// + /// Special rule — PerfectAether tile: accepts any of the four elemental basics + /// (Lake, Hill, Forest, Field) as valid channeling targets, acting as a wildcard + /// for all elemental affinities. /// public static bool IsAffinityValid(Tile tile, Affinity cardAffinity) { + // PerfectAether tile acts as all four elemental basics when channeling. + if (Resolve(tile.Base1, tile.Base2) == Affinity.PerfectAether + && ElementalBasics.Contains(cardAffinity)) + return true; + if (BasicAffinities.Contains(cardAffinity)) return tile.Base1 == cardAffinity || tile.Base2 == cardAffinity; diff --git a/Server/src/SOR.Game/Grid/Board.cs b/Server/src/SOR.Game/Grid/Board.cs index f550212..41c16d8 100644 --- a/Server/src/SOR.Game/Grid/Board.cs +++ b/Server/src/SOR.Game/Grid/Board.cs @@ -15,14 +15,25 @@ public sealed class Board public Dictionary Tiles { get; init; } = new(); - // Basic affinities eligible for random tile seeding (excludes Void, Aether, and tile-only compounds). - private static readonly Affinity[] _randomAffinities = - [Affinity.Lake, Affinity.Hill, Affinity.Forest, Affinity.Field]; + // Base1 pool: elemental basics + Aether (never Void — Base1 always carries a real affinity). + private static readonly Affinity[] _base1Pool = + [Affinity.Lake, Affinity.Hill, Affinity.Forest, Affinity.Field, Affinity.Aether]; + + // Base2 pool: same as Base1 plus Void. + // If Void is drawn, BOTH slots are kept as Void (prevents Gateway tiles in random seeding). + private static readonly Affinity[] _base2Pool = + [Affinity.Lake, Affinity.Hill, Affinity.Forest, Affinity.Field, Affinity.Aether, Affinity.Void]; /// /// Create a board. When is greater than 0, - /// each tile independently has that probability (0–100) of receiving a random basic - /// affinity on its Base1 slot; Base2 remains Void, yielding Gateway-type tiles. + /// each tile independently has that probability (0–100) of receiving two random affinities, + /// producing a compound tile (e.g. Ocean, Fort, PerfectAether). + /// + /// If the Base2 roll selects Void — or the second independent roll fails — both slots remain + /// Void (PureVoid tile). This means random tiles are always either fully compound or fully void; + /// no Gateway tiles are produced. + /// + /// A PerfectAether tile (Aether + Aether) counts as all four elemental basics when channeling. /// public static Board Create(int width, int height, int startingRandomTilePct = 0) { @@ -36,7 +47,21 @@ public sealed class Board var tile = new Tile { Coord = c }; if (pct > 0 && Random.Shared.Next(100) < pct) - tile.Base1 = _randomAffinities[Random.Shared.Next(_randomAffinities.Length)]; + { + var b1 = _base1Pool[Random.Shared.Next(_base1Pool.Length)]; + + // Second independent roll for Base2. + var b2 = Random.Shared.Next(100) < pct + ? _base2Pool[Random.Shared.Next(_base2Pool.Length)] + : Affinity.Void; + + // If void is selected for Base2, keep both slots void. + if (b2 != Affinity.Void) + { + tile.Base1 = b1; + tile.Base2 = b2; + } + } tiles[c.ToKey()] = tile; }