champions-of-luneraria/Assets/Luneraria/Tests/UI/PlayMode/S2RulesViewsTests.cs
Martin Stickelbroeck 82066d17a6 S2 Glyphe, Item-Rezepte und Ancient-Stufen (Dota 2, LoL, Legion TD 2)
Hinter MatchOptions.Extended: Glyphe als Teamwahl einer Lane (Türme 5 s
unverwundbar, sobald einer unter 50 % fällt; 4 Runden Abklingzeit nur nach
Auslösen), vier Rezepte (Bollwerk, Glutsturm, Quellherz, Splitterkrone),
Ancient-Stufen 1-3 (150 x Stufe, Reparatur 1.000, Schuss 45/75/110),
Mid-Bots jagen bei sicherer Lane die Grotte. Teampanel mit Glyphe und
Ancient, Rezepte im Shop (TEILE FEHLEN), Glyphen-Ring und Ancient-Schüsse.
Kern 566/566 (s2 35), EditMode 32/32, PlayMode 17/17, Verify 718/0,
Selbsttest 30/30, Golden 0, Fingerabdruck unverändert.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 12:54:46 +02:00

130 lines
6.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections;
using System.Linq;
using Luneraria.Core;
using Luneraria.View;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
namespace Luneraria.UI.Tests
{
/// <summary>
/// S2 in the real scene: the team actions (glyph lane, Ancient level) in the team panel, the
/// recipe in the hero window's item shop, the glyph ring on an invulnerable tower and a
/// levelled Ancient in combat. S2Bilder (explicit) captures them at 1920×1080;
/// LUNE_EVIDENCE names the folder below docs/port/screenshots (default s2/spiel).
/// </summary>
public sealed class S2RulesViewsTests
{
static void Send(HudSession s, Command command)
{
CommandResult result = s.Match.Submit(HudSession.Human, command);
Assert.IsTrue(result.Ok, command.Type + ": " + result.Message);
s.Game.RebuildPreview();
s.Sync();
}
static IEnumerator Plan(HudSession s)
{
Assert.IsTrue(s.Match.Extended, "extended match");
yield return s.Starter();
s.Leave();
Send(s, Command.HeroBuy("held_ringborke"));
Send(s, Command.ItemBuy("basaltschild"));
Send(s, Command.ItemBuy("rankenmantel"));
// Public fixture: Blau's outer mid tower is already damaged.
s.Match.BuildingHp["blau_mid_outer"] = s.Match.Map.BuildingDef("blau_mid_outer").MaxHp * 0.55;
s.Sync();
}
static GameObject Ring(string id)
{
return UnityEngine.Object.FindObjectsByType<Transform>(FindObjectsInactive.Include, FindObjectsSortMode.None)
.Where(t => t.name == "GlyphRing_" + id).Select(t => t.gameObject).FirstOrDefault();
}
[UnityTest, Timeout(600000)]
public IEnumerator S2Hud()
{
var s = new HudSession();
yield return s.Open(1920, 1080, seed: 4, startRound: 6, extraGold: 3000, extended: true);
yield return Plan(s);
Assert.IsTrue(HudSession.Visible(s.Hud.Team.CoreButton), "team actions are visible under the extended rules");
s.Click(s.Hud.Team.GlyphButtons["mid"]);
yield return HudSession.Frames(2);
s.Sync();
Assert.AreEqual("mid", s.Me.Draft.GlyphLane, "the mid button holds the glyph");
Assert.IsTrue(s.Hud.Team.GlyphButtons["mid"].On, "the button shows it");
int gold = s.Me.Draft.Gold;
s.Click(s.Hud.Team.CoreButton);
yield return HudSession.Frames(2);
s.Sync();
Assert.AreEqual(1, s.Me.Draft.CoreInvest, "the Ancient button buys a level");
Assert.AreEqual(gold - 150, s.Me.Draft.Gold, "for 150 gold");
s.Hud.OpenHero(LuneHeroDetail.TabItems);
yield return HudSession.Frames(2);
s.Sync();
Assert.IsTrue(s.Hud.HeroDetail.ItemCards.ContainsKey("bollwerk"), "recipes appear in the shop");
Assert.AreEqual(LuneItemSlot.State.Available, s.Hud.HeroDetail.ItemCards["bollwerk"].Current, "Bollwerk can be forged");
Assert.AreEqual(LuneItemSlot.State.MissingParts, s.Hud.HeroDetail.ItemCards["glutsturm"].Current, "Glutsturm lacks its parts");
s.Click(s.Hud.HeroDetail.ItemCards["bollwerk"]);
yield return HudSession.Frames(2);
s.Sync();
CollectionAssert.AreEqual(new[] { "bollwerk" }, s.Me.Draft.Hero.Items, "the shop card forges Bollwerk");
s.Hud.CloseModal();
s.Game.Key(KeyCode.Space);
yield return HudSession.Frames(2);
Assert.AreEqual("mid", s.Match.Combat.GlyphLane[0], "Blau holds the glyph on mid");
LuneUnit core = s.Match.Combat.Buildings["blau_ancient"];
Assert.AreEqual(45.0, core.Def.Damage, 1e-9, "the Ancient shoots at level 1");
LuneUnit tower = s.Match.Combat.Buildings["blau_mid_outer"];
tower.Hp = tower.MaxHp * .45;
s.Runner.Advance(.05);
yield return HudSession.Frames(3);
Assert.IsTrue(s.Match.Combat.Glyphed(tower), "the glyph fires below half health");
GameObject ring = Ring("blau_mid_outer");
Assert.IsTrue(ring != null && ring.activeSelf, "the tower shows the glyph ring");
s.Close();
}
[UnityTest, Timeout(600000), Explicit("Bildwerkzeug: nur gezielt per -testFilter")]
public IEnumerator S2Bilder()
{
string evidence = Environment.GetEnvironmentVariable("LUNE_EVIDENCE");
string folder = "docs/port/screenshots/" + (string.IsNullOrEmpty(evidence) ? "s2/spiel" : evidence) + "/";
var s = new HudSession();
yield return s.Open(1920, 1080, seed: 4, startRound: 6, extraGold: 3000, extended: true);
yield return Plan(s);
Send(s, Command.Glyph("mid"));
Send(s, Command.CoreUpgrade());
yield return new WaitForSecondsRealtime(.5f);
yield return s.Shot(folder + "01-team-aktionen.png");
s.Hover(s.Hud.Team.CoreButton);
yield return new WaitForSecondsRealtime(.3f);
yield return s.Shot(folder + "02-ancient-tooltip.png");
s.Leave();
s.Hud.OpenHero(LuneHeroDetail.TabItems);
yield return new WaitForSecondsRealtime(.6f);
s.Hover(s.Hud.HeroDetail.ItemCards["bollwerk"]);
yield return new WaitForSecondsRealtime(.3f);
yield return s.Shot(folder + "03-rezept-im-shop.png");
Send(s, Command.ItemBuy("bollwerk"));
s.Leave();
yield return new WaitForSecondsRealtime(.4f);
yield return s.Shot(folder + "04-bollwerk-geschmiedet.png");
s.Hud.CloseModal();
s.Game.Key(KeyCode.Space);
yield return HudSession.Frames(2);
LuneUnit tower = s.Match.Combat.Buildings["blau_mid_outer"];
tower.Hp = tower.MaxHp * .45;
s.Runner.Advance(.05);
yield return s.Fight(1.0);
s.Driver.Paused = true;
s.Rig.LookAt(tower.Position, 14f, true);
yield return new WaitForSecondsRealtime(.5f);
yield return s.Shot(folder + "05-glyphe-am-turm.png");
s.Close();
}
}
}