3D-Arena (Duell, Hub, Freiheit, Erstellung, Bestenliste), Retiarius beidhändig, Waffen je Klasse, Einführung, Willkommen, weniger Reiter, Wirtschaft ohne Taberna, Kantenglättung, Leuchten, weiche Schatten, Gamepad, Absturz-Protokoll

Stand von main 20cd8ba2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 13:24:20 +01:00
parent a08764c505
commit e29db47b20
44 changed files with 2089 additions and 991 deletions

View File

@@ -22,97 +22,8 @@ namespace GladiatorIdle
DevShot.Log(missing.Count == 0 ? "keys ok" : "keys MISSING: " + string.Join(", ", missing));
if (DevShot.FastForwardHours > 0) { Offline(DevShot.FastForwardHours); return; }
if (DevShot.DuelTest) { DuelTest(); return; }
if (Array.IndexOf(Environment.GetCommandLineArgs(), "--arenatest") >= 0) { ArenaRun(); return; }
var gs = new GameState(seed: 1);
gs.NewRun(DevShot.Name, DevShot.Class);
DevShot.Log($"playtest: class={DevShot.Class} skill={DevShot.Skill} maxHours={DevShot.Hours} runs={DevShot.Runs}");
double total = 0;
for (int run = 1; run <= DevShot.Runs; run++)
{
double t = PlayRun(gs, run);
total += t;
if (!gs.FreedomEarned) { DevShot.Log($"run {run}: NO freedom after {H(t)}"); break; }
int favor = gs.TakeFreedom();
SpendFavor(gs);
DevShot.Log($"run {run}: FREEDOM after {H(t)} wins={gs.Legends[^1].Wins} favor+{favor} " +
$"gods=[{string.Join(",", gs.GodLevels)}] total {H(total)}");
gs.NewRun(DevShot.Name, DevShot.Class);
}
}
/// Ein Leben spielen, bis zur Freiheit oder bis die Zeit um ist. Liefert die Spielzeit.
static double PlayRun(GameState gs, int run)
{
var bot = new Bot(DevShot.Skill);
double nextReport = 3600, arenaStart = 0;
int champFails = 0;
while (bot.Time < DevShot.Hours * 3600 && !gs.FreedomEarned)
{
bot.Step(gs, DT);
foreach (var e in gs.Events)
{
if (e.Type == GameEventType.FightLost && e.Key!.StartsWith("champion.")) champFails++;
else if (e.Type == GameEventType.ArenaUnlocked)
{
DevShot.Log($"run {run}: arena {(int)e.A} at {H(bot.Time)} (+{H(bot.Time - arenaStart)}, champion fails {champFails}) " +
$"duelratio={gs.DuelRatio(Enemy.Create((int)e.A - 1, 9, true)):0.00} {Snapshot(gs)}");
arenaStart = bot.Time; champFails = 0;
}
}
gs.Events.Clear();
if (bot.Time >= nextReport) { nextReport += 3600; DevShot.Log($"run {run}: {H(bot.Time)} {Snapshot(gs)}"); }
}
return bot.Time;
}
/// Spielstand für Screenshots: <paramref name="hours"/> Spielzeit mit dem Bot vorspielen.
public static void Advance(GameState gs, double hours, double skill = 0.6)
{
var bot = new Bot(skill);
while (bot.Time < hours * 3600)
{
bot.Step(gs, DT);
gs.Events.Clear();
}
}
/// Der Testspieler: Timing-Schläge mit Treffsicherheit <c>skill</c> (0 = schlägt nie, 1 = fast
/// immer perfekt), nutzt den Spezialschlag, kauft das Billigste, fordert Champions heraus
/// (nach Niederlage 90 s Pause). Trainingsplan bleibt auf dem Standard.
sealed class Bot
{
readonly double _skill;
readonly Random _rng = new(5);
double _nextBuy, _lastChampFail = -999, _aim = -1;
public double Time { get; private set; }
public Bot(double skill) => _skill = skill;
public void Step(GameState gs, double dt)
{
gs.Tick(dt);
Time += dt;
if (_skill > 0 && gs.Fight is { OpeningAge: >= 0 } f)
{
// Zeitpunkt je Lücke einmal wählen: je geschickter, desto näher am Ziel
if (_aim < 0) _aim = Balance.OPENING_TARGET + (_rng.NextDouble() * 2 - 1) * (0.03 + 0.45 * (1 - _skill));
if (f.OpeningAge >= _aim) { gs.Strike(); _aim = -1; }
}
else _aim = -1;
if (gs.CanUseSpecial && gs.Fight!.Elapsed > 2) gs.UseSpecial();
if (Time >= _nextBuy) { _nextBuy = Time + 1; ManageGear(gs); BuyCheapest(gs); }
if (gs.PendingEvent != null)
{
int n = Adventures.GetEvent(gs.PendingEvent).Choices.Length;
for (int i = 0; i < n && gs.Choose(i) == null; i++) { }
}
if (gs.ExpeditionResult != null) gs.DismissExpeditionResult();
if (gs.CanChallenge && !gs.ChampionNext && Time - _lastChampFail > 90) gs.ChallengeChampion();
foreach (var e in gs.Events)
if (e.Type == GameEventType.FightLost && e.Key!.StartsWith("champion.")) _lastChampFail = Time;
gs.Fight?.Events.Clear();
gs.LastFight?.Events.Clear();
}
ArenaRun(); // Standard: der Bot spielt bis zur Freiheit
}
/// Immer das Billigste: Ausbilder, Gebäude oder eine Schmied-Stufe für ein angelegtes Stück.
@@ -127,7 +38,7 @@ namespace GladiatorIdle
}
}
/// Gegenstände: Bestes anlegen; Attributpunkte nach dem Trainingsplan verteilen.
/// Gegenstände: Bestes anlegen; Attributpunkte wie das tägliche Training verteilen.
static void ManageGear(GameState gs)
{
gs.EquipBest();
@@ -139,8 +50,8 @@ namespace GladiatorIdle
}
while (gs.AttrPoints > 0)
{
// Wert, der im Verhältnis zum Plan am wenigsten Punkte hat
var s = Enum.GetValues<Stat>().OrderBy(x => (gs.StatBonus[(int)x] + 1.0) / Math.Max(1, gs.Plan[(int)x])).First();
// Wert, der im Verhältnis zum Training am wenigsten Punkte hat
var s = Enum.GetValues<Stat>().OrderBy(x => (gs.StatBonus[(int)x] + 1.0) / Balance.DRILL_SPLIT[(int)x]).First();
gs.SpendPoint(s);
}
}
@@ -169,7 +80,7 @@ namespace GladiatorIdle
{
var gs = new GameState(seed: 2);
gs.NewRun(DevShot.Name, DevShot.Class);
// kurz anspielen, damit Ausbilder/Taberna laufen
// kurz anspielen, damit die Ausbilder laufen
for (double t = 0; t < 600; t += DT) gs.Tick(DT);
BuyCheapest(gs);
gs.Events.Clear();
@@ -177,7 +88,7 @@ namespace GladiatorIdle
var sw = System.Diagnostics.Stopwatch.StartNew();
var r = gs.ApplyOffline(hours * 3600);
DevShot.Log($"offline {hours} h (cap {gs.OfflineCapSeconds / 3600} h): simulated {r.Seconds / 3600:0.##} h in {sw.ElapsedMilliseconds} ms, " +
$"gold+{r.Gold:0.##e0} fame+{r.Fame:0.##e0} wins {r.Wins} losses {r.Losses} levels+{r.LevelUps}");
$"gold+{r.Gold:0.##e0} fame+{r.Fame:0.##e0} levels+{r.LevelUps}");
DevShot.Log($"offline after: {Snapshot(gs)}");
}
@@ -186,7 +97,6 @@ namespace GladiatorIdle
{
var gs = new GameState(seed: 3);
gs.NewRun("Test", GladiatorClass.Thraex);
gs.ChangePlan(Stat.Showmanship, -1);
for (int i = 0; i < 3000; i++) gs.Tick(DT);
BuyCheapest(gs);
string a = Json(gs);
@@ -205,6 +115,7 @@ namespace GladiatorIdle
/// Duell-Bot: spielt Echtzeit-Duelle mit Geschick 0..1 und misst Siegquote und Dauer je Kampfkraft-Verhältnis.
static void DuelTest()
{
HeavyProbe();
// jede Fähigkeit einzeln (volle Ränge): Champion, Verhältnis 1,4, mittleres Geschick
foreach (var sk in SkillDef.All)
{
@@ -248,6 +159,35 @@ namespace GladiatorIdle
}
}
/// Schwerer Schlag (W) gegen normalen Schlag: wie oft trifft er, wie viel Schaden macht er.
static void HeavyProbe()
{
var perks = SkillPerks.From(id => id == "heavystrike" ? 1 : 0);
int hSw = 0, hHit = 0, nSw = 0, nHit = 0; double hDmg = 0, nDmg = 0;
for (int n = 0; n < 200; n++)
{
var rng = new Random(n * 31 + 7);
var d = new Duel(1000, 0.0, Special.ShieldBash, 1000, 1.0, false, false, rng, perks);
var bot = new DuelBot(0.6, rng);
var last = d.Player.State;
while (!d.Over && d.Time < 120)
{
bot.Act(d);
var p = d.Player;
if (p.HeavyCd <= 0 && p.Stamina >= Duel.HEAVY_COST && !p.Busy && Math.Abs(d.Enemy.X - p.X) < p.Reach) d.PressHeavy();
d.Step(1 / 60.0);
bool heavy = d.Player.Heavy;
if (d.Player.State == DuelState.Strike && last != DuelState.Strike) { if (heavy) hSw++; else nSw++; }
foreach (var e in d.Events)
if (e.ByPlayer && e.Type == DuelEventType.Hit)
{ if (heavy) { hHit++; hDmg += e.Amount; } else { nHit++; nDmg += e.Amount; } }
last = d.Player.State;
d.Events.Clear();
}
}
DevShot.Log($"heavy probe: heavy swings={hSw} hits={hHit} ({100.0 * hHit / Math.Max(1, hSw):0}%) dmg/hit={hDmg / Math.Max(1, hHit):0.0} normal swings={nSw} hits={nHit} ({100.0 * nHit / Math.Max(1, nSw):0}%) dmg/hit={nDmg / Math.Max(1, nHit):0.0}");
}
static string H(double s) => $"{s / 3600:0.00} h";
}
}