Resolve merge conflict: wire HexSideLength into main's hex algorithm
Main already had the HexLine+flood-fill implementation. Resolution keeps main's CartToHex/CubeRound local functions and zone logic, but switches the sideLength source from _pendingHexRadius to _pendingHexSideLength and adds _template.HexSideLength = L to persist the new field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -108,10 +108,10 @@ else
|
||||
<div class="form-text">Number of corners / player slots. 3 = triangle, 6 = hexagon, 10 = decagon.</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label fw-semibold">Radius (tiles)</label>
|
||||
<input type="number" class="form-control" min="2" max="15"
|
||||
@bind="_pendingHexRadius" />
|
||||
<div class="form-text">Board radius from center to corner. Diameter = 2R+1.</div>
|
||||
<label class="form-label fw-semibold">Side Length (tiles)</label>
|
||||
<input type="number" class="form-control" min="1" max="12"
|
||||
@bind="_pendingHexSideLength" />
|
||||
<div class="form-text">Number of hex tiles per polygon edge.</div>
|
||||
</div>
|
||||
<button class="btn btn-outline-secondary btn-sm w-100" @onclick="ApplyHexConfig">
|
||||
Apply
|
||||
@@ -266,9 +266,9 @@ else
|
||||
<div class="card-header d-flex justify-content-between align-items-center">
|
||||
@if (_template.GridType == "Hexagon")
|
||||
{
|
||||
int _hpoly = _template.HexPolygonSides > 0 ? _template.HexPolygonSides : _pendingHexPolySides;
|
||||
int _hradius = _template.HexSides > 1 ? _template.HexSides - 1 : _pendingHexRadius;
|
||||
<span>Canvas <span class="text-muted small">@_hpoly-gon, R=@_hradius (@(2*_hradius+1)×@(2*_hradius+1))</span></span>
|
||||
int _hpoly = _template.HexPolygonSides > 0 ? _template.HexPolygonSides : _pendingHexPolySides;
|
||||
int _hside = _template.HexSideLength > 0 ? _template.HexSideLength : _pendingHexSideLength;
|
||||
<span>Canvas <span class="text-muted small">@_hpoly-gon, L=@_hside tiles/edge</span></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -284,7 +284,7 @@ else
|
||||
const double HexR = 16.0;
|
||||
const double HexPad = 12.0;
|
||||
// hexN = radius + 1 (for HexGrid coordinate math)
|
||||
int hexN = _template.HexSides > 0 ? _template.HexSides : (_pendingHexRadius + 1);
|
||||
int hexN = _template.HexSides > 0 ? _template.HexSides : (_pendingHexSideLength * 2 + 1);
|
||||
int hexDim = 2 * hexN - 1;
|
||||
double svgW = HexR * Math.Sqrt(3) * (hexDim - 1) + 2 * HexR + 2 * HexPad;
|
||||
double svgH = HexR * 1.5 * (hexDim - 1) + 2 * HexR + 2 * HexPad;
|
||||
@@ -406,8 +406,8 @@ else
|
||||
private BoardTemplate _template = new();
|
||||
private int _pendingWidth = 8;
|
||||
private int _pendingHeight = 8;
|
||||
private int _pendingHexPolySides = 6; // polygon corner count (3–10)
|
||||
private int _pendingHexRadius = 5; // board radius in tiles (2–15)
|
||||
private int _pendingHexPolySides = 6; // polygon corner count (3–10)
|
||||
private int _pendingHexSideLength = 5; // tiles per polygon edge (1–12)
|
||||
|
||||
// Only non-default tiles stored; key = "x,y"
|
||||
private Dictionary<string, TileDefinition> _tiles = new();
|
||||
@@ -454,8 +454,8 @@ else
|
||||
_template = new BoardTemplate { CreatedAt = DateTimeOffset.UtcNow, UpdatedAt = DateTimeOffset.UtcNow };
|
||||
_pendingWidth = _template.Width;
|
||||
_pendingHeight = _template.Height;
|
||||
_pendingHexPolySides = 6;
|
||||
_pendingHexRadius = 5;
|
||||
_pendingHexPolySides = 6;
|
||||
_pendingHexSideLength = 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -469,8 +469,8 @@ else
|
||||
_template = t;
|
||||
_pendingWidth = t.Width;
|
||||
_pendingHeight = t.Height;
|
||||
_pendingHexPolySides = t.HexPolygonSides > 0 ? t.HexPolygonSides : 6;
|
||||
_pendingHexRadius = t.HexSides > 1 ? t.HexSides - 1 : 5;
|
||||
_pendingHexPolySides = t.HexPolygonSides > 0 ? t.HexPolygonSides : 6;
|
||||
_pendingHexSideLength = t.HexSideLength > 0 ? t.HexSideLength : 5;
|
||||
DeserializeTiles(t.TilesJson);
|
||||
DeserializeZones(t.StartingZonesJson);
|
||||
}
|
||||
@@ -542,17 +542,17 @@ else
|
||||
/// <summary>
|
||||
/// Generate a regular N-gon board of hex tiles for any N in [3,10].
|
||||
/// Algorithm:
|
||||
/// 1. Place N corners as a regular N-gon in Cartesian space (scaled by sideLength),
|
||||
/// 1. Place N corners as a regular N-gon in Cartesian space (scaled by HexSideLength),
|
||||
/// then convert each to the nearest hex using cube-coordinate rounding.
|
||||
/// 2. Draw each edge via cube-space lerp so the line follows the hex lattice naturally.
|
||||
/// 3. Flood-fill the interior from (0,0), using the border as walls.
|
||||
/// 4. Mark absent all in-bounds hex cells that are outside the filled region.
|
||||
/// HexSides = bounding radius + 1; HexPolygonSides = N.
|
||||
/// HexSides = bounding radius + 1; HexPolygonSides = N; HexSideLength = tiles per edge.
|
||||
/// </summary>
|
||||
private void ApplyHexConfig()
|
||||
{
|
||||
int N = Math.Clamp(_pendingHexPolySides, 3, 10);
|
||||
int sideLength = Math.Clamp(_pendingHexRadius, 2, 15);
|
||||
int N = Math.Clamp(_pendingHexPolySides, 3, 10);
|
||||
int L = Math.Clamp(_pendingHexSideLength, 1, 12);
|
||||
|
||||
// ── Helpers: cube ↔ axial, rounding, hex-line ────────────────────────────
|
||||
|
||||
@@ -607,17 +607,16 @@ else
|
||||
}
|
||||
|
||||
// ── 1. Compute N corners in axial hex coords ──────────────────────────────
|
||||
// Regular N-gon in Cartesian, radius = sideLength, top-pointing (−π/2 offset).
|
||||
// Regular N-gon in Cartesian, radius = L, top-pointing (−π/2 offset).
|
||||
var corners = new (int q, int r)[N];
|
||||
for (int k = 0; k < N; k++)
|
||||
{
|
||||
double angle = -Math.PI / 2.0 + 2.0 * Math.PI * k / N;
|
||||
corners[k] = CartToHex(sideLength * Math.Cos(angle),
|
||||
sideLength * Math.Sin(angle));
|
||||
corners[k] = CartToHex(L * Math.Cos(angle), L * Math.Sin(angle));
|
||||
}
|
||||
|
||||
// ── 2. Bounding hex radius ────────────────────────────────────────────────
|
||||
int R = sideLength;
|
||||
int R = L;
|
||||
foreach (var (q, r) in corners)
|
||||
R = Math.Max(R, Math.Max(Math.Abs(q), Math.Max(Math.Abs(r), Math.Abs(q + r))));
|
||||
R += 1;
|
||||
@@ -661,9 +660,10 @@ else
|
||||
int hexSides = R + 1;
|
||||
|
||||
_pendingHexPolySides = N;
|
||||
_pendingHexRadius = sideLength;
|
||||
_pendingHexSideLength = L;
|
||||
_template.HexSides = hexSides;
|
||||
_template.HexPolygonSides = N;
|
||||
_template.HexSideLength = L;
|
||||
_template.Width = dim;
|
||||
_template.Height = dim;
|
||||
|
||||
@@ -681,7 +681,7 @@ else
|
||||
}
|
||||
|
||||
// ── 6. Generate starting zones at the N polygon corners ──────────────────
|
||||
int half = Math.Max(1, sideLength / 4);
|
||||
int half = Math.Max(1, L / 4);
|
||||
for (int playerCount = 2; playerCount <= N; playerCount++)
|
||||
{
|
||||
var seatMap = new Dictionary<int, HashSet<string>>();
|
||||
@@ -721,9 +721,13 @@ else
|
||||
_zones.Clear();
|
||||
if (_template.GridType == "Hexagon")
|
||||
{
|
||||
_template.HexSides = _pendingHexRadius + 1;
|
||||
double circumR = _pendingHexSideLength <= 1 ? 0.0
|
||||
: (_pendingHexSideLength - 1.0) / (2.0 * Math.Sin(Math.PI / _pendingHexPolySides));
|
||||
int R = Math.Max(_pendingHexSideLength * 2, (int)Math.Ceiling(circumR) + 2);
|
||||
R = Math.Clamp(R, 2, 30);
|
||||
_template.HexSides = R + 1;
|
||||
_template.HexPolygonSides = _pendingHexPolySides;
|
||||
int dim = 2 * _pendingHexRadius + 1;
|
||||
int dim = 2 * R + 1;
|
||||
_template.Width = dim;
|
||||
_template.Height = dim;
|
||||
}
|
||||
@@ -749,24 +753,28 @@ else
|
||||
return Math.Max(Math.Abs(q), Math.Max(Math.Abs(r), Math.Abs(q + r))) <= R;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True when scaled hex-Cartesian point (cx,cy) is inside a regular N-gon with
|
||||
/// circumradius R. Uses cross-product test on each CCW edge (slightly expanded to
|
||||
/// include boundary tiles).
|
||||
/// </summary>
|
||||
private static bool NPolyInside(double cx, double cy, int N, double R)
|
||||
/// <summary>Round continuous axial (fq,fr) to the nearest integer hex cell (preserves cube constraint).</summary>
|
||||
private static (int q, int r) HexRound(double fq, double fr)
|
||||
{
|
||||
double Rexp = R * 1.02; // slight expansion to include perimeter tiles
|
||||
for (int k = 0; k < N; k++)
|
||||
double fs = -fq - fr;
|
||||
int rq = (int)Math.Round(fq), rr = (int)Math.Round(fr), rs = (int)Math.Round(fs);
|
||||
double dq = Math.Abs(rq - fq), dr = Math.Abs(rr - fr), ds = Math.Abs(rs - fs);
|
||||
if (dq > dr && dq > ds) rq = -rr - rs;
|
||||
else if (dr > ds) rr = -rq - rs;
|
||||
return (rq, rr);
|
||||
}
|
||||
|
||||
/// <summary>Yield all hex cells on the straight line from (q0,r0) to (q1,r1) via cube lerp.</summary>
|
||||
private static IEnumerable<(int q, int r)> HexLinePath(int q0, int r0, int q1, int r1)
|
||||
{
|
||||
int s0 = -q0 - r0, s1 = -q1 - r1;
|
||||
int steps = Math.Max(Math.Abs(q1 - q0), Math.Max(Math.Abs(r1 - r0), Math.Abs(s1 - s0)));
|
||||
for (int i = 0; i <= steps; i++)
|
||||
{
|
||||
double a1 = Math.PI / 2.0 + 2.0 * Math.PI * k / N;
|
||||
double a2 = Math.PI / 2.0 + 2.0 * Math.PI * (k + 1) / N;
|
||||
double v1x = Rexp * Math.Cos(a1), v1y = Rexp * Math.Sin(a1);
|
||||
double v2x = Rexp * Math.Cos(a2), v2y = Rexp * Math.Sin(a2);
|
||||
double cross = (v2x - v1x) * (cy - v1y) - (v2y - v1y) * (cx - v1x);
|
||||
if (cross < -1e-9) return false;
|
||||
double t = steps == 0 ? 0.0 : (double)i / steps;
|
||||
var pt = HexRound(q0 + (q1 - q0) * t, r0 + (r1 - r0) * t);
|
||||
yield return pt;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>Find the nearest non-absent hex tile (in offset coords) to scaled-Cartesian (vx,vy).</summary>
|
||||
|
||||
@@ -37,6 +37,8 @@ public sealed class BoardTemplate
|
||||
public int HexSides { get; set; } = 0;
|
||||
/// <summary>Number of polygon sides/corners (3–10). 6 = regular hexagon. Only meaningful when GridType = "Hexagon".</summary>
|
||||
public int HexPolygonSides { get; set; } = 6;
|
||||
/// <summary>Number of hex tiles per polygon edge. Drives the board shape. Only meaningful when GridType = "Hexagon".</summary>
|
||||
public int HexSideLength { get; set; } = 5;
|
||||
|
||||
public DateTimeOffset CreatedAt { get; set; }
|
||||
public DateTimeOffset UpdatedAt { get; set; }
|
||||
|
||||
Generated
+544
@@ -0,0 +1,544 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
||||
using SOR.Database.Contexts;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Game
|
||||
{
|
||||
[DbContext(typeof(GameDbContext))]
|
||||
[Migration("20260406000000_AddBoardTemplateHexSideLength")]
|
||||
partial class AddBoardTemplateHexSideLength
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasDefaultSchema("game")
|
||||
.HasAnnotation("ProductVersion", "8.0.0")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 63);
|
||||
|
||||
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.BoardTemplate", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("GridType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("Height")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("HexPolygonSides")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("HexSideLength")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("HexSides")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsAvailableForCustom")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsAvailableForRanked")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsEnabled")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MinPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("StartingZonesJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<string>("TilesJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("jsonb");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("Width")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IsEnabled");
|
||||
|
||||
b.ToTable("board_templates", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.CustomLobby", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AdditionalPlayersJson")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("additional_players_json");
|
||||
|
||||
b.Property<int?>("BoardHeightOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("BoardShapeOverride")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid?>("BoardTemplateIdOverride")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int?>("BoardWidthOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool?>("DiscardOnMaxHandOverride")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("DrawPerTurnOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool?>("FirstPlayerSkipsDrawOverride")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("GameMode")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("FFA")
|
||||
.HasColumnName("game_mode");
|
||||
|
||||
b.Property<Guid?>("GameSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("GuestAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid?>("GuestDeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("GuestFirstTurnPref")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("GuestReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("HandSizeCapOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("HexSidesOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid>("HostAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("HostDeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("HostFirstTurnPref")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<bool>("HostReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("MaxArchTier1Override")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MaxDeckSizeOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaxPlayers")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MinDeckSizeOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("MpBuffOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("OpeningHandSizeOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int?>("SpAccumulationPerTurnOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("SpCapOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool?>("SpHasCapOverride")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int?>("StartingRandomTilePctOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("TeamAssignmentsJson")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("TeamCount")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(1)
|
||||
.HasColumnName("team_count");
|
||||
|
||||
b.Property<int?>("TimeLimitMinutesOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("TurnLimitOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int?>("TurnTimerSecondsOverride")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("HostAccountId");
|
||||
|
||||
b.HasIndex("Status", "CreatedAt");
|
||||
|
||||
b.ToTable("custom_lobbies", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameActionLog", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("ActionType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("ActorAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("GameSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("OccurredAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("PayloadJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("payload");
|
||||
|
||||
b.Property<string>("ResultJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("result");
|
||||
|
||||
b.Property<int>("SequenceNumber")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ActorAccountId");
|
||||
|
||||
b.HasIndex("GameSessionId", "SequenceNumber")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("action_logs", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameRuleSet", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("BoardHeight")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<Guid?>("BoardTemplateId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("BoardWidth")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<bool>("DiscardOnMaxHand")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("DrawPerTurn")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("FirstPlayerSkipsDraw")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("GridType")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("HandSizeCap")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("HexSides")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("IsCustomDefault")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<bool>("IsRankedDefault")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("LoserOpReward")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaxArchTier1")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MaxDeckSize")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MinDeckSize")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("MpBuff")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<int>("OpeningHandSize")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("RankDiffOpMultiplierPct")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SpAccumulationPerTurn")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("SpCap")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<bool>("SpHasCap")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("StartingRandomTilePct")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TimeLimitMinutes")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TurnLimit")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("TurnTimerSeconds")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset>("UpdatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("WinnerOpReward")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("IsCustomDefault");
|
||||
|
||||
b.HasIndex("IsRankedDefault");
|
||||
|
||||
b.ToTable("game_rule_sets", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameSession", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("AdditionalPlayersJson")
|
||||
.HasColumnType("text")
|
||||
.HasColumnName("additional_players_json");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<DateTimeOffset?>("EndedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("GameMode")
|
||||
.IsRequired()
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("text")
|
||||
.HasDefaultValue("FFA")
|
||||
.HasColumnName("game_mode");
|
||||
|
||||
b.Property<DateTimeOffset?>("LastActionAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<int>("PlayerCount")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("integer")
|
||||
.HasDefaultValue(2)
|
||||
.HasColumnName("player_count");
|
||||
|
||||
b.Property<Guid>("PlayerOneAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("PlayerOneDeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("PlayerOneReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<Guid>("PlayerTwoAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("PlayerTwoDeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<bool>("PlayerTwoReady")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<string>("RuleSnapshotJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("rule_snapshot");
|
||||
|
||||
b.Property<DateTimeOffset?>("StartedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("StateJson")
|
||||
.HasColumnType("jsonb")
|
||||
.HasColumnName("state");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("WinCondition")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid?>("WinnerAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PlayerOneAccountId");
|
||||
|
||||
b.HasIndex("PlayerTwoAccountId");
|
||||
|
||||
b.HasIndex("Status", "CreatedAt");
|
||||
|
||||
b.ToTable("game_sessions", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.LobbyPreset", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("CreatedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<Guid>("OwnerAccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<string>("RulesJson")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("OwnerAccountId");
|
||||
|
||||
b.ToTable("lobby_presets", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.MatchmakingEntry", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("AccountId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<Guid>("DeckId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<DateTimeOffset>("JoinedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<Guid?>("MatchedGameSessionId")
|
||||
.HasColumnType("uuid");
|
||||
|
||||
b.Property<int>("RankScore")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<DateTimeOffset?>("ResolvedAt")
|
||||
.HasColumnType("timestamp with time zone");
|
||||
|
||||
b.Property<string>("Status")
|
||||
.IsRequired()
|
||||
.HasColumnType("text");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("AccountId", "Status");
|
||||
|
||||
b.HasIndex("Status", "RankScore");
|
||||
|
||||
b.ToTable("matchmaking_entries", "game");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameActionLog", b =>
|
||||
{
|
||||
b.HasOne("SOR.Database.Entities.Game.GameSession", "Session")
|
||||
.WithMany("ActionLog")
|
||||
.HasForeignKey("GameSessionId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Session");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SOR.Database.Entities.Game.GameSession", b =>
|
||||
{
|
||||
b.Navigation("ActionLog");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SOR.Database.Migrations.Game
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddBoardTemplateHexSideLength : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "HexSideLength",
|
||||
schema: "game",
|
||||
table: "board_templates",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "HexSideLength",
|
||||
schema: "game",
|
||||
table: "board_templates");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,6 +42,9 @@ namespace SOR.Database.Migrations.Game
|
||||
b.Property<int>("HexPolygonSides")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("HexSideLength")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<int>("HexSides")
|
||||
.HasColumnType("integer");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user