Fix SetAffinity tile layout: Base1=Void, Base2=affinity

Setting both slots to the same basic affinity produces the wrong
resolved value (Lake+Lake→Ocean). Basic tiles are represented as
(Void, Basic) per §8, so SetAffinity now sets Base1=Void and
Base2=newAffinity. Both original slot values are still tracked
for reversal when the duration expires.

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:
dingo
2026-03-23 13:01:08 -04:00
co-authored by Claude Happy
parent a768f1b27c
commit 04dd457efa
@@ -1007,14 +1007,15 @@ public static class AbilitySystem
}
case SetAffinityEffect sa when target is Coord coord:
{
// SetAffinity on a tile writes both slots so the resolved affinity is unambiguous,
// and tracks a reversal for each slot so both are restored when the duration expires.
// SetAffinity on a tile uses the basic-tile layout: Base1=Void, Base2=affinity.
// Setting both slots to the same basic value would combine incorrectly
// (e.g. Lake+Lake → Ocean), so we follow the §8 convention instead.
var tile = ctx.State.Board?.GetTile(coord);
if (tile is null) break;
var origBase1 = tile.Base1;
var origBase2 = tile.Base2;
var newAff = ResolveAffinity(sa.Affinity, ctx);
tile.Base1 = newAff;
tile.Base1 = Affinity.Void;
tile.Base2 = newAff;
var tileRef = $"tile:{coord.X},{coord.Y}";
TrackEffect(new SetBaseAffinity1Effect { Affinity = new AffinityExpr { Fixed = origBase1 } },