Feldzugkarte, Reise in 3D, Kampfstile der Gegner, Missio, inszenierte Heimkehr
Stand von main 8c62f0dd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -80,7 +80,20 @@ namespace GladiatorIdle.Arena
|
||||
int _countShown = -1;
|
||||
public bool Paused;
|
||||
public bool Won { get; private set; }
|
||||
public bool Finished => _phase == Phase.End && _phaseTime > 1.2f;
|
||||
public bool Finished => _phase == Phase.End && (_missio ? _decidedAt >= 0 && _missioT - _decidedAt > 1.8f : _phaseTime > 1.2f);
|
||||
|
||||
// ── Gnadenstoß (Missio): das Publikum stimmt ab, der Sieger wählt ──
|
||||
readonly Ui _ui = new();
|
||||
bool _missio; float _missioT, _voteK = 0.5f, _decidedAt = -1, _chantIn;
|
||||
bool _crowdMercy;
|
||||
bool? _mercy, _spared;
|
||||
sealed class Chant { public string Text = ""; public Vector2 Pos; public float Age; public Color Color; }
|
||||
readonly List<Chant> _chants = new();
|
||||
/// Ergebnis für das Spiel: Wahl des Siegers, Wunsch des Publikums; nach einer Niederlage: verschont?
|
||||
public bool? MercyChosen => _mercy;
|
||||
public bool CrowdMercy => _crowdMercy;
|
||||
public bool? Spared => _spared;
|
||||
public float MissioTime => _missio ? _missioT : -1;
|
||||
public bool Over => _phase == Phase.End;
|
||||
|
||||
sealed class Floater { public string Text = ""; public Vector2 Pos; public Color Color; public float Size, Age, Life = 1.1f; public bool Big; }
|
||||
@@ -184,6 +197,7 @@ namespace GladiatorIdle.Arena
|
||||
var pc = game.PlayerCombat();
|
||||
Duel = new Duel(pc.MaxHp, pc.Crit, game.ClassDef.Special, enemy.Hp, game.DuelRatio(enemy), enemy.IsChampion,
|
||||
game.Equipped[(int)ItemSlot.Weapon]?.Base == "trident", new Random(seed), game.Perks);
|
||||
Duel.SetStyle(Duel.StyleOf(enemy.Art ?? Art.Enemy(enemy.NameKey), enemy.IsChampion)); // Kampfstil des Gegners
|
||||
// eigener Gladiator: Vorlage in Teamfarbe (sonst das Klassenbild)
|
||||
string hero = Art.Hero(game.Class, game.Look.Preset);
|
||||
_pv = Assets.Has(hero) ? new FighterView(hero, 0, game.Look.Color) : new FighterView(Art.Fighter(game.Class), 0, -1, game.Look.Color);
|
||||
@@ -220,8 +234,9 @@ namespace GladiatorIdle.Arena
|
||||
|
||||
// ── Takt ────────────────────────────────────────────────────
|
||||
|
||||
public void Update(float realDt, Input input)
|
||||
public void Update(float realDt, Input input, Matrix ui)
|
||||
{
|
||||
_ui.Begin(input, ui);
|
||||
if (Paused) return;
|
||||
_time += realDt;
|
||||
// Trefferstopp friert die Kämpfer kurz ein, Zeitlupe verlangsamt das Ende
|
||||
@@ -258,6 +273,10 @@ namespace GladiatorIdle.Arena
|
||||
if (Duel.Over)
|
||||
{
|
||||
_phase = Phase.End; _phaseTime = 0; Won = Duel.PlayerWon;
|
||||
// Gnadenstoß: nicht in der Einführung und nicht gegen Legenden
|
||||
_missio = !TutorialRan && _enemy.Display == null;
|
||||
_crowdMercy = Duel.DamageToPlayer >= Duel.Player.MaxHp * 0.3 || Duel.Time >= 25; // tapferer Gegner
|
||||
if (!Won) _spared = Duel.PlayerParries >= 2 || Duel.Enemy.Hp <= Duel.Enemy.MaxHp * 0.5 || Duel.Time >= 30;
|
||||
_cam.FocusX = Won ? _pv.X : _ev.X;
|
||||
if (!_calm) _cam.HoldYaw(Won ? 24 : -24); // langsame Fahrt um den Sieger
|
||||
if (Won) SoundManager.PlayVictory(); else SoundManager.PlayDefeat();
|
||||
@@ -266,6 +285,7 @@ namespace GladiatorIdle.Arena
|
||||
case Phase.End:
|
||||
Duel.Step(dt);
|
||||
HandleEvents();
|
||||
if (_missio) MissioUpdate(realDt, input);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -469,6 +489,13 @@ namespace GladiatorIdle.Arena
|
||||
Big(L.t(TextKeys.Of(Duel.PlayerSpecial)), D.Blue);
|
||||
SoundManager.PlayCheer();
|
||||
break;
|
||||
case DuelEventType.Charge:
|
||||
Big(L.t("duel.charge"), new Color(255, 90, 60));
|
||||
_cam.Shake(0.25f);
|
||||
if (!_calm) _cam.Pulse(-6, 0.8f);
|
||||
SoundManager.PlayWhoosh();
|
||||
_crowd.Excite(0.3f);
|
||||
break;
|
||||
case DuelEventType.Leap:
|
||||
_fx.Dust(new Vector2(_pv.X, Stage.FloorY), 10, 90, 50, 70);
|
||||
if (!_calm) { _cam.Lift(140); _cam.Pulse(10f * (float)Duel.Player.Facing, 1.0f); } // Kamera steigt mit
|
||||
@@ -608,7 +635,7 @@ namespace GladiatorIdle.Arena
|
||||
if (e.State == DuelState.Windup) // fair: der Schlag kündigt sich rot an
|
||||
{
|
||||
float k = (float)Math.Min(1, e.StateTime / e.Windup);
|
||||
_ev.DrawAura(gd, fx, new Color(255, 60, 40) * (0.55f * k), 0.035f * k);
|
||||
_ev.DrawAura(gd, fx, new Color(255, 60, 40) * ((e.Heavy ? 0.85f : 0.55f) * k), (e.Heavy ? 0.075f : 0.035f) * k);
|
||||
}
|
||||
if (p.State == DuelState.Wall || p.Invulnerable > 0) _pv.DrawAura(gd, fx, D.Blue * 0.5f, 0.03f);
|
||||
if (p.Heavy && p.State == DuelState.Windup) _pv.DrawAura(gd, fx, new Color(255, 150, 40) * 0.6f, 0.035f);
|
||||
@@ -768,12 +795,20 @@ namespace GladiatorIdle.Arena
|
||||
D.Text(sb, Assets.SansBold, 28, L.t(_enemy.Display != null ? "duel.legend" : _enemy.IsChampion ? "duel.champion" : "duel.practice").ToUpperInvariant(),
|
||||
new Vector2(Camera.W / 2, 600), D.Sand, Align.Center);
|
||||
}
|
||||
if (_phase == Phase.End)
|
||||
if (_phase == Phase.End && _missio && _decidedAt < 0) DrawMissio(sb);
|
||||
else if (_phase == Phase.End)
|
||||
{
|
||||
float k = MathHelper.Clamp(_phaseTime / 0.6f, 0, 1);
|
||||
float since = _missio ? _missioT - _decidedAt : _phaseTime;
|
||||
float k = MathHelper.Clamp(since / 0.6f, 0, 1);
|
||||
D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * (0.35f * k));
|
||||
D.Text(sb, Assets.Serif, 170, L.t(Won ? "duel.win" : "duel.lose"), new Vector2(Camera.W / 2, 400),
|
||||
(Won ? D.Gold : D.Red) * k, Align.Center, 1 + 0.4f * (1 - k));
|
||||
if (_missio)
|
||||
{
|
||||
string line = Won ? L.t(_mercy == _crowdMercy ? "missio.react.cheer" : "missio.react.boo")
|
||||
: L.t(_spared == true ? "missio.spared" : "missio.doomed");
|
||||
D.Text(sb, Assets.Serif, 30, line, new Vector2(Camera.W / 2, 520), Color.White * k, Align.Center);
|
||||
}
|
||||
if (Finished)
|
||||
D.Text(sb, Assets.SansBold, 30, L.t("mono.next"), new Vector2(Camera.W / 2, 600), Color.White, Align.Center);
|
||||
}
|
||||
@@ -785,6 +820,102 @@ namespace GladiatorIdle.Arena
|
||||
}
|
||||
}
|
||||
|
||||
// ── Gnadenstoß ──────────────────────────────────────────────
|
||||
|
||||
void MissioUpdate(float realDt, Input input)
|
||||
{
|
||||
_missioT += realDt;
|
||||
bool wantMercy = Won ? _crowdMercy : _spared == true;
|
||||
float target = wantMercy ? 0.12f : 0.88f;
|
||||
// Abstimmung: die Stimmung schwankt und kippt dann zum Wunsch der Menge
|
||||
if (_missioT > 0.9f && _decidedAt < 0)
|
||||
{
|
||||
float k = MathHelper.Clamp((_missioT - 0.9f) / 2.0f, 0, 1);
|
||||
float wobble = (1 - k) * 0.25f * MathF.Sin(_missioT * 7.3f) * MathF.Sin(_missioT * 3.1f);
|
||||
_voteK = MathHelper.Lerp(0.5f, target, k * k) + wobble;
|
||||
if (!_calm && (_chantIn -= realDt) <= 0)
|
||||
{
|
||||
_chantIn = 0.11f;
|
||||
bool mercyChant = Random.Shared.NextDouble() < (1 - _voteK);
|
||||
_chants.Add(new Chant
|
||||
{
|
||||
Text = L.t(mercyChant ? "missio.mitte" : "missio.iugula"),
|
||||
Pos = new Vector2(80 + (float)Random.Shared.NextDouble() * (Camera.W - 160), 960 + (float)Random.Shared.NextDouble() * 60),
|
||||
Color = mercyChant ? D.Gold : new Color(255, 110, 70),
|
||||
});
|
||||
_crowd.Excite(0.08f);
|
||||
}
|
||||
}
|
||||
for (int i = _chants.Count - 1; i >= 0; i--)
|
||||
{
|
||||
_chants[i].Age += realDt;
|
||||
_chants[i].Pos.Y -= 90 * realDt;
|
||||
if (_chants[i].Age > 1.6f) _chants.RemoveAt(i);
|
||||
}
|
||||
if (_decidedAt >= 0) return;
|
||||
if (!Won)
|
||||
{
|
||||
if (_missioT >= 3.0f) Decide(_spared == true);
|
||||
return;
|
||||
}
|
||||
if (_missioT < 3.0f) return;
|
||||
// Wahl des Siegers: Knöpfe, Tasten 1/2, Gamepad X/Y; Testlauf und Zeitablauf: Wunsch der Menge
|
||||
if (input.Pressed(Keys.D1) || input.Pressed(Keys.NumPad1) || input.PadPressed(Buttons.X)) Decide(true);
|
||||
else if (input.Pressed(Keys.D2) || input.Pressed(Keys.NumPad2) || input.PadPressed(Buttons.Y)) Decide(false);
|
||||
else if (Bot != null && _missioT > 3.8f) Decide(_crowdMercy);
|
||||
else if (_missioT > 9.5f) Decide(_crowdMercy);
|
||||
}
|
||||
|
||||
void Decide(bool mercy)
|
||||
{
|
||||
if (_decidedAt >= 0) return;
|
||||
_decidedAt = _missioT;
|
||||
if (!Won) { if (mercy) SoundManager.PlayCheer(); else SoundManager.PlayBoo(); return; }
|
||||
_mercy = mercy;
|
||||
bool match = mercy == _crowdMercy;
|
||||
if (match) { _crowd.Wave(); SoundManager.PlayCheer(); } else SoundManager.PlayBoo();
|
||||
if (!mercy) { _pv.HoldClip = "powerup"; _cam.Shake(0.35f); SoundManager.PlayFury(); } // Kampfschrei, keine Tötung
|
||||
Big(L.t(mercy ? "missio.mitte" : "missio.iugula"), mercy ? D.Gold : new Color(255, 120, 70));
|
||||
}
|
||||
|
||||
void DrawMissio(SpriteBatch sb)
|
||||
{
|
||||
float a = MathHelper.Clamp(_missioT / 0.6f, 0, 1);
|
||||
D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * (0.32f * a));
|
||||
D.Text(sb, Assets.Serif, 120, L.t("missio.title"), new Vector2(Camera.W / 2, 240), D.Gold * a, Align.Center);
|
||||
D.Text(sb, Assets.Serif, 30, L.t(Won ? "missio.crowd" : "missio.crowd.you"), new Vector2(Camera.W / 2, 330), D.Sand * a, Align.Center);
|
||||
|
||||
// Stimmungsleiste: links Gnade (Mitte!), rechts Ende (Iugula!)
|
||||
var bar = new RectangleF(Camera.W / 2 - 460, 410, 920, 26);
|
||||
D.Rect(sb, bar, new Color(20, 14, 10) * (0.9f * a));
|
||||
D.Rect(sb, new RectangleF(bar.X, bar.Y, bar.Width * (1 - _voteK), bar.Height), D.Gold * (0.75f * a));
|
||||
D.Rect(sb, new RectangleF(bar.X + bar.Width * (1 - _voteK), bar.Y, bar.Width * _voteK, bar.Height), new Color(200, 70, 50) * (0.75f * a));
|
||||
D.Frame(sb, bar, D.Border * a, 2);
|
||||
float mx = bar.X + bar.Width * (1 - _voteK);
|
||||
D.Glow(sb, new Vector2(mx, bar.Center.Y), new Vector2(60, 90), Color.White * (0.8f * a));
|
||||
D.Text(sb, Assets.Serif, 34, L.t("missio.mitte"), new Vector2(bar.X, bar.Y - 30), D.Gold * a);
|
||||
D.Text(sb, Assets.Sans, 18, L.t("missio.mitte.hint"), new Vector2(bar.X, bar.Bottom + 24), D.Sand * a);
|
||||
D.Text(sb, Assets.Serif, 34, L.t("missio.iugula"), new Vector2(bar.Right, bar.Y - 30), new Color(255, 120, 80) * a, Align.Right);
|
||||
D.Text(sb, Assets.Sans, 18, L.t("missio.iugula.hint"), new Vector2(bar.Right, bar.Bottom + 24), D.Sand * a, Align.Right);
|
||||
|
||||
foreach (var c in _chants)
|
||||
{
|
||||
float ca = MathF.Min(1, c.Age * 4) * MathF.Max(0, 1 - c.Age / 1.6f);
|
||||
D.Text(sb, Assets.Serif, 30, c.Text, c.Pos + new Vector2(2, 2), Color.Black * (0.6f * ca), Align.Center);
|
||||
D.Text(sb, Assets.Serif, 30, c.Text, c.Pos, c.Color * ca, Align.Center);
|
||||
}
|
||||
|
||||
if (!Won || _missioT < 3.0f) return;
|
||||
float b = MathHelper.Clamp((_missioT - 3.0f) / 0.4f, 0, 1);
|
||||
D.Text(sb, Assets.SansBold, 26, L.t(_crowdMercy ? "missio.wants.mercy" : "missio.wants.end"), new Vector2(Camera.W / 2, 520), Color.White * b, Align.Center);
|
||||
var r1 = new RectangleF(Camera.W / 2 - 470, 580, 450, 84);
|
||||
var r2 = new RectangleF(Camera.W / 2 + 20, 580, 450, 84);
|
||||
if (_ui.Button(sb, r1, L.t("missio.btn.mercy"), selected: _crowdMercy, size: 26, accent: D.Gold)) Decide(true);
|
||||
if (_ui.Button(sb, r2, L.t("missio.btn.end"), selected: !_crowdMercy, size: 26, accent: new Color(220, 90, 60))) Decide(false);
|
||||
float left = MathF.Max(0, 9.5f - _missioT);
|
||||
D.Text(sb, Assets.Sans, 18, string.Format(L.t("missio.timer"), MathF.Ceiling(left)), new Vector2(Camera.W / 2, 700), D.Dim * b, Align.Center);
|
||||
}
|
||||
|
||||
public void GiveUp()
|
||||
{
|
||||
Paused = false;
|
||||
|
||||
Reference in New Issue
Block a user