Tile seeding: compound tiles, void collapse, PerfectAether wildcard
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 <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -19,6 +19,12 @@ public static class AffinitySystem
|
|||||||
Affinity.Lake, Affinity.Hill, Affinity.Forest, Affinity.Field,
|
Affinity.Lake, Affinity.Hill, Affinity.Forest, Affinity.Field,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// The four elemental basics that a PerfectAether tile accepts for channeling.
|
||||||
|
private static readonly HashSet<Affinity> ElementalBasics =
|
||||||
|
[
|
||||||
|
Affinity.Lake, Affinity.Hill, Affinity.Forest, Affinity.Field,
|
||||||
|
];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resolve the effective affinity of a tile from its two base slots.
|
/// Resolve the effective affinity of a tile from its two base slots.
|
||||||
/// Base1 = older slot, Base2 = newer slot.
|
/// 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.
|
/// 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.
|
/// 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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool IsAffinityValid(Tile tile, Affinity cardAffinity)
|
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))
|
if (BasicAffinities.Contains(cardAffinity))
|
||||||
return tile.Base1 == cardAffinity || tile.Base2 == cardAffinity;
|
return tile.Base1 == cardAffinity || tile.Base2 == cardAffinity;
|
||||||
|
|
||||||
|
|||||||
@@ -15,14 +15,25 @@ public sealed class Board
|
|||||||
|
|
||||||
public Dictionary<string, Tile> Tiles { get; init; } = new();
|
public Dictionary<string, Tile> Tiles { get; init; } = new();
|
||||||
|
|
||||||
// Basic affinities eligible for random tile seeding (excludes Void, Aether, and tile-only compounds).
|
// Base1 pool: elemental basics + Aether (never Void — Base1 always carries a real affinity).
|
||||||
private static readonly Affinity[] _randomAffinities =
|
private static readonly Affinity[] _base1Pool =
|
||||||
[Affinity.Lake, Affinity.Hill, Affinity.Forest, Affinity.Field];
|
[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];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a board. When <paramref name="startingRandomTilePct"/> is greater than 0,
|
/// Create a board. When <paramref name="startingRandomTilePct"/> is greater than 0,
|
||||||
/// each tile independently has that probability (0–100) of receiving a random basic
|
/// each tile independently has that probability (0–100) of receiving two random affinities,
|
||||||
/// affinity on its Base1 slot; Base2 remains Void, yielding Gateway-type tiles.
|
/// 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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Board Create(int width, int height, int startingRandomTilePct = 0)
|
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 };
|
var tile = new Tile { Coord = c };
|
||||||
|
|
||||||
if (pct > 0 && Random.Shared.Next(100) < pct)
|
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;
|
tiles[c.ToKey()] = tile;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user