champions-of-luneraria/Assets/Luneraria/Tests/Core/S4NetSuite.cs
Martin Stickelbroeck 7b86973197 S4 Feinschliff: Betäubung sichtbar, Nebel im Gelände, Glyphe für Gäste
Betäubungs-Ring über dem Kopf (Gäste über Bit 18 der Rahmen-Flags),
Nebel-Gitter LuneFogOverlay mit Shader Luneraria/FogOverlay aus
LuneFog.Vision (10 Hz, weiche Kante), laufende Glyphe je Team als vier
Zusatzwerte nach den Gebäude-Lebenspunkten. Reine Darstellung.
Kern 627/627 (s4 8), EditMode 35/35, PlayMode 20/20, Verify 718/0,
Selbsttest 30/30, Golden 0, Fingerabdruck unverändert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 17:55:42 +02:00

55 lines
3.1 KiB
C#

using System.Collections.Generic;
using System.Linq;
namespace Luneraria.Core.Tests
{
/// <summary>
/// S4: what guests see of the extended rules. Over the in-process loopback a guest receives
/// the running glyph of each team (extra values after the building HP of a frame) and the
/// stun flag of every unit, and its fog sources match the host's (LuneFog.Vision).
/// </summary>
public sealed class S4NetSuite : CheckSuite
{
public override string Name { get { return "s4"; } }
protected override void RunChecks()
{
var hub = new LuneLoopback();
LuneSession host = hub.Attach(1, new LuneSession());
var options = new MatchOptions { Seed = 42, HumanSlot = 0, Extended = true,
Bunds = new List<string> { "glutpakt", "wurzelbund", "glutpakt", "wurzelbund", "glutpakt", "wurzelbund" } };
Check(host.HostNetwork(options, "Host"), "host starts");
LuneSession guest = hub.Attach(10, new LuneSession());
guest.JoinNetwork("Gast");
guest.OnClientConnected();
Check(guest.MatchState != null && guest.MatchState.Extended, "the guest's match has the extended rules");
host.PlanBotSeats();
host.Submit(Command.Buy("g01"));
host.ReadyUp();
guest.Submit(Command.Buy(guest.MatchState.BaseIds(guest.MatchState.Players[guest.LocalSlot].Bund)[0]));
guest.ReadyUp();
for (int i = 0; i < 20 && host.MatchState.Phase != Phase.Combat; i++)
host.HostTick(LuneNet.FrameInterval);
Check(host.MatchState.Phase == Phase.Combat && guest.MatchState.Phase == Phase.Combat, "both sides are in combat");
LuneCombat combat = host.MatchState.Combat;
for (int i = 0; i < 10; i++)
host.MatchState.StepCombat();
combat.GlyphLane[0] = "mid";
combat.GlyphUntil[0] = combat.Elapsed + 3.0;
LuneUnit target = combat.Units.First(u => u.IsMobile() && u.Team == 1 && u.Alive);
target.ApplyEffect("valkyrie_stun", "stun", 1.0, 2.0);
host.HostTick(LuneNet.FrameInterval);
LuneCombat mirror = guest.MatchState.Combat;
Check(mirror.GlyphLane[0] == "mid" && mirror.GlyphLane[1] == "", "the guest knows Blau's glyph on mid");
LuneUnit tower;
Check(mirror.Buildings.TryGetValue("blau_mid_outer", out tower) && mirror.Glyphed(tower), "the guest sees the mid tower glyphed");
LuneUnit copy = mirror.Units.FirstOrDefault(u => u.Id == target.Id);
Check(copy != null && copy.ShowsStun(), "the guest sees the stun");
Check(mirror.Units.Where(u => u.Id != target.Id && u.IsMobile()).All(u => !u.ShowsStun()), "nobody else looks stunned");
int team = 0;
int hostSources = LuneFog.Vision(host.MatchState, combat, team).Count;
int guestSources = LuneFog.Vision(guest.MatchState, mirror, team).Count;
Check(hostSources == guestSources && hostSources > 0, "fog sources agree on host and guest (" + hostSources + "/" + guestSources + ")");
}
}
}