Freiheit, Ehrenhalle, Götter, Champion-Auftritte; Waffen weichen dem Körper aus

Stand von main 0abffe17.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-08 13:29:26 +01:00
parent a7134b2753
commit bdcf9a4a2c
383 changed files with 554 additions and 8 deletions

View File

@@ -28,6 +28,11 @@ namespace GladiatorIdle
HubScene? _hub;
DuelScene? _scene;
ModelTestScene? _model; // --model3d: 3D-Test
FreedomScene? _freedom; // Freiheit: Clip, Bilanz, Götter
bool _nextLife; // nächste Erstellung behält das Profil (Legenden, Götter)
Legend? _legend; // laufendes Duell gegen eine Legende
static readonly bool DevFreedomRun = Array.IndexOf(Environment.GetCommandLineArgs(), "--freedom") >= 0;
static readonly bool DevChampionRun = Array.IndexOf(Environment.GetCommandLineArgs(), "--champion") >= 0;
static readonly bool Model3DTest = Array.IndexOf(Environment.GetCommandLineArgs(), "--model3d") >= 0;
SettingsOverlay _settings = null!;
bool _paused;
@@ -121,7 +126,7 @@ namespace GladiatorIdle
void ToMenu()
{
_hub = null; _scene = null; _creator = null; _intro = null; _paused = false;
_hub = null; _scene = null; _creator = null; _intro = null; _freedom = null; _paused = false; _nextLife = false;
_menu = new MenuScene(_game != null, _game?.Freedoms ?? 0);
}
@@ -134,9 +139,17 @@ namespace GladiatorIdle
/// Erstellung fertig: neues Leben mit dem eigenen Gladiator, dann in die Arena.
void StartGame(CreatorScene c)
{
int freedoms = _game?.Freedoms ?? 0;
_game = new GameState(seed: DevShot.Active ? 7 : Environment.TickCount);
_game.Create(c.Name.Trim(), c.Class, c.Look, c.Bonus, c.StartSkill);
if (_nextLife && _game != null)
{
// nach der Freiheit: neues Leben im selben Profil (Legenden, Götter, Freiheiten bleiben)
_nextLife = false;
_game.Create(c.Name.Trim(), c.Class, c.Look, c.Bonus, c.StartSkill);
}
else
{
_game = new GameState(seed: DevShot.Active ? 7 : Environment.TickCount);
_game.Create(c.Name.Trim(), c.Class, c.Look, c.Bonus, c.StartSkill);
}
// --sim H: weiter vorn einsteigen (Testläufe, Ausprobieren späterer Arenen)
if (Array.IndexOf(Environment.GetCommandLineArgs(), "--sim") >= 0) Playtest.Advance(_game, DevShot.SimHours);
_game.ManualFights = true;
@@ -147,6 +160,30 @@ namespace GladiatorIdle
DevShot.Log($"timing: hub created in {sw.ElapsedMilliseconds} ms");
}
/// Letzter Champion besiegt: Freiheit annehmen (Legende, Gunst), dann der Freiheits-Bildschirm.
void StartFreedom()
{
int favor = _game!.TakeFreedom();
if (favor <= 0 && _game.Legends.Count == 0) return;
_game.Save();
_hub = null; _scene = null; _paused = false;
_freedom = new FreedomScene(_game, _game.Legends[^1], favor);
_devTime = 0;
}
/// Duell gegen eine Legende aus der Ehrenhalle.
void StartLegendDuel(Legend l)
{
_legend = l;
_offer = null;
_enemy = GameState.LegendEnemy(l);
_before = _hub!.Snapshot();
_game!.BeginDuel();
_scene = new DuelScene(_game, _enemy, _seed++);
if (DevShot.Active) _scene.Bot = new DuelBot(0.8, new Random(3));
DevShot.Log($"legend duel vs #{l.Number} {l.Name} ratio={_game.DuelRatio(_enemy):0.00}");
}
/// Gegner gewählt: Duell beginnt.
void StartDuel(Offer o)
{
@@ -165,8 +202,20 @@ namespace GladiatorIdle
void EndDuel()
{
bool won = _scene!.Won;
_game!.ResolveFight(_offer!, won);
_hub!.ShowResult(_hub.ResultLines(_before, won), won ? Gfx.Draw.Gold : Gfx.Draw.Red);
if (_legend is Legend l)
{
bool first = _game!.ResolveLegendDuel(l, won);
_hub!.ShowResult(new[] { L.t(won ? "duel.win" : "duel.lose"),
first ? string.Format(L.t("hall.reward"), l.Name, GameState.LEGEND_FAVOR) : l.Name },
won ? Gfx.Draw.Gold : Gfx.Draw.Red);
if (first) SoundManager.PlayAchievement();
_legend = null;
}
else
{
_game!.ResolveFight(_offer!, won);
_hub!.ShowResult(_hub.ResultLines(_before, won), won ? Gfx.Draw.Gold : Gfx.Draw.Red);
}
SoundManager.StartAmbient("music_ludus");
_scene = null;
_game.Save();
@@ -204,6 +253,19 @@ namespace GladiatorIdle
if (input.Pressed(Keys.Escape)) Exit();
if (DevShot.Active) DevModel(dt);
}
else if (_freedom != null)
{
_freedom.Update(dt, input, ui);
if (DevShot.Active) DevFreedom(dt);
if (_freedom != null && _freedom.Done)
{
// der nächste Gladiator: Erstellung im selben Profil
_freedom = null;
_nextLife = true;
_creator = new CreatorScene(DevShot.Active ? DevShot.Name : L.t("gladiator.defaultname"));
_devTime = 0;
}
}
else if (_intro != null)
{
_intro.Update(dt, input, ui);
@@ -244,6 +306,8 @@ namespace GladiatorIdle
if (_paused) _pauseUi.Begin(input, ui);
if (DevShot.Active) DevHub(dt);
if (_hub?.Chosen is Offer o) { _hub.Chosen = null; StartDuel(o); }
else if (_hub?.ChosenLegend is Legend lg) { _hub.ChosenLegend = null; StartLegendDuel(lg); }
else if (_hub != null && _game!.FreedomEarned && !_settings.Open) StartFreedom();
}
else if (_scene != null)
{
@@ -340,6 +404,19 @@ namespace GladiatorIdle
{
_devTime += dt;
void Shot(string name) { if (_shots.Add(name)) _capture = name; }
if (DevFreedomRun && _game!.Legends.Count == 0 && _devTime > 0.5) { _game.DevFreedom(); return; }
if (DevFreedomRun && _game!.Legends.Count > 0 && !_shots.Contains("m_end"))
{
if (_devTime > 0.8 && !_shots.Contains("h_hall_open")) { _shots.Add("h_hall_open"); _hub!.DevOpen(5); }
if (_devTime > 1.5) Shot("h_hall");
if (_devTime > 1.8 && _capture == null && _shots.Contains("h_hall")) { _hub!.DevOpen(0); _hub.ChosenLegend = _game.Legends[0]; _devTime = 0; }
return;
}
if (DevChampionRun && !_shots.Contains("m_end"))
{
if (_devTime > 0.5 && _capture == null) { _hub!.Chosen = new Offer(_game!.ChampionEnemy, 1, OfferKind.Champion); _devTime = 0; }
return;
}
if (!_shots.Contains("m_end"))
{
if (_devTime > 1.0) Shot("h_hub");
@@ -369,6 +446,19 @@ namespace GladiatorIdle
}
}
/// Testlauf --freedom: Clip, Bilanz und Götter aufnehmen, dann weiter zum nächsten Leben.
void DevFreedom(float dt)
{
_devTime += dt;
void Shot(string name) { if (_shots.Add(name)) _capture = name; }
if (_devTime > 2.5) Shot("f_clip");
if (_devTime > 2.7 && !_shots.Contains("f_sum_open")) { _shots.Add("f_sum_open"); _freedom!.DevShow(1, 0.2f); }
if (_devTime > 4.2) Shot("f_summary");
if (_devTime > 4.4 && !_shots.Contains("f_gods_open")) { _shots.Add("f_gods_open"); _freedom!.DevShow(2, 0.5f); }
if (_devTime > 5.0) Shot("f_gods");
if (_devTime > 5.3 && _capture == null && _shots.Contains("f_gods")) _freedom!.DevDone();
}
/// Testlauf: Bot kämpft; Aufnahmen an markanten Stellen.
void DevSteps(float dt)
{
@@ -376,6 +466,7 @@ namespace GladiatorIdle
var d = _scene!.Duel;
if (Perf) { PerfStep(); return; }
void Shot(string name) { if (_shots.Add(name)) _capture = name; }
if (_scene.InIntro) { if (_devTime > 2.5) Shot("m_champintro"); return; }
if (_devTime > 0.5) Shot("m_countdown");
if (d.Time > 0.6) Shot("m_fight");
if (d.Enemy.State == DuelState.Windup && d.Enemy.StateTime > d.Enemy.Windup * 0.6) Shot("m_telegraph");
@@ -441,6 +532,7 @@ namespace GladiatorIdle
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
Gfx.Draw.UiScale = scale;
if (_model != null) _model.Draw(gd, _sb, scale, offset);
else if (_freedom != null) _freedom.Draw(gd, _sb, _fx, scale, offset);
else if (_intro != null) _intro.Draw(_sb, scale, offset);
else if (_menu != null) _menu.Draw(_sb, scale, offset);
else if (_creator != null) _creator.Draw(gd, _sb, _fx, scale, offset);