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

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

BIN
Assets/Sprites/tex_gate.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
Assets/Sprites/tex_sand.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

View File

@@ -39,6 +39,15 @@ namespace GladiatorIdle
/// Weniger Bewegung: keine Partikel, schwebenden Zahlen, Kamera-Ruck, Kampf-Clips. /// Weniger Bewegung: keine Partikel, schwebenden Zahlen, Kamera-Ruck, Kampf-Clips.
public static bool ReduceMotion { get; set; } public static bool ReduceMotion { get; set; }
/// Kantenglättung (MSAA 4×).
public static bool AntiAlias { get; set; } = true;
/// Nachleuchten heller Stellen (Feuer, Funken, Sonne).
public static bool Bloom { get; set; } = true;
/// Bildrate: 0 = an den Bildschirm gebunden (VSync), 1 = 120 Bilder/s, 2 = unbegrenzt.
public static int FrameLimit { get; set; }
/// Tipps im Spiel (Sprechblasen bei neuen Bereichen). /// Tipps im Spiel (Sprechblasen bei neuen Bereichen).
public static bool Hints { get; set; } = true; public static bool Hints { get; set; } = true;
@@ -80,6 +89,9 @@ namespace GladiatorIdle
case "voicevol": if (int.TryParse(val, out int vv)) VoiceVolume = Math.Clamp(vv, 0, 100); break; case "voicevol": if (int.TryParse(val, out int vv)) VoiceVolume = Math.Clamp(vv, 0, 100); break;
case "muted": Muted = val == "1"; break; case "muted": Muted = val == "1"; break;
case "reducemotion": ReduceMotion = val == "1"; break; case "reducemotion": ReduceMotion = val == "1"; break;
case "antialias": AntiAlias = val == "1"; break;
case "bloom": Bloom = val == "1"; break;
case "framelimit": if (int.TryParse(val, out int fl)) FrameLimit = Math.Clamp(fl, 0, 2); break;
case "textscale": if (int.TryParse(val, out int ts)) TextScale = Math.Clamp(ts, 1, 3); break; case "textscale": if (int.TryParse(val, out int ts)) TextScale = Math.Clamp(ts, 1, 3); break;
case "hintsseen": case "hintsseen":
foreach (var id in val.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)) foreach (var id in val.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries))
@@ -110,6 +122,9 @@ namespace GladiatorIdle
$"voicevol={VoiceVolume}\n" + $"voicevol={VoiceVolume}\n" +
$"muted={(Muted ? 1 : 0)}\n" + $"muted={(Muted ? 1 : 0)}\n" +
$"reducemotion={(ReduceMotion ? 1 : 0)}\n" + $"reducemotion={(ReduceMotion ? 1 : 0)}\n" +
$"antialias={(AntiAlias ? 1 : 0)}\n" +
$"bloom={(Bloom ? 1 : 0)}\n" +
$"framelimit={FrameLimit}\n" +
$"textscale={TextScale}\n" + $"textscale={TextScale}\n" +
$"hintsseen={string.Join(",", HintsSeen.OrderBy(x => x))}\n"); $"hintsseen={string.Join(",", HintsSeen.OrderBy(x => x))}\n");
} }

View File

@@ -75,6 +75,8 @@ namespace GladiatorIdle
internal static class Adventures internal static class Adventures
{ {
public static readonly double[] Durations = { 300, 1800, 7200 }; public static readonly double[] Durations = { 300, 1800, 7200 };
/// Lohn je Dauer in Siegen der Region (Denare, Ruhm, Erfahrung); Hauptlohn ist die Beute.
public static readonly double[] Wins = { 3, 8, 20 };
public const int LOG_LINES = 12; // expedition.log.1 … 12 public const int LOG_LINES = 12; // expedition.log.1 … 12
public const double EVENT_MIN = 480, EVENT_MAX = 840; // 8–14 min aktive Spielzeit public const double EVENT_MIN = 480, EVENT_MAX = 840; // 8–14 min aktive Spielzeit

View File

@@ -13,13 +13,11 @@ namespace GladiatorIdle
/// XP von Stufe <paramref name="level"/> zur nächsten. /// XP von Stufe <paramref name="level"/> zur nächsten.
public static double XpToNext(int level) => 20 * Math.Pow(1.16, level); public static double XpToNext(int level) => 20 * Math.Pow(1.16, level);
/// Trainingsplan: so viele Stunden am Tag, die der Spieler auf die vier Werte verteilt. /// Tägliches Training: Grund-XP/s plus dieser Anteil der gesamten Ausbilder-Leistung,
public const int PLAN_HOURS = 10; /// fest verteilt (Stärke, Ausdauer, Geschick, Showtalent) – wächst mit den Ausbildern mit.
public const int PLAN_MAX_PER_STAT = 6;
/// Drill nach Plan: Grund-XP/s plus dieser Anteil der gesamten Ausbilder-Leistung,
/// verteilt nach den Stunden im Plan (wächst also mit den Ausbildern mit).
public const double DRILL_BASE = 1.0; public const double DRILL_BASE = 1.0;
public const double DRILL_TRAINER_SHARE = 0.6; public const double DRILL_TRAINER_SHARE = 0.6;
public static readonly double[] DRILL_SPLIT = { 0.3, 0.3, 0.2, 0.2 };
// ── Gladiator-Stufe (Kampf-Erfahrung) ─────────────────────── // ── Gladiator-Stufe (Kampf-Erfahrung) ───────────────────────
public static double CharXpToNext(int level) => 10 * Math.Pow(1.15, level); public static double CharXpToNext(int level) => 10 * Math.Pow(1.15, level);
@@ -39,22 +37,15 @@ namespace GladiatorIdle
public static double CrowdGainMult(int show) => 1 + 0.04 * show; public static double CrowdGainMult(int show) => 1 + 0.04 * show;
public static double FameMult(int show) => 1 + 0.02 * show; public static double FameMult(int show) => 1 + 0.02 * show;
// ── Kampf-Takt ────────────────────────────────────────────── // ── Kampf ───────────────────────────────────────────────────
public const double PLAYER_ATTACK_INTERVAL = 1.0;
public const double ENEMY_ATTACK_INTERVAL = 1.1;
public const double FIGHT_PAUSE = 3.0; // zwischen zwei Kämpfen
public const double RECOVERY_TIME = 20.0; // nach einer Niederlage public const double RECOVERY_TIME = 20.0; // nach einer Niederlage
public const int MAX_ROUNDS = 60; // danach entscheidet das Leben in %
public const double SPECIAL_COOLDOWN = 20.0;
// ── Echtzeit-Duell ────────────────────────────────────────── // ── Echtzeit-Duell ──────────────────────────────────────────
/// Gegner-Kampfkraft = Faktor × √(Schaden × Leben). 0,5: bei dem Verhältnis, mit dem Champions /// Gegner-Kampfkraft = Faktor × √(Schaden × Leben). 0,5: bei dem Verhältnis, mit dem Champions
/// sonst automatisch fallen (~0,9), gewinnt ein mittelguter Spieler meistens (Duell-Bot: 55–87 %). /// sonst automatisch fallen (~0,9), gewinnt ein mittelguter Spieler meistens (Duell-Bot: 55–87 %).
public const double DUEL_POWER_SCALE = 0.5; public const double DUEL_POWER_SCALE = 0.5;
public const double PRACTICE_COOLDOWN = 300; // Übungsduell alle 5 min /// Lohn je Angebot (leichter / ebenbürtig / stärker).
/// Selbst kämpfen: Lohn je Angebot (leichter / ebenbürtig / stärker), automatischer Sieg ab Verhältnis. public const double OFFER_EASY = 0.7, OFFER_EVEN = 1.0, OFFER_HARD = 1.8;
public const double OFFER_EASY = 0.7, OFFER_EVEN = 1.0, OFFER_HARD = 1.8, AUTO_RATIO = 2.5, AUTO_REWARD = 0.8;
public const double PRACTICE_REWARD = 3;
// ── Selbst kämpfen (neues Spiel) ──────────────────────────── // ── Selbst kämpfen (neues Spiel) ────────────────────────────
/// Schaden eines gegnerischen Treffers im Duell (Anteil am Leben bei Verhältnis 1). /// Schaden eines gegnerischen Treffers im Duell (Anteil am Leben bei Verhältnis 1).
@@ -62,11 +53,11 @@ namespace GladiatorIdle
public static double DUEL_ENEMY_HIT = Tune("GI_EHIT", new[] { 0.055 })[0]; public static double DUEL_ENEMY_HIT = Tune("GI_EHIT", new[] { 0.055 })[0];
/// Gegner im Duell stärker gewichtet, je Arena (die Idle-Werte setzten große Überlegenheit voraus). /// Gegner im Duell stärker gewichtet, je Arena (die Idle-Werte setzten große Überlegenheit voraus).
/// Abgestimmt mit --arenatest: 3,0–4,1 h bis zur Freiheit, je Arena meist 15–40 min, /// Abgestimmt mit --playtest (ohne Taberna, Denare nur aus Kämpfen): ~3,1 h bis zur Freiheit,
/// mittleres Verhältnis der gewählten Gegner um 1,0–1,4. /// je Arena 14–41 min, mittleres Verhältnis der gewählten Gegner um 1,0–1,1.
public static double[] MANUAL_ENEMY = Tune("GI_ENEMY", new[] { 4.5, 13, 14, 7, 3.8, 1.4, 0.65 }); public static double[] MANUAL_ENEMY = Tune("GI_ENEMY", new[] { 4.5, 13, 14, 7, 2.6, 1.3, 0.55 });
/// Mehr Ruhm bis zum Champion, damit eine Arena trägt. /// Mehr Ruhm bis zum Champion, damit eine Arena trägt.
public static double[] MANUAL_FAME = Tune("GI_FAME", new[] { 3.0, 3.0, 3.0, 3.0, 2.3, 1.8, 0.9 }); public static double[] MANUAL_FAME = Tune("GI_FAME", new[] { 3.0, 3.0, 3.0, 3.0, 2.3, 2.2, 0.8 });
/// Abstimmung im Testlauf: Werte aus einer Umgebungsvariablen (Komma-Liste), sonst Standard. /// Abstimmung im Testlauf: Werte aus einer Umgebungsvariablen (Komma-Liste), sonst Standard.
static double[] Tune(string env, double[] fallback) static double[] Tune(string env, double[] fallback)
@@ -75,23 +66,7 @@ namespace GladiatorIdle
if (string.IsNullOrWhiteSpace(v)) return fallback; if (string.IsNullOrWhiteSpace(v)) return fallback;
var parts = v.Split(',').Select(x => double.Parse(x, System.Globalization.CultureInfo.InvariantCulture)).ToArray(); var parts = v.Split(',').Select(x => double.Parse(x, System.Globalization.CultureInfo.InvariantCulture)).ToArray();
return parts.Length >= fallback.Length ? parts : fallback; return parts.Length >= fallback.Length ? parts : fallback;
} // dreifacher Lohn und sichere Beute }
// ── Timing-Schlag: eine Lücke öffnet sich, ein Ring schrumpft auf das Ziel ──
public const double OPENING_MIN = 5, OPENING_MAX = 9; // Abstand zwischen zwei Lücken
public const double OPENING_TIME = 1.4; // so lange ist sie offen
public const double OPENING_TARGET = 1.0; // Ring genau auf dem Ziel
public const double STRIKE_PERFECT = 0.10, STRIKE_GOOD = 0.25; // ± Sekunden um das Ziel
public const double STRIKE_PERFECT_DMG = 3.5, STRIKE_GOOD_DMG = 1.8;
public const double CROWD_PERFECT = 6, CROWD_GOOD = 2;
// ── Taktik: (Schaden ausgeteilt, Schaden erlitten) ──────────
public static (double dealt, double taken) TacticMult(Tactic t) => t switch
{
Tactic.Attack => (1.25, 1.20),
Tactic.Defense => (0.75, 0.65),
_ => (1.0, 1.0)
};
// ── Gegner ────────────────────────────────────────────────── // ── Gegner ──────────────────────────────────────────────────
public const int RANKS_PER_ARENA = 10; public const int RANKS_PER_ARENA = 10;
@@ -102,13 +77,15 @@ namespace GladiatorIdle
public const double CHAMPION_HP = 1.9, CHAMPION_DMG = 1.5, CHAMPION_AGI = 1.2; public const double CHAMPION_HP = 1.9, CHAMPION_DMG = 1.5, CHAMPION_AGI = 1.2;
public static double GoldPerWin(int tier) => 6 * Math.Pow(1.22, tier); public static double GoldPerWin(int tier) => 6 * Math.Pow(1.22, tier);
/// Denare je Sieg (Faktor auf GoldPerWin): Kämpfe sind die Haupteinnahme, seit es keine Taberna mehr gibt.
public static double FIGHT_GOLD = Tune("GI_GOLD", new[] { 2.5 })[0];
public static double FamePerWin(int tier) => 1 * Math.Pow(1.22, tier); public static double FamePerWin(int tier) => 1 * Math.Pow(1.22, tier);
/// Ruhm (gesamt in diesem Leben), ab dem der Champion der Arena herausgefordert werden kann. /// Ruhm (gesamt in diesem Leben), ab dem der Champion der Arena herausgefordert werden kann.
public static double FameRequired(int arena) => (20 + 15 * arena) * FamePerWin(arena * RANKS_PER_ARENA + RANKS_PER_ARENA - 1); public static double FameRequired(int arena) => (20 + 15 * arena) * FamePerWin(arena * RANKS_PER_ARENA + RANKS_PER_ARENA - 1);
public const double CHAMPION_REWARD = 5; // Gold und Ruhm × so viel wie ein normaler Sieg public const double CHAMPION_REWARD = 5; // Gold und Ruhm × so viel wie ein normaler Sieg
// ── Gunst der Menge (0–100) ───────────────────────────────── // ── Gunst der Menge (0–100) ─────────────────────────────────
public const double CROWD_WIN = 8, CROWD_LOSS = 25, CROWD_SPECIAL = 3, CROWD_DECAY = 0.15; public const double CROWD_WIN = 8, CROWD_LOSS = 25, CROWD_DECAY = 0.15;
/// ×1 bei 0 Gunst bis ×3 bei 100. /// ×1 bei 0 Gunst bis ×3 bei 100.
public static double CrowdMult(double favor) => 1 + 2 * favor / 100; public static double CrowdMult(double favor) => 1 + 2 * favor / 100;

View File

@@ -6,7 +6,6 @@ namespace GladiatorIdle
{ {
public enum Stat { Strength, Endurance, Agility, Showmanship } public enum Stat { Strength, Endurance, Agility, Showmanship }
public enum GladiatorClass { Murmillo, Retiarius, Thraex, Secutor } public enum GladiatorClass { Murmillo, Retiarius, Thraex, Secutor }
public enum Tactic { Attack, Balanced, Defense }
public enum God { Mars, Fortuna, Minerva, Apollo, Bacchus, Jupiter } public enum God { Mars, Fortuna, Minerva, Apollo, Bacchus, Jupiter }
/// Spezialschlag je Klasse. /// Spezialschlag je Klasse.
@@ -49,7 +48,6 @@ namespace GladiatorIdle
new("building.baths", UpgradeKind.Building, 60, 1.90), // schnellere Erholung new("building.baths", UpgradeKind.Building, 60, 1.90), // schnellere Erholung
new("building.kitchen", UpgradeKind.Building, 80, 1.70), // mehr XP new("building.kitchen", UpgradeKind.Building, 80, 1.70), // mehr XP
new("building.medicus", UpgradeKind.Building, 100, 1.75), // mehr Leben new("building.medicus", UpgradeKind.Building, 100, 1.75), // mehr Leben
new("building.taberna", UpgradeKind.Building, 150, 1.60), // Gold pro Sekunde
}; };
static readonly Dictionary<string, UpgradeDef> _byId = All.ToDictionary(u => u.Id); static readonly Dictionary<string, UpgradeDef> _byId = All.ToDictionary(u => u.Id);
@@ -123,7 +121,6 @@ namespace GladiatorIdle
internal static class TextKeys internal static class TextKeys
{ {
public static string Of(Stat s) => "stat." + s.ToString().ToLowerInvariant(); public static string Of(Stat s) => "stat." + s.ToString().ToLowerInvariant();
public static string Of(Tactic t) => "tactic." + t.ToString().ToLowerInvariant();
public static string Of(Special s) => "special." + s.ToString().ToLowerInvariant(); public static string Of(Special s) => "special." + s.ToString().ToLowerInvariant();
/// Alle gebauten Keys — der Playtest prüft, dass jeder in en.json steht. /// Alle gebauten Keys — der Playtest prüft, dass jeder in en.json steht.
@@ -131,7 +128,6 @@ namespace GladiatorIdle
{ {
foreach (var c in ClassDef.All) { yield return c.Key; yield return Of(c.Special); } foreach (var c in ClassDef.All) { yield return c.Key; yield return Of(c.Special); }
foreach (Stat s in Enum.GetValues<Stat>()) yield return Of(s); foreach (Stat s in Enum.GetValues<Stat>()) yield return Of(s);
foreach (Tactic t in Enum.GetValues<Tactic>()) yield return Of(t);
foreach (God g in Enum.GetValues<God>()) { yield return Gods.Key(g); yield return Gods.Key(g) + ".desc"; } foreach (God g in Enum.GetValues<God>()) { yield return Gods.Key(g); yield return Gods.Key(g) + ".desc"; }
foreach (var u in UpgradeDef.All) foreach (var u in UpgradeDef.All)
{ {

View File

@@ -60,7 +60,7 @@ namespace GladiatorIdle
const double ATTACK_COST = 14, DODGE_COST = 24, BLOCK_HIT_COST = 18, REGEN = 30, REGEN_BLOCKING = 8; const double ATTACK_COST = 14, DODGE_COST = 24, BLOCK_HIT_COST = 18, REGEN = 30, REGEN_BLOCKING = 8;
const double DODGE_TIME = 0.32, DODGE_DIST = 320 * SCALE, HIT_TIME = 0.25, PARRY_WINDOW = 0.18, PARRY_STUN = 1.1; const double DODGE_TIME = 0.32, DODGE_DIST = 320 * SCALE, HIT_TIME = 0.25, PARRY_WINDOW = 0.18, PARRY_STUN = 1.1;
public const double SPECIAL_COOLDOWN = 15; public const double SPECIAL_COOLDOWN = 15;
public const double HEAVY_COOLDOWN = 10, HEAVY_WINDUP = 0.5, HEAVY_COST = 30, HEAVY_MULT = 1.6; public const double HEAVY_COOLDOWN = 10, HEAVY_WINDUP = 0.5, HEAVY_COST = 30, HEAVY_MULT = 2.5;
public const double WALL_COOLDOWN = 12, WALL_TIME = 2.5; public const double WALL_COOLDOWN = 12, WALL_TIME = 2.5;
// Sprungangriff (Leertaste): Satz nach vorn, in der Luft unverwundbar, Schlag von oben // Sprungangriff (Leertaste): Satz nach vorn, in der Luft unverwundbar, Schlag von oben
public const double LEAP_COST = 26, LEAP_COOLDOWN = 3, LEAP_TIME = 0.8, LEAP_HIT = 0.52, LEAP_DIST = 300 * SCALE, LEAP_MULT = 1.4; public const double LEAP_COST = 26, LEAP_COOLDOWN = 3, LEAP_TIME = 0.8, LEAP_HIT = 0.52, LEAP_DIST = 300 * SCALE, LEAP_MULT = 1.4;
@@ -81,6 +81,11 @@ namespace GladiatorIdle
// Eingaben des Spielers (von der Anzeige gesetzt) // Eingaben des Spielers (von der Anzeige gesetzt)
public int MoveDir; public int MoveDir;
public bool BlockHeld; public bool BlockHeld;
// Einführung: Gegner wartet (EnemyPassive) oder greift nur an (EnemyAttacksOnly, blockt nicht),
// macht weniger Schaden, und niemand fällt, solange GuardHp gesetzt ist.
public bool EnemyPassive, EnemyAttacksOnly, GuardHp;
public double EnemyDamageMult = 1;
bool _attack, _dodge, _special, _heavy, _wall, _leap, _super; bool _attack, _dodge, _special, _heavy, _wall, _leap, _super;
public void PressLeap() => _leap = true; public void PressLeap() => _leap = true;
public void PressSuper() => _super = true; public void PressSuper() => _super = true;
@@ -204,9 +209,10 @@ namespace GladiatorIdle
double dist = Math.Abs(p.X - e.X); double dist = Math.Abs(p.X - e.X);
double speed = e.Speed * (e.Slow > 0 ? 0.45 : 1); double speed = e.Speed * (e.Slow > 0 ? 0.45 : 1);
if (e.Busy && e.State != DuelState.Block) return; if (e.Busy && e.State != DuelState.Block) return;
if (EnemyPassive) return;
// Spieler holt aus: manchmal blocken // Spieler holt aus: manchmal blocken
if (p.State == DuelState.Windup && dist < p.Reach + 40 * SCALE && e.State != DuelState.Block && _rng.NextDouble() < (_champion ? 0.45 : 0.3) * dt * 12) if (!EnemyAttacksOnly && p.State == DuelState.Windup && dist < p.Reach + 40 * SCALE && e.State != DuelState.Block && _rng.NextDouble() < (_champion ? 0.45 : 0.3) * dt * 12)
{ {
e.Set(DuelState.Block); e.BlockSince = Time; e.Set(DuelState.Block); e.BlockSince = Time;
return; return;
@@ -388,7 +394,8 @@ namespace GladiatorIdle
void Damage(DuelFighter a, DuelFighter d, double dmg, bool crit, bool silent = false) void Damage(DuelFighter a, DuelFighter d, double dmg, bool crit, bool silent = false)
{ {
d.Hp = Math.Max(0, d.Hp - dmg); if (!a.IsPlayer) dmg *= EnemyDamageMult;
d.Hp = Math.Max(GuardHp ? d.MaxHp * 0.15 : 0, d.Hp - dmg);
if (!silent) Events.Add(new DuelEvent(DuelEventType.Hit, a.IsPlayer, dmg, crit)); if (!silent) Events.Add(new DuelEvent(DuelEventType.Hit, a.IsPlayer, dmg, crit));
if (!silent && a.State != DuelState.Super) { AddRage(a, RAGE_HIT); AddRage(d, RAGE_HURT); } if (!silent && a.State != DuelState.Super) { AddRage(a, RAGE_HIT); AddRage(d, RAGE_HURT); }
if (d.IsPlayer && d.Hp > 0 && _perks.SecondWind > 0 && !d.SecondWindUsed && d.Hp < d.MaxHp * 0.25) if (d.IsPlayer && d.Hp > 0 && _perks.SecondWind > 0 && !d.SecondWindUsed && d.Hp < d.MaxHp * 0.25)

View File

@@ -1,162 +1,6 @@
using System;
using System.Collections.Generic;
namespace GladiatorIdle namespace GladiatorIdle
{ {
public enum FightEventType { PlayerHit, PlayerMiss, EnemyHit, EnemyMiss, EnemyStunned, Special, Heal,
OpeningStarted, Strike, StrikeMissed }
/// Ein Schlag/Ereignis im Kampf, für Anzeige (Zahlen, Clips, Töne).
internal readonly record struct FightEvent(FightEventType Type, double Amount = 0, bool Crit = false);
/// Kampfwerte des Gladiators beim Kampfbeginn. /// Kampfwerte des Gladiators beim Kampfbeginn.
internal readonly record struct Combatant(double MaxHp, double Damage, double Agility, double Crit, double DamageTakenMult, internal readonly record struct Combatant(double MaxHp, double Damage, double Agility, double Crit, double DamageTakenMult,
double CritMult = Balance.CRIT_MULT, double Execute = 0, double SecondWind = 0); double CritMult = Balance.CRIT_MULT, double Execute = 0, double SecondWind = 0);
/// <summary>
/// Ein Kampf als Werte-Duell: beide Seiten schlagen in eigenem Takt, Treffer/Krit nach
/// Geschick. Endet bei 0 Leben oder nach <see cref="Balance.MAX_ROUNDS"/> Schlägen (dann
/// gewinnt, wer prozentual mehr Leben hat).
/// </summary>
internal sealed class Fight
{
public Enemy Enemy { get; }
public Combatant Player { get; }
public double PlayerHp { get; private set; }
public double EnemyHp { get; private set; }
public bool Over { get; private set; }
public bool Won { get; private set; }
public double Elapsed { get; private set; }
public Tactic Tactic { get; set; } = Tactic.Balanced;
/// Ereignisse seit dem letzten Abholen (UI liest und leert sie).
public List<FightEvent> Events { get; } = new();
public bool CollectEvents { get; set; } = true;
readonly Random _rng;
double _pt, _et, _openIn;
/// Timing-Schlag: Alter der offenen Lücke in Sekunden, −1 = keine offen.
public double OpeningAge { get; private set; } = -1;
int _rounds;
int _stun, _net, _sica;
bool _secondWind; // verbleibende Wirkungen der Spezialschläge
public Fight(Enemy enemy, Combatant player, Random rng)
{
Enemy = enemy; Player = player; _rng = rng;
PlayerHp = player.MaxHp;
EnemyHp = enemy.Hp;
_et = -0.4; // Gegner schlägt etwas später zum ersten Mal
_openIn = 2 + rng.NextDouble() * 2; // erste Lücke früh im Kampf
}
void ScheduleOpening() =>
_openIn = Balance.OPENING_MIN + _rng.NextDouble() * (Balance.OPENING_MAX - Balance.OPENING_MIN);
/// Schlag in die Lücke. 2 = perfekt, 1 = gut, 0 = daneben (Lücke ist zu), −1 = keine Lücke.
public int Strike()
{
if (Over || OpeningAge < 0) return -1;
double d = Math.Abs(OpeningAge - Balance.OPENING_TARGET);
int q = d <= Balance.STRIKE_PERFECT ? 2 : d <= Balance.STRIKE_GOOD ? 1 : 0;
OpeningAge = -1;
ScheduleOpening();
if (q == 0) { Add(new FightEvent(FightEventType.StrikeMissed)); return 0; }
double dmg = Player.Damage * (q == 2 ? Balance.STRIKE_PERFECT_DMG : Balance.STRIKE_GOOD_DMG) * Spread();
EnemyHp -= dmg;
Add(new FightEvent(FightEventType.Strike, dmg, q == 2));
if (EnemyHp <= 0) Finish(true);
return q;
}
public double PlayerHpFrac => Math.Clamp(PlayerHp / Player.MaxHp, 0, 1);
public double EnemyHpFrac => Math.Clamp(EnemyHp / Enemy.Hp, 0, 1);
public void Step(double dt)
{
if (Over) return;
Elapsed += dt;
if (OpeningAge >= 0)
{
OpeningAge += dt;
if (OpeningAge > Balance.OPENING_TIME) { OpeningAge = -1; ScheduleOpening(); } // verpasst
}
else if ((_openIn -= dt) <= 0)
{
OpeningAge = 0;
Add(new FightEvent(FightEventType.OpeningStarted));
}
_pt += dt; _et += dt;
const double PI = Balance.PLAYER_ATTACK_INTERVAL, EI = Balance.ENEMY_ATTACK_INTERVAL;
while (!Over && (_pt >= PI || _et >= EI))
{
// wer zuerst dran war (größerer Überhang), schlägt zuerst
if (_pt >= PI && _pt - PI >= _et - EI) { _pt -= PI; PlayerAttack(); }
else { _et -= EI; EnemyAttack(); }
}
}
void PlayerAttack()
{
var (dealt, _) = Balance.TacticMult(Tactic);
if (_sica == 0 && _rng.NextDouble() > Balance.HitChance(Player.Agility, Enemy.Agility))
Add(new FightEvent(FightEventType.PlayerMiss));
else
{
bool crit = _sica > 0 || _rng.NextDouble() < Player.Crit;
if (_sica > 0) _sica--;
double dmg = Player.Damage * dealt * Spread() * (crit ? Player.CritMult : 1)
* (EnemyHpFrac < 0.3 ? 1 + Player.Execute : 1); // Gnadenstoß
EnemyHp -= dmg;
Add(new FightEvent(FightEventType.PlayerHit, dmg, crit));
if (EnemyHp <= 0) { Finish(true); return; }
}
if (++_rounds >= Balance.MAX_ROUNDS) Finish(PlayerHpFrac >= EnemyHpFrac);
}
void EnemyAttack()
{
if (_stun > 0) { _stun--; Add(new FightEvent(FightEventType.EnemyStunned)); return; }
var (_, taken) = Balance.TacticMult(Tactic);
double hit = Balance.HitChance(Enemy.Agility, Player.Agility) * (_net > 0 ? 0.5 : 1);
if (_net > 0) _net--;
if (_rng.NextDouble() > hit) { Add(new FightEvent(FightEventType.EnemyMiss)); return; }
double dmg = Enemy.Damage * taken * Player.DamageTakenMult * Spread();
PlayerHp -= dmg;
Add(new FightEvent(FightEventType.EnemyHit, dmg));
// Zweiter Atem: einmal je Kampf bei wenig Leben eine Heilung
if (PlayerHp > 0 && Player.SecondWind > 0 && !_secondWind && PlayerHpFrac < 0.25)
{
_secondWind = true;
double heal = Player.MaxHp * Player.SecondWind;
PlayerHp += heal;
Add(new FightEvent(FightEventType.Heal, heal));
}
if (PlayerHp <= 0) Finish(false);
}
public void ApplySpecial(Special s)
{
if (Over) return;
switch (s)
{
case Special.ShieldBash: _stun = 2; break;
case Special.Net: _net = 4; break;
case Special.Sica: _sica = 3; break;
case Special.Endure:
double heal = Math.Min(Player.MaxHp - PlayerHp, Player.MaxHp * 0.3);
PlayerHp += heal;
Add(new FightEvent(FightEventType.Heal, heal));
break;
}
Add(new FightEvent(FightEventType.Special));
}
double Spread() => 0.85 + 0.3 * _rng.NextDouble();
void Finish(bool won) { Over = true; Won = won; }
void Add(FightEvent e) { if (CollectEvents) Events.Add(e); }
}
} }

View File

@@ -56,9 +56,6 @@ namespace GladiatorIdle
public int Wins { get; private set; } public int Wins { get; private set; }
public int Losses { get; private set; } public int Losses { get; private set; }
public double RunSeconds { get; private set; } public double RunSeconds { get; private set; }
public Tactic Tactic { get; set; } = Tactic.Balanced;
/// Trainingsplan: Stunden je Wert (Summe höchstens <see cref="Balance.PLAN_HOURS"/>). Bleibt über Leben hinweg.
public int[] Plan { get; private set; } = { 3, 3, 2, 2 };
// Gladiator-Stufe und Attributpunkte (Kampf-Erfahrung, je Stufe frei verteilbar) // Gladiator-Stufe und Attributpunkte (Kampf-Erfahrung, je Stufe frei verteilbar)
public int CharLevel { get; private set; } public int CharLevel { get; private set; }
@@ -68,13 +65,11 @@ namespace GladiatorIdle
/// Gelernte Fähigkeiten (Rang je Id). /// Gelernte Fähigkeiten (Rang je Id).
public Dictionary<string, int> SkillRanks { get; private set; } = new(); public Dictionary<string, int> SkillRanks { get; private set; } = new();
// Ausrüstung: angelegt (je Slot), Inventar, Händler // Ausrüstung: angelegt (je Slot), Inventar
public Item?[] Equipped { get; private set; } = new Item?[5]; public Item?[] Equipped { get; private set; } = new Item?[5];
/// Verstärkung je Slot beim Schmied (bleibt beim Wechsel des Gegenstands). /// Verstärkung je Slot beim Schmied (bleibt beim Wechsel des Gegenstands).
public int[] SlotLevels { get; private set; } = new int[5]; public int[] SlotLevels { get; private set; } = new int[5];
public List<Item> Inventory { get; private set; } = new(); public List<Item> Inventory { get; private set; } = new();
public List<Item> Merchant { get; private set; } = new();
public double MerchantRefreshIn { get; private set; }
long _nextItemId = 1; long _nextItemId = 1;
// Expedition, Ereignisse, Segen // Expedition, Ereignisse, Segen
@@ -88,13 +83,8 @@ namespace GladiatorIdle
string? _lastEvent; string? _lastEvent;
// ── Laufend (nicht gespeichert) ───────────────────────────── // ── Laufend (nicht gespeichert) ─────────────────────────────
public Fight? Fight { get; private set; } /// Erholung nach einer Niederlage: so lange kein Kampf.
/// Der zuletzt beendete Kampf (Anzeige zwischen zwei Kämpfen, letzte Ereignisse).
public Fight? LastFight { get; private set; }
public double Pause { get; private set; } = 1;
public double Recovery { get; private set; } public double Recovery { get; private set; }
public double SpecialCooldown { get; private set; }
public bool ChampionNext { get; private set; }
public List<GameEvent> Events { get; } = new(); public List<GameEvent> Events { get; } = new();
/// Aus = keine Ereignis-Listen (Offline-Rechnung, Bot). /// Aus = keine Ereignis-Listen (Offline-Rechnung, Bot).
public bool CollectEvents { get; set; } = true; public bool CollectEvents { get; set; } = true;
@@ -124,8 +114,7 @@ namespace GladiatorIdle
GoldEarnedRun = FameRun = Crowd = RunSeconds = 0; GoldEarnedRun = FameRun = Crowd = RunSeconds = 0;
Arena = Rank = Wins = Losses = _lossStreak = 0; Arena = Rank = Wins = Losses = _lossStreak = 0;
FreedomEarned = false; FreedomEarned = false;
Tactic = Tactic.Balanced; Recovery = 0;
Fight = LastFight = null; Pause = 1; Recovery = 0; SpecialCooldown = 0; ChampionNext = false;
CharLevel = 0; CharXp = 0; AttrPoints = 0; StatBonus = new int[4]; SkillRanks = new(); ExtraSkillPoints = 0; CharLevel = 0; CharXp = 0; AttrPoints = 0; StatBonus = new int[4]; SkillRanks = new(); ExtraSkillPoints = 0;
Equipped = new Item?[5]; Equipped = new Item?[5];
SlotLevels = new int[5]; SlotLevels = new int[5];
@@ -137,7 +126,6 @@ namespace GladiatorIdle
var it = new Item { Id = _nextItemId++, Base = b, Rarity = Rarity.Common, Level = 0 }; var it = new Item { Id = _nextItemId++, Base = b, Rarity = Rarity.Common, Level = 0 };
Equipped[(int)it.Slot] = it; Equipped[(int)it.Slot] = it;
} }
RefreshMerchant();
} }
// ── Erstellung ────────────────────────────────────────────── // ── Erstellung ──────────────────────────────────────────────
@@ -268,7 +256,7 @@ namespace GladiatorIdle
var it = FindItem(id); var it = FindItem(id);
if (it == null) return false; if (it == null) return false;
Inventory.Remove(it); Inventory.Remove(it);
EarnGold(Items.SellValue(it)); EarnGold(Items.SellValue(it), "sell");
return true; return true;
} }
@@ -280,7 +268,7 @@ namespace GladiatorIdle
{ {
double total = InventoryValue; double total = InventoryValue;
Inventory.Clear(); Inventory.Clear();
if (total > 0) EarnGold(total); if (total > 0) EarnGold(total, "sell");
return total; return total;
} }
@@ -297,23 +285,6 @@ namespace GladiatorIdle
return true; return true;
} }
public bool BuyFromMerchant(long id)
{
var it = Merchant.FirstOrDefault(i => i.Id == id);
if (it == null || Gold < Items.Value(it) || Inventory.Count >= Items.INVENTORY) return false;
Gold -= Items.Value(it);
Merchant.Remove(it);
Inventory.Add(it);
Emit(new GameEvent(GameEventType.Purchased, it.Level, Items.Value(it), it.Base));
return true;
}
public void RefreshMerchant()
{
Merchant = Enumerable.Range(0, Items.MERCHANT_OFFERS).Select(_ => Items.MerchantItem(_rng, Tier, _nextItemId++)).ToList();
MerchantRefreshIn = Items.MERCHANT_REFRESH;
}
/// Für jeden Slot das Stück mit der höchsten Kampfkraft anlegen (Knopf "Bestes anlegen", Bot). /// Für jeden Slot das Stück mit der höchsten Kampfkraft anlegen (Knopf "Bestes anlegen", Bot).
public int EquipBest() public int EquipBest()
{ {
@@ -339,7 +310,7 @@ namespace GladiatorIdle
// voll: das schwächste Stück (nach Wert) wird automatisch verkauft // voll: das schwächste Stück (nach Wert) wird automatisch verkauft
var worst = Inventory.Append(it).OrderBy(Items.Value).First(); var worst = Inventory.Append(it).OrderBy(Items.Value).First();
if (worst != it) { Inventory.Remove(worst); Inventory.Add(it); } if (worst != it) { Inventory.Remove(worst); Inventory.Add(it); }
EarnGold(Items.SellValue(worst)); EarnGold(Items.SellValue(worst), "sell");
Emit(new GameEvent(GameEventType.LootSold, Items.SellValue(worst), (int)worst.Rarity, worst.Base)); Emit(new GameEvent(GameEventType.LootSold, Items.SellValue(worst), (int)worst.Rarity, worst.Base));
if (worst == it) return; if (worst == it) return;
} }
@@ -362,28 +333,17 @@ namespace GladiatorIdle
return t == 0 ? 0 : 0.6 * t * Math.Pow(1.08, t) * XpMult(s); return t == 0 ? 0 : 0.6 * t * Math.Pow(1.08, t) * XpMult(s);
} }
/// Drill nach Trainingsplan: XP/s für diesen Wert. /// Tägliches Training im Ludus (feste Aufteilung): XP/s für diesen Wert, wächst mit den Ausbildern.
public double DrillXpPerSec(Stat s) public double DrillXpPerSec(Stat s)
{ {
double trainers = 0; double trainers = 0;
for (int i = 0; i < 4; i++) trainers += TrainerXpPerSec((Stat)i); for (int i = 0; i < 4; i++) trainers += TrainerXpPerSec((Stat)i);
return (Balance.DRILL_BASE * XpMult(s) + Balance.DRILL_TRAINER_SHARE * trainers) * Plan[(int)s] / Balance.PLAN_HOURS; return (Balance.DRILL_BASE * XpMult(s) + Balance.DRILL_TRAINER_SHARE * trainers) * Balance.DRILL_SPLIT[(int)s];
} }
/// Gesamt-XP/s eines Werts (Ausbilder + Drill). /// Gesamt-XP/s eines Werts (Ausbilder + Training).
public double XpPerSec(Stat s) => TrainerXpPerSec(s) + DrillXpPerSec(s); public double XpPerSec(Stat s) => TrainerXpPerSec(s) + DrillXpPerSec(s);
public int PlanFree => Balance.PLAN_HOURS - Plan.Sum();
/// Eine Stunde im Plan dazu (+1) oder weg (−1). false, wenn nicht möglich.
public bool ChangePlan(Stat s, int delta)
{
int v = Plan[(int)s] + delta;
if (v < 0 || v > Balance.PLAN_MAX_PER_STAT || (delta > 0 && PlanFree <= 0)) return false;
Plan[(int)s] = v;
return true;
}
public double XpToNext(Stat s) => Balance.XpToNext(Level(s)); public double XpToNext(Stat s) => Balance.XpToNext(Level(s));
public Combatant PlayerCombat() public Combatant PlayerCombat()
@@ -405,15 +365,10 @@ namespace GladiatorIdle
public double GoldMult => Balance.CrowdMult(Crowd) * Gods.GoldMult(GodLevel(God.Fortuna)) * AllMult * Gear.GoldMult * BuffMult(BuffKind.Gold); public double GoldMult => Balance.CrowdMult(Crowd) * Gods.GoldMult(GodLevel(God.Fortuna)) * AllMult * Gear.GoldMult * BuffMult(BuffKind.Gold);
public double FameMult => Balance.CrowdMult(Crowd) * Balance.FameMult(Level(Stat.Showmanship)) * AllMult; public double FameMult => Balance.CrowdMult(Crowd) * Balance.FameMult(Level(Stat.Showmanship)) * AllMult;
/// Einnahmen der Taberna pro Sekunde (wächst mit der aktuellen Gegnerstufe).
public double GoldPerSec =>
0.03 * UpgradeLevel("building.taberna") * Balance.GoldPerWin(Tier)
* Gods.GoldMult(GodLevel(God.Fortuna)) * AllMult;
public double RecoveryTime => public double RecoveryTime =>
Balance.RECOVERY_TIME * Math.Pow(0.88, UpgradeLevel("building.baths")) * Gods.RecoveryMult(GodLevel(God.Apollo)) * Perks.RecoveryMult; Balance.RECOVERY_TIME * Math.Pow(0.88, UpgradeLevel("building.baths")) * Gods.RecoveryMult(GodLevel(God.Apollo)) * Perks.RecoveryMult;
public double FameRequired => Balance.FameRequired(Arena) * (ManualFights ? Balance.MANUAL_FAME[Arena] : 1); public double FameRequired => Balance.FameRequired(Arena) * Balance.MANUAL_FAME[Arena];
public bool CanChallenge => !FreedomEarned && FameRun >= FameRequired; public bool CanChallenge => !FreedomEarned && FameRun >= FameRequired;
// ── Takt ──────────────────────────────────────────────────── // ── Takt ────────────────────────────────────────────────────
@@ -427,76 +382,26 @@ namespace GladiatorIdle
double r = XpPerSec((Stat)i); double r = XpPerSec((Stat)i);
if (r > 0) AddXp((Stat)i, r * dt); if (r > 0) AddXp((Stat)i, r * dt);
} }
double income = GoldPerSec * dt; Recovery = Math.Max(0, Recovery - dt);
if (income > 0) EarnGold(income);
SpecialCooldown = Math.Max(0, SpecialCooldown - dt);
PracticeCooldown = Math.Max(0, PracticeCooldown - dt);
if ((MerchantRefreshIn -= dt) <= 0) RefreshMerchant();
for (int i = Buffs.Count - 1; i >= 0; i--) for (int i = Buffs.Count - 1; i >= 0; i--)
if ((Buffs[i].Left -= dt) <= 0) Buffs.RemoveAt(i); if ((Buffs[i].Left -= dt) <= 0) Buffs.RemoveAt(i);
// Ereignisse nur beim aktiven Spielen (nicht offline, nicht unterwegs) // Ereignisse nur beim aktiven Spielen (nicht offline, nicht unterwegs)
if (CollectEvents && Away == null && PendingEvent == null && (EventIn -= dt) <= 0) StartEvent(); if (CollectEvents && Away == null && PendingEvent == null && (EventIn -= dt) <= 0) StartEvent();
if (Away != null && (Away.Left -= dt) <= 0) FinishExpedition(); // unterwegs: kein Kampf, Training läuft weiter
if (Away != null)
{
if ((Away.Left -= dt) <= 0) FinishExpedition();
return; // unterwegs: keine Arenakämpfe (Training läuft oben weiter)
}
if (ManualFights)
{
// selbst kämpfen: nur die Erholung läuft, Kämpfe startet der Spieler
Recovery = Math.Max(0, Recovery - dt);
return;
}
if (Recovery > 0)
{
Recovery -= dt;
if (Recovery <= 0) { Recovery = 0; Pause = 0.5; }
}
else if (Fight == null)
{
Pause -= dt;
if (Pause <= 0) StartFight();
}
else
{
Fight.Tactic = Tactic;
Fight.Step(dt);
if (Fight.Over) EndFight();
}
} }
void StartFight() /// Ergebnis eines Duells: Lohn, Aufstieg bzw. Niederlage.
{ /// <paramref name="bonus"/>: Faktor auf Gold/Ruhm/Erfahrung (Wahl des Gegners).
bool champ = ChampionNext && CanChallenge;
ChampionNext = false;
var enemy = Enemy.Create(Arena, Rank, champ);
Fight = new Fight(enemy, PlayerCombat(), _rng) { Tactic = Tactic, CollectEvents = CollectEvents };
Emit(new GameEvent(GameEventType.FightStarted, enemy.Tier, champ ? 1 : 0, enemy.NameKey));
}
void EndFight()
{
var f = Fight!;
Fight = null;
LastFight = f;
ApplyResult(f.Enemy, f.Won, 1);
}
/// Ergebnis eines Kampfs (automatisch oder Echtzeit): Lohn, Aufstieg bzw. Niederlage.
/// <paramref name="bonus"/>: Faktor auf Gold/Ruhm/Erfahrung (Übungsduell).
void ApplyResult(Enemy enemy, bool won, double bonus) void ApplyResult(Enemy enemy, bool won, double bonus)
{ {
var f = (Enemy: enemy, Won: won); var f = (Enemy: enemy, Won: won);
Pause = Balance.FIGHT_PAUSE;
if (f.Won) if (f.Won)
{ {
Wins++; _lossStreak = 0; Wins++; _lossStreak = 0;
double reward = (f.Enemy.IsChampion ? Balance.CHAMPION_REWARD : 1) * bonus; double reward = (f.Enemy.IsChampion ? Balance.CHAMPION_REWARD : 1) * bonus;
double gold = Balance.GoldPerWin(f.Enemy.Tier) * reward * GoldMult; double gold = Balance.GoldPerWin(f.Enemy.Tier) * Balance.FIGHT_GOLD * reward * GoldMult;
double fame = Balance.FamePerWin(f.Enemy.Tier) * reward * FameMult; double fame = Balance.FamePerWin(f.Enemy.Tier) * reward * FameMult;
EarnGold(gold); EarnGold(gold, "fight");
FameRun += fame; FameRun += fame;
Crowd = Math.Min(100, Crowd + Balance.CROWD_WIN * CrowdGain); Crowd = Math.Min(100, Crowd + Balance.CROWD_WIN * CrowdGain);
Emit(new GameEvent(GameEventType.FightWon, gold, fame, f.Enemy.NameKey)); Emit(new GameEvent(GameEventType.FightWon, gold, fame, f.Enemy.NameKey));
@@ -512,7 +417,6 @@ namespace GladiatorIdle
else else
{ {
Arena++; Rank = 0; Arena++; Rank = 0;
RefreshMerchant(); // neue Arena, neue Ware
Emit(new GameEvent(GameEventType.ArenaUnlocked, Arena)); Emit(new GameEvent(GameEventType.ArenaUnlocked, Arena));
} }
} }
@@ -529,7 +433,9 @@ namespace GladiatorIdle
} }
} }
void EarnGold(double g) { Gold += g; GoldEarnedRun += g; } void EarnGold(double g, string source = "other") { Gold += g; GoldEarnedRun += g; GoldBySource[source] = GoldBySource.GetValueOrDefault(source) + g; }
/// Einnahmen je Quelle in diesem Spiel (nicht gespeichert; Balance-Bot).
public Dictionary<string, double> GoldBySource { get; } = new();
/// Gewinn an Gunst der Menge: Showtalent, Bacchus, Ausrüstung. /// Gewinn an Gunst der Menge: Showtalent, Bacchus, Ausrüstung.
double CrowdGain => Balance.CrowdGainMult(Level(Stat.Showmanship)) * Gods.CrowdGainMult(GodLevel(God.Bacchus)) * Gear.CrowdMult; double CrowdGain => Balance.CrowdGainMult(Level(Stat.Showmanship)) * Gods.CrowdGainMult(GodLevel(God.Bacchus)) * Gear.CrowdMult;
@@ -559,32 +465,32 @@ namespace GladiatorIdle
public bool StartExpedition(string region, int duration) public bool StartExpedition(string region, int duration)
{ {
var r = RegionDef.Get(region); var r = RegionDef.Get(region);
if (Away != null || !RegionOpen(r) || Fight is { Enemy.IsChampion: true } || FreedomEarned) return false; if (Away != null || !RegionOpen(r) || FreedomEarned) return false;
Fight = null; ChampionNext = false; Recovery = 0; Recovery = 0;
Away = new Expedition { Region = region, Duration = duration, Left = Adventures.Durations[duration], Chance = ExpeditionChance(r) }; Away = new Expedition { Region = region, Duration = duration, Left = Adventures.Durations[duration], Chance = ExpeditionChance(r) };
return true; return true;
} }
/// Zurückrufen: sofort zurück, ohne Belohnung. /// Zurückrufen: sofort zurück, ohne Belohnung.
public void Recall() { Away = null; Pause = 1; } public void Recall() { Away = null; }
void FinishExpedition() void FinishExpedition()
{ {
var a = Away!; var a = Away!;
Away = null; Away = null;
Pause = 1;
var r = RegionDef.Get(a.Region); var r = RegionDef.Get(a.Region);
bool ok = _rng.NextDouble() < a.Chance; bool ok = _rng.NextDouble() < a.Chance;
double fights = Adventures.Durations[a.Duration] / 9.0; // so viele Kämpfe hätte er ungefähr geschafft // Lohn in "Siegen" der Region: weniger, als man in der Zeit selbst erkämpfen würde – Hauptlohn ist die Beute
double fights = Adventures.Wins[a.Duration];
double share = ok ? 1 : 0.5; double share = ok ? 1 : 0.5;
var rep = new ExpeditionReport var rep = new ExpeditionReport
{ {
Region = a.Region, Success = ok, Region = a.Region, Success = ok,
Gold = Balance.GoldPerWin(r.Tier) * GoldMult * fights * 0.9 * share, Gold = Balance.GoldPerWin(r.Tier) * GoldMult * fights * 0.9 * share,
Fame = Balance.FamePerWin(r.Tier) * FameMult * fights * 0.3 * share, Fame = Balance.FamePerWin(r.Tier) * FameMult * fights * 0.5 * share,
Xp = Balance.CharXpPerWin(r.Tier) * fights * 0.8 * share, Xp = Balance.CharXpPerWin(r.Tier) * fights * 0.8 * share,
}; };
EarnGold(rep.Gold); EarnGold(rep.Gold, "expedition");
FameRun += rep.Fame; FameRun += rep.Fame;
AddCharXp(rep.Xp); AddCharXp(rep.Xp);
if (ok) if (ok)
@@ -641,7 +547,7 @@ namespace GladiatorIdle
{ {
case EffectKind.Gold: case EffectKind.Gold:
double g = e.Amount * Balance.GoldPerWin(Tier); double g = e.Amount * Balance.GoldPerWin(Tier);
if (g >= 0) EarnGold(g); else Gold = Math.Max(0, Gold + g); if (g >= 0) EarnGold(g, "event"); else Gold = Math.Max(0, Gold + g);
break; break;
case EffectKind.Fame: FameRun = Math.Max(0, FameRun + e.Amount * Balance.FamePerWin(Tier)); break; case EffectKind.Fame: FameRun = Math.Max(0, FameRun + e.Amount * Balance.FamePerWin(Tier)); break;
case EffectKind.Crowd: Crowd = Math.Clamp(Crowd + e.Amount, 0, 100); break; case EffectKind.Crowd: Crowd = Math.Clamp(Crowd + e.Amount, 0, 100); break;
@@ -649,7 +555,6 @@ namespace GladiatorIdle
case EffectKind.Item: AddLoot(Items.Create(_rng, Items.DropLevel(Tier, _rng) + 3, e.Rarity, e.Slot, _nextItemId++)); break; case EffectKind.Item: AddLoot(Items.Create(_rng, Items.DropLevel(Tier, _rng) + 3, e.Rarity, e.Slot, _nextItemId++)); break;
case EffectKind.Buff: Buffs.Add(new ActiveBuff { Kind = e.Buff, Mult = e.Amount, Left = e.Seconds }); break; case EffectKind.Buff: Buffs.Add(new ActiveBuff { Kind = e.Buff, Mult = e.Amount, Left = e.Seconds }); break;
case EffectKind.Recovery: case EffectKind.Recovery:
if (Fight is { Enemy.IsChampion: false }) Fight = null;
Recovery = Math.Max(Recovery, e.Amount); Recovery = Math.Max(Recovery, e.Amount);
break; break;
} }
@@ -662,35 +567,13 @@ namespace GladiatorIdle
public double DuelRatio(Enemy e) => Power() / (EnemyPower(e) * EnemyWeight(e)); public double DuelRatio(Enemy e) => Power() / (EnemyPower(e) * EnemyWeight(e));
/// Im neuen Spiel (selbst kämpfen) zählen Gegner je Arena stärker; Legenden bleiben, wie sie waren. /// Gegner zählen je Arena stärker (Abstimmung); Legenden bleiben, wie sie waren.
double EnemyWeight(Enemy e) => double EnemyWeight(Enemy e) =>
ManualFights && e.Display == null ? Balance.MANUAL_ENEMY[Math.Clamp(e.Tier / Balance.RANKS_PER_ARENA, 0, Balance.ARENA_COUNT - 1)] : 1; e.Display == null ? Balance.MANUAL_ENEMY[Math.Clamp(e.Tier / Balance.RANKS_PER_ARENA, 0, Balance.ARENA_COUNT - 1)] : 1;
public Enemy ChampionEnemy => Enemy.Create(Arena, Rank, true); public Enemy ChampionEnemy => Enemy.Create(Arena, Rank, true);
public Enemy PracticeEnemy => Enemy.Create(Arena, Rank, false); /// Kampf-Einführung gesehen (oder übersprungen); in den Einstellungen wieder einschaltbar.
public bool TutorialDone { get; set; }
/// Übungsduell: wieder möglich in … Sekunden.
public double PracticeCooldown { get; private set; }
public bool CanPractice => PracticeCooldown <= 0 && Away == null && !FreedomEarned;
/// Vor dem Duell: laufenden Kampf abbrechen (ohne Folgen), damit nichts doppelt zählt.
public void BeginDuel()
{
Fight = null; ChampionNext = false;
}
/// Ergebnis eines Echtzeit-Duells übernehmen (Champion: Aufstieg/Freiheit wie sonst).
public void ResolveDuel(Enemy enemy, bool won)
{
if (!enemy.IsChampion) PracticeCooldown = Balance.PRACTICE_COOLDOWN;
ApplyResult(enemy, won, enemy.IsChampion ? 1 : Balance.PRACTICE_REWARD);
Emit(new GameEvent(won ? GameEventType.FightWon : GameEventType.FightLost, 0, 0, enemy.NameKey));
}
// ── Selbst kämpfen: Gegner wählen ───────────────────────────
/// Arenakämpfe nur auf Wunsch des Spielers (neues Spiel): der Takt startet keine Idle-Kämpfe.
public bool ManualFights { get; set; }
/// Gegner zur Wahl: leichter (weniger Lohn, kein Aufstieg), ebenbürtig, stärker (mehr Lohn, /// Gegner zur Wahl: leichter (weniger Lohn, kein Aufstieg), ebenbürtig, stärker (mehr Lohn,
/// zwei Ränge Aufstieg) und — mit genug Ruhm — der Champion der Arena. /// zwei Ränge Aufstieg) und — mit genug Ruhm — der Champion der Arena.
@@ -707,15 +590,11 @@ namespace GladiatorIdle
public bool CanFight => Recovery <= 0 && Away == null && !FreedomEarned; public bool CanFight => Recovery <= 0 && Away == null && !FreedomEarned;
/// Deutlich schwächer: ohne Kampf gewinnen (etwas weniger Lohn).
public bool CanAutoWin(Offer o) => o.Kind is OfferKind.Easy or OfferKind.Even && DuelRatio(o.Enemy) >= Balance.AUTO_RATIO;
/// Ergebnis eines selbst gekämpften Duells; Rang je nach Wahl. /// Ergebnis eines selbst gekämpften Duells; Rang je nach Wahl.
public void ResolveFight(Offer o, bool won, bool auto = false) public void ResolveFight(Offer o, bool won)
{ {
int rank = Rank; int rank = Rank;
Fight = null; ApplyResult(o.Enemy, won, o.Reward);
ApplyResult(o.Enemy, won, o.Reward * (auto ? Balance.AUTO_REWARD : 1));
if (won && !o.Enemy.IsChampion) if (won && !o.Enemy.IsChampion)
Rank = Math.Min(Balance.RANKS_PER_ARENA - 1, o.Kind switch Rank = Math.Min(Balance.RANKS_PER_ARENA - 1, o.Kind switch
{ {
@@ -726,13 +605,11 @@ namespace GladiatorIdle
Emit(new GameEvent(won ? GameEventType.FightWon : GameEventType.FightLost, 0, 0, o.Enemy.NameKey)); Emit(new GameEvent(won ? GameEventType.FightWon : GameEventType.FightLost, 0, 0, o.Enemy.NameKey));
} }
public void AutoWin(Offer o) => ResolveFight(o, true, auto: true);
/// Lohn eines Sieges (Vorschau auf der Gegnerkarte). /// Lohn eines Sieges (Vorschau auf der Gegnerkarte).
public (double Gold, double Fame, double Xp) RewardPreview(Offer o) public (double Gold, double Fame, double Xp) RewardPreview(Offer o)
{ {
double r = (o.Enemy.IsChampion ? Balance.CHAMPION_REWARD : 1) * o.Reward; double r = (o.Enemy.IsChampion ? Balance.CHAMPION_REWARD : 1) * o.Reward;
return (Balance.GoldPerWin(o.Enemy.Tier) * r * GoldMult, Balance.FamePerWin(o.Enemy.Tier) * r * FameMult, return (Balance.GoldPerWin(o.Enemy.Tier) * Balance.FIGHT_GOLD * r * GoldMult, Balance.FamePerWin(o.Enemy.Tier) * r * FameMult,
Balance.CharXpPerWin(o.Enemy.Tier) * r); Balance.CharXpPerWin(o.Enemy.Tier) * r);
} }
@@ -759,37 +636,12 @@ namespace GladiatorIdle
/// Testlauf: Gladiator-Stufe direkt setzen (Fähigkeitspunkte für den Duell-Test). /// Testlauf: Gladiator-Stufe direkt setzen (Fähigkeitspunkte für den Duell-Test).
public void DevLevel(int level) => CharLevel = level; public void DevLevel(int level) => CharLevel = level;
/// Testlauf: direkt in Arena <paramref name="arena"/> (Kulisse prüfen).
public void DevArena(int arena) { Arena = Math.Clamp(arena, 0, Balance.ARENA_COUNT - 1); Rank = 0; }
/// Testlauf: Freiheit sofort verdienen (Aufnahmen des Freiheits-Bildschirms). /// Testlauf: Freiheit sofort verdienen (Aufnahmen des Freiheits-Bildschirms).
public void DevFreedom() => FreedomEarned = true; public void DevFreedom() => FreedomEarned = true;
/// Timing-Schlag in die offene Lücke: 2 = perfekt, 1 = gut, 0 = daneben, −1 = keine Lücke.
public int Strike()
{
if (Fight is not { Over: false } f) return -1;
int q = f.Strike();
if (q > 0) Crowd = Math.Min(100, Crowd + (q == 2 ? Balance.CROWD_PERFECT : Balance.CROWD_GOOD) * CrowdGain);
return q;
}
public bool CanUseSpecial => Fight is { Over: false } && SpecialCooldown <= 0;
public bool UseSpecial()
{
if (!CanUseSpecial) return false;
Fight!.ApplySpecial(ClassDef.Special);
Crowd = Math.Min(100, Crowd + Balance.CROWD_SPECIAL);
SpecialCooldown = Balance.SPECIAL_COOLDOWN;
return true;
}
/// Der nächste Kampf ist gegen den Champion der Arena (wenn genug Ruhm).
public bool ChallengeChampion()
{
if (!CanChallenge) return false;
ChampionNext = true;
return true;
}
public double UpgradeCost(string id) => UpgradeDef.Get(id).Cost(UpgradeLevel(id)); public double UpgradeCost(string id) => UpgradeDef.Get(id).Cost(UpgradeLevel(id));
public bool Buy(string id) public bool Buy(string id)
@@ -823,7 +675,6 @@ namespace GladiatorIdle
Legends.Add(new Legend(Name, Class, Freedoms, Wins, FameRun, RunSeconds, DateTime.UtcNow, CharLevel, Power())); Legends.Add(new Legend(Name, Class, Freedoms, Wins, FameRun, RunSeconds, DateTime.UtcNow, CharLevel, Power()));
_pendingInherit = Balance.InheritGold(GoldEarnedRun, Freedoms); _pendingInherit = Balance.InheritGold(GoldEarnedRun, Freedoms);
FreedomEarned = false; FreedomEarned = false;
Fight = null;
return favor; return favor;
} }
@@ -831,8 +682,7 @@ namespace GladiatorIdle
public double OfflineCapSeconds => Gods.OfflineHours(GodLevel(God.Jupiter)) * 3600; public double OfflineCapSeconds => Gods.OfflineHours(GodLevel(God.Jupiter)) * 3600;
/// Abwesenheit nachrechnen (gedeckelt): Kämpfe und Ausbilder laufen weiter, keine /// Abwesenheit nachrechnen (gedeckelt): Training, Erholung und eine laufende Expedition.
/// Champion-Kämpfe und keine Klicks.
public OfflineReport ApplyOffline(double seconds) public OfflineReport ApplyOffline(double seconds)
{ {
seconds = Math.Clamp(seconds, 0, OfflineCapSeconds); seconds = Math.Clamp(seconds, 0, OfflineCapSeconds);
@@ -840,12 +690,9 @@ namespace GladiatorIdle
int wins = Wins, losses = Losses, levels = StatLevels.Sum(); int wins = Wins, losses = Losses, levels = StatLevels.Sum();
bool collect = CollectEvents; bool collect = CollectEvents;
CollectEvents = false; CollectEvents = false;
ChampionNext = false;
if (Fight != null) Fight.CollectEvents = false;
for (double t = 0; t < seconds; t += Balance.OFFLINE_STEP) for (double t = 0; t < seconds; t += Balance.OFFLINE_STEP)
Tick(Math.Min(Balance.OFFLINE_STEP, seconds - t)); Tick(Math.Min(Balance.OFFLINE_STEP, seconds - t));
CollectEvents = collect; CollectEvents = collect;
if (Fight != null) Fight.CollectEvents = collect;
return new OfflineReport(seconds, GoldEarnedRun - gold, FameRun - fame, Wins - wins, Losses - losses, return new OfflineReport(seconds, GoldEarnedRun - gold, FameRun - fame, Wins - wins, Losses - losses,
StatLevels.Sum() - levels); StatLevels.Sum() - levels);
} }
@@ -872,6 +719,7 @@ namespace GladiatorIdle
public HashSet<int> LegendsBeaten { get; set; } = new(); public HashSet<int> LegendsBeaten { get; set; } = new();
public Appearance? Look { get; set; } public Appearance? Look { get; set; }
public int ExtraSkillPoints { get; set; } public int ExtraSkillPoints { get; set; }
public bool TutorialDone { get; set; }
public double LifetimeFame { get; set; } public double LifetimeFame { get; set; }
public string Name { get; set; } = ""; public string Name { get; set; } = "";
public GladiatorClass Class { get; set; } public GladiatorClass Class { get; set; }
@@ -888,9 +736,7 @@ namespace GladiatorIdle
public int Wins { get; set; } public int Wins { get; set; }
public int Losses { get; set; } public int Losses { get; set; }
public double RunSeconds { get; set; } public double RunSeconds { get; set; }
public Tactic Tactic { get; set; }
public double PendingInherit { get; set; } public double PendingInherit { get; set; }
public int[] Plan { get; set; } = { 3, 3, 2, 2 };
public int CharLevel { get; set; } public int CharLevel { get; set; }
public double CharXp { get; set; } public double CharXp { get; set; }
public int AttrPoints { get; set; } public int AttrPoints { get; set; }
@@ -898,8 +744,6 @@ namespace GladiatorIdle
public Item?[] Equipped { get; set; } = new Item?[5]; public Item?[] Equipped { get; set; } = new Item?[5];
public int[] SlotLevels { get; set; } = new int[5]; public int[] SlotLevels { get; set; } = new int[5];
public List<Item> Inventory { get; set; } = new(); public List<Item> Inventory { get; set; } = new();
public List<Item> Merchant { get; set; } = new();
public double MerchantRefreshIn { get; set; }
public long NextItemId { get; set; } = 1; public long NextItemId { get; set; } = 1;
public Expedition? Away { get; set; } public Expedition? Away { get; set; }
public ExpeditionReport? ExpeditionResult { get; set; } public ExpeditionReport? ExpeditionResult { get; set; }
@@ -913,13 +757,13 @@ namespace GladiatorIdle
{ {
SavedUtc = DateTime.UtcNow, SavedUtc = DateTime.UtcNow,
Freedoms = Freedoms, GodFavor = GodFavor, GodLevels = GodLevels, Legends = Legends, LifetimeFame = LifetimeFame, Freedoms = Freedoms, GodFavor = GodFavor, GodLevels = GodLevels, Legends = Legends, LifetimeFame = LifetimeFame,
LegendsBeaten = LegendsBeaten, Look = Look, ExtraSkillPoints = ExtraSkillPoints, LegendsBeaten = LegendsBeaten, Look = Look, ExtraSkillPoints = ExtraSkillPoints, TutorialDone = TutorialDone,
Name = Name, Class = Class, StatLevels = StatLevels, StatXp = StatXp, Upgrades = Upgrades, Name = Name, Class = Class, StatLevels = StatLevels, StatXp = StatXp, Upgrades = Upgrades,
Gold = Gold, GoldEarnedRun = GoldEarnedRun, FameRun = FameRun, Crowd = Crowd, Gold = Gold, GoldEarnedRun = GoldEarnedRun, FameRun = FameRun, Crowd = Crowd,
Arena = Arena, Rank = Rank, FreedomEarned = FreedomEarned, Wins = Wins, Losses = Losses, Arena = Arena, Rank = Rank, FreedomEarned = FreedomEarned, Wins = Wins, Losses = Losses,
RunSeconds = RunSeconds, Tactic = Tactic, PendingInherit = _pendingInherit, Plan = Plan, RunSeconds = RunSeconds, PendingInherit = _pendingInherit,
CharLevel = CharLevel, CharXp = CharXp, AttrPoints = AttrPoints, StatBonus = StatBonus, CharLevel = CharLevel, CharXp = CharXp, AttrPoints = AttrPoints, StatBonus = StatBonus,
Equipped = Equipped, SlotLevels = SlotLevels, Inventory = Inventory, Merchant = Merchant, MerchantRefreshIn = MerchantRefreshIn, Equipped = Equipped, SlotLevels = SlotLevels, Inventory = Inventory,
NextItemId = _nextItemId, NextItemId = _nextItemId,
Away = Away, ExpeditionResult = ExpeditionResult, PendingEvent = PendingEvent, EventIn = EventIn, Buffs = Buffs, Away = Away, ExpeditionResult = ExpeditionResult, PendingEvent = PendingEvent, EventIn = EventIn, Buffs = Buffs,
SkillRanks = SkillRanks SkillRanks = SkillRanks
@@ -930,21 +774,21 @@ namespace GladiatorIdle
var g = new GameState(seed) var g = new GameState(seed)
{ {
Freedoms = d.Freedoms, GodFavor = d.GodFavor, LifetimeFame = d.LifetimeFame, Freedoms = d.Freedoms, GodFavor = d.GodFavor, LifetimeFame = d.LifetimeFame,
GodLevels = Fit(d.GodLevels, 6), Legends = d.Legends ?? new(), LegendsBeaten = d.LegendsBeaten ?? new(), Look = d.Look ?? new(), ExtraSkillPoints = d.ExtraSkillPoints, GodLevels = Fit(d.GodLevels, 6), Legends = d.Legends ?? new(), LegendsBeaten = d.LegendsBeaten ?? new(), Look = d.Look ?? new(), ExtraSkillPoints = d.ExtraSkillPoints, TutorialDone = d.TutorialDone,
Name = d.Name, Class = d.Class, StatLevels = Fit(d.StatLevels, 4), StatXp = Fit(d.StatXp, 4), Name = d.Name, Class = d.Class, StatLevels = Fit(d.StatLevels, 4), StatXp = Fit(d.StatXp, 4),
Upgrades = d.Upgrades ?? new(), // nur bekannte Gebäude (die Taberna gibt es nicht mehr)
Upgrades = (d.Upgrades ?? new()).Where(kv => UpgradeDef.All.Any(u => u.Id == kv.Key)).ToDictionary(kv => kv.Key, kv => kv.Value),
Gold = d.Gold, GoldEarnedRun = d.GoldEarnedRun, FameRun = d.FameRun, Crowd = Math.Clamp(d.Crowd, 0, 100), Gold = d.Gold, GoldEarnedRun = d.GoldEarnedRun, FameRun = d.FameRun, Crowd = Math.Clamp(d.Crowd, 0, 100),
Arena = Math.Clamp(d.Arena, 0, Balance.ARENA_COUNT - 1), Arena = Math.Clamp(d.Arena, 0, Balance.ARENA_COUNT - 1),
Rank = Math.Clamp(d.Rank, 0, Balance.RANKS_PER_ARENA - 1), Rank = Math.Clamp(d.Rank, 0, Balance.RANKS_PER_ARENA - 1),
FreedomEarned = d.FreedomEarned, Wins = d.Wins, Losses = d.Losses, RunSeconds = d.RunSeconds, FreedomEarned = d.FreedomEarned, Wins = d.Wins, Losses = d.Losses, RunSeconds = d.RunSeconds
Tactic = d.Tactic
}; };
g._pendingInherit = d.PendingInherit; g._pendingInherit = d.PendingInherit;
g.CharLevel = d.CharLevel; g.CharXp = d.CharXp; g.AttrPoints = d.AttrPoints; g.StatBonus = Fit(d.StatBonus, 4); g.CharLevel = d.CharLevel; g.CharXp = d.CharXp; g.AttrPoints = d.AttrPoints; g.StatBonus = Fit(d.StatBonus, 4);
g.Equipped = Fit(d.Equipped, 5); g.Equipped = Fit(d.Equipped, 5);
g.SlotLevels = Fit(d.SlotLevels, 5); g.SlotLevels = Fit(d.SlotLevels, 5);
g.Inventory = d.Inventory ?? new(); g.Merchant = d.Merchant ?? new(); g.Inventory = d.Inventory ?? new();
g.MerchantRefreshIn = d.MerchantRefreshIn; g._nextItemId = Math.Max(1, d.NextItemId); g._nextItemId = Math.Max(1, d.NextItemId);
// ältere Spielstände ohne Ausrüstung: Startausrüstung der Klasse // ältere Spielstände ohne Ausrüstung: Startausrüstung der Klasse
if (g.Equipped.All(e => e == null)) if (g.Equipped.All(e => e == null))
foreach (var b in Items.StartKit(g.Class)) foreach (var b in Items.StartKit(g.Class))
@@ -952,13 +796,10 @@ namespace GladiatorIdle
var it = new Item { Id = g._nextItemId++, Base = b }; var it = new Item { Id = g._nextItemId++, Base = b };
g.Equipped[(int)it.Slot] = it; g.Equipped[(int)it.Slot] = it;
} }
if (g.Merchant.Count == 0) g.RefreshMerchant();
g.Away = d.Away; g.ExpeditionResult = d.ExpeditionResult; g.Buffs = d.Buffs ?? new(); g.Away = d.Away; g.ExpeditionResult = d.ExpeditionResult; g.Buffs = d.Buffs ?? new();
g.SkillRanks = (d.SkillRanks ?? new()).Where(kv => SkillDef.All.Any(s => s.Id == kv.Key)).ToDictionary(kv => kv.Key, kv => kv.Value); g.SkillRanks = (d.SkillRanks ?? new()).Where(kv => SkillDef.All.Any(s => s.Id == kv.Key)).ToDictionary(kv => kv.Key, kv => kv.Value);
g.PendingEvent = d.PendingEvent != null && Adventures.Events.Any(e => e.Id == d.PendingEvent) ? d.PendingEvent : null; g.PendingEvent = d.PendingEvent != null && Adventures.Events.Any(e => e.Id == d.PendingEvent) ? d.PendingEvent : null;
g.EventIn = d.EventIn > 0 ? d.EventIn : Adventures.EVENT_MIN; g.EventIn = d.EventIn > 0 ? d.EventIn : Adventures.EVENT_MIN;
var plan = Fit(d.Plan, 4);
if (plan.Sum() <= Balance.PLAN_HOURS && plan.All(p => p >= 0 && p <= Balance.PLAN_MAX_PER_STAT)) g.Plan = plan;
return g; return g;
} }

View File

@@ -87,8 +87,6 @@ namespace GladiatorIdle
public const double DROP_CHANCE = 0.25; public const double DROP_CHANCE = 0.25;
public const int INVENTORY = 30; public const int INVENTORY = 30;
public const int MERCHANT_OFFERS = 6;
public const double MERCHANT_REFRESH = 600; // Sekunden
/// Schaden/Leben je wirksamer Stufe (wie früher die Ausrüstungs-Stufen). /// Schaden/Leben je wirksamer Stufe (wie früher die Ausrüstungs-Stufen).
public const double LEVEL_GROWTH = 1.17; public const double LEVEL_GROWTH = 1.17;
@@ -171,10 +169,7 @@ namespace GladiatorIdle
return Create(rng, DropLevel(tier, rng) + (champion ? 3 : 0), RollRarity(rng, champion ? ChampionWeights : DropWeights), id: id); return Create(rng, DropLevel(tier, rng) + (champion ? 3 : 0), RollRarity(rng, champion ? ChampionWeights : DropWeights), id: id);
} }
public static Item MerchantItem(Random rng, int tier, long id) => /// Grundwert in Denaren (Verkauf bringt ein Viertel).
Create(rng, DropLevel(tier, rng) + 1, RollRarity(rng, new[] { 30, 40, 22, 7, 1 }), id: id);
/// Grundwert in Gold (Händler-Preis; Verkauf bringt ein Viertel).
public static double Value(Item it) => public static double Value(Item it) =>
25 * Math.Pow(1.5, it.EffLevel(0)) * (1 + 0.25 * it.Affixes.Count); 25 * Math.Pow(1.5, it.EffLevel(0)) * (1 + 0.25 * it.Affixes.Count);

View File

@@ -22,97 +22,8 @@ namespace GladiatorIdle
DevShot.Log(missing.Count == 0 ? "keys ok" : "keys MISSING: " + string.Join(", ", missing)); DevShot.Log(missing.Count == 0 ? "keys ok" : "keys MISSING: " + string.Join(", ", missing));
if (DevShot.FastForwardHours > 0) { Offline(DevShot.FastForwardHours); return; } if (DevShot.FastForwardHours > 0) { Offline(DevShot.FastForwardHours); return; }
if (DevShot.DuelTest) { DuelTest(); return; } if (DevShot.DuelTest) { DuelTest(); return; }
if (Array.IndexOf(Environment.GetCommandLineArgs(), "--arenatest") >= 0) { ArenaRun(); return; }
var gs = new GameState(seed: 1); ArenaRun(); // Standard: der Bot spielt bis zur Freiheit
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();
}
} }
/// Immer das Billigste: Ausbilder, Gebäude oder eine Schmied-Stufe für ein angelegtes Stück. /// 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) static void ManageGear(GameState gs)
{ {
gs.EquipBest(); gs.EquipBest();
@@ -139,8 +50,8 @@ namespace GladiatorIdle
} }
while (gs.AttrPoints > 0) while (gs.AttrPoints > 0)
{ {
// Wert, der im Verhältnis zum Plan am wenigsten Punkte hat // Wert, der im Verhältnis zum Training 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(); var s = Enum.GetValues<Stat>().OrderBy(x => (gs.StatBonus[(int)x] + 1.0) / Balance.DRILL_SPLIT[(int)x]).First();
gs.SpendPoint(s); gs.SpendPoint(s);
} }
} }
@@ -169,7 +80,7 @@ namespace GladiatorIdle
{ {
var gs = new GameState(seed: 2); var gs = new GameState(seed: 2);
gs.NewRun(DevShot.Name, DevShot.Class); 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); for (double t = 0; t < 600; t += DT) gs.Tick(DT);
BuyCheapest(gs); BuyCheapest(gs);
gs.Events.Clear(); gs.Events.Clear();
@@ -177,7 +88,7 @@ namespace GladiatorIdle
var sw = System.Diagnostics.Stopwatch.StartNew(); var sw = System.Diagnostics.Stopwatch.StartNew();
var r = gs.ApplyOffline(hours * 3600); 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, " + 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)}"); DevShot.Log($"offline after: {Snapshot(gs)}");
} }
@@ -186,7 +97,6 @@ namespace GladiatorIdle
{ {
var gs = new GameState(seed: 3); var gs = new GameState(seed: 3);
gs.NewRun("Test", GladiatorClass.Thraex); gs.NewRun("Test", GladiatorClass.Thraex);
gs.ChangePlan(Stat.Showmanship, -1);
for (int i = 0; i < 3000; i++) gs.Tick(DT); for (int i = 0; i < 3000; i++) gs.Tick(DT);
BuyCheapest(gs); BuyCheapest(gs);
string a = Json(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. /// Duell-Bot: spielt Echtzeit-Duelle mit Geschick 0..1 und misst Siegquote und Dauer je Kampfkraft-Verhältnis.
static void DuelTest() static void DuelTest()
{ {
HeavyProbe();
// jede Fähigkeit einzeln (volle Ränge): Champion, Verhältnis 1,4, mittleres Geschick // jede Fähigkeit einzeln (volle Ränge): Champion, Verhältnis 1,4, mittleres Geschick
foreach (var sk in SkillDef.All) 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"; static string H(double s) => $"{s / 3600:0.00} h";
} }
} }

View File

@@ -13,12 +13,12 @@ namespace GladiatorIdle
/// </summary> /// </summary>
internal static partial class Playtest internal static partial class Playtest
{ {
const double HUB_TIME = 8, AUTO_TIME = 2; const double HUB_TIME = 8;
sealed class ArenaStats sealed class ArenaStats
{ {
public double Start; public double Start;
public int Fights, Wins, Losses, Autos, ChampTries; public int Fights, Wins, Losses, ChampTries;
public readonly Dictionary<OfferKind, int> Picks = new(); public readonly Dictionary<OfferKind, int> Picks = new();
public double RatioSum; public int RatioN; public double RatioSum; public int RatioN;
public string Entry = ""; public string Entry = "";
@@ -29,12 +29,21 @@ namespace GladiatorIdle
var gs = new GameState(seed: 1); var gs = new GameState(seed: 1);
var start = GameState.StartSkills(DevShot.Class).First().Id; var start = GameState.StartSkills(DevShot.Class).First().Id;
gs.Create(DevShot.Name, DevShot.Class, new Appearance(), new[] { 2, 1, 2, 0 }, start); gs.Create(DevShot.Name, DevShot.Class, new Appearance(), new[] { 2, 1, 2, 0 }, start);
gs.ManualFights = true; DevShot.Log($"arenatest: class={DevShot.Class} skill={DevShot.Skill} maxHours={DevShot.Hours}");
double time = PlayArena(gs, DevShot.Hours, DevShot.Skill, log: true);
DevShot.Log(gs.FreedomEarned ? $"FREEDOM after {H(time)}" : $"NO freedom after {H(time)} (arena {gs.Arena} rank {gs.Rank})");
}
/// Spielstand für Screenshots (<c>--sim H</c>): <paramref name="hours"/> Spielzeit mit dem Bot vorspielen.
public static void Advance(GameState gs, double hours, double skill = 0.6) => PlayArena(gs, hours, skill, log: false);
/// Der Bot spielt: Gegner wählen, Duell simulieren, Ausrüstung und Käufe. Liefert die Spielzeit.
static double PlayArena(GameState gs, double hours, double skill, bool log)
{
var rng = new Random(11); var rng = new Random(11);
double time = 0, nextReport = 1800; double time = 0, nextReport = 1800;
var st = new ArenaStats { Entry = OfferRatios(gs) }; var st = new ArenaStats { Entry = OfferRatios(gs) };
DevShot.Log($"arenatest: class={DevShot.Class} skill={DevShot.Skill} maxHours={DevShot.Hours}"); if (log) DevShot.Log($"arena 0 offers: {st.Entry}");
DevShot.Log($"arena 0 offers: {st.Entry}");
void Pass(double seconds) void Pass(double seconds)
{ {
@@ -42,10 +51,11 @@ namespace GladiatorIdle
time += seconds; time += seconds;
} }
while (time < DevShot.Hours * 3600 && !gs.FreedomEarned) while (time < hours * 3600 && !gs.FreedomEarned)
{ {
ManageGear(gs); ManageGear(gs);
BuyCheapest(gs); BuyCheapest(gs);
if (gs.PendingEvent != null) gs.Choose(0);
if (!gs.CanFight) { Pass(5); continue; } // Erholung abwarten if (!gs.CanFight) { Pass(5); continue; } // Erholung abwarten
var offers = gs.Offers(); var offers = gs.Offers();
@@ -55,33 +65,23 @@ namespace GladiatorIdle
st.RatioSum += ratio; st.RatioN++; st.RatioSum += ratio; st.RatioN++;
int arena = gs.Arena; int arena = gs.Arena;
if (gs.CanAutoWin(pick) && pick.Kind != OfferKind.Hard) if (pick.Kind == OfferKind.Champion) st.ChampTries++;
{ var (won, secs) = SimulateDuel(gs, pick.Enemy, rng, skill);
gs.AutoWin(pick); Pass(secs + HUB_TIME);
st.Autos++; st.Wins++; st.Fights++; gs.ResolveFight(pick, won);
Pass(AUTO_TIME); st.Fights++;
} if (won) st.Wins++; else st.Losses++;
else
{
if (pick.Kind == OfferKind.Champion) st.ChampTries++;
var (won, secs) = SimulateDuel(gs, pick.Enemy, rng);
gs.BeginDuel();
Pass(secs + HUB_TIME);
gs.ResolveFight(pick, won);
st.Fights++;
if (won) st.Wins++; else st.Losses++;
}
gs.Events.Clear(); gs.Events.Clear();
if (gs.Arena != arena || gs.FreedomEarned) if (gs.Arena != arena || gs.FreedomEarned)
{ {
LogArena(arena, time, st, gs); if (log) LogArena(arena, time, st, gs);
st = new ArenaStats { Start = time, Entry = OfferRatios(gs) }; st = new ArenaStats { Start = time, Entry = OfferRatios(gs) };
if (!gs.FreedomEarned) DevShot.Log($"arena {gs.Arena} offers: {st.Entry}"); if (log && !gs.FreedomEarned) DevShot.Log($"arena {gs.Arena} offers: {st.Entry}");
} }
if (time >= nextReport) { nextReport += 1800; DevShot.Log($" {H(time)} {Snapshot(gs)}"); } if (log && time >= nextReport) { nextReport += 1800; DevShot.Log($" {H(time)} {Snapshot(gs)}"); }
} }
DevShot.Log(gs.FreedomEarned ? $"FREEDOM after {H(time)}" : $"NO freedom after {H(time)} (arena {gs.Arena} rank {gs.Rank})"); return time;
} }
/// Wahl wie ein vernünftiger Spieler: Champion, sobald möglich und nicht hoffnungslos; sonst /// Wahl wie ein vernünftiger Spieler: Champion, sobald möglich und nicht hoffnungslos; sonst
@@ -96,12 +96,12 @@ namespace GladiatorIdle
return Get(OfferKind.Easy) ?? Get(OfferKind.Even) ?? offers[0]; return Get(OfferKind.Easy) ?? Get(OfferKind.Even) ?? offers[0];
} }
static (bool Won, double Seconds) SimulateDuel(GameState gs, Enemy enemy, Random rng) static (bool Won, double Seconds) SimulateDuel(GameState gs, Enemy enemy, Random rng, double skill)
{ {
var pc = gs.PlayerCombat(); var pc = gs.PlayerCombat();
var d = new Duel(pc.MaxHp, pc.Crit, gs.ClassDef.Special, enemy.Hp, gs.DuelRatio(enemy), enemy.IsChampion, var d = new Duel(pc.MaxHp, pc.Crit, gs.ClassDef.Special, enemy.Hp, gs.DuelRatio(enemy), enemy.IsChampion,
gs.Equipped[(int)ItemSlot.Weapon]?.Base == "trident", rng, gs.Perks); gs.Equipped[(int)ItemSlot.Weapon]?.Base == "trident", rng, gs.Perks);
var bot = new DuelBot(DevShot.Skill, rng); var bot = new DuelBot(skill, rng);
while (!d.Over && d.Time < 180) { bot.Act(d); d.Step(1 / 60.0); d.Events.Clear(); } while (!d.Over && d.Time < 180) { bot.Act(d); d.Step(1 / 60.0); d.Events.Clear(); }
return (d.PlayerWon, d.Time); return (d.PlayerWon, d.Time);
} }
@@ -114,9 +114,10 @@ namespace GladiatorIdle
{ {
string picks = string.Join(",", st.Picks.OrderBy(p => p.Key).Select(p => $"{p.Key}:{p.Value}")); string picks = string.Join(",", st.Picks.OrderBy(p => p.Key).Select(p => $"{p.Key}:{p.Value}"));
DevShot.Log($"arena {arena} done at {H(time)} (+{(time - st.Start) / 60:0} min): fights={st.Fights} W/L={st.Wins}/{st.Losses} " + DevShot.Log($"arena {arena} done at {H(time)} (+{(time - st.Start) / 60:0} min): fights={st.Fights} W/L={st.Wins}/{st.Losses} " +
$"auto={st.Autos} champTries={st.ChampTries} picks=[{picks}] avgRatio={st.RatioSum / Math.Max(1, st.RatioN):0.00} " + $"champTries={st.ChampTries} picks=[{picks}] avgRatio={st.RatioSum / Math.Max(1, st.RatioN):0.00} " +
$"lv={gs.CharLevel} pow={gs.Power():0.##e0} exp=[" + $"lv={gs.CharLevel} pow={gs.Power():0.##e0} exp=[" +
string.Join(",", RegionDef.All.Where(gs.RegionOpen).Select(r => $"{r.Id}:{gs.ExpeditionChance(r):P0}")) + "]"); string.Join(",", RegionDef.All.Where(gs.RegionOpen).Select(r => $"{r.Id}:{gs.ExpeditionChance(r):P0}")) + "] gold=[" +
string.Join(",", gs.GoldBySource.OrderByDescending(k => k.Value).Select(k => $"{k.Key}:{k.Value / Math.Max(1, gs.GoldEarnedRun):P0}")) + "]");
} }
} }
} }

View File

@@ -3,7 +3,6 @@
"main.settings": "Einstellungen", "main.settings": "Einstellungen",
"main.quit": "Beenden", "main.quit": "Beenden",
"main.ludus": "Ludus", "main.ludus": "Ludus",
"main.shop": "Forum",
"res.gold": "Denare", "res.gold": "Denare",
"res.fame": "Ruhm", "res.fame": "Ruhm",
"res.crowd": "Gunst", "res.crowd": "Gunst",
@@ -41,9 +40,6 @@
"stat.endurance": "Ausdauer", "stat.endurance": "Ausdauer",
"stat.agility": "Geschick", "stat.agility": "Geschick",
"stat.showmanship": "Showtalent", "stat.showmanship": "Showtalent",
"tactic.attack": "Angriff",
"tactic.balanced": "Ausgewogen",
"tactic.defense": "Abwehr",
"upgrade.trainer.strength": "Kraft-Ausbilder", "upgrade.trainer.strength": "Kraft-Ausbilder",
"upgrade.trainer.endurance": "Ausdauer-Ausbilder", "upgrade.trainer.endurance": "Ausdauer-Ausbilder",
"upgrade.trainer.agility": "Geschick-Ausbilder", "upgrade.trainer.agility": "Geschick-Ausbilder",
@@ -51,7 +47,6 @@
"upgrade.building.baths": "Thermen", "upgrade.building.baths": "Thermen",
"upgrade.building.kitchen": "Küche", "upgrade.building.kitchen": "Küche",
"upgrade.building.medicus": "Medicus", "upgrade.building.medicus": "Medicus",
"upgrade.building.taberna": "Taberna",
"god.mars": "Mars", "god.mars": "Mars",
"god.fortuna": "Fortuna", "god.fortuna": "Fortuna",
"god.minerva": "Minerva", "god.minerva": "Minerva",
@@ -93,7 +88,6 @@
"time.m": "{0} Min.", "time.m": "{0} Min.",
"time.hm": "{0} Std. {1} Min.", "time.hm": "{0} Std. {1} Min.",
"gladiator.defaultname": "Spartacus", "gladiator.defaultname": "Spartacus",
"res.persec": "+{0}/s",
"num.pct": "{0} %", "num.pct": "{0} %",
"ludus.hp": "Leben", "ludus.hp": "Leben",
"ludus.damage": "Schaden", "ludus.damage": "Schaden",
@@ -147,16 +141,10 @@
"hall.reward": "Du hast die Legende {0} besiegt! +{1} Gunst der Götter", "hall.reward": "Du hast die Legende {0} besiegt! +{1} Gunst der Götter",
"hall.away": "Dein Gladiator ist auf Expedition.", "hall.away": "Dein Gladiator ist auf Expedition.",
"duel.legend": "Duell der Legenden", "duel.legend": "Duell der Legenden",
"forum.tab.trainers": "Ausbilder",
"forum.tab.ludus": "Ludus",
"forum.tab.gods": "Götter",
"forum.xps": "Jetzt: {0} XP/s",
"forum.recovery": "Erholung: {0}",
"upgrade.trainer.desc": "Trainiert {0} nach und nach – auch wenn du nicht spielst.", "upgrade.trainer.desc": "Trainiert {0} nach und nach – auch wenn du nicht spielst.",
"upgrade.building.baths.desc": "Schnellere Erholung nach einer Niederlage (−12 % je Stufe).", "upgrade.building.baths.desc": "Schnellere Erholung nach einer Niederlage (−12 % je Stufe).",
"upgrade.building.kitchen.desc": "Besseres Essen: +15 % XP je Stufe.", "upgrade.building.kitchen.desc": "Besseres Essen: +15 % XP je Stufe.",
"upgrade.building.medicus.desc": "Ein Heiler für den Ludus: +8 % Leben je Stufe.", "upgrade.building.medicus.desc": "Ein Heiler für den Ludus: +8 % Leben je Stufe.",
"upgrade.building.taberna.desc": "Fans zahlen für Wein und Geschichten: Denare jede Sekunde.",
"gods.favor": "Gunst der Götter: {0}", "gods.favor": "Gunst der Götter: {0}",
"gods.freedoms": "Freiheiten: {0}", "gods.freedoms": "Freiheiten: {0}",
"gods.locked": "Erringe vor dem Kaiser die Freiheit, um die Gunst der Götter zu erhalten.", "gods.locked": "Erringe vor dem Kaiser die Freiheit, um die Gunst der Götter zu erhalten.",
@@ -168,12 +156,12 @@
"god.bacchus.desc": "Die Menge liebt dich mehr und vergisst dich langsamer.", "god.bacchus.desc": "Die Menge liebt dich mehr und vergisst dich langsamer.",
"god.jupiter.desc": "+5 % auf alles und +1 Std. Offline-Zeit je Stufe.", "god.jupiter.desc": "+5 % auf alles und +1 Std. Offline-Zeit je Stufe.",
"offline.title": "Willkommen zurück!", "offline.title": "Willkommen zurück!",
"offline.away": "Du warst {0} weg. Dein Ludus hat weitergekämpft.", "offline.away": "Du warst {0} weg. Dein Ludus hat weitergearbeitet.",
"offline.gold": "Denare verdient", "offline.gold": "Denare verdient",
"offline.fame": "Ruhm gewonnen", "offline.fame": "Ruhm gewonnen",
"offline.fights": "Kämpfe", "offline.fights": "Kämpfe",
"offline.fights.value": "{0} gewonnen · {1} verloren", "offline.fights.value": "{0} gewonnen · {1} verloren",
"offline.levels": "Stufenaufstiege", "offline.levels": "Werte durch Ausbilder gestiegen",
"offline.ok": "In die Arena!", "offline.ok": "In die Arena!",
"ludus.rate": "{0} XP/s · {1} Std. am Tag", "ludus.rate": "{0} XP/s · {1} Std. am Tag",
"arena.opening": "Lücke!", "arena.opening": "Lücke!",
@@ -222,10 +210,6 @@
"special.net.desc": "Der Gegner verfehlt die Hälfte seiner nächsten vier Angriffe.", "special.net.desc": "Der Gegner verfehlt die Hälfte seiner nächsten vier Angriffe.",
"special.sica.desc": "Deine nächsten drei Treffer sind kritisch.", "special.sica.desc": "Deine nächsten drei Treffer sind kritisch.",
"special.endure.desc": "Heilt 30 % deines Lebens.", "special.endure.desc": "Heilt 30 % deines Lebens.",
"forum.tab.forge": "Schmied",
"forum.tab.merchant": "Händler",
"merchant.refresh": "Neue Ware in {0}",
"merchant.bag": "Tasche {0}/{1}",
"slot.weapon": "Waffe", "slot.weapon": "Waffe",
"slot.shield": "Schild", "slot.shield": "Schild",
"slot.helmet": "Helm", "slot.helmet": "Helm",
@@ -428,7 +412,6 @@
"offer.hard": "Stärkerer Gegner", "offer.hard": "Stärkerer Gegner",
"offer.champion": "Champion der Arena", "offer.champion": "Champion der Arena",
"hub.fight": "Kämpfen!", "hub.fight": "Kämpfen!",
"hub.auto": "Kampflos siegen",
"hub.odds.easy": "Du bist klar überlegen", "hub.odds.easy": "Du bist klar überlegen",
"hub.odds.even": "Ein ausgeglichener Kampf", "hub.odds.even": "Ein ausgeglichener Kampf",
"hub.odds.hard": "Gefährlich!", "hub.odds.hard": "Gefährlich!",
@@ -472,7 +455,7 @@
"skill.power": "Kraftvolle Hiebe", "skill.power": "Kraftvolle Hiebe",
"skill.power.desc": "+6 % Schaden je Rang.", "skill.power.desc": "+6 % Schaden je Rang.",
"skill.heavystrike": "Schwerer Schlag", "skill.heavystrike": "Schwerer Schlag",
"skill.heavystrike.desc": "Duell (Q): ein langsamer, gewaltiger Hieb mit 1,6-fachem Schaden, der jeden Block durchbricht.", "skill.heavystrike.desc": "Duell (W): ein langsamer, gewaltiger Hieb mit 2,5-fachem Schaden, der jeden Block durchbricht und den Gegner taumeln lässt.",
"skill.frenzy": "Kampfrausch", "skill.frenzy": "Kampfrausch",
"skill.frenzy.desc": "+3 % Chance auf kritische Treffer je Rang.", "skill.frenzy.desc": "+3 % Chance auf kritische Treffer je Rang.",
"skill.execute": "Gnadenstoß", "skill.execute": "Gnadenstoß",
@@ -480,7 +463,7 @@
"skill.toughness": "Abhärtung", "skill.toughness": "Abhärtung",
"skill.toughness.desc": "+7 % Leben je Rang.", "skill.toughness.desc": "+7 % Leben je Rang.",
"skill.shieldwall": "Schildwall", "skill.shieldwall": "Schildwall",
"skill.shieldwall.desc": "Duell (R): 2,5 Sekunden lang keinerlei Schaden.", "skill.shieldwall.desc": "Duell (E): 2,5 Sekunden lang keinerlei Schaden.",
"skill.steadfast": "Standhaft", "skill.steadfast": "Standhaft",
"skill.steadfast.desc": "-4 % erlittener Schaden und Blocken kostet 20 % weniger Ausdauer je Rang.", "skill.steadfast.desc": "-4 % erlittener Schaden und Blocken kostet 20 % weniger Ausdauer je Rang.",
"skill.secondwind": "Zweiter Atem", "skill.secondwind": "Zweiter Atem",
@@ -549,17 +532,12 @@
"guide.gladiator.1": "Jede Stufe bringt einen Attributpunkt. Verteile ihn mit „+“.", "guide.gladiator.1": "Jede Stufe bringt einen Attributpunkt. Verteile ihn mit „+“.",
"guide.gladiator.2": "Stärke = Schaden, Ausdauer = Leben, Geschick = kritische Treffer, Showtalent = mehr Ruhm und Stimmung.", "guide.gladiator.2": "Stärke = Schaden, Ausdauer = Leben, Geschick = kritische Treffer, Showtalent = mehr Ruhm und Stimmung.",
"guide.gladiator.3": "Klicke einen Gegenstand im Inventar an: die Karte zeigt seine Werte und um wie viel du stärker wirst (grün).", "guide.gladiator.3": "Klicke einen Gegenstand im Inventar an: die Karte zeigt seine Werte und um wie viel du stärker wirst (grün).",
"guide.gladiator.4": "„Bestes anlegen“ wählt die stärkste Ausrüstung. Den Rest verkaufst du für Denare.", "guide.gladiator.4": "„Bestes anlegen“ wählt die stärkste Ausrüstung. „Verstärken“ (Schmied) macht einen Platz stärker – für jedes Stück, das du dort trägst. Den Rest verkaufst du.",
"guide.ludus.what": "Deine Gladiatorenschule: Ausbilder und Gebäude wirken die ganze Zeit, auch wenn du nicht spielst.", "guide.ludus.what": "Deine Gladiatorenschule: Ausbilder und Gebäude wirken die ganze Zeit, auch wenn du nicht spielst.",
"guide.ludus.1": "Ausbilder steigern einen Wert nach und nach, während die Zeit vergeht.", "guide.ludus.1": "Ausbilder steigern einen Wert nach und nach, während die Zeit vergeht.",
"guide.ludus.2": "Gebäude geben Dauerboni: schnellere Erholung, mehr Erfahrung, mehr Leben, Denare pro Sekunde.", "guide.ludus.2": "Gebäude geben Dauerboni: schnellere Erholung, mehr Erfahrung, mehr Leben.",
"guide.ludus.3": "Jede Stufe kostet etwas mehr als die vorige.", "guide.ludus.3": "Jede Stufe kostet etwas mehr als die vorige.",
"guide.ludus.4": "Gewinne Kämpfe für Denare und investiere früh hier: das zahlt sich mit der Zeit aus.", "guide.ludus.4": "Gewinne Kämpfe für Denare und investiere früh hier – das zahlt sich mit der Zeit aus.",
"guide.forum.what": "Der Markt: Der Händler verkauft Ausrüstung, der Schmied verstärkt deine Ausrüstungsplätze.",
"guide.forum.1": "Die grüne Zahl zeigt, um wie viel dich ein Stück stärker machen würde.",
"guide.forum.2": "Der Händler bringt regelmäßig neue Ware – die Zeit steht über der Liste.",
"guide.forum.3": "Der Schmied verstärkt einen Platz, nicht ein Stück: jedes Teil, das du dort trägst, profitiert.",
"guide.forum.4": "Gekaufte Stücke landen im Inventar – anlegen im Reiter Gladiator.",
"guide.skills.what": "Dein Fähigkeitenbaum: drei Zweige mit Dauerboni und neuen Angriffen fürs Duell.", "guide.skills.what": "Dein Fähigkeitenbaum: drei Zweige mit Dauerboni und neuen Angriffen fürs Duell.",
"guide.skills.1": "Alle zwei Stufen bekommst du einen Fähigkeitspunkt.", "guide.skills.1": "Alle zwei Stufen bekommst du einen Fähigkeitspunkt.",
"guide.skills.2": "Klicke eine Fähigkeit an, um sie zu lernen. Untere Reihen öffnen sich mit genug Punkten im Zweig.", "guide.skills.2": "Klicke eine Fähigkeit an, um sie zu lernen. Untere Reihen öffnen sich mit genug Punkten im Zweig.",
@@ -570,7 +548,7 @@
"guide.hall.2": "Fordere Legenden zum Duell – der erste Sieg über jede bringt Gunst der Götter.", "guide.hall.2": "Fordere Legenden zum Duell – der erste Sieg über jede bringt Gunst der Götter.",
"guide.hall.3": "Opfere die Gunst den Göttern: Ihre Boni helfen jedem Gladiator nach dir.", "guide.hall.3": "Opfere die Gunst den Göttern: Ihre Boni helfen jedem Gladiator nach dir.",
"guide.hall.4": "Rote Stärke = stärker als du, grün = schlagbar.", "guide.hall.4": "Rote Stärke = stärker als du, grün = schlagbar.",
"guide.expedition.what": "Schicke deinen Gladiator in die Provinzen – für Beute, Denare und Erfahrung.", "guide.expedition.what": "Schicke deinen Gladiator in die Provinzen – vor allem für Beute, dazu etwas Denare und Erfahrung.",
"guide.expedition.1": "Wähle eine Region. Die Erfolgschance steigt mit deiner Kampfkraft; mit jeder Arena öffnen sich neue.", "guide.expedition.1": "Wähle eine Region. Die Erfolgschance steigt mit deiner Kampfkraft; mit jeder Arena öffnen sich neue.",
"guide.expedition.2": "Wähle die Dauer: längere Reisen bringen mehr Beute.", "guide.expedition.2": "Wähle die Dauer: längere Reisen bringen mehr Beute.",
"guide.expedition.3": "Solange er unterwegs ist, kämpft er nicht in der Arena – sein Training läuft aber weiter.", "guide.expedition.3": "Solange er unterwegs ist, kämpft er nicht in der Arena – sein Training läuft aber weiter.",
@@ -581,9 +559,6 @@
"tip.gladiator.none": "Alles bestens. Gewinne Kämpfe für Erfahrung und Beute.", "tip.gladiator.none": "Alles bestens. Gewinne Kämpfe für Erfahrung und Beute.",
"tip.ludus.afford": "Du kannst dir {0} leisten – die günstigste Verbesserung gerade.", "tip.ludus.afford": "Du kannst dir {0} leisten – die günstigste Verbesserung gerade.",
"tip.ludus.save": "Die nächste Verbesserung ist {0}: Es fehlen noch {1} Denare.", "tip.ludus.save": "Die nächste Verbesserung ist {0}: Es fehlen noch {1} Denare.",
"tip.forum.buy": "Lohnt sich: {0} macht dich {1} stärker.",
"tip.forum.forge": "Beim Händler nichts Besseres – lass den Schmied deinen Platz {0} verstärken.",
"tip.forum.wait": "Gerade lohnt sich nichts. Neue Ware in {0}.",
"tip.skills.points": "Du hast {0} Fähigkeitspunkt(e) – klicke eine leuchtende Fähigkeit an.", "tip.skills.points": "Du hast {0} Fähigkeitspunkt(e) – klicke eine leuchtende Fähigkeit an.",
"tip.skills.next": "Der nächste Fähigkeitspunkt kommt mit Stufe {0}.", "tip.skills.next": "Der nächste Fähigkeitspunkt kommt mit Stufe {0}.",
"tip.hall.none": "Noch keine Legenden. Erringe die Freiheit gegen den Champion des Kaisers, um in die Halle einzuziehen.", "tip.hall.none": "Noch keine Legenden. Erringe die Freiheit gegen den Champion des Kaisers, um in die Halle einzuziehen.",
@@ -593,5 +568,30 @@
"tip.hall.done": "Du hast jede Legende besiegt. Erringe erneut die Freiheit für eine neue.", "tip.hall.done": "Du hast jede Legende besiegt. Erringe erneut die Freiheit für eine neue.",
"tip.exp.away": "Dein Gladiator ist unterwegs – zurück in {0}. Verbessere solange deinen Ludus.", "tip.exp.away": "Dein Gladiator ist unterwegs – zurück in {0}. Verbessere solange deinen Ludus.",
"tip.exp.safe": "{0} ist für dich sicher (ab 75 %). Ein gutes Ziel.", "tip.exp.safe": "{0} ist für dich sicher (ab 75 %). Ein gutes Ziel.",
"tip.exp.risky": "Jede offene Region ist noch riskant. Werde erst stärker oder wähle eine kurze Reise." "tip.exp.risky": "Jede offene Region ist noch riskant. Werde erst stärker oder wähle eine kurze Reise.",
"duel.locked": "Noch nicht gelernt – im Reiter Fähigkeiten freischalten",
"offline.capped": "(gezählt werden höchstens {0} – Jupiter verlängert das)",
"tut.header": "Einführung · {0}/{1}",
"tut.skip": "Tab: Einführung überspringen",
"tut.move": "A / D: bewegen – geh auf den Gegner zu",
"tut.strike": "Linksklick: zuschlagen – triff ihn zweimal",
"tut.block": "Er holt aus – der rote Schimmer warnt dich! Rechtsklick halten: blocken",
"tut.parry": "Parade: Block erst kurz vor dem Treffer heben – dann taumelt er",
"tut.dodge": "S: zurückspringen und ausweichen",
"tut.leap": "Leertaste: Sprungangriff – in der Luft trifft dich nichts",
"tut.fury": "Deine Wut-Leiste ist voll – R: Raserei!",
"tut.finish": "Q, W, E: Fähigkeiten aus dem Fähigkeitenbaum. Jetzt besiege ihn!",
"settings.tutorial": "Kampf-Einführung",
"settings.tutorial.replay": "Im nächsten Kampf zeigen",
"settings.tutorial.next": "Kommt im nächsten Kampf",
"char.page.gear": "Werte & Ausrüstung",
"tip.gladiator.forge": "Nichts Besseres im Inventar – lass den Schmied deinen Platz {0} verstärken.",
"settings.antialias": "Kantenglättung",
"settings.bloom": "Leuchten von Feuer und Licht",
"settings.framerate": "Bildrate",
"settings.fps.vsync": "Bildschirm",
"settings.fps.120": "120",
"settings.fps.max": "Unbegrenzt",
"mono.help.pad": "Stick bewegen · A Schlag · LT halten Block (kurz vor dem Treffer: Parade!) · X Sprungangriff · B Ausweichen · RT Raserei · Y/LB/RB Fähigkeiten · Start Pause",
"duel.super.pad": "RT: RASEREI"
} }

View File

@@ -3,7 +3,6 @@
"main.settings": "Settings", "main.settings": "Settings",
"main.quit": "Quit", "main.quit": "Quit",
"main.ludus": "Ludus", "main.ludus": "Ludus",
"main.shop": "Forum",
"res.gold": "Denarii", "res.gold": "Denarii",
"res.fame": "Fame", "res.fame": "Fame",
"res.crowd": "Crowd", "res.crowd": "Crowd",
@@ -41,9 +40,6 @@
"stat.endurance": "Endurance", "stat.endurance": "Endurance",
"stat.agility": "Agility", "stat.agility": "Agility",
"stat.showmanship": "Showmanship", "stat.showmanship": "Showmanship",
"tactic.attack": "Attack",
"tactic.balanced": "Balanced",
"tactic.defense": "Defense",
"upgrade.trainer.strength": "Strength trainer", "upgrade.trainer.strength": "Strength trainer",
"upgrade.trainer.endurance": "Endurance trainer", "upgrade.trainer.endurance": "Endurance trainer",
"upgrade.trainer.agility": "Agility trainer", "upgrade.trainer.agility": "Agility trainer",
@@ -51,7 +47,6 @@
"upgrade.building.baths": "Baths", "upgrade.building.baths": "Baths",
"upgrade.building.kitchen": "Kitchen", "upgrade.building.kitchen": "Kitchen",
"upgrade.building.medicus": "Medicus", "upgrade.building.medicus": "Medicus",
"upgrade.building.taberna": "Taberna",
"god.mars": "Mars", "god.mars": "Mars",
"god.fortuna": "Fortuna", "god.fortuna": "Fortuna",
"god.minerva": "Minerva", "god.minerva": "Minerva",
@@ -93,7 +88,6 @@
"time.m": "{0} min", "time.m": "{0} min",
"time.hm": "{0} h {1} min", "time.hm": "{0} h {1} min",
"gladiator.defaultname": "Spartacus", "gladiator.defaultname": "Spartacus",
"res.persec": "+{0}/s",
"num.pct": "{0}%", "num.pct": "{0}%",
"ludus.hp": "Health", "ludus.hp": "Health",
"ludus.damage": "Damage", "ludus.damage": "Damage",
@@ -147,16 +141,10 @@
"hall.reward": "You defeated the legend {0}! +{1} favor of the gods", "hall.reward": "You defeated the legend {0}! +{1} favor of the gods",
"hall.away": "Your gladiator is on an expedition.", "hall.away": "Your gladiator is on an expedition.",
"duel.legend": "Duel of legends", "duel.legend": "Duel of legends",
"forum.tab.trainers": "Trainers",
"forum.tab.ludus": "Ludus",
"forum.tab.gods": "Gods",
"forum.xps": "Now: {0} XP/s",
"forum.recovery": "Recovery: {0}",
"upgrade.trainer.desc": "Trains {0} bit by bit over time – even while you are away.", "upgrade.trainer.desc": "Trains {0} bit by bit over time – even while you are away.",
"upgrade.building.baths.desc": "Faster recovery after a defeat (−12% per level).", "upgrade.building.baths.desc": "Faster recovery after a defeat (−12% per level).",
"upgrade.building.kitchen.desc": "Better food: +15% XP per level.", "upgrade.building.kitchen.desc": "Better food: +15% XP per level.",
"upgrade.building.medicus.desc": "A healer for the ludus: +8% health per level.", "upgrade.building.medicus.desc": "A healer for the ludus: +8% health per level.",
"upgrade.building.taberna.desc": "Fans pay for wine and stories: denarii every second.",
"gods.favor": "Favor of the gods: {0}", "gods.favor": "Favor of the gods: {0}",
"gods.freedoms": "Freedoms: {0}", "gods.freedoms": "Freedoms: {0}",
"gods.locked": "Win your freedom before the emperor to earn the favor of the gods.", "gods.locked": "Win your freedom before the emperor to earn the favor of the gods.",
@@ -168,13 +156,13 @@
"god.bacchus.desc": "The crowd loves you more and forgets you slower.", "god.bacchus.desc": "The crowd loves you more and forgets you slower.",
"god.jupiter.desc": "+5% to everything and +1 h offline time per level.", "god.jupiter.desc": "+5% to everything and +1 h offline time per level.",
"offline.title": "Welcome back!", "offline.title": "Welcome back!",
"offline.away": "You were away for {0}. Your ludus kept fighting.", "offline.away": "You were away for {0}. Your ludus kept working.",
"offline.gold": "Denarii earned", "offline.gold": "Denarii earned",
"offline.fame": "Fame earned", "offline.fame": "Fame earned",
"offline.fights": "Fights", "offline.fights": "Fights",
"offline.fights.value": "{0} won · {1} lost", "offline.fights.value": "{0} won · {1} lost",
"offline.levels": "Level-ups", "offline.levels": "Values raised by trainers",
"offline.ok": "To the arena!", "offline.ok": "Into the arena!",
"ludus.rate": "{0} XP/s · {1} h a day", "ludus.rate": "{0} XP/s · {1} h a day",
"arena.opening": "Opening!", "arena.opening": "Opening!",
"arena.perfect": "PERFECT!", "arena.perfect": "PERFECT!",
@@ -222,10 +210,6 @@
"special.net.desc": "The enemy misses half of his next four attacks.", "special.net.desc": "The enemy misses half of his next four attacks.",
"special.sica.desc": "Your next three hits are critical.", "special.sica.desc": "Your next three hits are critical.",
"special.endure.desc": "Heals 30% of your health.", "special.endure.desc": "Heals 30% of your health.",
"forum.tab.forge": "Forge",
"forum.tab.merchant": "Merchant",
"merchant.refresh": "New goods in {0}",
"merchant.bag": "Bag {0}/{1}",
"slot.weapon": "Weapon", "slot.weapon": "Weapon",
"slot.shield": "Shield", "slot.shield": "Shield",
"slot.helmet": "Helmet", "slot.helmet": "Helmet",
@@ -428,7 +412,6 @@
"offer.hard": "Stronger opponent", "offer.hard": "Stronger opponent",
"offer.champion": "Champion of the arena", "offer.champion": "Champion of the arena",
"hub.fight": "Fight!", "hub.fight": "Fight!",
"hub.auto": "Win without a fight",
"hub.odds.easy": "You are clearly stronger", "hub.odds.easy": "You are clearly stronger",
"hub.odds.even": "An even fight", "hub.odds.even": "An even fight",
"hub.odds.hard": "Dangerous!", "hub.odds.hard": "Dangerous!",
@@ -472,7 +455,7 @@
"skill.power": "Mighty Blows", "skill.power": "Mighty Blows",
"skill.power.desc": "+6% damage per rank.", "skill.power.desc": "+6% damage per rank.",
"skill.heavystrike": "Heavy Strike", "skill.heavystrike": "Heavy Strike",
"skill.heavystrike.desc": "Duel (Q): a slow, mighty blow for 1.6x damage that breaks any block.", "skill.heavystrike.desc": "Duel (W): a slow, mighty blow for 2.5x damage that breaks any block and staggers the opponent.",
"skill.frenzy": "Battle Frenzy", "skill.frenzy": "Battle Frenzy",
"skill.frenzy.desc": "+3% critical hit chance per rank.", "skill.frenzy.desc": "+3% critical hit chance per rank.",
"skill.execute": "Coup de Grâce", "skill.execute": "Coup de Grâce",
@@ -480,7 +463,7 @@
"skill.toughness": "Hardened", "skill.toughness": "Hardened",
"skill.toughness.desc": "+7% health per rank.", "skill.toughness.desc": "+7% health per rank.",
"skill.shieldwall": "Shield Wall", "skill.shieldwall": "Shield Wall",
"skill.shieldwall.desc": "Duel (R): take no damage at all for 2.5 seconds.", "skill.shieldwall.desc": "Duel (E): take no damage at all for 2.5 seconds.",
"skill.steadfast": "Steadfast", "skill.steadfast": "Steadfast",
"skill.steadfast.desc": "-4% damage taken and blocking costs 20% less stamina per rank.", "skill.steadfast.desc": "-4% damage taken and blocking costs 20% less stamina per rank.",
"skill.secondwind": "Second Wind", "skill.secondwind": "Second Wind",
@@ -549,17 +532,12 @@
"guide.gladiator.1": "Every level gives an attribute point. Spend it with “+”.", "guide.gladiator.1": "Every level gives an attribute point. Spend it with “+”.",
"guide.gladiator.2": "Strength = damage, Endurance = health, Agility = critical hits, Showmanship = more fame and a livelier crowd.", "guide.gladiator.2": "Strength = damage, Endurance = health, Agility = critical hits, Showmanship = more fame and a livelier crowd.",
"guide.gladiator.3": "Click an item in the inventory: the card shows its values and how much stronger you would get (green).", "guide.gladiator.3": "Click an item in the inventory: the card shows its values and how much stronger you would get (green).",
"guide.gladiator.4": "“Equip best” picks the strongest set. Sell the rest for denarii.", "guide.gladiator.4": "“Equip best” picks the strongest set. “Reinforce” (smith) makes a slot stronger for every piece you wear there. Sell the rest for denarii.",
"guide.ludus.what": "Your gladiator school: trainers and buildings work all the time, even while you are away.", "guide.ludus.what": "Your gladiator school: trainers and buildings work all the time, even while you are away.",
"guide.ludus.1": "Trainers raise one value step by step while the days go by.", "guide.ludus.1": "Trainers raise one value step by step while the days go by.",
"guide.ludus.2": "Buildings give lasting bonuses: faster recovery, more experience, more health, denarii every second.", "guide.ludus.2": "Buildings give lasting bonuses: faster recovery, more experience, more health.",
"guide.ludus.3": "Each level costs a little more than the last one.", "guide.ludus.3": "Each level costs a little more than the last one.",
"guide.ludus.4": "Win fights for denarii and invest them here early: it pays off over time.", "guide.ludus.4": "Win fights for denarii and invest here early – it pays off over time.",
"guide.forum.what": "The market: the merchant sells equipment, the smith reinforces your equipment slots.",
"guide.forum.1": "The green number shows how much stronger an item would make you.",
"guide.forum.2": "The merchant brings new wares regularly – the time is shown above the list.",
"guide.forum.3": "The smith reinforces a slot, not an item: every piece you wear there profits.",
"guide.forum.4": "Bought items go into your inventory – equip them in the Gladiator tab.",
"guide.skills.what": "Your skill tree: three branches with passive bonuses and new attacks for the duel.", "guide.skills.what": "Your skill tree: three branches with passive bonuses and new attacks for the duel.",
"guide.skills.1": "You get a skill point every two levels.", "guide.skills.1": "You get a skill point every two levels.",
"guide.skills.2": "Click a skill to learn it. Lower rows open after enough points in their branch.", "guide.skills.2": "Click a skill to learn it. Lower rows open after enough points in their branch.",
@@ -570,7 +548,7 @@
"guide.hall.2": "Challenge legends to a duel – the first win over each one gives favour of the gods.", "guide.hall.2": "Challenge legends to a duel – the first win over each one gives favour of the gods.",
"guide.hall.3": "Offer your favour to the gods: their bonuses help every gladiator after you.", "guide.hall.3": "Offer your favour to the gods: their bonuses help every gladiator after you.",
"guide.hall.4": "Red strength = stronger than you, green = beatable.", "guide.hall.4": "Red strength = stronger than you, green = beatable.",
"guide.expedition.what": "Send your gladiator to the provinces for loot, denarii and experience.", "guide.expedition.what": "Send your gladiator into the provinces – mostly for loot, plus some denarii and experience.",
"guide.expedition.1": "Pick a region. The success chance grows with your strength; new regions open with each arena.", "guide.expedition.1": "Pick a region. The success chance grows with your strength; new regions open with each arena.",
"guide.expedition.2": "Choose the duration: longer trips bring more loot.", "guide.expedition.2": "Choose the duration: longer trips bring more loot.",
"guide.expedition.3": "While he is away he cannot fight in the arena – but his training goes on.", "guide.expedition.3": "While he is away he cannot fight in the arena – but his training goes on.",
@@ -581,9 +559,6 @@
"tip.gladiator.none": "All set. Win fights for experience and loot.", "tip.gladiator.none": "All set. Win fights for experience and loot.",
"tip.ludus.afford": "You can afford {0} – the cheapest improvement right now.", "tip.ludus.afford": "You can afford {0} – the cheapest improvement right now.",
"tip.ludus.save": "The next improvement is {0}: {1} denarii are still missing.", "tip.ludus.save": "The next improvement is {0}: {1} denarii are still missing.",
"tip.forum.buy": "Worth buying: {0} would make you {1} stronger.",
"tip.forum.forge": "Nothing better at the merchant – let the smith reinforce your {0}.",
"tip.forum.wait": "Nothing worth it right now. New wares in {0}.",
"tip.skills.points": "You have {0} skill point(s) – click a glowing skill to learn it.", "tip.skills.points": "You have {0} skill point(s) – click a glowing skill to learn it.",
"tip.skills.next": "Your next skill point comes at level {0}.", "tip.skills.next": "Your next skill point comes at level {0}.",
"tip.hall.none": "No legends yet. Win your freedom against the emperor's champion to enter the hall.", "tip.hall.none": "No legends yet. Win your freedom against the emperor's champion to enter the hall.",
@@ -593,5 +568,30 @@
"tip.hall.done": "You have beaten every legend. Win your freedom again to add a new one.", "tip.hall.done": "You have beaten every legend. Win your freedom again to add a new one.",
"tip.exp.away": "Your gladiator is travelling – back in {0}. Meanwhile improve your ludus.", "tip.exp.away": "Your gladiator is travelling – back in {0}. Meanwhile improve your ludus.",
"tip.exp.safe": "{0} is safe for you (75 % or more). A good destination.", "tip.exp.safe": "{0} is safe for you (75 % or more). A good destination.",
"tip.exp.risky": "Every open region is still risky. Grow stronger first or take a short trip." "tip.exp.risky": "Every open region is still risky. Grow stronger first or take a short trip.",
"duel.locked": "Not learned yet – unlock it in the Skills tab",
"offline.capped": "(at most {0} are counted – Jupiter extends that)",
"tut.header": "Tutorial · {0}/{1}",
"tut.skip": "Tab: skip tutorial",
"tut.move": "A / D: move – walk up to your opponent",
"tut.strike": "Left click: strike – hit him twice",
"tut.block": "He winds up – the red glow warns you! Hold right click: block",
"tut.parry": "Parry: raise the block just before the hit – he staggers",
"tut.dodge": "S: jump back and dodge",
"tut.leap": "Space: leap attack – nothing hits you in the air",
"tut.fury": "Your fury bar is full – R: Fury!",
"tut.finish": "Q, W, E: skills from your skill tree. Now beat him!",
"settings.tutorial": "Fight tutorial",
"settings.tutorial.replay": "Show again next fight",
"settings.tutorial.next": "Comes in the next fight",
"char.page.gear": "Stats & gear",
"tip.gladiator.forge": "Nothing better in the bag – let the smith reinforce your {0} slot.",
"settings.antialias": "Smooth edges (anti-aliasing)",
"settings.bloom": "Glow of fire and light",
"settings.framerate": "Frame rate",
"settings.fps.vsync": "Screen",
"settings.fps.120": "120",
"settings.fps.max": "Unlimited",
"mono.help.pad": "Stick move · A strike · hold LT block (just before the hit: parry!) · X leap attack · B dodge · RT fury · Y/LB/RB skills · Start pause",
"duel.super.pad": "RT: FURY ATTACK"
} }

View File

@@ -3,7 +3,6 @@
"main.settings": "Ajustes", "main.settings": "Ajustes",
"main.quit": "Salir", "main.quit": "Salir",
"main.ludus": "Ludus", "main.ludus": "Ludus",
"main.shop": "Foro",
"res.gold": "Denarios", "res.gold": "Denarios",
"res.fame": "Fama", "res.fame": "Fama",
"res.crowd": "Público", "res.crowd": "Público",
@@ -41,9 +40,6 @@
"stat.endurance": "Resistencia", "stat.endurance": "Resistencia",
"stat.agility": "Agilidad", "stat.agility": "Agilidad",
"stat.showmanship": "Espectáculo", "stat.showmanship": "Espectáculo",
"tactic.attack": "Ataque",
"tactic.balanced": "Equilibrado",
"tactic.defense": "Defensa",
"upgrade.trainer.strength": "Entrenador de fuerza", "upgrade.trainer.strength": "Entrenador de fuerza",
"upgrade.trainer.endurance": "Entrenador de resistencia", "upgrade.trainer.endurance": "Entrenador de resistencia",
"upgrade.trainer.agility": "Entrenador de agilidad", "upgrade.trainer.agility": "Entrenador de agilidad",
@@ -51,7 +47,6 @@
"upgrade.building.baths": "Termas", "upgrade.building.baths": "Termas",
"upgrade.building.kitchen": "Cocina", "upgrade.building.kitchen": "Cocina",
"upgrade.building.medicus": "Médico", "upgrade.building.medicus": "Médico",
"upgrade.building.taberna": "Taberna",
"god.mars": "Marte", "god.mars": "Marte",
"god.fortuna": "Fortuna", "god.fortuna": "Fortuna",
"god.minerva": "Minerva", "god.minerva": "Minerva",
@@ -93,7 +88,6 @@
"time.m": "{0} min", "time.m": "{0} min",
"time.hm": "{0} h {1} min", "time.hm": "{0} h {1} min",
"gladiator.defaultname": "Espartaco", "gladiator.defaultname": "Espartaco",
"res.persec": "+{0}/s",
"num.pct": "{0} %", "num.pct": "{0} %",
"ludus.hp": "Vida", "ludus.hp": "Vida",
"ludus.damage": "Daño", "ludus.damage": "Daño",
@@ -147,16 +141,10 @@
"hall.reward": "¡Has derrotado a la leyenda {0}! +{1} favor de los dioses", "hall.reward": "¡Has derrotado a la leyenda {0}! +{1} favor de los dioses",
"hall.away": "Tu gladiador está de expedición.", "hall.away": "Tu gladiador está de expedición.",
"duel.legend": "Duelo de leyendas", "duel.legend": "Duelo de leyendas",
"forum.tab.trainers": "Entrenadores",
"forum.tab.ludus": "Ludus",
"forum.tab.gods": "Dioses",
"forum.xps": "Ahora: {0} XP/s",
"forum.recovery": "Recuperación: {0}",
"upgrade.trainer.desc": "Entrena {0} poco a poco con el tiempo, incluso cuando no juegas.", "upgrade.trainer.desc": "Entrena {0} poco a poco con el tiempo, incluso cuando no juegas.",
"upgrade.building.baths.desc": "Recuperación más rápida tras una derrota (−12 % por nivel).", "upgrade.building.baths.desc": "Recuperación más rápida tras una derrota (−12 % por nivel).",
"upgrade.building.kitchen.desc": "Mejor comida: +15 % de XP por nivel.", "upgrade.building.kitchen.desc": "Mejor comida: +15 % de XP por nivel.",
"upgrade.building.medicus.desc": "Un sanador para el ludus: +8 % de vida por nivel.", "upgrade.building.medicus.desc": "Un sanador para el ludus: +8 % de vida por nivel.",
"upgrade.building.taberna.desc": "Los fans pagan vino e historias: denarios cada segundo.",
"gods.favor": "Favor de los dioses: {0}", "gods.favor": "Favor de los dioses: {0}",
"gods.freedoms": "Libertades: {0}", "gods.freedoms": "Libertades: {0}",
"gods.locked": "Gana tu libertad ante el emperador para obtener el favor de los dioses.", "gods.locked": "Gana tu libertad ante el emperador para obtener el favor de los dioses.",
@@ -168,12 +156,12 @@
"god.bacchus.desc": "El público te ama más y te olvida más despacio.", "god.bacchus.desc": "El público te ama más y te olvida más despacio.",
"god.jupiter.desc": "+5 % a todo y +1 h de tiempo sin conexión por nivel.", "god.jupiter.desc": "+5 % a todo y +1 h de tiempo sin conexión por nivel.",
"offline.title": "¡Bienvenido de nuevo!", "offline.title": "¡Bienvenido de nuevo!",
"offline.away": "Estuviste fuera {0}. Tu ludus siguió luchando.", "offline.away": "Estuviste fuera {0}. Tu ludus siguió trabajando.",
"offline.gold": "Denarios ganados", "offline.gold": "Denarios ganados",
"offline.fame": "Fama ganada", "offline.fame": "Fama ganada",
"offline.fights": "Combates", "offline.fights": "Combates",
"offline.fights.value": "{0} ganados · {1} perdidos", "offline.fights.value": "{0} ganados · {1} perdidos",
"offline.levels": "Subidas de nivel", "offline.levels": "Atributos subidos por entrenadores",
"offline.ok": "¡A la arena!", "offline.ok": "¡A la arena!",
"ludus.rate": "{0} XP/s · {1} h al día", "ludus.rate": "{0} XP/s · {1} h al día",
"arena.opening": "¡Hueco!", "arena.opening": "¡Hueco!",
@@ -222,10 +210,6 @@
"special.net.desc": "El enemigo falla la mitad de sus próximos cuatro ataques.", "special.net.desc": "El enemigo falla la mitad de sus próximos cuatro ataques.",
"special.sica.desc": "Tus próximos tres golpes son críticos.", "special.sica.desc": "Tus próximos tres golpes son críticos.",
"special.endure.desc": "Cura el 30 % de tu vida.", "special.endure.desc": "Cura el 30 % de tu vida.",
"forum.tab.forge": "Herrero",
"forum.tab.merchant": "Mercader",
"merchant.refresh": "Mercancía nueva en {0}",
"merchant.bag": "Bolsa {0}/{1}",
"slot.weapon": "Arma", "slot.weapon": "Arma",
"slot.shield": "Escudo", "slot.shield": "Escudo",
"slot.helmet": "Casco", "slot.helmet": "Casco",
@@ -428,7 +412,6 @@
"offer.hard": "Rival más fuerte", "offer.hard": "Rival más fuerte",
"offer.champion": "Campeón de la arena", "offer.champion": "Campeón de la arena",
"hub.fight": "¡Luchar!", "hub.fight": "¡Luchar!",
"hub.auto": "Ganar sin luchar",
"hub.odds.easy": "Eres claramente superior", "hub.odds.easy": "Eres claramente superior",
"hub.odds.even": "Un combate igualado", "hub.odds.even": "Un combate igualado",
"hub.odds.hard": "¡Peligroso!", "hub.odds.hard": "¡Peligroso!",
@@ -472,7 +455,7 @@
"skill.power": "Golpes poderosos", "skill.power": "Golpes poderosos",
"skill.power.desc": "+6 % de daño por rango.", "skill.power.desc": "+6 % de daño por rango.",
"skill.heavystrike": "Golpe pesado", "skill.heavystrike": "Golpe pesado",
"skill.heavystrike.desc": "Duelo (Q): un golpe lento y poderoso con 1,6 veces el daño que rompe cualquier bloqueo.", "skill.heavystrike.desc": "Duelo (W): un golpe lento y poderoso con 2,5 veces el daño que rompe cualquier bloqueo y hace tambalear al rival.",
"skill.frenzy": "Frenesí", "skill.frenzy": "Frenesí",
"skill.frenzy.desc": "+3 % de probabilidad de crítico por rango.", "skill.frenzy.desc": "+3 % de probabilidad de crítico por rango.",
"skill.execute": "Golpe de gracia", "skill.execute": "Golpe de gracia",
@@ -480,7 +463,7 @@
"skill.toughness": "Endurecido", "skill.toughness": "Endurecido",
"skill.toughness.desc": "+7 % de vida por rango.", "skill.toughness.desc": "+7 % de vida por rango.",
"skill.shieldwall": "Muro de escudo", "skill.shieldwall": "Muro de escudo",
"skill.shieldwall.desc": "Duelo (R): ningún daño durante 2,5 segundos.", "skill.shieldwall.desc": "Duelo (E): ningún daño durante 2,5 segundos.",
"skill.steadfast": "Firme", "skill.steadfast": "Firme",
"skill.steadfast.desc": "-4 % de daño recibido y bloquear cuesta un 20 % menos de aguante por rango.", "skill.steadfast.desc": "-4 % de daño recibido y bloquear cuesta un 20 % menos de aguante por rango.",
"skill.secondwind": "Segundo aliento", "skill.secondwind": "Segundo aliento",
@@ -549,17 +532,12 @@
"guide.gladiator.1": "Cada nivel da un punto de atributo. Gástalo con «+».", "guide.gladiator.1": "Cada nivel da un punto de atributo. Gástalo con «+».",
"guide.gladiator.2": "Fuerza = daño, Resistencia = vida, Agilidad = críticos, Espectáculo = más fama y público.", "guide.gladiator.2": "Fuerza = daño, Resistencia = vida, Agilidad = críticos, Espectáculo = más fama y público.",
"guide.gladiator.3": "Haz clic en un objeto del inventario: la tarjeta muestra sus valores y cuánto más fuerte serías (verde).", "guide.gladiator.3": "Haz clic en un objeto del inventario: la tarjeta muestra sus valores y cuánto más fuerte serías (verde).",
"guide.gladiator.4": "«Equipar lo mejor» elige el equipo más fuerte. Vende el resto por denarios.", "guide.gladiator.4": "«Equipar lo mejor» elige el equipo más fuerte. «Reforzar» (herrero) mejora una ranura para cada pieza que lleves en ella. Vende el resto.",
"guide.ludus.what": "Tu escuela de gladiadores: entrenadores y edificios trabajan siempre, incluso cuando no juegas.", "guide.ludus.what": "Tu escuela de gladiadores: entrenadores y edificios trabajan siempre, incluso cuando no juegas.",
"guide.ludus.1": "Los entrenadores suben un atributo poco a poco con el paso del tiempo.", "guide.ludus.1": "Los entrenadores suben un atributo poco a poco con el paso del tiempo.",
"guide.ludus.2": "Los edificios dan bonos permanentes: recuperación, experiencia, vida, denarios por segundo.", "guide.ludus.2": "Los edificios dan bonos permanentes: recuperación más rápida, más experiencia, más vida.",
"guide.ludus.3": "Cada nivel cuesta algo más que el anterior.", "guide.ludus.3": "Cada nivel cuesta algo más que el anterior.",
"guide.ludus.4": "Gana combates por denarios e invierte pronto aquí: compensa con el tiempo.", "guide.ludus.4": "Gana combates por denarios e invierte pronto aquí: compensa con el tiempo.",
"guide.forum.what": "El mercado: el mercader vende equipo, el herrero refuerza tus ranuras de equipo.",
"guide.forum.1": "El número verde muestra cuánto más fuerte te haría un objeto.",
"guide.forum.2": "El mercader trae género nuevo con regularidad: el tiempo aparece sobre la lista.",
"guide.forum.3": "El herrero refuerza una ranura, no un objeto: cualquier pieza que lleves ahí se beneficia.",
"guide.forum.4": "Lo comprado va al inventario: equípalo en la pestaña Gladiador.",
"guide.skills.what": "Tu árbol de habilidades: tres ramas con bonos y nuevos ataques para el duelo.", "guide.skills.what": "Tu árbol de habilidades: tres ramas con bonos y nuevos ataques para el duelo.",
"guide.skills.1": "Cada dos niveles recibes un punto de habilidad.", "guide.skills.1": "Cada dos niveles recibes un punto de habilidad.",
"guide.skills.2": "Haz clic en una habilidad para aprenderla. Las filas inferiores se abren con suficientes puntos en su rama.", "guide.skills.2": "Haz clic en una habilidad para aprenderla. Las filas inferiores se abren con suficientes puntos en su rama.",
@@ -570,7 +548,7 @@
"guide.hall.2": "Reta a las leyendas a un duelo: la primera victoria sobre cada una da favor de los dioses.", "guide.hall.2": "Reta a las leyendas a un duelo: la primera victoria sobre cada una da favor de los dioses.",
"guide.hall.3": "Ofrece tu favor a los dioses: sus bonos ayudan a cada gladiador posterior.", "guide.hall.3": "Ofrece tu favor a los dioses: sus bonos ayudan a cada gladiador posterior.",
"guide.hall.4": "Fuerza roja = más fuerte que tú, verde = vencible.", "guide.hall.4": "Fuerza roja = más fuerte que tú, verde = vencible.",
"guide.expedition.what": "Envía a tu gladiador a las provincias a por botín, denarios y experiencia.", "guide.expedition.what": "Envía a tu gladiador a las provincias: sobre todo por botín, y algo de denarios y experiencia.",
"guide.expedition.1": "Elige una región. La probabilidad sube con tu fuerza; con cada arena se abren nuevas.", "guide.expedition.1": "Elige una región. La probabilidad sube con tu fuerza; con cada arena se abren nuevas.",
"guide.expedition.2": "Elige la duración: los viajes largos traen más botín.", "guide.expedition.2": "Elige la duración: los viajes largos traen más botín.",
"guide.expedition.3": "Mientras está fuera no lucha en la arena, pero su entrenamiento sigue.", "guide.expedition.3": "Mientras está fuera no lucha en la arena, pero su entrenamiento sigue.",
@@ -581,9 +559,6 @@
"tip.gladiator.none": "Todo listo. Gana combates para experiencia y botín.", "tip.gladiator.none": "Todo listo. Gana combates para experiencia y botín.",
"tip.ludus.afford": "Puedes pagar {0}: la mejora más barata ahora.", "tip.ludus.afford": "Puedes pagar {0}: la mejora más barata ahora.",
"tip.ludus.save": "La siguiente mejora es {0}: faltan {1} denarios.", "tip.ludus.save": "La siguiente mejora es {0}: faltan {1} denarios.",
"tip.forum.buy": "Merece la pena: {0} te haría un {1} más fuerte.",
"tip.forum.forge": "Nada mejor en el mercader: que el herrero refuerce tu {0}.",
"tip.forum.wait": "Ahora no merece la pena nada. Género nuevo en {0}.",
"tip.skills.points": "Tienes {0} punto(s) de habilidad: haz clic en una habilidad que brille.", "tip.skills.points": "Tienes {0} punto(s) de habilidad: haz clic en una habilidad que brille.",
"tip.skills.next": "Tu próximo punto de habilidad llega en el nivel {0}.", "tip.skills.next": "Tu próximo punto de habilidad llega en el nivel {0}.",
"tip.hall.none": "Aún no hay leyendas. Gana tu libertad contra el campeón del emperador para entrar en la sala.", "tip.hall.none": "Aún no hay leyendas. Gana tu libertad contra el campeón del emperador para entrar en la sala.",
@@ -593,5 +568,30 @@
"tip.hall.done": "Has vencido a todas las leyendas. Vuelve a ganar tu libertad para añadir otra.", "tip.hall.done": "Has vencido a todas las leyendas. Vuelve a ganar tu libertad para añadir otra.",
"tip.exp.away": "Tu gladiador está de viaje: vuelve en {0}. Mientras, mejora tu ludus.", "tip.exp.away": "Tu gladiador está de viaje: vuelve en {0}. Mientras, mejora tu ludus.",
"tip.exp.safe": "{0} es segura para ti (75 % o más). Un buen destino.", "tip.exp.safe": "{0} es segura para ti (75 % o más). Un buen destino.",
"tip.exp.risky": "Todas las regiones abiertas son arriesgadas. Hazte más fuerte o elige un viaje corto." "tip.exp.risky": "Todas las regiones abiertas son arriesgadas. Hazte más fuerte o elige un viaje corto.",
"duel.locked": "Aún no aprendida: desbloquéala en Habilidades",
"offline.capped": "(se cuentan como máximo {0}; Júpiter lo amplía)",
"tut.header": "Tutorial · {0}/{1}",
"tut.skip": "Tab: saltar tutorial",
"tut.move": "A / D: moverse – acércate a tu rival",
"tut.strike": "Clic izquierdo: golpear – dale dos veces",
"tut.block": "Prepara un golpe – ¡el brillo rojo te avisa! Mantén clic derecho: bloquear",
"tut.parry": "Parada: levanta el bloqueo justo antes del golpe – se tambalea",
"tut.dodge": "S: salta atrás y esquiva",
"tut.leap": "Espacio: ataque en salto – en el aire nada te alcanza",
"tut.fury": "Tu barra de furia está llena – R: ¡Furia!",
"tut.finish": "Q, W, E: habilidades de tu árbol. ¡Ahora derrótalo!",
"settings.tutorial": "Tutorial de combate",
"settings.tutorial.replay": "Mostrar en el próximo combate",
"settings.tutorial.next": "En el próximo combate",
"char.page.gear": "Atributos y equipo",
"tip.gladiator.forge": "Nada mejor en el inventario: que el herrero refuerce tu ranura de {0}.",
"settings.antialias": "Suavizado de bordes",
"settings.bloom": "Brillo del fuego y la luz",
"settings.framerate": "Fotogramas por segundo",
"settings.fps.vsync": "Pantalla",
"settings.fps.120": "120",
"settings.fps.max": "Sin límite",
"mono.help.pad": "Stick moverse · A golpe · mantén LT bloqueo (justo antes del golpe: ¡parada!) · X ataque en salto · B esquivar · RT furia · Y/LB/RB habilidades · Start pausa",
"duel.super.pad": "RT: ATAQUE DE FURIA"
} }

543
Mono/Arena/ArenaSet.cs Normal file
View File

@@ -0,0 +1,543 @@
using System;
using System.Collections.Generic;
using GladiatorIdle.Gfx;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using D = GladiatorIdle.Gfx.Draw;
namespace GladiatorIdle.Arena
{
/// Licht und Ausstattung einer Arena (Duell-Kulisse).
internal sealed record ArenaLook(
string Wall, Vector3 SunDir, Vector3 Sun, Vector3 Ambient, Vector3 Fog, float FogStart, float FogEnd,
Vector3 Sand, Color Banner, int Braziers, bool Posts, float Horizon, float BackdropLight)
{
/// Je Arena (Index wie <see cref="ArenaDef"/>): Tageszeit, Mauer, Farben. Sonnenrichtung = Richtung,
/// in die das Licht fällt (y nach unten = von oben).
public static readonly ArenaLook[] All =
{
// Ludus: Nachmittag, Holzzaun, Übungspfosten
new("wood", new(0.55f, 0.75f, -0.35f), new(1.00f, 0.88f, 0.70f), new(0.44f, 0.40f, 0.36f), new(0.78f, 0.66f, 0.50f), 2600, 11000,
new(1.00f, 0.90f, 0.74f), new Color(150, 60, 40), 0, true, 0.64f, 0.95f),
// Provinz: goldener Abend
new("wood", new(-0.65f, 0.55f, -0.45f), new(1.00f, 0.76f, 0.52f), new(0.40f, 0.33f, 0.30f), new(0.82f, 0.58f, 0.38f), 2400, 10000,
new(1.00f, 0.84f, 0.66f), new Color(190, 140, 50), 2, false, 0.70f, 0.95f),
// Capua: Mittag, Stein
new("stone", new(0.25f, 0.92f, -0.30f), new(1.00f, 0.97f, 0.90f), new(0.48f, 0.46f, 0.44f), new(0.80f, 0.76f, 0.70f), 2800, 12000,
new(1.00f, 0.92f, 0.78f), new Color(170, 40, 35), 0, false, 0.86f, 1.0f),
// Pompeji: Sonnenuntergang
new("stone", new(-0.75f, 0.42f, -0.50f), new(1.00f, 0.62f, 0.40f), new(0.40f, 0.31f, 0.31f), new(0.78f, 0.47f, 0.36f), 2400, 10000,
new(0.98f, 0.80f, 0.64f), new Color(200, 100, 30), 2, false, 0.80f, 0.95f),
// Circus Maximus: staubig
new("stone", new(0.45f, 0.78f, -0.42f), new(1.00f, 0.86f, 0.66f), new(0.46f, 0.40f, 0.34f), new(0.84f, 0.70f, 0.52f), 2000, 9000,
new(1.00f, 0.88f, 0.70f), new Color(40, 120, 70), 0, false, 0.80f, 0.95f),
// Kolosseum: hell unter dem Sonnensegel
new("stone", new(0.30f, 0.88f, -0.32f), new(1.00f, 0.92f, 0.80f), new(0.50f, 0.45f, 0.40f), new(0.80f, 0.70f, 0.56f), 2800, 12000,
new(1.00f, 0.90f, 0.74f), new Color(160, 35, 35), 2, false, 0.84f, 1.0f),
// Vor dem Kaiser: Dämmerung, Fackeln, Marmor
new("marble", new(-0.30f, 0.70f, -0.60f), new(0.80f, 0.64f, 0.72f), new(0.34f, 0.28f, 0.34f), new(0.40f, 0.29f, 0.38f), 2200, 9500,
new(0.92f, 0.78f, 0.68f), new Color(90, 30, 110), 4, false, 0.90f, 0.9f),
};
public static ArenaLook For(int arena) => All[Math.Clamp(arena, 0, All.Length - 1)];
}
/// <summary>
/// Kulisse des Duells in echtem 3D: Sandboden in Perspektive, gebogene Arenamauer mit Toren und
/// Bannern, Kohlebecken (Feuer als Lichter), im Ludus Übungspfosten; dahinter das Arena-Gemälde
/// (bzw. sein Video) weit entfernt auf einem Zylinderstück, sodass die Mauer seinen gemalten
/// Boden verdeckt. Licht und Dunst je Arena (<see cref="ArenaLook"/>).
/// </summary>
internal sealed class ArenaSet
{
// Mauer: Kreisbogen um (CX, ·, ZC); vorderster Punkt bei z = ZC − R
const float CX = Camera.W / 2, ZC = 2400, R = 3800, WALL_H = 300, BACK_R = 6500;
// Ränge hinter der Mauer: Stufen (Höhe, Tiefe), Säulenreihe obenauf
const float ROW_H = 64, ROW_D = 118, COL_H = 330;
static float Floor => Stage.FloorY;
sealed class Part
{
public readonly List<VertexPNCT> V = new();
public readonly List<int> I = new();
public Texture2D? Tex;
public bool Lit = true, Wrap, Mirror, Fog = true;
public Vector3 Tint = Vector3.One;
public VertexPNCT[]? VA; public int[]? IA;
public void Quad(Vector3 a, Vector3 b, Vector3 c, Vector3 d, Vector3 n, Color col,
Vector2 ta, Vector2 tb, Vector2 tc, Vector2 td)
{
int i = V.Count;
V.Add(new VertexPNCT { Position = a, Normal = n, Color = col, Uv = ta });
V.Add(new VertexPNCT { Position = b, Normal = n, Color = col, Uv = tb });
V.Add(new VertexPNCT { Position = c, Normal = n, Color = col, Uv = tc });
V.Add(new VertexPNCT { Position = d, Normal = n, Color = col, Uv = td });
I.AddRange(new[] { i, i + 1, i + 2, i, i + 2, i + 3 });
}
/// Quader (achsengerade), Mitte c, Größe s.
public void Box(Vector3 c, Vector3 s, Color col)
{
var h = s / 2;
Vector3 P(float x, float y, float z) => c + new Vector3(x * h.X, y * h.Y, z * h.Z);
var z0 = Vector2.Zero;
Quad(P(-1, -1, 1), P(1, -1, 1), P(1, 1, 1), P(-1, 1, 1), Vector3.UnitZ, col, z0, z0, z0, z0);
Quad(P(1, -1, -1), P(-1, -1, -1), P(-1, 1, -1), P(1, 1, -1), -Vector3.UnitZ, col, z0, z0, z0, z0);
Quad(P(-1, -1, -1), P(-1, -1, 1), P(-1, 1, 1), P(-1, 1, -1), -Vector3.UnitX, col, z0, z0, z0, z0);
Quad(P(1, -1, 1), P(1, -1, -1), P(1, 1, -1), P(1, 1, 1), Vector3.UnitX, col, z0, z0, z0, z0);
Quad(P(-1, -1, -1), P(1, -1, -1), P(1, -1, 1), P(-1, -1, 1), -Vector3.UnitY, col, z0, z0, z0, z0);
}
/// Senkrechter Zylinder (Becken, Pfosten): Mitte unten c, Radius r, Höhe h (nach oben = −y).
public void Cylinder(Vector3 c, float r, float h, Color col, int seg = 12, float rTop = -1)
{
if (rTop < 0) rTop = r;
var z0 = Vector2.Zero;
for (int i = 0; i < seg; i++)
{
float a0 = MathF.Tau * i / seg, a1 = MathF.Tau * (i + 1) / seg;
Vector3 Pt(float a, float rad, float y) => c + new Vector3(MathF.Cos(a) * rad, y, MathF.Sin(a) * rad);
var n = new Vector3(MathF.Cos((a0 + a1) / 2), 0, MathF.Sin((a0 + a1) / 2));
Quad(Pt(a0, r, 0), Pt(a1, r, 0), Pt(a1, rTop, -h), Pt(a0, rTop, -h), n, col, z0, z0, z0, z0);
Quad(Pt(a0, rTop, -h), Pt(a1, rTop, -h), c + new Vector3(0, -h, 0), c + new Vector3(0, -h, 0), -Vector3.UnitY, col, z0, z0, z0, z0);
}
}
public void Freeze() { VA = V.ToArray(); IA = I.ToArray(); }
}
readonly ArenaLook _look;
readonly List<Part> _parts = new();
readonly Part _backdrop, _banners;
readonly List<Vector3> _fires = new();
readonly List<(float Angle, float Phase)> _bannerAt = new();
readonly BasicEffect _fx;
readonly Texture2D? _still;
readonly string? _loop;
readonly int _rows;
readonly bool _colonnade;
// Publikum auf den Rängen: Bilder der Zuschauer (ruhig/jubelnd), jedes Bild neu gebaut (wippen, jubeln)
sealed class Fan { public Vector3 Base, Right; public float H, Phase, Threshold; public int Kind; public bool Mirror; }
readonly List<Fan> _fans = new();
readonly List<(Texture2D Calm, Texture2D Cheer)> _fanTex = new();
readonly AlphaTestEffect _fanFx;
// je Bild (ruhig/jubelnd je Zuschauerbild) feste Punkt-Arrays: keine neuen Objekte je Bild
VertexPositionColorTexture[][] _fanV = null!;
int[] _fanN = null!;
// Kulisse je Arena nur einmal bauen (Hub, Duell, Freiheit teilen sie)
static readonly Dictionary<(int, bool), ArenaSet> _cache = new();
public static ArenaSet Get(int arena, string backdropArt, bool calm)
{
if (!_cache.TryGetValue((arena, calm), out var s)) _cache[(arena, calm)] = s = new ArenaSet(arena, backdropArt, calm);
return s;
}
public ArenaLook Look => _look;
ArenaSet(int arena, string backdropArt, bool calm)
{
_look = ArenaLook.For(arena);
_still = Assets.Sprite(backdropArt, "jpg");
_loop = calm ? null : backdropArt;
_fx = new BasicEffect(Assets.Device) { VertexColorEnabled = true, TextureEnabled = true, PreferPerPixelLighting = true };
// Ludus: Hof mit Säulengang, keine Ränge; Provinz: wenige Holzränge; sonst volle Steinränge
_rows = _look.Posts ? 0 : _look.Wall == "wood" ? 4 : 7;
_colonnade = _look.Wall != "wood" || _look.Posts;
_backdrop = BuildBackdrop();
_parts.Add(BuildFloor());
_parts.Add(BuildStands());
if (_colonnade) _parts.Add(BuildColonnade());
_parts.Add(BuildWall());
_parts.Add(BuildCoping());
if (Assets.Sprite("tex_gate", "jpg") is Texture2D gate) _parts.Add(BuildGates(gate));
_parts.Add(BuildProps());
_banners = new Part { Tex = Assets.Sprite("tex_banner", "jpg"), Tint = _look.Banner.ToVector3() * 1.15f };
foreach (var a in new[] { -50f, -14f, 14f, 50f }) _bannerAt.Add((a, a * 0.13f));
foreach (var p in _parts) p.Freeze();
_backdrop.Freeze();
for (int i = 1; i <= 6; i++)
if (Assets.Sprite($"spectator_{i}") is Texture2D idle) _fanTex.Add((idle, Assets.Sprite($"spectator_{i}_cheer") ?? idle));
_fanFx = new AlphaTestEffect(Assets.Device) { VertexColorEnabled = true, ReferenceAlpha = 110, AlphaFunction = CompareFunction.Greater };
if (_fanTex.Count > 0 && _rows > 0) SeatFans(arena);
_fanV = new VertexPositionColorTexture[_fanTex.Count * 2][];
_fanN = new int[_fanV.Length];
for (int i = 0; i < _fanV.Length; i++)
{
int n = 0; foreach (var f in _fans) if (f.Kind == i / 2) n++;
_fanV[i] = new VertexPositionColorTexture[n * 6];
}
}
static float RowTop(int i) => Floor - WALL_H - 14 - (i + 1) * ROW_H;
static float RowR(int i) => R + 30 + i * ROW_D;
/// Stufen der Ränge: je Reihe eine senkrechte Setzstufe und eine waagrechte Sitzfläche.
Part BuildStands()
{
var p = new Part { Tex = Assets.Pixel };
var (tread, riser) = _look.Wall switch
{
"wood" => (new Color(112, 82, 56), new Color(78, 56, 38)),
"marble" => (new Color(222, 214, 202), new Color(168, 156, 148)),
_ => (new Color(186, 172, 150), new Color(132, 120, 104)),
};
const int SEG = 80;
for (int i = 0; i < _rows; i++)
{
float yLow = i == 0 ? Floor - WALL_H - 14 : RowTop(i - 1), yTop = RowTop(i), r0 = RowR(i), r1 = r0 + ROW_D;
var shade = (i % 2 == 0) ? 1f : 0.94f;
for (int k = 0; k < SEG; k++)
{
float d0 = -78 + 156f * k / SEG, d1 = -78 + 156f * (k + 1) / SEG;
var z0 = Vector2.Zero;
p.Quad(OnWall(d0, r0, yTop), OnWall(d1, r0, yTop), OnWall(d1, r0, yLow), OnWall(d0, r0, yLow), Inward((d0 + d1) / 2), riser * shade, z0, z0, z0, z0);
p.Quad(OnWall(d0, r1, yTop), OnWall(d1, r1, yTop), OnWall(d1, r0, yTop), OnWall(d0, r0, yTop), -Vector3.UnitY, tread * shade, z0, z0, z0, z0);
}
}
return p;
}
/// Säulenreihe mit Gebälk über den Rängen (im Ludus: Säulengang hinter dem Zaun), dahinter dunkler Gang.
Part BuildColonnade()
{
var p = new Part { Tex = Assets.Pixel };
float baseY = _rows > 0 ? RowTop(_rows - 1) : Floor, r = _rows > 0 ? RowR(_rows - 1) + ROW_D - 20 : R + 320;
float h = _rows > 0 ? COL_H : COL_H + 160;
var stone = _look.Wall == "marble" ? new Color(226, 218, 204) : _look.Wall == "wood" ? new Color(206, 196, 178) : new Color(196, 184, 162);
float step = _look.Wall == "marble" ? 4.5f : 6;
for (float a = -78; a <= 78.01f; a += step)
{
var c = OnWall(a, r, baseY);
p.Cylinder(c, 24, h, stone, 12);
p.Cylinder(c, 34, 18, stone * 0.9f, 10); // Basis
p.Cylinder(c + new Vector3(0, -h + 20, 0), 32, 20, stone * 0.9f, 10); // Kapitell
}
const int SEG = 80;
for (int k = 0; k < SEG; k++)
{
float d0 = -78 + 156f * k / SEG, d1 = -78 + 156f * (k + 1) / SEG;
var z0 = Vector2.Zero;
float top = baseY - h, n = (d0 + d1) / 2;
// Gebälk vorn und oben
p.Quad(OnWall(d0, r - 40, top - 56), OnWall(d1, r - 40, top - 56), OnWall(d1, r - 40, top), OnWall(d0, r - 40, top), Inward(n), stone, z0, z0, z0, z0);
p.Quad(OnWall(d0, r + 120, top - 56), OnWall(d1, r + 120, top - 56), OnWall(d1, r - 40, top - 56), OnWall(d0, r - 40, top - 56), -Vector3.UnitY, stone * 0.85f, z0, z0, z0, z0);
// hinter den Säulen offen: dort sieht man das Arena-Gemälde (Boden des Gangs bleibt)
p.Quad(OnWall(d0, r + 120, baseY), OnWall(d1, r + 120, baseY), OnWall(d1, r - 40, baseY), OnWall(d0, r - 40, baseY), -Vector3.UnitY, stone * 0.6f, z0, z0, z0, z0);
}
return p;
}
/// Zuschauer auf die Ränge setzen (dichter in großen Arenen; einige Lücken).
void SeatFans(int arena)
{
var rng = new Random(arena * 977 + 13);
float gap = _look.Wall == "wood" ? 74 : 54;
for (int i = 0; i < _rows; i++)
{
float r = RowR(i) + ROW_D * 0.42f;
float step = MathHelper.ToDegrees(gap / r);
for (float a = -77; a <= 77; a += step * (0.8f + 0.4f * (float)rng.NextDouble()))
{
if (rng.NextDouble() < 0.1) continue; // freier Platz
float rad = MathHelper.ToRadians(a);
_fans.Add(new Fan
{
Base = OnWall(a, r, RowTop(i) + 6),
Right = new Vector3(MathF.Cos(rad), 0, MathF.Sin(rad)),
H = 118 * (0.88f + 0.24f * (float)rng.NextDouble()),
Phase = (float)(rng.NextDouble() * 10),
Threshold = 0.15f + 0.8f * (float)rng.NextDouble(),
Kind = rng.Next(_fanTex.Count),
Mirror = rng.NextDouble() < 0.5,
});
}
}
}
void DrawFans(GraphicsDevice gd, Matrix view3, Matrix proj3, double time, float excite)
{
if (_fans.Count == 0) return;
Array.Clear(_fanN);
float t = (float)time;
// Publikum etwas im Halbschatten der Ränge: dunkler als die Kämpfer, die so vorn bleiben
var light = Vector3.Clamp((_look.Ambient + _look.Sun * 0.5f) * 0.74f, Vector3.Zero, Vector3.One);
var col = new Color(light);
foreach (var f in _fans)
{
bool cheer = excite > f.Threshold;
float bob = cheer ? MathF.Abs(MathF.Sin(t * 6.5f + f.Phase)) * 16 * (0.5f + excite) : MathF.Sin(t * 1.4f + f.Phase) * 2;
var (calm, cheerTex) = _fanTex[f.Kind];
var tex = cheer ? cheerTex : calm;
float w = f.H * tex.Width / tex.Height;
var b = f.Base + new Vector3(0, -bob, 0);
var right = f.Right * (w / 2);
var up = new Vector3(0, -f.H, 0);
float u0 = f.Mirror ? 1 : 0, u1 = 1 - u0;
int k = f.Kind * 2 + (cheer ? 1 : 0);
var arr = _fanV[k]; ref int n = ref _fanN[k];
arr[n++] = new VertexPositionColorTexture(b - right + up, col, new Vector2(u0, 0));
arr[n++] = new VertexPositionColorTexture(b + right + up, col, new Vector2(u1, 0));
arr[n++] = new VertexPositionColorTexture(b + right, col, new Vector2(u1, 1));
arr[n++] = new VertexPositionColorTexture(b - right + up, col, new Vector2(u0, 0));
arr[n++] = new VertexPositionColorTexture(b + right, col, new Vector2(u1, 1));
arr[n++] = new VertexPositionColorTexture(b - right, col, new Vector2(u0, 1));
}
_fanFx.World = Matrix.Identity; _fanFx.View = view3; _fanFx.Projection = proj3;
_fanFx.FogEnabled = true; _fanFx.FogColor = _look.Fog; _fanFx.FogStart = _look.FogStart * 0.55f; _fanFx.FogEnd = _look.FogEnd * 0.9f;
gd.DepthStencilState = DepthStencilState.Default;
gd.BlendState = BlendState.Opaque;
for (int k = 0; k < _fanV.Length; k++)
{
if (_fanN[k] == 0) continue;
var (calm, cheerTex) = _fanTex[k / 2];
_fanFx.Texture = Assets.Mipmapped(k % 2 == 1 ? cheerTex : calm);
foreach (var pass in _fanFx.CurrentTechnique.Passes)
{
pass.Apply();
gd.SamplerStates[0] = Clamp;
gd.DrawUserPrimitives(PrimitiveType.TriangleList, _fanV[k], 0, _fanN[k] / 3);
}
}
}
static Vector3 OnWall(float deg, float radius, float y)
{
float a = MathHelper.ToRadians(deg);
return new Vector3(CX + radius * MathF.Sin(a), y, ZC - radius * MathF.Cos(a));
}
static Vector3 Inward(float deg) { float a = MathHelper.ToRadians(deg); return new Vector3(-MathF.Sin(a), 0, MathF.Cos(a)); }
// ── Bauteile ────────────────────────────────────────────────
/// Arena-Gemälde weit hinten: Zylinderstück, ±30° = ganzes Bild, außen gespiegelt (Schwenks).
Part BuildBackdrop()
{
var p = new Part { Lit = false, Mirror = true, Fog = false, Tint = Vector3.Lerp(new Vector3(_look.BackdropLight), _look.Fog, 0.18f) };
const float SPAN = 30, EXTRA = 60;
float width = BACK_R * MathHelper.ToRadians(2 * SPAN), height = width * 9 / 16;
// Bildzeile "Horizon" (dort beginnt der gemalte Boden) liegt knapp unter der Mauerkrone
float wallTop = HorizonY();
float top = wallTop - _look.Horizon * height;
const int SEG = 40;
for (int i = 0; i < SEG; i++)
{
float d0 = -EXTRA + 2 * EXTRA * i / SEG, d1 = -EXTRA + 2 * EXTRA * (i + 1) / SEG;
float u0 = (d0 + SPAN) / (2 * SPAN), u1 = (d1 + SPAN) / (2 * SPAN);
p.Quad(OnWall(d0, BACK_R, top), OnWall(d1, BACK_R, top), OnWall(d1, BACK_R, top + height), OnWall(d0, BACK_R, top + height),
Inward((d0 + d1) / 2), Color.White, new Vector2(u0, 0), new Vector2(u1, 0), new Vector2(u1, 1), new Vector2(u0, 1));
}
return p;
}
/// Höhe (y) auf dem fernen Bild, die hinter der Mauerkrone liegt (von der Kamera aus gesehen).
static float HorizonY()
{
float wFront = (Camera.DIST + (R - ZC)) / Camera.DIST; // Mauer vorn
float wBack = (Camera.DIST + (BACK_R - ZC)) / Camera.DIST; // Gemälde
float screenY = (Floor - WALL_H + Camera.EYE_Y * (wFront - 1)) / wFront;
return screenY * wBack - Camera.EYE_Y * (wBack - 1) + 40;
}
/// Sandboden als Gitter: Farbe leicht dunkler am Mauerfuß und in der getretenen Kampfmitte.
Part BuildFloor()
{
var p = new Part { Tex = Assets.Sprite("tex_sand", "jpg"), Wrap = true, Tint = _look.Sand * new Vector3(0.86f, 0.88f, 0.98f) };
const int NX = 40, NZ = 16;
float x0 = CX - 5200, x1 = CX + 5200, z0 = -(R - ZC) - 900, z1 = 900;
Vector3 Pt(int i, int k) => new(x0 + (x1 - x0) * i / NX, Floor, z0 + (z1 - z0) * k / NZ);
Color Shade(Vector3 v)
{
float toWall = MathF.Sqrt((v.X - CX) * (v.X - CX) + (v.Z - ZC) * (v.Z - ZC));
float ao = MathHelper.Clamp((R - toWall) / 500, 0, 1); // 0 am Mauerfuß
float mid = MathF.Sqrt((v.X - CX) * (v.X - CX) / 1.0f + v.Z * v.Z * 2.2f);
float trod = MathHelper.Clamp(1 - mid / 900, 0, 1);
float s = (0.62f + 0.38f * ao) * (1 - 0.12f * trod);
return new Color(s, s * 0.98f, s * 0.95f);
}
for (int i = 0; i < NX; i++)
for (int k = 0; k < NZ; k++)
{
Vector3 a = Pt(i, k + 1), b = Pt(i + 1, k + 1), c = Pt(i + 1, k), d = Pt(i, k);
Vector2 T(Vector3 v) => new(v.X / 420f, v.Z / 420f);
int n = p.V.Count;
foreach (var v in new[] { a, b, c, d })
p.V.Add(new VertexPNCT { Position = v, Normal = -Vector3.UnitY, Color = Shade(v), Uv = T(v) });
p.I.AddRange(new[] { n, n + 1, n + 2, n, n + 2, n + 3 });
}
return p;
}
string WallTex => _look.Wall switch { "wood" => "tex_wall_wood", "marble" => "tex_wall_marble", _ => "tex_wall_stone" };
Part BuildWall()
{
var tint = _look.Wall == "wood" ? new Vector3(1.05f, 0.82f, 0.62f) : Vector3.One; // Holz wärmer als die graue Vorlage
var p = new Part { Tex = Assets.Sprite(WallTex, "jpg"), Wrap = true, Tint = tint };
const int SEG = 72;
const float FROM = -75, TO = 75;
float tile = WALL_H * 3; // Textur 3:1
for (int i = 0; i < SEG; i++)
{
float d0 = FROM + (TO - FROM) * i / SEG, d1 = FROM + (TO - FROM) * (i + 1) / SEG;
float u0 = R * MathHelper.ToRadians(d0) / tile, u1 = R * MathHelper.ToRadians(d1) / tile;
p.Quad(OnWall(d0, R, Floor - WALL_H), OnWall(d1, R, Floor - WALL_H), OnWall(d1, R, Floor), OnWall(d0, R, Floor),
Inward((d0 + d1) / 2), Color.White, new Vector2(u0, 0), new Vector2(u1, 0), new Vector2(u1, 1), new Vector2(u0, 1));
}
return p;
}
/// Mauerkrone: flache Abdeckung, etwas heller, ragt nach innen.
Part BuildCoping()
{
var p = new Part { Tex = Assets.Pixel };
var col = _look.Wall switch { "wood" => new Color(92, 66, 44), "marble" => new Color(214, 196, 150), _ => new Color(196, 184, 160) };
const int SEG = 72;
for (int i = 0; i < SEG; i++)
{
float d0 = -75 + 150f * i / SEG, d1 = -75 + 150f * (i + 1) / SEG;
var z0 = Vector2.Zero;
float y = Floor - WALL_H;
p.Quad(OnWall(d0, R + 30, y - 14), OnWall(d1, R + 30, y - 14), OnWall(d1, R - 26, y - 14), OnWall(d0, R - 26, y - 14),
-Vector3.UnitY, col, z0, z0, z0, z0);
p.Quad(OnWall(d0, R - 26, y - 14), OnWall(d1, R - 26, y - 14), OnWall(d1, R - 26, y + 10), OnWall(d0, R - 26, y + 10),
Inward((d0 + d1) / 2), col * 0.8f, z0, z0, z0, z0);
}
return p;
}
/// Tore in der Mauer (links und rechts, beim Kaiser auch in der Mitte).
Part BuildGates(Texture2D gate)
{
var p = new Part { Tex = gate };
var at = _look.Wall == "marble" ? new[] { -30f, 0f, 30f } : new[] { -30f, 30f };
foreach (float a in at)
{
float half = MathHelper.ToDegrees(130 / R); // 260 breit
float y0 = Floor - WALL_H + 22;
p.Quad(OnWall(a - half, R - 3, y0), OnWall(a + half, R - 3, y0), OnWall(a + half, R - 3, Floor), OnWall(a - half, R - 3, Floor),
Inward(a), Color.White, new Vector2(0.08f, 0.04f), new Vector2(0.92f, 0.04f), new Vector2(0.92f, 0.98f), new Vector2(0.08f, 0.98f));
}
return p;
}
/// Kohlebecken (Feuer als Licht), im Ludus Holzpfosten.
Part BuildProps()
{
var p = new Part { Tex = Assets.Pixel };
var bronze = new Color(86, 62, 38); var iron = new Color(46, 40, 36); var wood = new Color(104, 72, 46);
float[] fire = _look.Braziers switch { 4 => new[] { -42f, -18f, 18f, 42f }, 2 => new[] { -40f, 40f }, _ => Array.Empty<float>() };
foreach (float a in fire)
{
var c = OnWall(a, R - 170, Floor);
p.Cylinder(c, 9, 120, iron, 8); // Säule
p.Cylinder(c + new Vector3(0, -120, 0), 22, 26, bronze, 14, 46); // Schale (oben weiter)
p.Cylinder(c, 30, 8, iron, 10); // Fuß
_fires.Add(c + new Vector3(0, -150, 0));
}
if (_look.Posts)
foreach (var (x, z, h) in new[] { (180f, -620f, 170f), (1760f, -520f, 150f), (-220f, -980f, 190f), (2240f, -880f, 160f), (960f, -1100f, 140f) })
{
p.Cylinder(new Vector3(x, Floor, z), 20, h, wood, 10);
p.Box(new Vector3(x, Floor - h * 0.7f, z), new Vector3(70, 12, 12), wood * 0.85f); // Querholz
}
return p;
}
// ── Zeichnen ────────────────────────────────────────────────
void Light(Part p)
{
_fx.LightingEnabled = p.Lit;
_fx.FogEnabled = p.Fog;
_fx.FogColor = _look.Fog;
_fx.FogStart = _look.FogStart; _fx.FogEnd = _look.FogEnd;
_fx.DiffuseColor = p.Tint;
if (!p.Lit) return;
_fx.AmbientLightColor = _look.Ambient;
_fx.DirectionalLight0.Enabled = true;
_fx.DirectionalLight0.Direction = Vector3.Normalize(_look.SunDir);
_fx.DirectionalLight0.DiffuseColor = _look.Sun;
_fx.DirectionalLight0.SpecularColor = Vector3.Zero;
_fx.DirectionalLight1.Enabled = false;
_fx.DirectionalLight2.Enabled = false;
}
static readonly SamplerState WrapMirror = new() { AddressU = TextureAddressMode.Mirror, AddressV = TextureAddressMode.Clamp, Filter = TextureFilter.Anisotropic, MaxAnisotropy = 8 };
static readonly SamplerState Wrap = new() { AddressU = TextureAddressMode.Wrap, AddressV = TextureAddressMode.Wrap, Filter = TextureFilter.Anisotropic, MaxAnisotropy = 8 };
static readonly SamplerState Clamp = new() { AddressU = TextureAddressMode.Clamp, AddressV = TextureAddressMode.Clamp, Filter = TextureFilter.Anisotropic, MaxAnisotropy = 8 };
void DrawPart(GraphicsDevice gd, Part p, Texture2D? tex = null)
{
if (p.VA == null || p.VA.Length == 0) return;
// feste Texturen mit Stufen gegen Flimmern in der Tiefe; das ferne Gemälde (Video-Bilder) ohne
_fx.Texture = tex ?? (p.Tex == null || p.Tex == Assets.Pixel ? Assets.Pixel : Assets.Mipmapped(p.Tex));
Light(p);
foreach (var pass in _fx.CurrentTechnique.Passes)
{
pass.Apply();
gd.SamplerStates[0] = p.Mirror ? WrapMirror : p.Wrap ? Wrap : Clamp;
gd.DrawUserIndexedPrimitives(PrimitiveType.TriangleList, p.VA, 0, p.VA.Length, p.IA, 0, p.IA!.Length / 3);
}
}
/// Kulisse zeichnen (mit Tiefe), danach liegen Schatten und Kämpfer darauf.
public void Draw(GraphicsDevice gd, Matrix view3, Matrix proj3, double time, float excite = 0.3f)
{
_fx.World = Matrix.Identity; _fx.View = view3; _fx.Projection = proj3;
gd.BlendState = BlendState.Opaque;
gd.RasterizerState = RasterizerState.CullNone;
// fernes Gemälde ohne Tiefe, dann alles andere mit Tiefe
gd.DepthStencilState = DepthStencilState.None;
var loop = _loop != null ? ClipCache.Video(_loop) : null;
var bg = loop != null ? loop[PingPong(time * 8, loop.Length)] : _still;
if (bg != null) DrawPart(gd, _backdrop, bg);
gd.DepthStencilState = DepthStencilState.Default;
foreach (var p in _parts) DrawPart(gd, p);
DrawFans(gd, view3, proj3, time, excite);
// Banner schwingen leicht: jedes Bild neu
_banners.V.Clear(); _banners.I.Clear();
foreach (var (a, ph) in _bannerAt)
{
float half = MathHelper.ToDegrees(42 / R), sway = 9 * MathF.Sin((float)time * 1.3f + ph);
float y0 = Floor - WALL_H + 4, y1 = y0 + 190;
var top0 = OnWall(a - half, R - 6, y0); var top1 = OnWall(a + half, R - 6, y0);
var off = new Vector3(sway, 0, 0) + Inward(a) * 8;
_banners.Quad(top0, top1, OnWall(a + half, R - 6, y1) + off, OnWall(a - half, R - 6, y1) + off, Inward(a), Color.White,
new Vector2(0, 0), new Vector2(1, 0), new Vector2(1, 1), new Vector2(0, 1));
}
_banners.Freeze();
gd.BlendState = BlendState.Opaque;
DrawPart(gd, _banners);
gd.BlendState = BlendState.AlphaBlend;
}
/// Feuer der Kohlebecken als Licht (Bildschirm-Pixel, additiv), Größe nach Entfernung.
public void DrawFires(SpriteBatch sb, Camera cam, Matrix view3, Matrix proj3, int vpW, int vpH, float screenScale, double time)
{
int i = 0;
foreach (var f in _fires)
{
var px = cam.ToPixel(f, view3, proj3, vpW, vpH, out float w);
float k = screenScale / w, flick = 0.85f + 0.15f * MathF.Sin((float)time * 17 + i * 2.3f) * MathF.Sin((float)time * 5.1f + i);
D.Glow(sb, px + new Vector2(0, 30 * k), new Vector2(520 * k, 300 * k), new Color(255, 120, 40) * (0.30f * flick));
D.Glow(sb, px, new Vector2(110 * k, 160 * k * flick), new Color(255, 170, 60) * 0.9f);
D.Glow(sb, px - new Vector2(0, 18 * k), new Vector2(60 * k, 90 * k * flick), new Color(255, 230, 160) * 0.9f);
i++;
}
}
static int PingPong(double t, int n)
{
if (n <= 1) return 0;
int period = 2 * (n - 1), i = (int)t % period;
return i < n ? i : period - i;
}
}
}

View File

@@ -37,6 +37,7 @@ namespace GladiatorIdle.Arena
_trauma = MathF.Max(0, _trauma - dt * 1.7f); _trauma = MathF.Max(0, _trauma - dt * 1.7f);
_punch *= MathF.Exp(-dt * 9f); _punch *= MathF.Exp(-dt * 9f);
if (calm) { _trauma = 0; _punch = 0; } if (calm) { _trauma = 0; _punch = 0; }
UpdateYaw(dt, calm);
} }
/// Kameraverschiebung durch Rütteln (Design-Pixel). /// Kameraverschiebung durch Rütteln (Design-Pixel).
@@ -48,6 +49,95 @@ namespace GladiatorIdle.Arena
s * (MathF.Cos((float)_t * 89) + 0.6f * MathF.Sin((float)_t * 151 + 0.7f)) / 1.6f); s * (MathF.Cos((float)_t * 89) + 0.6f * MathF.Sin((float)_t * 151 + 0.7f)) / 1.6f);
} }
// ── 3D: Perspektive, die die Kampfebene z = 0 genau wie die 2D-Ansicht abbildet ──
// Raum in Design-Pixeln: x rechts, y nach unten, z zum Betrachter; Kämpfer bei z = 0.
/// Augenhöhe (y) und Abstand der Kamera zur Kampfebene; Nah- und Fernebene.
public const float EYE_Y = 330, DIST = 2600, NEAR = 150, FAR = 16000;
/// Augenhöhe jetzt (atmet leicht, steigt beim Sprung mit).
public float EyeY { get; private set; } = EYE_Y;
float _lift, _liftTarget;
/// Kamera hebt sich kurz (Sprungangriff): Ziel in Design-Pixeln nach oben.
public void Lift(float amount) => _liftTarget = amount;
/// Drehung um die Bildmitte (Grad): Kinomomente. Basis gleitet zum Ziel, Puls schwingt hin und zurück.
public float Yaw { get; private set; }
float _yawBase, _yawTarget, _pulseAmp, _pulseDur, _pulseT = -1;
/// Kurzer Schwenk um die Kämpfer und zurück (Raserei, Treffer zum Sieg).
public void Pulse(float degrees, float seconds)
{
// ein laufender, größerer Schwenk wird nicht von einem kleinen unterbrochen
if (_pulseT >= 0 && MathF.Abs(_pulseAmp) > MathF.Abs(degrees) && _pulseT < _pulseDur * 0.7f) return;
_pulseAmp = degrees; _pulseDur = seconds; _pulseT = 0;
}
/// Langsame Fahrt auf einen festen Winkel (Sieg); 0 = zurück zur Seitenansicht.
public void HoldYaw(float degrees) => _yawTarget = degrees;
void UpdateYaw(float dt, bool calm)
{
_yawBase += (_yawTarget - _yawBase) * (1 - MathF.Exp(-dt * 0.9f));
float pulse = 0;
if (_pulseT >= 0)
{
_pulseT += dt;
float k = _pulseT / _pulseDur;
if (k >= 1) _pulseT = -1;
else pulse = _pulseAmp * MathF.Sin(MathF.PI * k);
}
// ständige leichte Bewegung: langsames Pendeln und Atmen der Höhe (wie eine Handkamera am Rand)
float drift = 3.2f * MathF.Sin((float)_t * 0.21f) + 1.3f * MathF.Sin((float)_t * 0.53f + 1.1f);
Yaw = calm ? 0 : _yawBase + pulse + drift;
_lift += (_liftTarget - _lift) * (1 - MathF.Exp(-dt * 4));
_liftTarget *= MathF.Exp(-dt * 1.5f);
EyeY = calm ? EYE_Y : EYE_Y + 22 * MathF.Sin((float)_t * 0.33f) - _lift;
}
/// Welt → Kameraraum (Kamera im Ursprung, Blick nach −z), mit Drehung um die Bildmitte.
public Matrix View3()
{
var pivot = new Vector3(Center.X, 0, 0);
return Matrix.CreateTranslation(-pivot) * Matrix.CreateRotationY(MathHelper.ToRadians(Yaw)) * Matrix.CreateTranslation(pivot)
* Matrix.CreateTranslation(-Center.X, -EyeY, -DIST);
}
/// Kameraraum → Bildschirm (Clip): erst perspektivisch zurück in Design-Pixel der Ebene z = 0,
/// dann dieselbe 2D-Abbildung wie <see cref="View"/> (Zoom, Wackeln, Stoß), dann Pixel → Clip.
public Matrix Proj3(float screenScale, Vector2 offset, int vpW, int vpH)
{
float ex = Center.X, ey = EyeY, d = DIST;
float a = -FAR / (d * (FAR - NEAR)), b = -NEAR * FAR / (d * (FAR - NEAR));
// Zeilen-Vektor-Form: (x, y, z, 1) → (X, Y, Z, W) mit W = −z/d (z = 0 der Welt ⇒ W = 1)
var p = new Matrix(
1, 0, 0, 0,
0, 1, 0, 0,
-ex / d, -ey / d, a, -1 / d,
0, 0, b, 0);
// Kameraraum hat den Ursprung bei (ex, ey, d): Design-Pixel = x_c + ex·W
var v2 = View(screenScale, offset); // nur x/y benutzen (2D-affin)
var a2 = new Matrix(
v2.M11, v2.M12, 0, 0,
v2.M21, v2.M22, 0, 0,
0, 0, 1, 0,
v2.M41, v2.M42, 0, 1);
var clip = new Matrix(
2f / vpW, 0, 0, 0,
0, -2f / vpH, 0, 0,
0, 0, 1, 0,
-1, 1, 0, 1);
return p * a2 * clip;
}
/// Weltpunkt → Bildschirm-Pixel; <c>w</c> &gt; 1 heißt weiter hinten (für Größen von Lichtern).
public Vector2 ToPixel(Vector3 world, Matrix view3, Matrix proj3, int vpW, int vpH, out float w)
{
var c = Vector4.Transform(new Vector4(world, 1), view3 * proj3);
w = MathF.Max(0.001f, c.W);
return new Vector2((c.X / w + 1) * 0.5f * vpW, (1 - c.Y / w) * 0.5f * vpH);
}
/// Design-Pixel → Bildschirm. <paramref name="parallax"/>: 1 = Ebene der Kämpfer, &lt;1 weiter hinten. /// Design-Pixel → Bildschirm. <paramref name="parallax"/>: 1 = Ebene der Kämpfer, &lt;1 weiter hinten.
public Matrix View(float screenScale, Vector2 offset, float parallax = 1f) public Matrix View(float screenScale, Vector2 offset, float parallax = 1f)
{ {

View File

@@ -26,7 +26,8 @@ namespace GladiatorIdle.Arena
readonly Ui _ui = new(); readonly Ui _ui = new();
readonly Particles _fx = new(); readonly Particles _fx = new();
readonly Texture2D? _backdrop = Assets.Sprite("arena_ludus", "jpg"); readonly Stage3D _stage = new(0, AppSettings.ReduceMotion) { }; // Hof des Ludus in 3D
const float PREVIEW_X = 470;
FighterView _preview = null!; FighterView _preview = null!;
// Vorschaubilder der Vorlagen: aus den 3D-Figuren gerendert (je Klasse einmal geladen) // Vorschaubilder der Vorlagen: aus den 3D-Figuren gerendert (je Klasse einmal geladen)
const int THUMB_W = 296, THUMB_H = 340; const int THUMB_W = 296, THUMB_H = 340;
@@ -46,6 +47,7 @@ namespace GladiatorIdle.Arena
public CreatorScene(string name) public CreatorScene(string name)
{ {
Name = name; Name = name;
_stage.Cam.FocusX = 820; // Figur links groß, Auswahl rechts
SetClass(Class); SetClass(Class);
SoundManager.StartAmbient("music_menu"); SoundManager.StartAmbient("music_menu");
} }
@@ -75,7 +77,7 @@ namespace GladiatorIdle.Arena
_t += dt; _t += dt;
_ui.Begin(input, ui); _ui.Begin(input, ui);
ShowcaseStep(dt); ShowcaseStep(dt);
_preview.Update(dt, dt, _dummy, 0, AppSettings.ReduceMotion); _preview.Update(dt, dt, _dummy, PREVIEW_X, AppSettings.ReduceMotion);
_fx.Motes(AppSettings.ReduceMotion ? 0 : 50, Camera.W, Camera.H); _fx.Motes(AppSettings.ReduceMotion ? 0 : 50, Camera.W, Camera.H);
_fx.Update(dt); _fx.Update(dt);
} }
@@ -108,32 +110,23 @@ namespace GladiatorIdle.Arena
D.UiScale = scale; D.UiScale = scale;
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0); var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
// Bühne: der Hof des Ludus in 3D, die Figur steht mit Schatten im Sand, die Kamera wandert langsam
_stage.Cam.Update(1 / 60f, PREVIEW_X, PREVIEW_X, AppSettings.ReduceMotion);
_stage.Cam.HoldYaw(12 * MathF.Sin((float)_t * 0.22f));
_stage.Prepare(gd, scale, offset);
_stage.DrawSet(gd, sb, _t, 0.3f);
_stage.Shadows(gd, sb, 0, _preview);
_stage.FloorLight(sb, PREVIEW_X, 900, 0.22f);
Stage3D.BeginFigures(gd);
_stage.Use(_preview);
_preview.DrawBody(gd, fx, _dummy, AppSettings.ReduceMotion);
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui); sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
if (_backdrop != null) D.Glow(sb, new Vector2(Camera.W + 200, Camera.H / 2), new Vector2(1400, 2000), Color.Black * 0.6f);
{ for (int i = 0; i < 14; i++)
float k = 1.1f * MathF.Max(Camera.W / _backdrop.Width, Camera.H / _backdrop.Height); D.Rect(sb, new RectangleF(0, i * 14, 900, 14), Color.Black * (0.45f * (1 - i / 14f)));
sb.Draw(_backdrop, new Vector2(Camera.W / 2, Camera.H / 2), null, new Color(0.42f, 0.38f, 0.34f), 0,
new Vector2(_backdrop.Width / 2f, _backdrop.Height / 2f), k, SpriteEffects.None, 0);
}
D.Glow(sb, new Vector2(-200, Camera.H / 2), new Vector2(900, 2000), Color.Black * 0.7f);
D.Glow(sb, new Vector2(Camera.W + 200, Camera.H / 2), new Vector2(900, 2000), Color.Black * 0.7f);
D.Text(sb, Assets.Serif, 56, L.t("create.title").ToUpperInvariant(), new Vector2(110, 78), D.Gold); D.Text(sb, Assets.Serif, 56, L.t("create.title").ToUpperInvariant(), new Vector2(110, 78), D.Gold);
sb.End(); sb.End();
// Vorschau: eigene Kamera (größer), Lichtkegel, Schatten, Figur
var view = Matrix.CreateTranslation(0, -Stage.FloorY, 0) * Matrix.CreateScale(1.25f) * Matrix.CreateTranslation(470, 905, 0) * ui;
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, view);
D.Glow(sb, new Vector2(0, Stage.FloorY - 300), new Vector2(900, 1100), new Color(255, 190, 120) * 0.16f);
D.Glow(sb, new Vector2(0, Stage.FloorY + 6), new Vector2(700, 120), new Color(255, 180, 110) * 0.25f);
sb.End();
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, view);
_preview.DrawShadow(sb);
sb.End();
fx.View = view;
fx.Projection = Matrix.CreateOrthographicOffCenter(0, gd.Viewport.Width, gd.Viewport.Height, 0, 0, 1);
gd.BlendState = BlendState.AlphaBlend; gd.SamplerStates[0] = SamplerState.LinearClamp;
gd.RasterizerState = RasterizerState.CullNone; gd.DepthStencilState = DepthStencilState.None;
_preview.DrawBody(gd, fx, _dummy, AppSettings.ReduceMotion);
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, ui); sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, ui);
_fx.DrawAdd(sb); _fx.DrawAdd(sb);
sb.End(); sb.End();

View File

@@ -17,6 +17,22 @@ namespace GladiatorIdle.Arena
public bool Pressed(Keys k) => Keys.IsKeyDown(k) && !PrevKeys.IsKeyDown(k); public bool Pressed(Keys k) => Keys.IsKeyDown(k) && !PrevKeys.IsKeyDown(k);
public bool LeftClick => Mouse.LeftButton == ButtonState.Pressed && PrevMouse.LeftButton == ButtonState.Released; public bool LeftClick => Mouse.LeftButton == ButtonState.Pressed && PrevMouse.LeftButton == ButtonState.Released;
public bool RightHeld => Mouse.RightButton == ButtonState.Pressed; public bool RightHeld => Mouse.RightButton == ButtonState.Pressed;
// Gamepad (erster Spieler)
public GamePadState Pad, PrevPad;
/// Zuletzt benutztes Gerät war das Gamepad (Hinweise passen sich an).
public bool UsingPad;
public bool PadDown(Buttons b) => Pad.IsConnected && Pad.IsButtonDown(b);
public bool PadPressed(Buttons b) => Pad.IsConnected && Pad.IsButtonDown(b) && !PrevPad.IsButtonDown(b);
public float PadX => !Pad.IsConnected ? 0 : MathF.Abs(Pad.ThumbSticks.Left.X) > 0.35f ? MathF.Sign(Pad.ThumbSticks.Left.X)
: Pad.DPad.Left == ButtonState.Pressed ? -1 : Pad.DPad.Right == ButtonState.Pressed ? 1 : 0;
/// Gerät erkennen: Tasten/Maus → Tastatur, Knopf/Stick → Gamepad.
public void DetectDevice()
{
if (Pad.IsConnected && (Pad.Buttons != PrevPad.Buttons || Pad.ThumbSticks.Left.Length() > 0.5f || Pad.Triggers.Left > 0.4f || Pad.Triggers.Right > 0.4f)) UsingPad = true;
if (Keys.GetPressedKeyCount() > 0 || Mouse.LeftButton == ButtonState.Pressed || Mouse.Position != PrevMouse.Position) UsingPad = false;
}
} }
/// <summary> /// <summary>
@@ -36,8 +52,10 @@ namespace GladiatorIdle.Arena
readonly Camera _cam = new(); readonly Camera _cam = new();
readonly Particles _fx = new(); readonly Particles _fx = new();
readonly Crowd _crowd; readonly Crowd _crowd;
readonly Texture2D? _backdrop; readonly Texture2D? _backdrop; // Standbild für das Champion-Intro
readonly string? _loopName; readonly ArenaSet _set; // 3D-Kulisse: Sand, Mauer, Tore, Feuer, fernes Gemälde
BasicEffect? _plane; // 2D-Effekte auf der Kampfebene (z = 0) durch die 3D-Kamera
bool _wasFury;
readonly bool _calm = AppSettings.ReduceMotion; readonly bool _calm = AppSettings.ReduceMotion;
readonly AbilityBar _bar = new(); readonly AbilityBar _bar = new();
@@ -71,6 +89,94 @@ namespace GladiatorIdle.Arena
/// Testlauf: Bot steuert den Spieler. /// Testlauf: Bot steuert den Spieler.
public DuelBot? Bot; public DuelBot? Bot;
// ── Einführung (erster Kampf) ──
public enum TutStep { Off, Move, Strike, Block, Parry, Dodge, Leap, Fury, Finish }
TutStep _tut;
int _tutCount, _tutTries;
double _tutT;
double _enemyWindup;
public TutStep Tutorial => _tut;
public bool TutorialRan { get; private set; }
public void StartTutorial()
{
TutorialRan = true;
_enemyWindup = Duel.Enemy.Windup;
Duel.GuardHp = true;
Duel.EnemyDamageMult = 0.5;
TutGo(TutStep.Move);
}
void TutGo(TutStep s)
{
_tut = s; _tutCount = 0; _tutTries = 0; _tutT = 0;
var e = Duel.Enemy;
Duel.EnemyPassive = s is TutStep.Move or TutStep.Strike or TutStep.Dodge or TutStep.Leap or TutStep.Fury;
Duel.EnemyAttacksOnly = s is TutStep.Block or TutStep.Parry;
e.Windup = s is TutStep.Block or TutStep.Parry ? 0.9 : _enemyWindup; // deutlich angekündigt
if (s == TutStep.Fury) Duel.Player.Rage = 100;
if (s == TutStep.Finish) { Duel.GuardHp = false; Duel.EnemyAttacksOnly = false; }
if (s != TutStep.Move) SoundManager.PlayTip();
}
void TutSkip()
{
Duel.EnemyPassive = Duel.EnemyAttacksOnly = Duel.GuardHp = false;
Duel.EnemyDamageMult = 1;
Duel.Enemy.Windup = _enemyWindup;
_tut = TutStep.Off;
}
/// Schritt an Zuständen erkennen (jedes Bild).
void TutUpdate(float realDt, Input input)
{
if (_tut == TutStep.Off) return;
_tutT += realDt;
if (input.Pressed(Keys.Tab)) { TutSkip(); return; }
var p = Duel.Player; var e = Duel.Enemy;
switch (_tut)
{
case TutStep.Move when Math.Abs(e.X - p.X) < p.Reach: TutGo(TutStep.Strike); break;
case TutStep.Dodge when p.State == DuelState.Dodge: TutGo(TutStep.Leap); break;
case TutStep.Leap when p.State == DuelState.Leap: TutGo(TutStep.Fury); break;
case TutStep.Fury when p.State == DuelState.Super: TutGo(TutStep.Finish); break;
case TutStep.Finish when Duel.Over: _tut = TutStep.Off; break;
}
if (_tut == TutStep.Parry && e.State == DuelState.Strike && e.StateTime < 0.02) _tutTries++;
if (_tut == TutStep.Parry && _tutTries >= 4) TutGo(TutStep.Dodge); // nicht hängen bleiben
}
/// Schritt an Ereignissen erkennen.
void TutEvent(DuelEvent e)
{
switch (_tut)
{
case TutStep.Strike when e.Type == DuelEventType.Hit && e.ByPlayer: if (++_tutCount >= 2) TutGo(TutStep.Block); break;
case TutStep.Block when e.Type == DuelEventType.Blocked && e.ByPlayer: TutGo(TutStep.Parry); break;
case TutStep.Block when e.Type == DuelEventType.Parry && e.ByPlayer: TutGo(TutStep.Dodge); break;
case TutStep.Parry when e.Type == DuelEventType.Parry && e.ByPlayer: TutGo(TutStep.Dodge); break;
}
}
/// Testläufe: erfüllt jeden Schritt der Einführung.
void TutBot()
{
var d = Duel; var p = d.Player; var e = d.Enemy;
int toward = e.X >= p.X ? 1 : -1;
d.MoveDir = 0; d.BlockHeld = false;
switch (_tut)
{
case TutStep.Move: d.MoveDir = toward; break;
case TutStep.Strike: if (!p.Busy) d.PressAttack(); break;
case TutStep.Block: d.BlockHeld = e.State is DuelState.Windup or DuelState.Strike; break;
case TutStep.Parry: d.BlockHeld = e.State == DuelState.Windup && e.StateTime > e.Windup - 0.1 || e.State == DuelState.Strike; break;
case TutStep.Dodge: if (_tutT > 0.8) d.PressDodge(); break;
case TutStep.Leap: if (_tutT > 0.8) d.PressLeap(); break;
case TutStep.Fury: if (_tutT > 0.8) d.PressSuper(); break;
default: Bot?.Act(d); break;
}
}
public DuelScene(GameState game, Enemy enemy, int seed) public DuelScene(GameState game, Enemy enemy, int seed)
{ {
_game = game; _game = game;
@@ -88,7 +194,7 @@ namespace GladiatorIdle.Arena
_fx.Calm = _calm; _fx.Calm = _calm;
string arena = Art.Arena(ArenaDef.All[game.Arena]); string arena = Art.Arena(ArenaDef.All[game.Arena]);
_backdrop = Assets.Sprite(arena, "jpg"); _backdrop = Assets.Sprite(arena, "jpg");
_loopName = _calm ? null : arena; _set = ArenaSet.Get(game.Arena, arena, _calm);
_cam.Center = new Vector2(Camera.W / 2, Camera.H / 2 + 40); _cam.Center = new Vector2(Camera.W / 2, Camera.H / 2 + 40);
_cam.Zoom = 1.45f; // Auftakt: nah, dann fährt die Kamera auf _cam.Zoom = 1.45f; // Auftakt: nah, dann fährt die Kamera auf
_crowd.Excite(0.5f); _crowd.Excite(0.5f);
@@ -144,14 +250,16 @@ namespace GladiatorIdle.Arena
} }
break; break;
case Phase.Fight: case Phase.Fight:
if (Bot != null) Bot.Act(Duel); if (Bot != null) { if (_tut != TutStep.Off) TutBot(); else Bot.Act(Duel); }
else Controls(input); else Controls(input);
TutUpdate(realDt, input);
Duel.Step(dt); Duel.Step(dt);
HandleEvents(); HandleEvents();
if (Duel.Over) if (Duel.Over)
{ {
_phase = Phase.End; _phaseTime = 0; Won = Duel.PlayerWon; _phase = Phase.End; _phaseTime = 0; Won = Duel.PlayerWon;
_cam.FocusX = Won ? _pv.X : _ev.X; _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(); if (Won) SoundManager.PlayVictory(); else SoundManager.PlayDefeat();
} }
break; break;
@@ -190,6 +298,8 @@ namespace GladiatorIdle.Arena
{ {
var pl = Duel.Player; var pl = Duel.Player;
bool fury = pl.State == DuelState.Super; bool fury = pl.State == DuelState.Super;
if (fury && !_wasFury && !_calm) _cam.Pulse(-22, 1.6f); // Kinomoment: die Kamera schwenkt herum und zurück
_wasFury = fury;
_furyDark += ((fury ? 1f : 0f) - _furyDark) * (1 - MathF.Exp(-realDt * (fury ? 7 : 2.5f))); _furyDark += ((fury ? 1f : 0f) - _furyDark) * (1 - MathF.Exp(-realDt * (fury ? 7 : 2.5f)));
if (fury && _phase == Phase.Fight) _cam.FocusX = (_pv.X + _ev.X) / 2; if (fury && _phase == Phase.Fight) _cam.FocusX = (_pv.X + _ev.X) / 2;
else if (_phase == Phase.Fight && _cam.FocusX != null) _cam.FocusX = null; else if (_phase == Phase.Fight && _cam.FocusX != null) _cam.FocusX = null;
@@ -247,25 +357,40 @@ namespace GladiatorIdle.Arena
else if (!_pLanded && p.StateTime >= Duel.LEAP_HIT) { _pLanded = true; SoundManager.PlayLand(); _fx.Dust(new Vector2(_pv.X, Stage.FloorY), 10, 80, 40, 70); } else if (!_pLanded && p.StateTime >= Duel.LEAP_HIT) { _pLanded = true; SoundManager.PlayLand(); _fx.Dust(new Vector2(_pv.X, Stage.FloorY), 10, 80, 40, 70); }
} }
/// W/E ohne gelernte Fähigkeit: Hinweis, wo man sie bekommt (nicht öfter als alle 1,5 s).
void Locked()
{
if (_time - _lockedAt < 1.5) return;
_lockedAt = _time;
Float(L.t("duel.locked"), _pv.Chest - new Vector2(0, 220), D.Sand, 26);
}
double _lockedAt = -9;
static float Lag(float lag, float value, float dt) => lag <= value ? value : MathF.Max(value, lag - dt * 0.6f); static float Lag(float lag, float value, float dt) => lag <= value ? value : MathF.Max(value, lag - dt * 0.6f);
void Controls(Input i) void Controls(Input i)
{ {
Duel.MoveDir = (i.Down(Keys.D, Keys.Right) ? 1 : 0) - (i.Down(Keys.A, Keys.Left) ? 1 : 0); // Tastatur/Maus oder Gamepad: Stick/Steuerkreuz bewegen, A Schlag, B ausweichen, X Sprungangriff,
Duel.BlockHeld = i.RightHeld || i.Down(Keys.K, Keys.LeftShift); // LT halten Block, RT Raserei, Y Spezial (Q), LB schwerer Schlag (W), RB Schildwall (E)
if (i.LeftClick || i.Pressed(Keys.J)) Duel.PressAttack(); int keys = (i.Down(Keys.D, Keys.Right) ? 1 : 0) - (i.Down(Keys.A, Keys.Left) ? 1 : 0);
if (i.Pressed(Keys.Space)) Duel.PressLeap(); Duel.MoveDir = keys != 0 ? keys : (int)i.PadX;
if (i.Pressed(Keys.S) || i.Pressed(Keys.Down)) Duel.PressDodge(); Duel.BlockHeld = i.RightHeld || i.Down(Keys.K, Keys.LeftShift) || i.Pad.Triggers.Left > 0.4f;
if (i.Pressed(Keys.R)) Duel.PressSuper(); if (i.LeftClick || i.Pressed(Keys.J) || i.PadPressed(Buttons.A)) Duel.PressAttack();
if (i.Pressed(Keys.Q)) Duel.PressSpecial(); if (i.Pressed(Keys.Space) || i.PadPressed(Buttons.X)) Duel.PressLeap();
if (i.Pressed(Keys.W)) Duel.PressHeavy(); if (i.Pressed(Keys.S) || i.Pressed(Keys.Down) || i.PadPressed(Buttons.B)) Duel.PressDodge();
if (i.Pressed(Keys.E)) Duel.PressWall(); if (i.Pressed(Keys.R) || i.PadPressed(Buttons.RightTrigger)) Duel.PressSuper();
if (i.Pressed(Keys.Q) || i.PadPressed(Buttons.Y)) Duel.PressSpecial();
if (i.Pressed(Keys.W) || i.PadPressed(Buttons.LeftShoulder)) { if (Duel.Perks.HeavyStrike) Duel.PressHeavy(); else Locked(); }
if (i.Pressed(Keys.E) || i.PadPressed(Buttons.RightShoulder)) { if (Duel.Perks.ShieldWall) Duel.PressWall(); else Locked(); }
_pad = i.UsingPad;
} }
bool _pad; // Hinweise für das Gamepad
void HandleEvents() void HandleEvents()
{ {
foreach (var e in Duel.Events) foreach (var e in Duel.Events)
{ {
TutEvent(e);
var targetView = e.ByPlayer ? _ev : _pv; var targetView = e.ByPlayer ? _ev : _pv;
var actorView = e.ByPlayer ? _pv : _ev; var actorView = e.ByPlayer ? _pv : _ev;
var target = e.ByPlayer ? Duel.Enemy : Duel.Player; var target = e.ByPlayer ? Duel.Enemy : Duel.Player;
@@ -291,12 +416,15 @@ namespace GladiatorIdle.Arena
_hitstop = Math.Max(_hitstop, e.Crit || heavy ? 0.13f : 0.075f); _hitstop = Math.Max(_hitstop, e.Crit || heavy ? 0.13f : 0.075f);
_cam.Shake(e.Crit || heavy ? 0.6f : 0.38f); _cam.Shake(e.Crit || heavy ? 0.6f : 0.38f);
_cam.Punch(e.Crit ? 0.07f : 0.04f, at); _cam.Punch(e.Crit ? 0.07f : 0.04f, at);
if (!_calm && (e.Crit || heavy)) _cam.Pulse((e.ByPlayer ? 1 : -1) * (heavy ? 9 : 6), 0.7f); // schwerer Treffer: Kamera zuckt herum
_fx.Sparks(at, e.Crit ? 34 : 18, e.Crit ? D.Gold : new Color(255, 230, 190), target.Facing > 0 ? MathF.PI : 0, 1.1f); _fx.Sparks(at, e.Crit ? 34 : 18, e.Crit ? D.Gold : new Color(255, 230, 190), target.Facing > 0 ? MathF.PI : 0, 1.1f);
_fx.Dust(new Vector2(targetView.X, Stage.FloorY), 6, 50, 80, 70); _fx.Dust(new Vector2(targetView.X, Stage.FloorY), 6, 50, 80, 70);
targetView.Hurt(e.Crit); targetView.Hurt(e.Crit);
_crowd.Excite(e.Crit ? 0.45f : 0.2f); _crowd.Excite(e.Crit ? 0.45f : 0.2f);
Float("-" + NumberFormat.Format(e.Amount) + (e.Crit ? "!" : ""), at - new Vector2(0, 120), bool heavyHit = e.ByPlayer && Duel.Player.Heavy;
e.ByPlayer ? (e.Crit ? D.Gold : Color.White) : D.Red, e.Crit ? 62 : 44); Float("-" + NumberFormat.Format(e.Amount) + (e.Crit || heavyHit ? "!" : ""), at - new Vector2(0, 120), // i18n-ok
e.ByPlayer ? (heavyHit ? new Color(255, 150, 40) : e.Crit ? D.Gold : Color.White) : D.Red, heavyHit ? 72 : e.Crit ? 62 : 44);
if (heavyHit) { Big(L.t("skill.heavystrike") + "!", new Color(255, 150, 40)); _cam.Shake(0.4f); } // i18n-ok
SoundManager.PlayHit(); SoundManager.PlayHit();
if (e.Crit) SoundManager.PlayCheer(); if (e.Crit) SoundManager.PlayCheer();
break; break;
@@ -343,6 +471,7 @@ namespace GladiatorIdle.Arena
break; break;
case DuelEventType.Leap: case DuelEventType.Leap:
_fx.Dust(new Vector2(_pv.X, Stage.FloorY), 10, 90, 50, 70); _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
_crowd.Excite(0.15f); _crowd.Excite(0.15f);
break; break;
case DuelEventType.Super: case DuelEventType.Super:
@@ -367,6 +496,7 @@ namespace GladiatorIdle.Arena
break; break;
case DuelEventType.Ko: case DuelEventType.Ko:
_slowmo = _calm ? 0 : 1.4f; _slowmo = _calm ? 0 : 1.4f;
if (!_calm) _cam.Pulse(e.ByPlayer ? -16 : 16, 1.6f); // Kinomoment: Schwenk auf den Fallenden
_hitstop = 0.2f; _hitstop = 0.2f;
_cam.Shake(0.9f); _cam.Punch(0.12f, at); _cam.Shake(0.9f); _cam.Punch(0.12f, at);
_screenFlash = 0.5f; _flashColor = Color.White; _screenFlash = 0.5f; _flashColor = Color.White;
@@ -423,31 +553,39 @@ namespace GladiatorIdle.Arena
var view = _cam.View(scale, offset); var view = _cam.View(scale, offset);
fx.View = view; fx.View = view;
fx.Projection = Matrix.CreateOrthographicOffCenter(0, gd.Viewport.Width, gd.Viewport.Height, 0, 0, 1); fx.Projection = Matrix.CreateOrthographicOffCenter(0, gd.Viewport.Width, gd.Viewport.Height, 0, 0, 1);
int vw = gd.Viewport.Width, vh = gd.Viewport.Height;
var v3 = _cam.View3();
var p3 = _cam.Proj3(scale, offset, vw, vh);
_plane ??= new BasicEffect(gd) { TextureEnabled = true, VertexColorEnabled = true, LightingEnabled = false };
_plane.World = Matrix.Identity; _plane.View = v3; _plane.Projection = p3;
void Plane(BlendState blend) => sb.Begin(SpriteSortMode.Deferred, blend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone, _plane);
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
// Hintergrund: Arena (Wan-Loop, sonst Standbild) mit Parallaxe, abgedunkelt, Vignette // 3D-Kulisse: fernes Gemälde, Sand, Mauer, Tore, Banner, Kohlebecken
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, _cam.View(scale, offset, 0.35f)); gd.Clear(ClearOptions.DepthBuffer | ClearOptions.Stencil, Color.Transparent, 1, 0);
var loop = _loopName != null ? ClipCache.Video(_loopName) : null; _set.Draw(gd, v3, p3, _time, _crowd.Excitement);
var bg = loop != null ? loop[PingPong(_time * 8, loop.Length)] : _backdrop; sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, Matrix.Identity);
if (bg != null) _set.DrawFires(sb, _cam, v3, p3, vw, vh, scale, _time);
{
float k = 1.18f * MathF.Max(Camera.W / bg.Width, Camera.H / bg.Height);
sb.Draw(bg, new Vector2(Camera.W / 2, Camera.H / 2), null, new Color(0.66f, 0.62f, 0.58f), 0,
new Vector2(bg.Width / 2f, bg.Height / 2f), k, SpriteEffects.None, 0);
}
sb.End(); sb.End();
// Boden, Schatten, Staub (Kampfebene)
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, view);
if (_furyDark > 0.01f) // Raserei: Arena versinkt im Dunkel, nur die Kämpfer bleiben im Licht if (_furyDark > 0.01f) // Raserei: Arena versinkt im Dunkel, nur die Kämpfer bleiben im Licht
D.Rect(sb, new RectangleF(-3000, -3000, Camera.W + 6000, Camera.H + 6000), new Color(20, 4, 0) * (0.62f * _furyDark)); {
D.Rect(sb, new RectangleF(-1200, Stage.FloorY + 30, Camera.W + 2400, 900), Color.Black * 0.35f); sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
D.Glow(sb, new Vector2(Camera.W / 2, Stage.FloorY + 20), new Vector2(3600, 260), Color.Black * 0.45f); D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), new Color(20, 4, 0) * (0.62f * _furyDark));
sb.End();
}
// Schatten: Figuren flach auf den Sand (Sonne), dazu ein weicher Kontaktschatten unter den Füßen
_pv.UseCamera3D(v3, p3); _ev.UseCamera3D(v3, p3);
_pv.SetLighting(_set.Look); _ev.SetLighting(_set.Look);
float shade = _set.Look.Wall == "marble" ? 0.32f : 0.42f;
Stage3D.SoftShadows(gd, sb, _set.Look.SunDir, shade * (1 - 0.6f * _furyDark), _pv, _ev); // weiche Ränder
Plane(BlendState.AlphaBlend);
_pv.DrawShadow(sb); _pv.DrawShadow(sb);
_ev.DrawShadow(sb); _ev.DrawShadow(sb);
sb.End(); sb.End();
// warmer Lichtkegel auf dem Sand, wo gekämpft wird // warmer Lichtkegel auf dem Sand, wo gekämpft wird
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, view); Plane(BlendState.Additive);
D.Glow(sb, new Vector2((_pv.X + _ev.X) / 2, Stage.FloorY + 10), new Vector2(1500, 230), new Color(255, 180, 110) * 0.22f); D.Glow(sb, new Vector2((_pv.X + _ev.X) / 2, Stage.FloorY + 10), new Vector2(1500, 230), new Color(255, 180, 110) * 0.16f);
if (_furyDark > 0.01f) if (_furyDark > 0.01f)
{ {
float flicker = 0.8f + 0.2f * MathF.Sin((float)_time * 23) * MathF.Sin((float)_time * 7.3f); float flicker = 0.8f + 0.2f * MathF.Sin((float)_time * 23) * MathF.Sin((float)_time * 7.3f);
@@ -455,7 +593,7 @@ namespace GladiatorIdle.Arena
D.Glow(sb, _pv.Chest, new Vector2(Stage.FigH * 2.2f), new Color(255, 120, 30) * (0.35f * _furyDark * flicker)); D.Glow(sb, _pv.Chest, new Vector2(Stage.FigH * 2.2f), new Color(255, 120, 30) * (0.35f * _furyDark * flicker));
} }
sb.End(); sb.End();
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, view); Plane(BlendState.AlphaBlend);
_fx.DrawSoft(sb); _fx.DrawSoft(sb);
DrawSmear(sb, _pv, Duel.Player); DrawSmear(sb, _ev, Duel.Enemy); DrawSmear(sb, _pv, Duel.Player); DrawSmear(sb, _ev, Duel.Enemy);
sb.End(); sb.End();
@@ -465,7 +603,7 @@ namespace GladiatorIdle.Arena
gd.SamplerStates[0] = SamplerState.LinearClamp; gd.SamplerStates[0] = SamplerState.LinearClamp;
gd.RasterizerState = RasterizerState.CullNone; gd.RasterizerState = RasterizerState.CullNone;
gd.DepthStencilState = DepthStencilState.None; gd.DepthStencilState = DepthStencilState.None;
if (_pv.Is3D || _ev.Is3D) gd.Clear(ClearOptions.DepthBuffer, Color.Transparent, 1, 0); // 3D-Figuren verdecken sich richtig if (_pv.Is3D || _ev.Is3D) gd.Clear(ClearOptions.DepthBuffer, Color.Transparent, 1, 0); // Kämpfer vor der Kulisse, verdecken sich gegenseitig richtig
var e = Duel.Enemy; var p = Duel.Player; var e = Duel.Enemy; var p = Duel.Player;
if (e.State == DuelState.Windup) // fair: der Schlag kündigt sich rot an if (e.State == DuelState.Windup) // fair: der Schlag kündigt sich rot an
{ {
@@ -487,7 +625,7 @@ namespace GladiatorIdle.Arena
else { _ev.DrawBody(gd, fx, e, _calm); _pv.DrawBody(gd, fx, p, _calm); } else { _ev.DrawBody(gd, fx, e, _calm); _pv.DrawBody(gd, fx, p, _calm); }
// Licht und Funken (additiv) // Licht und Funken (additiv)
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, view); Plane(BlendState.Additive);
_fx.DrawAdd(sb); _fx.DrawAdd(sb);
if (e.State == DuelState.Windup) if (e.State == DuelState.Windup)
{ {
@@ -509,7 +647,6 @@ namespace GladiatorIdle.Arena
_crowd.Draw(sb, _calm); _crowd.Draw(sb, _calm);
sb.End(); sb.End();
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui); sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
DrawVignette(sb); DrawVignette(sb);
// wenig Leben: roter Puls am Rand // wenig Leben: roter Puls am Rand
@@ -527,8 +664,8 @@ namespace GladiatorIdle.Arena
if (_screenFlash > 0) D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), _flashColor * (_screenFlash * 0.5f)); if (_screenFlash > 0) D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), _flashColor * (_screenFlash * 0.5f));
sb.End(); sb.End();
// Zahlen über den Köpfen (Kamera) und HUD (Bildschirm) // Zahlen über den Köpfen (Kampfebene) und HUD (Bildschirm)
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, view); Plane(BlendState.AlphaBlend);
foreach (var f in _floaters) if (!f.Big) DrawFloater(sb, f); foreach (var f in _floaters) if (!f.Big) DrawFloater(sb, f);
sb.End(); sb.End();
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui); sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
@@ -551,6 +688,9 @@ namespace GladiatorIdle.Arena
D.Glow(sb, new Vector2(-200, Camera.H / 2), new Vector2(900, 2000), c); D.Glow(sb, new Vector2(-200, Camera.H / 2), new Vector2(900, 2000), c);
D.Glow(sb, new Vector2(Camera.W + 200, Camera.H / 2), new Vector2(900, 2000), c); D.Glow(sb, new Vector2(Camera.W + 200, Camera.H / 2), new Vector2(900, 2000), c);
D.Glow(sb, new Vector2(Camera.W / 2, -160), new Vector2(3200, 520), Color.Black * 0.5f); D.Glow(sb, new Vector2(Camera.W / 2, -160), new Vector2(3200, 520), Color.Black * 0.5f);
// oben dunkler Verlauf, damit Namen und Lebensbalken vor den vollen Rängen lesbar bleiben
for (int i = 0; i < 12; i++)
D.Rect(sb, new RectangleF(0, i * 14, Camera.W, 14), Color.Black * (0.5f * (1 - i / 12f)));
} }
/// Wischspur der Waffe beim Schlag: Bogen aus weichen Lichtpunkten vor der Figur. /// Wischspur der Waffe beim Schlag: Bogen aus weichen Lichtpunkten vor der Figur.
@@ -599,13 +739,24 @@ namespace GladiatorIdle.Arena
bool full = p.Rage >= 100; bool full = p.Rage >= 100;
float pulse = full ? 0.75f + 0.25f * MathF.Sin((float)_time * 8) : 1; float pulse = full ? 0.75f + 0.25f * MathF.Sin((float)_time * 8) : 1;
D.Bar(sb, new RectangleF(70, 150, 460, 12), (float)(p.Rage / 100), (float)(p.Rage / 100), new Color(255, 140, 40) * pulse); D.Bar(sb, new RectangleF(70, 150, 460, 12), (float)(p.Rage / 100), (float)(p.Rage / 100), new Color(255, 140, 40) * pulse);
D.Text(sb, Assets.SansBold, 16, L.t(full ? "duel.super.key" : "duel.rage"), new Vector2(544, 156), D.Text(sb, Assets.SansBold, 16, L.t(full ? (_pad ? "duel.super.pad" : "duel.super.key") : "duel.rage"), new Vector2(544, 156),
full ? new Color(255, 170, 60) * pulse : D.Sand * 0.8f); full ? new Color(255, 170, 60) * pulse : D.Sand * 0.8f);
// Gegner rechts oben // Gegner rechts oben
D.Text(sb, Assets.Serif, 34, _enemy.Name, new Vector2(Camera.W - 70, 58), D.Red * a, Align.Right); D.Text(sb, Assets.Serif, 34, _enemy.Name, new Vector2(Camera.W - 70, 58), D.Red * a, Align.Right);
D.Bar(sb, new RectangleF(Camera.W - 770, 88, 700, 34), (float)(e.Hp / e.MaxHp), _eLag, D.Red, fromRight: true); D.Bar(sb, new RectangleF(Camera.W - 770, 88, 700, 34), (float)(e.Hp / e.MaxHp), _eLag, D.Red, fromRight: true);
D.Text(sb, Assets.Sans, 15, L.t("mono.help"), new Vector2(Camera.W / 2, Camera.H - 13), D.Sand * 0.8f, Align.Center); D.Text(sb, Assets.Sans, 15, L.t(_pad ? "mono.help.pad" : "mono.help"), new Vector2(Camera.W / 2, Camera.H - 13), D.Sand * 0.8f, Align.Center);
if (_tut != TutStep.Off && _phase == Phase.Fight)
{
// Einführung: Banner mit dem aktuellen Schritt
int n = (int)_tut, total = (int)TutStep.Finish;
var br = new RectangleF(Camera.W / 2 - 620, 310, 1240, 104); // unter den großen Einblendungen
float tutPulse = 0.85f + 0.15f * MathF.Sin((float)_time * 4);
Ui.Panel(sb, br, D.Gold * tutPulse, 0.93f);
D.Text(sb, Assets.SansBold, 17, string.Format(L.t("tut.header"), n, total), new Vector2(br.X + 24, br.Y + 22), D.Gold);
D.Text(sb, Assets.Sans, 15, L.t("tut.skip"), new Vector2(br.Right - 24, br.Y + 22), D.Dim, Align.Right);
D.Text(sb, Assets.Serif, 30, L.t("tut." + _tut.ToString().ToLowerInvariant()), new Vector2(br.Center.X, br.Y + 66), Color.White, Align.Center);
}
if (_phase == Phase.Countdown) if (_phase == Phase.Countdown)
{ {

View File

@@ -169,12 +169,58 @@ namespace GladiatorIdle.Arena
* Matrix.CreateTranslation(X + _off * Facing * 0.35f * Stage.Scale, Stage.FloorY - _lift, 0); * Matrix.CreateTranslation(X + _off * Facing * 0.35f * Stage.Scale, Stage.FloorY - _lift, 0);
} }
/// Perspektive der Duell-Kulisse (sonst wie bisher orthografisch über die 2D-Ansicht).
Matrix? _view3, _proj3;
public void UseCamera3D(Matrix view3, Matrix proj3) { _view3 = view3; _proj3 = proj3; }
/// Licht der Arena übernehmen (Sonne, Umgebung, kühles Gegenlicht für die Kontur).
public void SetLighting(ArenaLook look)
{
if (_mfx == null) return;
_mfx.AmbientLightColor = look.Ambient * 0.95f + new Vector3(0.04f);
_mfx.DirectionalLight0.Direction = Vector3.Normalize(look.SunDir);
_mfx.DirectionalLight0.DiffuseColor = look.Sun;
_mfx.DirectionalLight1.Direction = Vector3.Normalize(new Vector3(-look.SunDir.X, 0.1f, 0.8f));
_mfx.DirectionalLight1.DiffuseColor = Vector3.Lerp(new Vector3(0.22f, 0.27f, 0.36f), look.Fog * 0.4f, 0.4f);
_mfx.FogEnabled = false;
}
// Schatten: Stencil, damit sich überlappende Teile nicht doppelt abdunkeln
static readonly DepthStencilState ShadowStencil = new()
{
DepthBufferEnable = true, DepthBufferWriteEnable = false,
StencilEnable = true, StencilFunction = CompareFunction.Equal, ReferenceStencil = 0,
StencilPass = StencilOperation.Increment, StencilFail = StencilOperation.Keep, StencilDepthBufferFail = StencilOperation.Keep,
};
/// Figur flach auf den Sand geworfen (Richtung der Sonne), halbdurchsichtig dunkel.
public void DrawCastShadow(GraphicsDevice gd, Vector3 sunDir, float strength)
{
if (_model == null || _mfx == null || _view3 == null) return;
var fx = _mfx;
fx.View = _view3.Value; fx.Projection = _proj3!.Value;
// Licht fällt flach: Schatten nicht endlos lang
var dir = Vector3.Normalize(new Vector3(sunDir.X, MathF.Max(0.45f, sunDir.Y), sunDir.Z));
var shadow = Matrix.CreateShadow(-dir, new Plane(new Vector3(0, -1, 0), Stage.FloorY - 1));
fx.World = ModelWorld(0) * shadow;
fx.LightingEnabled = false;
fx.DiffuseColor = Vector3.Zero;
fx.EmissiveColor = Vector3.Zero;
fx.Alpha = strength;
_model.Draw(gd, fx, depth: ShadowStencil, blend: BlendState.AlphaBlend);
fx.Alpha = 1;
fx.LightingEnabled = true;
fx.DiffuseColor = Vector3.One;
gd.DepthStencilState = DepthStencilState.None;
gd.BlendState = BlendState.AlphaBlend;
}
void DrawModel(GraphicsDevice gd, BasicEffect scene, Color aura, float grow) void DrawModel(GraphicsDevice gd, BasicEffect scene, Color aura, float grow)
{ {
var fx = _mfx!; var fx = _mfx!;
var vp = gd.Viewport; var vp = gd.Viewport;
fx.View = scene.View; fx.View = _view3 ?? scene.View;
fx.Projection = Matrix.CreateOrthographicOffCenter(0, vp.Width, vp.Height, 0, -100000, 100000); fx.Projection = _proj3 ?? Matrix.CreateOrthographicOffCenter(0, vp.Width, vp.Height, 0, -100000, 100000);
fx.World = ModelWorld(grow); fx.World = ModelWorld(grow);
if (aura.A > 0) if (aura.A > 0)
{ {

View File

@@ -283,7 +283,7 @@ namespace GladiatorIdle.Arena
public void DrawShadow(SpriteBatch sb) public void DrawShadow(SpriteBatch sb)
{ {
float w = 270 * Stage.Scale * (1 + _sq * 0.4f); float w = 270 * Stage.Scale * (1 + _sq * 0.4f);
Draw.Glow(sb, new Vector2(X + _off * Facing * 0.5f * Stage.Scale, Stage.FloorY + 4), new Vector2(w, 58 * Stage.Scale), Color.Black * 0.55f); Draw.Glow(sb, new Vector2(X + _off * Facing * 0.5f * Stage.Scale, Stage.FloorY + 4), new Vector2(w, 58 * Stage.Scale), Color.Black * 0.38f);
} }
/// Leuchten hinter der Figur (Silhouette, leicht vergrößert): angekündigter Schlag, Schildwall. /// Leuchten hinter der Figur (Silhouette, leicht vergrößert): angekündigter Schlag, Schildwall.

View File

@@ -25,6 +25,9 @@ namespace GladiatorIdle.Arena
readonly Particles _fx = new(); readonly Particles _fx = new();
readonly Texture2D? _still = Assets.Sprite("freedom_rudis", "jpg"); readonly Texture2D? _still = Assets.Sprite("freedom_rudis", "jpg");
readonly FighterView _hero; readonly FighterView _hero;
// Bilanz und Götter: der freie Gladiator in der Arena vor dem Kaiser, Kamera fährt langsam um ihn
readonly Stage3D _stage = new(Balance.ARENA_COUNT - 1, AppSettings.ReduceMotion);
const float HERO_X = 520;
readonly DuelFighter _dummy = new() { IsPlayer = true, Facing = 1, MaxHp = 1, Hp = 1, State = DuelState.Victory }; readonly DuelFighter _dummy = new() { IsPlayer = true, Facing = 1, MaxHp = 1, Hp = 1, State = DuelState.Victory };
readonly float _line2At, _clipTime; readonly float _line2At, _clipTime;
Phase _phase; Phase _phase;
@@ -51,6 +54,8 @@ namespace GladiatorIdle.Arena
SoundManager.StopAll(); SoundManager.StopAll();
SoundManager.PlayMusic("music_freedom", loop: true); SoundManager.PlayMusic("music_freedom", loop: true);
_fx.Calm = AppSettings.ReduceMotion; _fx.Calm = AppSettings.ReduceMotion;
_stage.Cam.FocusX = 800; // Held links, Platz für die Bilanz rechts
_stage.Cam.HoldYaw(-16);
} }
void Next(Phase p) void Next(Phase p)
@@ -75,7 +80,8 @@ namespace GladiatorIdle.Arena
_t += dt; _phaseT += dt; _t += dt; _phaseT += dt;
_ui.Begin(input, ui); _ui.Begin(input, ui);
_dummy.StateTime += dt; _dummy.StateTime += dt;
_hero.Update(dt, dt, _dummy, 0, AppSettings.ReduceMotion); _hero.Update(dt, dt, _dummy, HERO_X, AppSettings.ReduceMotion);
_stage.Cam.Update(dt, HERO_X, HERO_X, AppSettings.ReduceMotion);
_fx.Motes(AppSettings.ReduceMotion ? 0 : 40, Camera.W, Camera.H); _fx.Motes(AppSettings.ReduceMotion ? 0 : 40, Camera.W, Camera.H);
_fx.Update(dt); _fx.Update(dt);
if (_phase == Phase.Clip) if (_phase == Phase.Clip)
@@ -93,27 +99,29 @@ namespace GladiatorIdle.Arena
{ {
D.UiScale = scale; D.UiScale = scale;
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0); var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui); if (_phase == Phase.Clip)
if (_phase == Phase.Clip) DrawClip(sb);
else DrawBackdrop(sb);
sb.End();
if (_phase == Phase.Summary)
{ {
// der freie Gladiator, jubelnd, links in der Bilanz sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
var view = Matrix.CreateTranslation(0, -Stage.FloorY, 0) * Matrix.CreateScale(1.7f) * Matrix.CreateTranslation(560, 830, 0) * ui; DrawClip(sb);
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, view);
D.Glow(sb, new Vector2(0, Stage.FloorY - 200), new Vector2(700, 800), new Color(255, 200, 120) * 0.25f);
sb.End(); sb.End();
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, view); }
_hero.DrawShadow(sb); else
sb.End(); {
fx.View = view; // die Arena vor dem Kaiser in 3D, volle Ränge jubeln; der freie Gladiator steht im Sand
fx.Projection = Matrix.CreateOrthographicOffCenter(0, gd.Viewport.Width, gd.Viewport.Height, 0, 0, 1); _stage.Prepare(gd, scale, offset);
gd.BlendState = BlendState.AlphaBlend; gd.SamplerStates[0] = SamplerState.LinearClamp; _stage.DrawSet(gd, sb, _t, 0.95f);
gd.RasterizerState = RasterizerState.CullNone; gd.DepthStencilState = DepthStencilState.None; _stage.Shadows(gd, sb, 0, _hero);
gd.Clear(ClearOptions.DepthBuffer, Color.Transparent, 1, 0); _stage.FloorLight(sb, HERO_X, 1000, 0.28f);
Stage3D.BeginFigures(gd);
_stage.Use(_hero);
_hero.DrawBody(gd, fx, _dummy, AppSettings.ReduceMotion); _hero.DrawBody(gd, fx, _dummy, AppSettings.ReduceMotion);
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
// oben und an den Rändern dunkler (Titel lesbar); bei den Göttern tritt die Arena zurück
for (int i = 0; i < 16; i++)
D.Rect(sb, new RectangleF(0, i * 16, Camera.W, 16), Color.Black * (0.55f * (1 - i / 16f)));
D.Glow(sb, new Vector2(Camera.W + 200, Camera.H / 2), new Vector2(1100, 2000), Color.Black * 0.5f);
if (_phase == Phase.Gods) D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * 0.62f);
sb.End();
} }
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, ui); sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, ui);

View File

@@ -23,7 +23,10 @@ namespace GladiatorIdle.Arena
static Color ChanceColor(double c) => c >= 0.75 ? D.Green : c >= 0.4 ? D.Gold : D.Red; static Color ChanceColor(double c) => c >= 0.75 ? D.Green : c >= 0.4 ? D.Gold : D.Red;
/// Ein Fenster liegt über dem Hub (Bericht oder Ereignis): darunter nichts anklickbar. /// Ein Fenster liegt über dem Hub (Bericht oder Ereignis): darunter nichts anklickbar.
bool Modal => _game.ExpeditionResult != null || _game.PendingEvent != null || _eventShown != null; bool Modal => Welcome != null || _game.ExpeditionResult != null || _game.PendingEvent != null || _eventShown != null;
/// Bericht über die Zeit, in der das Spiel zu war (ab 2 Minuten), als erstes Fenster.
public OfflineReport? Welcome { get; set; }
void UpdateAdventure() void UpdateAdventure()
{ {
@@ -121,10 +124,37 @@ namespace GladiatorIdle.Arena
void DrawModal(SpriteBatch sb) void DrawModal(SpriteBatch sb)
{ {
D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * 0.65f); D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * 0.65f);
if (_game.ExpeditionResult is { } rep) DrawReport(sb, rep); if (Welcome is { } w) DrawWelcome(sb, w);
else if (_game.ExpeditionResult is { } rep) DrawReport(sb, rep);
else if (_eventShown != null || _game.PendingEvent != null) DrawEvent(sb); else if (_eventShown != null || _game.PendingEvent != null) DrawEvent(sb);
} }
void DrawWelcome(SpriteBatch sb, OfflineReport w)
{
var r = new RectangleF(Camera.W / 2 - 480, 200, 960, 640);
Ui.Panel(sb, r, D.Gold, 0.97f);
float y = r.Y + 70;
D.Text(sb, Assets.Serif, 52, L.t("offline.title"), new Vector2(r.Center.X, y), D.Gold, Align.Center);
y += 70;
D.Text(sb, Assets.Serif, 24, string.Format(L.t("offline.away"), NumberFormat.Duration(w.Seconds)), new Vector2(r.Center.X, y), D.Sand, Align.Center);
if (w.Seconds >= _game.OfflineCapSeconds - 1)
D.Text(sb, Assets.Sans, 17, string.Format(L.t("offline.capped"), NumberFormat.Duration(_game.OfflineCapSeconds)), new Vector2(r.Center.X, y + 34), D.Dim, Align.Center);
y += 90;
void Line(string label, string value, Color c)
{
D.Text(sb, Assets.Sans, 24, label, new Vector2(r.X + 160, y), D.Sand);
D.Text(sb, Assets.SansBold, 28, value, new Vector2(r.Right - 160, y), c, Align.Right);
D.Rect(sb, new RectangleF(r.X + 160, y + 26, r.Width - 320, 1), D.Border * 0.6f);
y += 62;
}
if (w.Gold > 0) Line(L.t("offline.gold"), "+" + NumberFormat.Format(w.Gold), D.Gold); // i18n-ok (nur von Expeditionen)
if (w.Fame > 0) Line(L.t("offline.fame"), "+" + NumberFormat.Format(w.Fame), D.Gold); // i18n-ok
Line(L.t("offline.levels"), "+" + w.LevelUps.ToString(NumberFormat.Culture), D.Green); // i18n-ok
if (w.Wins + w.Losses > 0) Line(L.t("offline.fights"), string.Format(L.t("offline.fights.value"), w.Wins, w.Losses), D.Sand);
if (_ui.Button(sb, new RectangleF(r.Center.X - 200, r.Bottom - 100, 400, 68), L.t("offline.ok"), selected: true, size: 26))
{ Welcome = null; SoundManager.PlayCoins(); }
}
void DrawReport(SpriteBatch sb, ExpeditionReport rep) void DrawReport(SpriteBatch sb, ExpeditionReport rep)
{ {
var reg = RegionDef.Get(rep.Region); var reg = RegionDef.Get(rep.Region);

View File

@@ -8,7 +8,7 @@ using D = GladiatorIdle.Gfx.Draw;
namespace GladiatorIdle.Arena namespace GladiatorIdle.Arena
{ {
/// Ausrüstung: Inventar mit Detailkarte (anlegen, verkaufen), Händler und Schmied. /// Ausrüstung: Inventar mit Detailkarte (anlegen, verkaufen).
internal sealed partial class HubScene internal sealed partial class HubScene
{ {
long? _sel; // gewähltes Stück (Inventar oder angelegt) long? _sel; // gewähltes Stück (Inventar oder angelegt)
@@ -117,53 +117,5 @@ namespace GladiatorIdle.Arena
if (_ui.Button(sb, new RectangleF(card.X + 28 + bw, by, bw, 42), string.Format(L.t("char.sell"), NumberFormat.Format(Items.SellValue(sel))), size: 16)) if (_ui.Button(sb, new RectangleF(card.X + 28 + bw, by, bw, 42), string.Format(L.t("char.sell"), NumberFormat.Format(Items.SellValue(sel))), size: 16))
if (_game.Sell(sel.Id)) { SoundManager.PlayCoins(); _sel = null; } if (_game.Sell(sel.Id)) { SoundManager.PlayCoins(); _sel = null; }
} }
// ── Forum: Händler (links) und Schmied (rechts) ─────────────
void DrawForum(SpriteBatch sb, RectangleF r)
{
float x = r.X + 30, y = r.Y + 40, w = 700;
D.Text(sb, Assets.Serif, 30, L.t("forum.tab.merchant"), new Vector2(x, y), D.Gold);
D.Text(sb, Assets.Sans, 16, string.Format(L.t("merchant.refresh"), NumberFormat.Duration(_game.MerchantRefreshIn)),
new Vector2(x + w, y), D.Dim, Align.Right);
D.Text(sb, Assets.Sans, 16, string.Format(L.t("merchant.bag"), _game.Inventory.Count, Items.INVENTORY), new Vector2(x + w, y + 24), D.Dim, Align.Right);
float ry = y + 50;
foreach (var it in _game.Merchant.ToList())
{
var row = new RectangleF(x, ry, w, 96);
D.Rect(sb, row, new Color(30, 22, 15) * 0.9f);
D.Frame(sb, row, RarityColor(it.Rarity), 2);
ItemTile(sb, new RectangleF(row.X + 10, row.Y + 10, 76, 76), it, false);
D.Text(sb, Assets.SansBold, 20, ItemName(it), new Vector2(row.X + 100, row.Y + 22), RarityColor(it.Rarity));
D.Text(sb, Assets.Sans, 15, ItemMain(it), new Vector2(row.X + 100, row.Y + 48), D.Sand);
string aff = string.Join(" · ", ItemAffixes(it)); // i18n-ok
if (aff.Length > 0) D.Text(sb, Assets.Sans, 14, aff, new Vector2(row.X + 100, row.Y + 72), D.Blue);
var (delta, dc) = PowerDelta(it);
D.Text(sb, Assets.SansBold, 15, delta, new Vector2(row.Right - 200, row.Y + 22), dc, Align.Right);
double price = Items.Value(it);
long id = it.Id;
if (_ui.Button(sb, new RectangleF(row.Right - 180, row.Y + 24, 166, 48), string.Format(L.t("btn.buy"), NumberFormat.Format(price)),
_game.Gold >= price && _game.Inventory.Count < Items.INVENTORY, size: 19))
if (_game.BuyFromMerchant(id)) { SoundManager.PlayPurchase(); _sel = id; }
ry += 104;
}
// Schmied: Ausrüstungsplätze verstärken (wirkt auf jedes Stück im Platz)
float fx = x + w + 50, fw = r.Right - 30 - fx;
D.Text(sb, Assets.Serif, 30, L.t("forum.tab.forge"), new Vector2(fx, y), D.Gold);
for (int i = 0; i < 5; i++)
{
var slot = (ItemSlot)i;
var row = new RectangleF(fx, y + 50 + i * 104, fw, 96);
D.Rect(sb, row, new Color(30, 22, 15) * 0.9f);
D.Frame(sb, row, D.Border, 2);
ItemTile(sb, new RectangleF(row.X + 10, row.Y + 10, 76, 76), _game.Equipped[i], false);
D.Text(sb, Assets.SansBold, 20, L.t("slot." + slot.ToString().ToLowerInvariant()), new Vector2(row.X + 100, row.Y + 30), Color.White);
D.Text(sb, Assets.Sans, 16, string.Format(L.t("forge.level"), _game.SlotLevels[i]), new Vector2(row.X + 100, row.Y + 60), D.Sand);
double cost = _game.UpgradeSlotCost(slot);
if (_ui.Button(sb, new RectangleF(row.Right - 200, row.Y + 24, 186, 48), string.Format(L.t("btn.forge"), NumberFormat.Format(cost)), _game.Gold >= cost, size: 17))
if (_game.UpgradeSlot(slot)) SoundManager.PlayLevelUp();
}
}
} }
} }

View File

@@ -11,15 +11,15 @@ namespace GladiatorIdle.Arena
/// Tipp, der zum aktuellen Spielstand passt (was jetzt sinnvoll ist). /// Tipp, der zum aktuellen Spielstand passt (was jetzt sinnvoll ist).
internal sealed partial class HubScene internal sealed partial class HubScene
{ {
static string GuideId(Drawer d) => d switch string GuideId => _drawer switch
{ {
Drawer.Gladiator => "gladiator", Drawer.Ludus => "ludus", Drawer.Forum => "forum", Drawer.Gladiator => _page == Page.Skills ? "skills" : "gladiator", Drawer.Ludus => "ludus",
Drawer.Skills => "skills", Drawer.Hall => "hall", _ => "expedition" Drawer.Hall => "hall", _ => "expedition"
}; };
void DrawGuide(SpriteBatch sb, RectangleF r) void DrawGuide(SpriteBatch sb, RectangleF r)
{ {
string id = GuideId(_drawer); string id = GuideId;
Ui.Panel(sb, r, D.Border, 0.94f); Ui.Panel(sb, r, D.Border, 0.94f);
float x = r.X + 26, w = r.Width - 52, y = r.Y + 34; float x = r.X + 26, w = r.Width - 52, y = r.Y + 34;
D.Text(sb, Assets.Serif, 28, L.t("guide.title"), new Vector2(x, y), D.Gold); D.Text(sb, Assets.Serif, 28, L.t("guide.title"), new Vector2(x, y), D.Gold);
@@ -52,6 +52,10 @@ namespace GladiatorIdle.Arena
var g = _game; var g = _game;
switch (_drawer) switch (_drawer)
{ {
case Drawer.Gladiator when _page == Page.Skills:
return g.LearnablePoints > 0
? (string.Format(L.t("tip.skills.points"), g.LearnablePoints), D.Gold)
: (string.Format(L.t("tip.skills.next"), g.CharLevel / 2 * 2 + 2), D.Sand);
case Drawer.Gladiator: case Drawer.Gladiator:
{ {
if (g.AttrPoints > 0) return (string.Format(L.t("tip.gladiator.points"), g.AttrPoints), D.Gold); if (g.AttrPoints > 0) return (string.Format(L.t("tip.gladiator.points"), g.AttrPoints), D.Gold);
@@ -59,6 +63,10 @@ namespace GladiatorIdle.Arena
var better = g.Inventory.Where(it => g.PowerWith(it) > now * 1.005).OrderByDescending(g.PowerWith).FirstOrDefault(); var better = g.Inventory.Where(it => g.PowerWith(it) > now * 1.005).OrderByDescending(g.PowerWith).FirstOrDefault();
if (better != null) return (string.Format(L.t("tip.gladiator.better"), ItemName(better)), D.Green); if (better != null) return (string.Format(L.t("tip.gladiator.better"), ItemName(better)), D.Green);
if (g.Inventory.Count >= Items.INVENTORY - 4) return (L.t("tip.gladiator.full"), D.Red); if (g.Inventory.Count >= Items.INVENTORY - 4) return (L.t("tip.gladiator.full"), D.Red);
var slot = Enumerable.Range(0, 5).Select(i => (ItemSlot)i).Where(s => g.Equipped[(int)s] != null)
.OrderBy(g.UpgradeSlotCost).FirstOrDefault();
if (g.Equipped[(int)slot] != null && g.Gold >= g.UpgradeSlotCost(slot))
return (string.Format(L.t("tip.gladiator.forge"), L.t("slot." + slot.ToString().ToLowerInvariant())), D.Green);
return (L.t("tip.gladiator.none"), D.Sand); return (L.t("tip.gladiator.none"), D.Sand);
} }
case Drawer.Ludus: case Drawer.Ludus:
@@ -69,23 +77,6 @@ namespace GladiatorIdle.Arena
? (string.Format(L.t("tip.ludus.afford"), L.t(cheapest.Key)), D.Green) ? (string.Format(L.t("tip.ludus.afford"), L.t(cheapest.Key)), D.Green)
: (string.Format(L.t("tip.ludus.save"), L.t(cheapest.Key), NumberFormat.Format(cost - g.Gold)), D.Sand); : (string.Format(L.t("tip.ludus.save"), L.t(cheapest.Key), NumberFormat.Format(cost - g.Gold)), D.Sand);
} }
case Drawer.Forum:
{
double now = g.Power();
var buy = g.Merchant.Where(it => g.Gold >= Items.Value(it) && g.PowerWith(it) > now * 1.005)
.OrderByDescending(g.PowerWith).FirstOrDefault();
if (buy != null)
return (string.Format(L.t("tip.forum.buy"), ItemName(buy), NumberFormat.Percent(g.PowerWith(buy) / now - 1)), D.Green);
var slot = Enumerable.Range(0, 5).Select(i => (ItemSlot)i).Where(s => g.Equipped[(int)s] != null)
.OrderBy(g.UpgradeSlotCost).FirstOrDefault();
if (g.Equipped[(int)slot] != null && g.Gold >= g.UpgradeSlotCost(slot))
return (string.Format(L.t("tip.forum.forge"), L.t("slot." + slot.ToString().ToLowerInvariant())), D.Green);
return (string.Format(L.t("tip.forum.wait"), NumberFormat.Duration(g.MerchantRefreshIn)), D.Sand);
}
case Drawer.Skills:
return g.LearnablePoints > 0
? (string.Format(L.t("tip.skills.points"), g.LearnablePoints), D.Gold)
: (string.Format(L.t("tip.skills.next"), g.CharLevel / 2 * 2 + 2), D.Sand);
case Drawer.Hall: case Drawer.Hall:
{ {
if (g.Legends.Count == 0) return (L.t("tip.hall.none"), D.Sand); if (g.Legends.Count == 0) return (L.t("tip.hall.none"), D.Sand);

View File

@@ -17,10 +17,9 @@ namespace GladiatorIdle.Arena
void DrawSkills(SpriteBatch sb, RectangleF r) void DrawSkills(SpriteBatch sb, RectangleF r)
{ {
float x = r.X + 30, y = r.Y + 40; float x = r.X + 30, y = r.Y + 46;
D.Text(sb, Assets.Serif, 30, L.t("char.skills"), new Vector2(x, y), D.Gold);
D.Text(sb, Assets.SansBold, 22, string.Format(L.t("char.skillpoints"), _game.SkillPoints), D.Text(sb, Assets.SansBold, 22, string.Format(L.t("char.skillpoints"), _game.SkillPoints),
new Vector2(x + 300, y + 2), _game.SkillPoints > 0 ? D.Gold : D.Dim); new Vector2(x + 650, y - 2), _game.SkillPoints > 0 ? D.Gold : D.Dim);
if (_ui.Button(sb, new RectangleF(r.Right - 330, y - 22, 300, 44), if (_ui.Button(sb, new RectangleF(r.Right - 330, y - 22, 300, 44),
string.Format(L.t("char.skillreset"), NumberFormat.Format(_game.SkillResetCost)), string.Format(L.t("char.skillreset"), NumberFormat.Format(_game.SkillResetCost)),
_game.SkillRanks.Count > 0 && _game.Gold >= _game.SkillResetCost, size: 16)) _game.SkillRanks.Count > 0 && _game.Gold >= _game.SkillResetCost, size: 16))
@@ -29,7 +28,7 @@ namespace GladiatorIdle.Arena
_skillHover = null; _skillHover = null;
_learnFlash = MathF.Max(0, _learnFlash - 1 / 60f * 2.5f); _learnFlash = MathF.Max(0, _learnFlash - 1 / 60f * 2.5f);
var branches = new[] { SkillBranch.Offense, SkillBranch.Defense, SkillBranch.Class }; var branches = new[] { SkillBranch.Offense, SkillBranch.Defense, SkillBranch.Class };
float colW = (r.Width - 60) / 3, top = y + 60, rowH = 142; float colW = (r.Width - 60) / 3, top = y + 66, rowH = 132;
for (int b = 0; b < 3; b++) for (int b = 0; b < 3; b++)
{ {
var branch = branches[b]; var branch = branches[b];

View File

@@ -15,7 +15,10 @@ namespace GladiatorIdle.Arena
/// </summary> /// </summary>
internal sealed partial class HubScene internal sealed partial class HubScene
{ {
enum Drawer { None, Gladiator, Ludus, Forum, Skills, Hall, Expedition } enum Drawer { None, Gladiator, Ludus, Expedition, Hall }
/// Seite im Gladiator-Reiter: Werte & Ausrüstung oder Fähigkeiten.
enum Page { Gear, Skills }
Page _page;
readonly GameState _game; readonly GameState _game;
readonly Ui _ui = new(); readonly Ui _ui = new();
@@ -23,9 +26,14 @@ namespace GladiatorIdle.Arena
readonly Crowd _crowd = new(11); readonly Crowd _crowd = new(11);
readonly FighterView _hero; readonly FighterView _hero;
readonly DuelFighter _dummy = new() { IsPlayer = true, X = 0, Facing = 1, MaxHp = 1, Hp = 1 }; readonly DuelFighter _dummy = new() { IsPlayer = true, X = 0, Facing = 1, MaxHp = 1, Hp = 1 };
Texture2D? _backdrop; readonly Stage3D _stage; // dieselbe 3D-Arena wie im Duell
string? _loopName; const float HERO_X = 560;
int _arenaShown = -1; // Gegnerkarten: echte 3D-Figur je Gegner (wie im Duell), in eigene Bildflächen gerendert
readonly Dictionary<string, FighterView> _foeViews = new();
readonly DuelFighter _foeDummy = new() { IsPlayer = false, X = 0, Facing = -1, MaxHp = 1, Hp = 1 };
readonly List<RenderTarget2D> _cardRt = new();
const int CARD_W = 300, CARD_H = 360;
int _cardFrame;
double _t; double _t;
Drawer _drawer; Drawer _drawer;
float _drawerK; // 0 zu, 1 offen (gleitet) float _drawerK; // 0 zu, 1 offen (gleitet)
@@ -45,6 +53,7 @@ namespace GladiatorIdle.Arena
string hero = Art.Hero(game.Class, game.Look.Preset); string hero = Art.Hero(game.Class, game.Look.Preset);
_hero = Assets.Has(hero) ? new FighterView(hero, 0.5f, game.Look.Color) : new FighterView(Art.Fighter(game.Class), 0.5f); _hero = Assets.Has(hero) ? new FighterView(hero, 0.5f, game.Look.Color) : new FighterView(Art.Fighter(game.Class), 0.5f);
_hero.Preload(); _hero.Preload();
_stage = new Stage3D(game.Arena, AppSettings.ReduceMotion);
_fx.Calm = AppSettings.ReduceMotion; _fx.Calm = AppSettings.ReduceMotion;
SoundManager.StartAmbient("music_ludus"); SoundManager.StartAmbient("music_ludus");
SoundManager.PlayAmbience("amb_crowd"); SoundManager.PlayAmbience("amb_crowd");
@@ -56,13 +65,40 @@ namespace GladiatorIdle.Arena
_crowd.Excite(color == D.Gold ? 0.8f : 0.1f); _crowd.Excite(color == D.Gold ? 0.8f : 0.1f);
} }
void EnsureArena() void EnsureArena() => _stage.SetArena(_game.Arena);
FighterView FoeView(Enemy e)
{ {
if (_arenaShown == _game.Arena) return; string art = e.Art ?? Art.Enemy(e.NameKey);
_arenaShown = _game.Arena; if (!_foeViews.TryGetValue(art, out var v))
string art = Art.Arena(ArenaDef.All[_game.Arena]); _foeViews[art] = v = new FighterView(art, 1.7f, -1, _game.Look.Color == 0 ? 6 : 0);
_backdrop = Assets.Sprite(art, "jpg"); return v;
_loopName = AppSettings.ReduceMotion ? null : art; }
/// Gegner der Karten in ihre Bildflächen zeichnen (vor allem anderen: Zielwechsel leert das Bild).
void RenderCards(GraphicsDevice gd, BasicEffect fx, float dt)
{
if (_drawerK > 0.98f || Modal || _game.Away != null) return;
// 15 Bilder/s reichen für die ruhige Bereit-Haltung (die Bildflächen behalten ihren Inhalt)
_cardFrame++;
var offers = _game.Offers();
if (_cardFrame % 4 != 0 && _cardRt.Count >= offers.Count) { foreach (var o in offers) FoeView(o.Enemy).Update(dt, dt, _foeDummy, 0, AppSettings.ReduceMotion); return; }
var previous = gd.GetRenderTargets();
for (int i = 0; i < offers.Count; i++)
{
var v = FoeView(offers[i].Enemy);
v.Update(dt, dt, _foeDummy, 0, AppSettings.ReduceMotion);
if (!v.Is3D) continue;
while (_cardRt.Count <= i) _cardRt.Add(new RenderTarget2D(gd, CARD_W, CARD_H, false, SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents));
gd.SetRenderTarget(_cardRt[i]);
gd.Clear(Color.Transparent);
fx.View = Matrix.CreateTranslation(0, -Stage.FloorY, 0) * Matrix.CreateScale(0.9f) * Matrix.CreateTranslation(CARD_W / 2f, CARD_H - 10, 0);
fx.Projection = Matrix.CreateOrthographicOffCenter(0, CARD_W, CARD_H, 0, 0, 1);
gd.BlendState = BlendState.AlphaBlend; gd.DepthStencilState = DepthStencilState.None; gd.RasterizerState = RasterizerState.CullNone;
v.DrawBody(gd, fx, _foeDummy, true);
}
gd.SetRenderTargets(previous);
gd.Clear(Color.Black);
} }
// ── Takt ──────────────────────────────────────────────────── // ── Takt ────────────────────────────────────────────────────
@@ -73,7 +109,9 @@ namespace GladiatorIdle.Arena
_toastAge += dt; _toastAge += dt;
_ui.Begin(input, ui); _ui.Begin(input, ui);
_game.Tick(dt); // Training, Einnahmen, Erholung _game.Tick(dt); // Training, Einnahmen, Erholung
_hero.Update(dt, dt, _dummy, 0, AppSettings.ReduceMotion); _hero.Update(dt, dt, _dummy, HERO_X, AppSettings.ReduceMotion);
_stage.Cam.Update(dt, Camera.W / 2 - 1800, Camera.W / 2 + 1800, AppSettings.ReduceMotion); // weiter weg, ruhige Drift
_lastDt = dt;
UpdateAdventure(); UpdateAdventure();
_crowd.Update(dt); _crowd.Update(dt);
_fx.Motes(AppSettings.ReduceMotion ? 0 : 50, Camera.W, Camera.H); _fx.Motes(AppSettings.ReduceMotion ? 0 : 50, Camera.W, Camera.H);
@@ -85,12 +123,15 @@ namespace GladiatorIdle.Arena
} }
public bool DrawerOpen => _drawer != Drawer.None; public bool DrawerOpen => _drawer != Drawer.None;
float _lastDt = 1 / 60f;
/// Testlauf: Schublade öffnen (0 zu, 1 Gladiator, 2 Ludus), sofort ganz offen. /// Testlauf: Schublade öffnen ("none", "gladiator", "skills", "ludus", "expedition", "hall"), sofort ganz offen.
public void DevOpen(int d) public void DevOpen(string d)
{ {
_drawer = (Drawer)d; _drawerK = d == 0 ? 0 : 1; _drawer = d switch { "gladiator" or "skills" => Drawer.Gladiator, "ludus" => Drawer.Ludus, "expedition" => Drawer.Expedition, "hall" => Drawer.Hall, _ => Drawer.None };
if (d == 1 && _game.Inventory.Count > 0) _sel = _game.Inventory[0].Id; _page = d == "skills" ? Page.Skills : Page.Gear;
_drawerK = _drawer == Drawer.None ? 0 : 1;
if (d == "gladiator" && _game.Inventory.Count > 0) _sel = _game.Inventory[0].Id;
} }
// ── Zeichnen ──────────────────────────────────────────────── // ── Zeichnen ────────────────────────────────────────────────
@@ -101,35 +142,23 @@ namespace GladiatorIdle.Arena
D.UiScale = scale; D.UiScale = scale;
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0); var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
// Arena im Hintergrund var sw = System.Diagnostics.Stopwatch.StartNew();
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui); RenderCards(gd, fx, _lastDt);
var loop = _loopName != null ? ClipCache.Video(_loopName) : null; // Standbild, bis der Film geladen ist double tCards = sw.Elapsed.TotalMilliseconds;
var bg = loop != null ? loop[PingPong(_t * 8, loop.Length)] : _backdrop; // Arena in 3D wie im Duell: Sand, Mauer, Ränge, Licht; der Gladiator steht mit Schatten darin
if (bg != null) _stage.Prepare(gd, scale, offset);
{ _stage.DrawSet(gd, sb, _t, _crowd.Excitement);
float k = 1.12f * MathF.Max(Camera.W / bg.Width, Camera.H / bg.Height); _stage.Shadows(gd, sb, 0, _hero);
sb.Draw(bg, new Vector2(Camera.W / 2, Camera.H / 2), null, new Color(0.55f, 0.51f, 0.47f), 0, _stage.FloorLight(sb, HERO_X, 900, 0.18f);
new Vector2(bg.Width / 2f, bg.Height / 2f), k, SpriteEffects.None, 0); Stage3D.BeginFigures(gd);
} _stage.Use(_hero);
D.Glow(sb, new Vector2(-200, Camera.H / 2), new Vector2(900, 2000), Color.Black * 0.7f);
D.Glow(sb, new Vector2(Camera.W + 200, Camera.H / 2), new Vector2(900, 2000), Color.Black * 0.6f);
D.Rect(sb, new RectangleF(0, 0, Camera.W, 120), Color.Black * 0.45f);
sb.End();
// Gladiator (links, in der Arena), Licht, Schatten
var view = Matrix.CreateTranslation(0, -Stage.FloorY, 0) * Matrix.CreateScale(1.1f) * Matrix.CreateTranslation(520, 930, 0) * ui;
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, view);
D.Glow(sb, new Vector2(0, Stage.FloorY - 300), new Vector2(1000, 1100), new Color(255, 190, 120) * 0.14f);
D.Glow(sb, new Vector2(0, Stage.FloorY + 6), new Vector2(760, 130), new Color(255, 180, 110) * 0.22f);
sb.End();
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, view);
_hero.DrawShadow(sb);
sb.End();
fx.View = view;
fx.Projection = Matrix.CreateOrthographicOffCenter(0, gd.Viewport.Width, gd.Viewport.Height, 0, 0, 1);
gd.BlendState = BlendState.AlphaBlend; gd.SamplerStates[0] = SamplerState.LinearClamp;
gd.RasterizerState = RasterizerState.CullNone; gd.DepthStencilState = DepthStencilState.None;
_hero.DrawBody(gd, fx, _dummy, AppSettings.ReduceMotion); _hero.DrawBody(gd, fx, _dummy, AppSettings.ReduceMotion);
double tStage = sw.Elapsed.TotalMilliseconds;
// oben dunkler Verlauf hinter der Kopfleiste
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
D.Glow(sb, new Vector2(-200, Camera.H / 2), new Vector2(900, 2000), Color.Black * 0.55f);
D.Glow(sb, new Vector2(Camera.W + 200, Camera.H / 2), new Vector2(900, 2000), Color.Black * 0.45f);
sb.End();
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui * Matrix.Identity); sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui * Matrix.Identity);
_crowd.Draw(sb, AppSettings.ReduceMotion); _crowd.Draw(sb, AppSettings.ReduceMotion);
@@ -150,7 +179,11 @@ namespace GladiatorIdle.Arena
if (_drawerK > 0.01f) DrawDrawer(sb); if (_drawerK > 0.01f) DrawDrawer(sb);
} }
sb.End(); sb.End();
// Profil (nur Testlauf --perf): Anteile der Hub-Zeichenzeit
if (DevShot.Active && ++_profN % 120 == 0)
DevShot.Log($"hub profile: cards {tCards:0.00} ms, stage {tStage - tCards:0.00} ms, ui {sw.Elapsed.TotalMilliseconds - tStage:0.00} ms, drawer {_drawerK:0.0}");
} }
int _profN;
static int PingPong(double t, int n) static int PingPong(double t, int n)
{ {
@@ -177,8 +210,6 @@ namespace GladiatorIdle.Arena
if (Assets.Sprite("icon_denarius") is Texture2D coin) if (Assets.Sprite("icon_denarius") is Texture2D coin)
sb.Draw(coin, new Vector2(gx, 60), null, Color.White, 0, new Vector2(coin.Width / 2f, coin.Height / 2f), 52f / coin.Width, SpriteEffects.None, 0); sb.Draw(coin, new Vector2(gx, 60), null, Color.White, 0, new Vector2(coin.Width / 2f, coin.Height / 2f), 52f / coin.Width, SpriteEffects.None, 0);
D.Text(sb, Assets.SansBold, 30, NumberFormat.Format(_game.Gold), new Vector2(gx + 36, 52), Color.White); D.Text(sb, Assets.SansBold, 30, NumberFormat.Format(_game.Gold), new Vector2(gx + 36, 52), Color.White);
if (_game.GoldPerSec > 0)
D.Text(sb, Assets.Sans, 17, string.Format(L.t("res.persec"), NumberFormat.Small(_game.GoldPerSec)), new Vector2(gx + 36, 86), D.Sand);
// Arena, Rang, Ruhm bis zum Champion // Arena, Rang, Ruhm bis zum Champion
float rx = Camera.W - 40; float rx = Camera.W - 40;
@@ -207,9 +238,16 @@ namespace GladiatorIdle.Arena
if (champ) D.Glow(sb, r.Center, new Vector2(w * 1.6f, h * 1.2f), D.Gold * (0.08f + 0.04f * MathF.Sin((float)_t * 3))); if (champ) D.Glow(sb, r.Center, new Vector2(w * 1.6f, h * 1.2f), D.Gold * (0.08f + 0.04f * MathF.Sin((float)_t * 3)));
D.Text(sb, Assets.SansBold, 18, L.t(o.Key).ToUpperInvariant(), new Vector2(r.Center.X, r.Y + 24), accent, Align.Center); D.Text(sb, Assets.SansBold, 18, L.t(o.Key).ToUpperInvariant(), new Vector2(r.Center.X, r.Y + 24), accent, Align.Center);
// Gegner // Gegner: 3D-Figur wie im Duell (sonst das Bild)
string art = o.Enemy.Art ?? Art.Enemy(o.Enemy.NameKey); string art = o.Enemy.Art ?? Art.Enemy(o.Enemy.NameKey);
if (Assets.Sprite(art) is Texture2D t) if (i < _cardRt.Count && FoeView(o.Enemy).Is3D)
{
var rt = _cardRt[i];
float k = 330f / CARD_H;
D.Glow(sb, new Vector2(r.Center.X, r.Y + 352), new Vector2(w * 0.9f, 40), Color.Black * 0.5f);
sb.Draw(rt, new Vector2(r.Center.X, r.Y + 352), null, Color.White, 0, new Vector2(CARD_W / 2f, CARD_H - 10), k, SpriteEffects.None, 0);
}
else if (Assets.Sprite(art) is Texture2D t)
{ {
float k = 300f / t.Height; float k = 300f / t.Height;
sb.Draw(t, new Vector2(r.Center.X, r.Y + 350), null, Color.White, 0, new Vector2(t.Width / 2f, Stage.Feet), k * 1.0f, SpriteEffects.FlipHorizontally, 0); sb.Draw(t, new Vector2(r.Center.X, r.Y + 350), null, Color.White, 0, new Vector2(t.Width / 2f, Stage.Feet), k * 1.0f, SpriteEffects.FlipHorizontally, 0);
@@ -228,18 +266,10 @@ namespace GladiatorIdle.Arena
Line(sb, r, ly + 26, L.t("res.fame"), "+" + NumberFormat.Format(fame)); Line(sb, r, ly + 26, L.t("res.fame"), "+" + NumberFormat.Format(fame));
Line(sb, r, ly + 52, "XP", "+" + NumberFormat.Format(xp)); // i18n-ok Line(sb, r, ly + 52, "XP", "+" + NumberFormat.Format(xp)); // i18n-ok
// Knöpfe // Knopf
bool auto = _game.CanAutoWin(o); var fb = new RectangleF(r.X + 16, r.Bottom - 62, r.Width - 32, 48);
var fb = new RectangleF(r.X + 16, r.Bottom - (auto ? 112 : 62), r.Width - 32, 48);
if (_ui.Button(sb, fb, L.t(champ ? "arena.challenge" : "hub.fight"), canFight, selected: champ, size: champ ? 18 : 22, accent: accent)) if (_ui.Button(sb, fb, L.t(champ ? "arena.challenge" : "hub.fight"), canFight, selected: champ, size: champ ? 18 : 22, accent: accent))
Chosen = o; Chosen = o;
if (auto && _ui.Button(sb, new RectangleF(r.X + 16, r.Bottom - 58, r.Width - 32, 42), L.t("hub.auto"), canFight, size: 17))
{
var before = Snapshot();
_game.AutoWin(o);
ShowResult(ResultLines(before, true), D.Gold);
SoundManager.PlayCoins();
}
} }
if (!canFight && _game.Recovery > 0) if (!canFight && _game.Recovery > 0)
{ {
@@ -289,29 +319,40 @@ namespace GladiatorIdle.Arena
// ── Schubladen ────────────────────────────────────────────── // ── Schubladen ──────────────────────────────────────────────
/// Ehrenhalle erst, wenn es dort etwas gibt (nach der ersten Freiheit).
bool HallOpen => _game.Freedoms > 0 || _game.Legends.Count > 0;
void DrawDrawerButtons(SpriteBatch sb) void DrawDrawerButtons(SpriteBatch sb)
{ {
float y = Camera.H - 92; float y = Camera.H - 92, x = 40;
string gl = _game.AttrPoints > 0 ? $"{L.t("ludus.gladiator")} ({_game.AttrPoints})" : L.t("ludus.gladiator"); bool Tab(string text, Drawer d, float w, Color? accent = null)
if (_ui.Button(sb, new RectangleF(40, y, 230, 60), gl, selected: _drawer == Drawer.Gladiator, size: 22, {
accent: _game.AttrPoints > 0 ? D.Gold : null)) bool hit = _ui.Button(sb, new RectangleF(x, y, w, 60), text, selected: _drawer == d, size: 22, accent: accent);
_drawer = _drawer == Drawer.Gladiator ? Drawer.None : Drawer.Gladiator; x += w + 16;
if (_ui.Button(sb, new RectangleF(286, y, 230, 60), L.t("main.ludus"), selected: _drawer == Drawer.Ludus, size: 22)) return hit;
_drawer = _drawer == Drawer.Ludus ? Drawer.None : Drawer.Ludus; }
if (_ui.Button(sb, new RectangleF(532, y, 230, 60), L.t("main.shop"), selected: _drawer == Drawer.Forum, size: 22)) // Gladiator: freie Attribut- und Fähigkeitspunkte zusammen
_drawer = _drawer == Drawer.Forum ? Drawer.None : Drawer.Forum; int pts = _game.AttrPoints + _game.LearnablePoints;
int sp = _game.LearnablePoints; if (Tab(pts > 0 ? $"{L.t("ludus.gladiator")} ({pts})" : L.t("ludus.gladiator"), Drawer.Gladiator, 260, pts > 0 ? D.Gold : null)) // i18n-ok
string sk = sp > 0 ? $"{L.t("char.skills")} ({sp})" : L.t("char.skills"); {
if (_ui.Button(sb, new RectangleF(778, y, 230, 60), sk, selected: _drawer == Drawer.Skills, size: 22, accent: sp > 0 ? D.Gold : null)) if (_drawer == Drawer.Gladiator) _drawer = Drawer.None;
_drawer = _drawer == Drawer.Skills ? Drawer.None : Drawer.Skills; else
int open = _game.Legends.Count(l => !_game.LegendsBeaten.Contains(l.Number)); {
if (_ui.Button(sb, new RectangleF(1024, y, 230, 60), string.Format(L.t("hall.button"), _game.Legends.Count), selected: _drawer == Drawer.Hall, _drawer = Drawer.Gladiator;
size: 22, accent: open > 0 || _game.GodFavor > 0 ? D.Purple : null)) // offene Punkte: gleich die passende Seite
_drawer = _drawer == Drawer.Hall ? Drawer.None : Drawer.Hall; if (_game.AttrPoints == 0 && _game.LearnablePoints > 0) _page = Page.Skills;
else if (_game.AttrPoints > 0) _page = Page.Gear;
}
}
if (Tab(L.t("main.ludus"), Drawer.Ludus, 260)) _drawer = _drawer == Drawer.Ludus ? Drawer.None : Drawer.Ludus;
string ex = _game.Away != null ? $"{L.t("exp.button")} · {NumberFormat.Duration(_game.Away.Left)}" : L.t("exp.button"); // i18n-ok string ex = _game.Away != null ? $"{L.t("exp.button")} · {NumberFormat.Duration(_game.Away.Left)}" : L.t("exp.button"); // i18n-ok
if (_ui.Button(sb, new RectangleF(1270, y, 300, 60), ex, selected: _drawer == Drawer.Expedition, size: 22, if (Tab(ex, Drawer.Expedition, 300, _game.Away != null ? D.Gold : null)) _drawer = _drawer == Drawer.Expedition ? Drawer.None : Drawer.Expedition;
accent: _game.Away != null ? D.Gold : null)) if (HallOpen)
_drawer = _drawer == Drawer.Expedition ? Drawer.None : Drawer.Expedition; {
int open = _game.Legends.Count(l => !_game.LegendsBeaten.Contains(l.Number));
if (Tab(string.Format(L.t("hall.button"), _game.Legends.Count), Drawer.Hall, 300, open > 0 || _game.GodFavor > 0 ? D.Purple : null))
_drawer = _drawer == Drawer.Hall ? Drawer.None : Drawer.Hall;
}
} }
void DrawDrawer(SpriteBatch sb) void DrawDrawer(SpriteBatch sb)
@@ -322,10 +363,17 @@ namespace GladiatorIdle.Arena
var r = new RectangleF(x, 140, W, Camera.H - 260); var r = new RectangleF(x, 140, W, Camera.H - 260);
Ui.Panel(sb, r, D.Gold, 0.94f); Ui.Panel(sb, r, D.Gold, 0.94f);
DrawGuide(sb, new RectangleF(r.Right + 20, r.Y, GUIDE, r.Height)); DrawGuide(sb, new RectangleF(r.Right + 20, r.Y, GUIDE, r.Height));
if (_drawer == Drawer.Gladiator) DrawGladiator(sb, r); if (_drawer == Drawer.Gladiator)
{
// zwei Seiten: Werte & Ausrüstung | Fähigkeiten
int sp = _game.LearnablePoints;
if (_ui.Button(sb, new RectangleF(r.X + 30, r.Y + 20, 300, 50), L.t("char.page.gear"), selected: _page == Page.Gear, size: 21,
accent: _game.AttrPoints > 0 ? D.Gold : null)) _page = Page.Gear;
if (_ui.Button(sb, new RectangleF(r.X + 342, r.Y + 20, 300, 50), sp > 0 ? $"{L.t("char.skills")} ({sp})" : L.t("char.skills"), // i18n-ok
selected: _page == Page.Skills, size: 21, accent: sp > 0 ? D.Gold : null)) _page = Page.Skills;
if (_page == Page.Skills) DrawSkills(sb, r); else DrawGladiator(sb, r);
}
else if (_drawer == Drawer.Ludus) DrawLudus(sb, r); else if (_drawer == Drawer.Ludus) DrawLudus(sb, r);
else if (_drawer == Drawer.Forum) DrawForum(sb, r);
else if (_drawer == Drawer.Skills) DrawSkills(sb, r);
else if (_drawer == Drawer.Hall) DrawHall(sb, r); else if (_drawer == Drawer.Hall) DrawHall(sb, r);
else if (_drawer == Drawer.Expedition) DrawExpeditions(sb, r); else if (_drawer == Drawer.Expedition) DrawExpeditions(sb, r);
} }
@@ -334,13 +382,11 @@ namespace GladiatorIdle.Arena
void DrawGladiator(SpriteBatch sb, RectangleF r) void DrawGladiator(SpriteBatch sb, RectangleF r)
{ {
float x = r.X + 30, y = r.Y + 40; float x = r.X + 30, y = r.Y + 100;
D.Text(sb, Assets.Serif, 30, $"{_game.Name} · {L.t(_game.ClassDef.Key)}", new Vector2(x, y), D.Gold);
D.Text(sb, Assets.SansBold, 20, string.Format(L.t("char.power"), NumberFormat.Format(_game.Power())), new Vector2(x + 700, y), D.Sand, Align.Right);
// Werte mit Attributpunkten // Werte mit Attributpunkten, Kampfkraft rechts in derselben Zeile
y += 50;
D.Text(sb, Assets.SansBold, 20, string.Format(L.t("char.points"), _game.AttrPoints), new Vector2(x, y), _game.AttrPoints > 0 ? D.Gold : D.Dim); D.Text(sb, Assets.SansBold, 20, string.Format(L.t("char.points"), _game.AttrPoints), new Vector2(x, y), _game.AttrPoints > 0 ? D.Gold : D.Dim);
D.Text(sb, Assets.SansBold, 20, string.Format(L.t("char.power"), NumberFormat.Format(_game.Power())), new Vector2(x + 700, y), D.Sand, Align.Right);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
{ {
var s = (Stat)i; var s = (Stat)i;
@@ -373,10 +419,19 @@ namespace GladiatorIdle.Arena
D.Frame(sb, row, it == null ? D.Border : RarityColor(it.Rarity), 2); D.Frame(sb, row, it == null ? D.Border : RarityColor(it.Rarity), 2);
if (it != null && Assets.Sprite(it.Def.Icon) is Texture2D icon) if (it != null && Assets.Sprite(it.Def.Icon) is Texture2D icon)
sb.Draw(icon, new Vector2(row.X + 36, row.Center.Y), null, Color.White, 0, new Vector2(icon.Width / 2f, icon.Height / 2f), 56f / icon.Width, SpriteEffects.None, 0); sb.Draw(icon, new Vector2(row.X + 36, row.Center.Y), null, Color.White, 0, new Vector2(icon.Width / 2f, icon.Height / 2f), 56f / icon.Width, SpriteEffects.None, 0);
D.Text(sb, Assets.Sans, 16, L.t("slot." + slot.ToString().ToLowerInvariant()), new Vector2(row.X + 76, row.Y + 18), D.Dim); string slotText = L.t("slot." + slot.ToString().ToLowerInvariant());
if (_game.SlotLevels[i] > 0) slotText += " · " + string.Format(L.t("forge.level"), _game.SlotLevels[i]); // i18n-ok
D.Text(sb, Assets.Sans, 16, slotText, new Vector2(row.X + 76, row.Y + 18), D.Dim);
D.Text(sb, Assets.SansBold, 20, it == null ? "–" : ItemName(it), new Vector2(row.X + 76, row.Y + 44), it == null ? D.Dim : RarityColor(it.Rarity)); // i18n-ok D.Text(sb, Assets.SansBold, 20, it == null ? "–" : ItemName(it), new Vector2(row.X + 76, row.Y + 44), it == null ? D.Dim : RarityColor(it.Rarity)); // i18n-ok
if (it != null && _sel == it.Id) D.Frame(sb, row, Color.White, 3); if (it != null && _sel == it.Id) D.Frame(sb, row, Color.White, 3);
if (it != null && _ui.Hit(row)) _sel = it.Id; // Schmied: diesen Platz verstärken (gilt für jedes Stück, das hier liegt)
double cost = _game.UpgradeSlotCost(slot);
var fr = new RectangleF(row.Right - 214, row.Y + 11, 200, 44);
if (_ui.Button(sb, fr, string.Format(L.t("btn.forge"), NumberFormat.Format(cost)), _game.Gold >= cost, size: 17))
{
if (_game.UpgradeSlot(slot)) SoundManager.PlayLevelUp();
}
else if (it != null && !fr.Contains(_ui.Mouse) && _ui.Hit(row)) _sel = it.Id;
} }
DrawInventory(sb, new RectangleF(r.X + 790, r.Y + 30, 430, r.Height - 60)); DrawInventory(sb, new RectangleF(r.X + 790, r.Y + 30, 430, r.Height - 60));
} }

View File

@@ -21,7 +21,14 @@ namespace GladiatorIdle.Arena
readonly Ui _ui = new(); readonly Ui _ui = new();
readonly Particles _fx = new(); readonly Particles _fx = new();
readonly Texture2D? _backdrop = Assets.Sprite("arena_colosseum", "jpg"); // Kolosseum in 3D als Bühne; die drei Besten stehen als Figuren ihrer Klasse auf dem Podest
readonly Stage3D _stage = new(5, AppSettings.ReduceMotion);
readonly Dictionary<string, FighterView> _podiumViews = new();
readonly DuelFighter _podiumDummy = new() { IsPlayer = true, Facing = 1, MaxHp = 1, Hp = 1, State = DuelState.Victory };
readonly RenderTarget2D?[] _podiumRt = new RenderTarget2D?[3];
BasicEffect? _figFx;
float _time;
const int FIG_W = 220, FIG_H = 300;
readonly string _me = Leaderboard.PlayerId; readonly string _me = Leaderboard.PlayerId;
List<LeaderEntry>? _all; List<LeaderEntry>? _all;
bool _loading = true, _offline, _dev; bool _loading = true, _offline, _dev;
@@ -79,17 +86,47 @@ namespace GladiatorIdle.Arena
// ── Zeichnen ──────────────────────────────────────────────── // ── Zeichnen ────────────────────────────────────────────────
/// Siegerfiguren der Plätze 1–3 in ihre Bildflächen (vor allem anderen: Zielwechsel leert das Bild).
void RenderPodium(GraphicsDevice gd, List<LeaderEntry> list)
{
_figFx ??= new BasicEffect(gd) { VertexColorEnabled = true };
_podiumDummy.StateTime = 0.6f + (_time % 4f) * 0.5f; // Siegesjubel immer wieder
var previous = gd.GetRenderTargets();
for (int i = 0; i < 3; i++)
{
_podiumRt[i] = null;
if (i >= list.Count || !Enum.TryParse<GladiatorClass>(list[i].Class, out var cls)) continue;
string art = Art.Hero(cls, 1);
if (!_podiumViews.TryGetValue(art, out var v)) _podiumViews[art] = v = new FighterView(art, i * 0.7f, -1, i == 0 ? 4 : i == 1 ? 7 : 0);
v.Update(1 / 60f, 1 / 60f, _podiumDummy, 0, true);
if (!v.Is3D) continue;
var rt = _podiumRtCache[i] ??= new RenderTarget2D(gd, FIG_W, FIG_H, false, SurfaceFormat.Color, DepthFormat.Depth24);
gd.SetRenderTarget(rt);
gd.Clear(Color.Transparent);
_figFx.View = Matrix.CreateTranslation(0, -Stage.FloorY, 0) * Matrix.CreateScale(0.78f) * Matrix.CreateTranslation(FIG_W / 2f, FIG_H - 6, 0);
_figFx.Projection = Matrix.CreateOrthographicOffCenter(0, FIG_W, FIG_H, 0, 0, 1);
gd.BlendState = BlendState.AlphaBlend; gd.DepthStencilState = DepthStencilState.None; gd.RasterizerState = RasterizerState.CullNone;
v.DrawBody(gd, _figFx, _podiumDummy, true);
_podiumRt[i] = rt;
}
gd.SetRenderTargets(previous);
gd.Clear(Color.Black);
}
readonly RenderTarget2D?[] _podiumRtCache = new RenderTarget2D?[3];
public void Draw(SpriteBatch sb, float scale, Vector2 offset) public void Draw(SpriteBatch sb, float scale, Vector2 offset)
{ {
D.UiScale = scale; D.UiScale = scale;
var gd = sb.GraphicsDevice;
_time += 1 / 60f;
var ranked = !_loading && !_offline ? Ranked() : new List<LeaderEntry>();
RenderPodium(gd, ranked);
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0); var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
_stage.Cam.Update(1 / 60f, Camera.W / 2 - 1800, Camera.W / 2 + 1800, AppSettings.ReduceMotion);
_stage.Prepare(gd, scale, offset);
_stage.DrawSet(gd, sb, _time, 0.8f);
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui); sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
if (_backdrop != null) D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * 0.45f); // Tafeln lesbar
{
float k = 1.08f * MathF.Max(Camera.W / _backdrop.Width, Camera.H / _backdrop.Height);
sb.Draw(_backdrop, new Vector2(Camera.W / 2, Camera.H / 2), null, new Color(0.3f, 0.27f, 0.24f), 0,
new Vector2(_backdrop.Width / 2f, _backdrop.Height / 2f), k, SpriteEffects.None, 0);
}
sb.End(); sb.End();
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, ui); sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, ui);
_fx.DrawAdd(sb); _fx.DrawAdd(sb);
@@ -134,19 +171,27 @@ namespace GladiatorIdle.Arena
var r = new RectangleF(x, baseY - h, w, h); var r = new RectangleF(x, baseY - h, w, h);
D.Rect(sb, r, new Color(30, 22, 15) * 0.92f); D.Rect(sb, r, new Color(30, 22, 15) * 0.92f);
D.Frame(sb, r, e.Id == _me ? D.Purple : medal[i], e.Id == _me ? 4 : 3); D.Frame(sb, r, e.Id == _me ? D.Purple : medal[i], e.Id == _me ? 4 : 3);
D.Text(sb, Assets.Serif, 44, (i + 1).ToString(NumberFormat.Culture), new Vector2(r.Center.X, r.Y + 30), medal[i], Align.Center); float tx = r.Center.X;
D.Text(sb, Assets.Serif, 28, e.Name, new Vector2(r.Center.X, r.Y + 72), Color.White, Align.Center); if (_podiumRt[i] is RenderTarget2D fig)
if (h >= 170) D.Text(sb, Assets.Sans, 17, $"{ClassName(e)} · {string.Format(L.t("ludus.level"), e.Level)}", new Vector2(r.Center.X, r.Y + 104), D.Sand, Align.Center); // i18n-ok {
D.Text(sb, Assets.SansBold, 24, Value(e), new Vector2(r.Center.X, r.Bottom - 26), medal[i], Align.Center); // Figur steht links auf der Tafel und ragt nach oben heraus
float k = (h + 60) / FIG_H;
sb.Draw(fig, new Vector2(r.X + 70, r.Bottom - 8), null, Color.White, 0, new Vector2(FIG_W / 2f, FIG_H - 6), k, SpriteEffects.None, 0);
tx = r.X + 230;
}
D.Text(sb, Assets.Serif, 44, (i + 1).ToString(NumberFormat.Culture), new Vector2(tx, r.Y + 30), medal[i], Align.Center);
D.Text(sb, Assets.Serif, e.Name.Length > 11 ? 22 : 28, e.Name, new Vector2(tx, r.Y + 72), Color.White, Align.Center);
if (h >= 170) D.Text(sb, Assets.Sans, 16, $"{ClassName(e)} · {string.Format(L.t("ludus.level"), e.Level)}", new Vector2(tx, r.Y + 104), D.Sand, Align.Center); // i18n-ok
D.Text(sb, Assets.SansBold, 24, Value(e), new Vector2(tx, r.Bottom - 26), medal[i], Align.Center);
} }
// Plätze 4–15 // Plätze 4–15
float x0 = Camera.W / 2 - 560, y = 512, rowH = 36, wAll = 1120; float x0 = Camera.W / 2 - 560, y = 512, rowH = 36, wAll = 1120;
D.Text(sb, Assets.Sans, 15, L.t("lb.col.rank"), new Vector2(x0 + 20, y), D.Dim); D.Text(sb, Assets.Sans, 15, L.t("lb.col.rank"), new Vector2(x0 + 20, y), D.Sand);
D.Text(sb, Assets.Sans, 15, L.t("lb.col.name"), new Vector2(x0 + 90, y), D.Dim); D.Text(sb, Assets.Sans, 15, L.t("lb.col.name"), new Vector2(x0 + 90, y), D.Sand);
D.Text(sb, Assets.Sans, 15, L.t("lb.col.class"), new Vector2(x0 + 470, y), D.Dim); D.Text(sb, Assets.Sans, 15, L.t("lb.col.class"), new Vector2(x0 + 470, y), D.Sand);
D.Text(sb, Assets.Sans, 15, L.t("lb.col.freedoms"), new Vector2(x0 + 760, y), D.Dim, Align.Center); D.Text(sb, Assets.Sans, 15, L.t("lb.col.freedoms"), new Vector2(x0 + 760, y), D.Sand, Align.Center);
D.Text(sb, Assets.Sans, 15, L.t(_tab == Tab.Power ? "lb.tab.power" : "lb.tab.fastest"), new Vector2(x0 + wAll - 20, y), D.Dim, Align.Right); D.Text(sb, Assets.Sans, 15, L.t(_tab == Tab.Power ? "lb.tab.power" : "lb.tab.fastest"), new Vector2(x0 + wAll - 20, y), D.Sand, Align.Right);
y += 26; y += 26;
for (int i = 3; i < Math.Min(15, list.Count); i++) { Row(sb, list[i], i, x0, y, wAll, rowH); y += rowH; } for (int i = 3; i < Math.Min(15, list.Count); i++) { Row(sb, list[i], i, x0, y, wAll, rowH); y += rowH; }
int mine = list.FindIndex(e => e.Id == _me); int mine = list.FindIndex(e => e.Id == _me);

View File

@@ -48,9 +48,11 @@ namespace GladiatorIdle.Arena
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui); sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
if (_backdrop != null) if (_backdrop != null)
{ {
// langsames Heranfahren // langsames Heranfahren und Wandern (Ken Burns, etwa 40 s je Schwung); still bei "Effekte reduzieren"
float k = (1.08f + 0.03f * (float)Math.Sin(_t * 0.05)) * MathF.Max(Camera.W / _backdrop.Width, Camera.H / _backdrop.Height); double t = AppSettings.ReduceMotion ? 0 : _t;
sb.Draw(_backdrop, new Vector2(Camera.W / 2, Camera.H / 2), null, new Color(0.62f, 0.58f, 0.54f), 0, float k = (1.1f + 0.04f * (float)Math.Sin(t * 0.16)) * MathF.Max(Camera.W / _backdrop.Width, Camera.H / _backdrop.Height);
var pan = new Vector2(38 * (float)Math.Sin(t * 0.11), 14 * (float)Math.Sin(t * 0.07 + 1));
sb.Draw(_backdrop, new Vector2(Camera.W / 2, Camera.H / 2) + pan, null, new Color(0.62f, 0.58f, 0.54f), 0,
new Vector2(_backdrop.Width / 2f, _backdrop.Height / 2f), k, SpriteEffects.None, 0); new Vector2(_backdrop.Width / 2f, _backdrop.Height / 2f), k, SpriteEffects.None, 0);
} }
D.Glow(sb, new Vector2(Camera.W / 2, Camera.H / 2), new Vector2(Camera.W * 0.9f, Camera.H * 1.2f), Color.Black * 0.35f); D.Glow(sb, new Vector2(Camera.W / 2, Camera.H / 2), new Vector2(Camera.W * 0.9f, Camera.H * 1.2f), Color.Black * 0.35f);

View File

@@ -33,7 +33,7 @@ namespace GladiatorIdle.Arena
// --model=<name>: andere Figur ansehen (Standard: hero_murmillo_1) // --model=<name>: andere Figur ansehen (Standard: hero_murmillo_1)
string name = Array.Find(Environment.GetCommandLineArgs(), x => x.StartsWith("--model="))?[8..] ?? "hero_murmillo_1"; string name = Array.Find(Environment.GetCommandLineArgs(), x => x.StartsWith("--model="))?[8..] ?? "hero_murmillo_1";
Model = Model3D.Load(gd, name); Model = Model3D.Load(gd, name);
Model?.Arm(name); Model?.Arm(Array.Find(Environment.GetCommandLineArgs(), x => x.StartsWith("--arm="))?[6..] ?? name); // --arm=<figur>: deren Ausrüstung
if (Model != null) DevShot.Log($"model3d {name}: {Model.BladeLog}"); if (Model != null) DevShot.Log($"model3d {name}: {Model.BladeLog}");
_backdrop = Assets.Sprite("arena_colosseum", "jpg"); _backdrop = Assets.Sprite("arena_colosseum", "jpg");
_fx = new BasicEffect(gd) { VertexColorEnabled = true, LightingEnabled = true, PreferPerPixelLighting = true }; _fx = new BasicEffect(gd) { VertexColorEnabled = true, LightingEnabled = true, PreferPerPixelLighting = true };

View File

@@ -19,6 +19,13 @@ namespace GladiatorIdle.Arena
public SettingsOverlay(Action toggleFullscreen) => _toggleFullscreen = toggleFullscreen; public SettingsOverlay(Action toggleFullscreen) => _toggleFullscreen = toggleFullscreen;
/// Bildrate geändert: Grafik neu einstellen (VSync, feste Rate).
public Action ApplyGraphics = () => { };
/// Einführung: null = kein Spielstand, true = schon gesehen; ReplayTutorial schaltet sie wieder ein.
public Func<bool?> Tutorial = () => null;
public Action ReplayTutorial = () => { };
public void Update(Input input, Matrix ui) public void Update(Input input, Matrix ui)
{ {
_ui.Begin(input, ui); _ui.Begin(input, ui);
@@ -39,7 +46,7 @@ namespace GladiatorIdle.Arena
var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0); var ui = Matrix.CreateScale(scale) * Matrix.CreateTranslation(offset.X, offset.Y, 0);
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui); sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, null, null, null, ui);
D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * 0.6f); D.Rect(sb, new RectangleF(0, 0, Camera.W, Camera.H), Color.Black * 0.6f);
var r = new RectangleF(Camera.W / 2 - 420, 100, 840, 880); var r = new RectangleF(Camera.W / 2 - 420, 24, 840, 1032);
Ui.Panel(sb, r, D.Gold, 0.97f); Ui.Panel(sb, r, D.Gold, 0.97f);
float x = r.X + 50, y = r.Y + 60, w = r.Width - 100; float x = r.X + 50, y = r.Y + 60, w = r.Width - 100;
D.Text(sb, Assets.Serif, 40, L.t("main.settings").ToUpperInvariant(), new Vector2(r.Center.X, y), D.Gold, Align.Center); D.Text(sb, Assets.Serif, 40, L.t("main.settings").ToUpperInvariant(), new Vector2(r.Center.X, y), D.Gold, Align.Center);
@@ -64,6 +71,17 @@ namespace GladiatorIdle.Arena
y += 56; y += 56;
Toggle(sb, x, y, w, L.t("settings.reducemotion"), AppSettings.ReduceMotion, () => AppSettings.ReduceMotion = !AppSettings.ReduceMotion); Toggle(sb, x, y, w, L.t("settings.reducemotion"), AppSettings.ReduceMotion, () => AppSettings.ReduceMotion = !AppSettings.ReduceMotion);
y += 56; y += 56;
Toggle(sb, x, y, w, L.t("settings.antialias"), AppSettings.AntiAlias, () => AppSettings.AntiAlias = !AppSettings.AntiAlias);
y += 56;
Toggle(sb, x, y, w, L.t("settings.bloom"), AppSettings.Bloom, () => AppSettings.Bloom = !AppSettings.Bloom);
y += 56;
D.Text(sb, Assets.Sans, 22, L.t("settings.framerate"), new Vector2(x, y), D.Sand);
var rates = new[] { "settings.fps.vsync", "settings.fps.120", "settings.fps.max" };
for (int i = 0; i < rates.Length; i++)
if (_ui.Button(sb, new RectangleF(x + w - 3 * 150 - 20 + i * 160, y - 22, 150, 44), L.t(rates[i]), selected: AppSettings.FrameLimit == i, size: 18)
&& AppSettings.FrameLimit != i)
{ AppSettings.FrameLimit = i; Save(); ApplyGraphics(); }
y += 56;
D.Text(sb, Assets.Sans, 22, L.t("settings.row.language"), new Vector2(x, y), D.Sand); D.Text(sb, Assets.Sans, 22, L.t("settings.row.language"), new Vector2(x, y), D.Sand);
var langs = new[] { (L.Lang.De, "Deutsch"), (L.Lang.En, "English"), (L.Lang.Es, "Español") }; // i18n-ok var langs = new[] { (L.Lang.De, "Deutsch"), (L.Lang.En, "English"), (L.Lang.Es, "Español") }; // i18n-ok
for (int i = 0; i < langs.Length; i++) for (int i = 0; i < langs.Length; i++)
@@ -72,6 +90,13 @@ namespace GladiatorIdle.Arena
if (_ui.Button(sb, new RectangleF(x + w - 3 * 150 - 20 + i * 160, y - 22, 150, 44), name, selected: L.Current == lang, size: 18)) if (_ui.Button(sb, new RectangleF(x + w - 3 * 150 - 20 + i * 160, y - 22, 150, 44), name, selected: L.Current == lang, size: 18))
if (L.Current != lang && DevShot.Lang == null) L.Set(lang); if (L.Current != lang && DevShot.Lang == null) L.Set(lang);
} }
y += 70;
if (Tutorial() is bool seen)
{
D.Text(sb, Assets.Sans, 22, L.t("settings.tutorial"), new Vector2(x, y), D.Sand);
if (_ui.Button(sb, new RectangleF(x + w - 300, y - 22, 300, 44), L.t(seen ? "settings.tutorial.replay" : "settings.tutorial.next"), seen, size: 18))
ReplayTutorial();
}
if (_ui.Button(sb, new RectangleF(r.Center.X - 160, r.Bottom - 100, 320, 64), L.t("select.back"), selected: true, size: 26)) if (_ui.Button(sb, new RectangleF(r.Center.X - 160, r.Bottom - 100, 320, 64), L.t("select.back"), selected: true, size: 26))
Open = false; Open = false;

135
Mono/Arena/Stage3D.cs Normal file
View File

@@ -0,0 +1,135 @@
using System;
using GladiatorIdle.Gfx;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using D = GladiatorIdle.Gfx.Draw;
namespace GladiatorIdle.Arena
{
/// <summary>
/// Gemeinsame 3D-Bühne für Duell, Hub, Freiheit und Erstellung: Kamera mit Perspektive,
/// Arena-Kulisse (<see cref="ArenaSet"/>), Schattenwurf der Figuren und ein Effekt, mit dem
/// SpriteBatch auf der Kampfebene (z = 0) zeichnet, sodass 2D-Effekte zur 3D-Kamera passen.
/// Ablauf je Bild: <see cref="Prepare"/>, <see cref="DrawSet"/>, <see cref="Shadows"/>,
/// dann Figuren (<see cref="Use"/>) und Ebenen-Batches (<see cref="BeginPlane"/>).
/// </summary>
internal sealed class Stage3D
{
public readonly Camera Cam = new();
public ArenaSet Set { get; private set; }
public int Arena { get; private set; }
public Matrix View3 { get; private set; }
public Matrix Proj3 { get; private set; }
readonly bool _calm;
BasicEffect? _plane;
int _vw, _vh; float _scale = 1;
public Stage3D(int arena, bool calm)
{
_calm = calm;
Arena = arena;
Set = ArenaSet.Get(arena, Art.Arena(ArenaDef.All[Math.Clamp(arena, 0, ArenaDef.All.Length - 1)]), calm);
Cam.Center = new Vector2(Camera.W / 2, Camera.H / 2 + 40);
}
/// Andere Arena (Aufstieg): Kulisse neu bauen.
public void SetArena(int arena)
{
if (arena == Arena) return;
Arena = arena;
Set = ArenaSet.Get(arena, Art.Arena(ArenaDef.All[Math.Clamp(arena, 0, ArenaDef.All.Length - 1)]), _calm);
}
/// Matrizen für dieses Bild.
public void Prepare(GraphicsDevice gd, float scale, Vector2 offset)
{
_vw = gd.Viewport.Width; _vh = gd.Viewport.Height; _scale = scale;
View3 = Cam.View3();
Proj3 = Cam.Proj3(scale, offset, _vw, _vh);
_plane ??= new BasicEffect(gd) { TextureEnabled = true, VertexColorEnabled = true, LightingEnabled = false };
_plane.World = Matrix.Identity; _plane.View = View3; _plane.Projection = Proj3;
}
/// Kulisse (Tiefe und Stencil frisch), Feuer als Licht.
public void DrawSet(GraphicsDevice gd, SpriteBatch sb, double time, float excite)
{
gd.Clear(ClearOptions.DepthBuffer | ClearOptions.Stencil, Color.Transparent, 1, 0);
Set.Draw(gd, View3, Proj3, time, excite);
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp, null, null, null, Matrix.Identity);
Set.DrawFires(sb, Cam, View3, Proj3, _vw, _vh, _scale, time);
sb.End();
}
/// Figur auf diese Bühne einstellen (Kamera und Licht der Arena).
public void Use(FighterView f)
{
f.UseCamera3D(View3, Proj3);
f.SetLighting(Set.Look);
}
/// Schattenwurf auf dem Sand und weicher Kontaktschatten unter den Füßen.
public void Shadows(GraphicsDevice gd, SpriteBatch sb, float dim, params FighterView[] figs)
{
float shade = (Set.Look.Wall == "marble" ? 0.32f : 0.42f) * (1 - 0.6f * dim);
foreach (var f in figs) Use(f);
SoftShadows(gd, sb, Set.Look.SunDir, shade, figs);
BeginPlane(sb, BlendState.AlphaBlend);
foreach (var f in figs) f.DrawShadow(sb);
sb.End();
}
static RenderTarget2D? _shadowRt;
/// Weicher Schattenwurf: die Figuren flach und deckend schwarz in eine halb so große Fläche,
/// dann mehrfach leicht versetzt auf das Bild gelegt (weiche Ränder, kein doppeltes Abdunkeln).
/// Die Figuren müssen schon auf die Kamera eingestellt sein (<see cref="FighterView.UseCamera3D"/>).
public static void SoftShadows(GraphicsDevice gd, SpriteBatch sb, Vector3 sunDir, float strength, params FighterView[] figs)
{
int vw = gd.Viewport.Width, vh = gd.Viewport.Height;
if (_shadowRt == null || _shadowRt.Width != vw / 2 || _shadowRt.Height != vh / 2)
{
_shadowRt?.Dispose();
_shadowRt = new RenderTarget2D(gd, Math.Max(1, vw / 2), Math.Max(1, vh / 2), false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8, 0, RenderTargetUsage.DiscardContents);
}
var previous = gd.GetRenderTargets();
gd.SetRenderTarget(_shadowRt);
gd.Clear(ClearOptions.Target | ClearOptions.DepthBuffer | ClearOptions.Stencil, Color.Transparent, 1, 0);
foreach (var f in figs) f.DrawCastShadow(gd, sunDir, 1f);
gd.SetRenderTargets(previous);
// 8 versetzte Abzüge im Kreis + Mitte: Gesamtdeckung im Kern = strength
const int TAPS = 9;
float a = 1 - MathF.Pow(1 - strength, 1f / TAPS);
float r = MathF.Max(2.5f, vw / 700f);
sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone);
var dst = new Rectangle(0, 0, vw, vh);
for (int i = 0; i < TAPS; i++)
{
var off = i == 0 ? Vector2.Zero : new Vector2(MathF.Cos(i * MathF.Tau / 8), MathF.Sin(i * MathF.Tau / 8)) * r * (i % 2 == 0 ? 1f : 0.6f);
sb.Draw(_shadowRt, new Rectangle(dst.X + (int)off.X, dst.Y + (int)off.Y, dst.Width, dst.Height), Color.White * a);
}
sb.End();
}
/// SpriteBatch auf der Kampfebene (Design-Pixel bei z = 0, durch die 3D-Kamera).
public void BeginPlane(SpriteBatch sb, BlendState blend) =>
sb.Begin(SpriteSortMode.Deferred, blend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullNone, _plane);
/// Warmer Lichtfleck auf dem Sand um eine Stelle (additiv, auf der Kampfebene).
public void FloorLight(SpriteBatch sb, float x, float width, float strength)
{
BeginPlane(sb, BlendState.Additive);
D.Glow(sb, new Vector2(x, Stage.FloorY + 10), new Vector2(width, 230), new Color(255, 180, 110) * strength);
sb.End();
}
/// Zeichenzustand für die Figuren danach (Tiefe neu, damit sie vor der Kulisse stehen).
public static void BeginFigures(GraphicsDevice gd)
{
gd.BlendState = BlendState.AlphaBlend;
gd.SamplerStates[0] = SamplerState.LinearClamp;
gd.RasterizerState = RasterizerState.CullNone;
gd.DepthStencilState = DepthStencilState.None;
gd.Clear(ClearOptions.DepthBuffer, Color.Transparent, 1, 0);
}
}
}

View File

@@ -29,6 +29,7 @@ namespace GladiatorIdle
DuelScene? _scene; DuelScene? _scene;
ModelTestScene? _model; // --model3d: 3D-Test ModelTestScene? _model; // --model3d: 3D-Test
FreedomScene? _freedom; // Freiheit: Clip, Bilanz, Götter FreedomScene? _freedom; // Freiheit: Clip, Bilanz, Götter
OfflineReport? _welcome; // was offline passiert ist (beim Weiterspielen gezeigt)
LeaderboardScene? _board; // Bestenliste (aus dem Menü) LeaderboardScene? _board; // Bestenliste (aus dem Menü)
bool _nextLife; // nächste Erstellung behält das Profil (Legenden, Götter) bool _nextLife; // nächste Erstellung behält das Profil (Legenden, Götter)
Legend? _legend; // laufendes Duell gegen eine Legende Legend? _legend; // laufendes Duell gegen eine Legende
@@ -36,6 +37,7 @@ namespace GladiatorIdle
static readonly bool DevChampionRun = Array.IndexOf(Environment.GetCommandLineArgs(), "--champion") >= 0; static readonly bool DevChampionRun = Array.IndexOf(Environment.GetCommandLineArgs(), "--champion") >= 0;
static readonly bool DevAdventureRun = Array.IndexOf(Environment.GetCommandLineArgs(), "--adventure") >= 0; static readonly bool DevAdventureRun = Array.IndexOf(Environment.GetCommandLineArgs(), "--adventure") >= 0;
static readonly bool DevBoardRun = Array.IndexOf(Environment.GetCommandLineArgs(), "--leaderboard") >= 0; static readonly bool DevBoardRun = Array.IndexOf(Environment.GetCommandLineArgs(), "--leaderboard") >= 0;
static readonly bool DevTutorialRun = Array.IndexOf(Environment.GetCommandLineArgs(), "--tutorial") >= 0;
static readonly bool Model3DTest = Array.IndexOf(Environment.GetCommandLineArgs(), "--model3d") >= 0; static readonly bool Model3DTest = Array.IndexOf(Environment.GetCommandLineArgs(), "--model3d") >= 0;
SettingsOverlay _settings = null!; SettingsOverlay _settings = null!;
bool _paused; bool _paused;
@@ -59,9 +61,11 @@ namespace GladiatorIdle
public ArenaGame() public ArenaGame()
{ {
_gdm = new GraphicsDeviceManager(this) { SynchronizeWithVerticalRetrace = true, GraphicsProfile = GraphicsProfile.HiDef }; _gdm = new GraphicsDeviceManager(this) { SynchronizeWithVerticalRetrace = true, GraphicsProfile = GraphicsProfile.HiDef,
PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8 }; // Stencil: Schatten im Duell
SetMode(AppSettings.Fullscreen); SetMode(AppSettings.Fullscreen);
IsFixedTimeStep = false; IsFixedTimeStep = false;
ApplyFrameLimit(apply: false);
IsMouseVisible = true; IsMouseVisible = true;
Window.Title = L.t("app.title"); Window.Title = L.t("app.title");
Window.AllowUserResizing = true; Window.AllowUserResizing = true;
@@ -86,6 +90,23 @@ namespace GladiatorIdle
} }
} }
/// Bildrate nach Einstellung: VSync, feste 120 Bilder/s oder unbegrenzt (Testläufe: immer VSync).
void ApplyFrameLimit(bool apply = true)
{
int mode = DevShot.Active ? 0 : AppSettings.FrameLimit;
_gdm.SynchronizeWithVerticalRetrace = mode == 0;
IsFixedTimeStep = mode == 1;
if (mode == 1) TargetElapsedTime = TimeSpan.FromSeconds(1 / 120.0);
if (apply) _gdm.ApplyChanges();
}
readonly Gfx.PostFx _post = new();
object? _shown; // zuletzt gezeigter Bildschirm (für das Überblenden)
double _fadeIn = 1; // 0 → 1 nach einem Wechsel
/// Spielstand sofort sichern (Absturz-Behandlung); Testläufe speichern ohnehin nie.
public void SaveNow() => _game?.Save();
void ToggleFullscreen() void ToggleFullscreen()
{ {
AppSettings.Fullscreen = !AppSettings.Fullscreen; AppSettings.Fullscreen = !AppSettings.Fullscreen;
@@ -111,7 +132,12 @@ namespace GladiatorIdle
_sb = new SpriteBatch(GraphicsDevice); _sb = new SpriteBatch(GraphicsDevice);
_fx = new BasicEffect(GraphicsDevice) { TextureEnabled = true, VertexColorEnabled = true, LightingEnabled = false, World = Matrix.Identity }; _fx = new BasicEffect(GraphicsDevice) { TextureEnabled = true, VertexColorEnabled = true, LightingEnabled = false, World = Matrix.Identity };
Assets.Init(GraphicsDevice); Assets.Init(GraphicsDevice);
_settings = new SettingsOverlay(ToggleFullscreen); _settings = new SettingsOverlay(ToggleFullscreen)
{
ApplyGraphics = () => ApplyFrameLimit(),
Tutorial = () => _game == null ? null : _game.TutorialDone,
ReplayTutorial = () => { if (_game != null) { _game.TutorialDone = false; _game.Save(); } }
};
Window.TextInput += (_, e) => { if (!_settings.Open) _creator?.OnText(e.Character, e.Key); }; Window.TextInput += (_, e) => { if (!_settings.Open) _creator?.OnText(e.Character, e.Key); };
// eigener Spielstand fürs neue Spiel; vorhandenen laden und Abwesenheit nachrechnen // eigener Spielstand fürs neue Spiel; vorhandenen laden und Abwesenheit nachrechnen
GameState.SaveFile = "arena.json"; GameState.SaveFile = "arena.json";
@@ -119,8 +145,8 @@ namespace GladiatorIdle
if (!DevShot.Active && GameState.Load(out var savedUtc) is GameState loaded) if (!DevShot.Active && GameState.Load(out var savedUtc) is GameState loaded)
{ {
_game = loaded; _game = loaded;
_game.ManualFights = true; var away = _game.ApplyOffline((DateTime.UtcNow - savedUtc).TotalSeconds);
_game.ApplyOffline((DateTime.UtcNow - savedUtc).TotalSeconds); if (away.Seconds >= 120) _welcome = away; // im Hub als erstes Fenster
ToMenu(); ToMenu();
} }
else if (!DevShot.Active) { _introThenCreate = true; _intro = new IntroScene(); } // erster Start: Intro else if (!DevShot.Active) { _introThenCreate = true; _intro = new IntroScene(); } // erster Start: Intro
@@ -156,7 +182,10 @@ namespace GladiatorIdle
} }
// --sim H: weiter vorn einsteigen (Testläufe, Ausprobieren späterer Arenen) // --sim H: weiter vorn einsteigen (Testläufe, Ausprobieren späterer Arenen)
if (Array.IndexOf(Environment.GetCommandLineArgs(), "--sim") >= 0) Playtest.Advance(_game, DevShot.SimHours); if (Array.IndexOf(Environment.GetCommandLineArgs(), "--sim") >= 0) Playtest.Advance(_game, DevShot.SimHours);
_game.ManualFights = true; // --duelarena N: gleich in Arena N (Kulisse prüfen)
var cmd = Environment.GetCommandLineArgs();
int da = Array.IndexOf(cmd, "--duelarena");
if (da >= 0 && da + 1 < cmd.Length && int.TryParse(cmd[da + 1], out int arenaN)) _game.DevArena(arenaN);
_game.Save(); _game.Save();
_creator = null; _creator = null;
var sw = Stopwatch.StartNew(); var sw = Stopwatch.StartNew();
@@ -183,7 +212,6 @@ namespace GladiatorIdle
_offer = null; _offer = null;
_enemy = GameState.LegendEnemy(l); _enemy = GameState.LegendEnemy(l);
_before = _hub!.Snapshot(); _before = _hub!.Snapshot();
_game!.BeginDuel();
_scene = new DuelScene(_game, _enemy, _seed++); _scene = new DuelScene(_game, _enemy, _seed++);
if (DevShot.Active) _scene.Bot = new DuelBot(0.8, new Random(3)); 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}"); DevShot.Log($"legend duel vs #{l.Number} {l.Name} ratio={_game.DuelRatio(_enemy):0.00}");
@@ -195,10 +223,11 @@ namespace GladiatorIdle
_offer = o; _offer = o;
_enemy = o.Enemy; _enemy = o.Enemy;
_before = _hub!.Snapshot(); _before = _hub!.Snapshot();
_game!.BeginDuel();
var sw = Stopwatch.StartNew(); var sw = Stopwatch.StartNew();
_scene = new DuelScene(_game, _enemy, _seed++); _scene = new DuelScene(_game, _enemy, _seed++);
DevShot.Log($"timing: duel created in {sw.ElapsedMilliseconds} ms"); DevShot.Log($"timing: duel created in {sw.ElapsedMilliseconds} ms");
// erster Kampf eines neuen Profils: Einführung (in Testläufen nur mit --tutorial)
if (!_game.TutorialDone && o.Kind != OfferKind.Champion && (!DevShot.Active || DevTutorialRun)) _scene.StartTutorial();
if (DevShot.Active) _scene.Bot = new DuelBot(0.8, new Random(3)); if (DevShot.Active) _scene.Bot = new DuelBot(0.8, new Random(3));
DevShot.Log($"duel vs {_enemy.NameKey} ({o.Kind}) arena={_game.Arena} rank={_game.Rank} ratio={_game.DuelRatio(_enemy):0.00}"); DevShot.Log($"duel vs {_enemy.NameKey} ({o.Kind}) arena={_game.Arena} rank={_game.Rank} ratio={_game.DuelRatio(_enemy):0.00}");
} }
@@ -207,6 +236,7 @@ namespace GladiatorIdle
void EndDuel() void EndDuel()
{ {
bool won = _scene!.Won; bool won = _scene!.Won;
if (_scene.TutorialRan) _game!.TutorialDone = true;
if (_legend is Legend l) if (_legend is Legend l)
{ {
bool first = _game!.ResolveLegendDuel(l, won); bool first = _game!.ResolveLegendDuel(l, won);
@@ -227,6 +257,26 @@ namespace GladiatorIdle
_game.Save(); _game.Save();
} }
// Speichern bald nach einem Klick außerhalb des Kampfs (Kauf, Anlegen, Lernen, Opfern, Expedition,
// Entscheidung …): gebündelt, höchstens alle 2 s. Testläufe speichern nie (GameState.Save).
double _saveSoon = -1, _clock, _lastSave = -9;
void SaveSoon(float dt)
{
_clock += dt;
if (_game == null || _creator != null) return;
if (_scene == null && _input.LeftClick) _saveSoon = 0.6;
if (_saveSoon < 0 || (_saveSoon -= dt) > 0) return;
if (_clock - _lastSave < 2) { _saveSoon = 0.3; return; }
_game.Save(); _lastSave = _clock; _saveSoon = -1;
}
/// Fenster verliert den Fokus (Alt+Tab, minimiert): sofort speichern.
protected override void OnDeactivated(object sender, EventArgs args)
{
if (_game != null && _creator == null) { _game.Save(); _lastSave = _clock; }
base.OnDeactivated(sender, args);
}
readonly Stopwatch _updWatch = new(); readonly Stopwatch _updWatch = new();
double _updMs; double _updMs;
@@ -245,12 +295,16 @@ namespace GladiatorIdle
_input.PrevKeys = _input.Keys; _input.PrevMouse = _input.Mouse; _input.PrevKeys = _input.Keys; _input.PrevMouse = _input.Mouse;
_input.Keys = Keyboard.GetState(); _input.Keys = Keyboard.GetState();
_input.Mouse = IsActive ? Mouse.GetState() : default; _input.Mouse = IsActive ? Mouse.GetState() : default;
_input.PrevPad = _input.Pad;
_input.Pad = IsActive ? GamePad.GetState(PlayerIndex.One) : default;
_input.DetectDevice();
var ui = UiMatrix(out _, out _); var ui = UiMatrix(out _, out _);
Window.Title = L.t("app.title"); Window.Title = L.t("app.title");
// Einstellungen liegen über allem und nehmen die Eingaben // Einstellungen liegen über allem und nehmen die Eingaben
var input = _input; var input = _input;
if (_settings.Open) { _settings.Update(_input, ui); input = _noInput; } if (_settings.Open) { _settings.Update(_input, ui); input = _noInput; }
SaveSoon(dt);
if (DevShot.Active) DevMenu(dt); if (DevShot.Active) DevMenu(dt);
if (_model != null) if (_model != null)
@@ -293,7 +347,7 @@ namespace GladiatorIdle
_menu.Update(dt, input, ui, _settings.Open); _menu.Update(dt, input, ui, _settings.Open);
switch (_menu.Picked) switch (_menu.Picked)
{ {
case MenuScene.Choice.Continue when _game != null: _menu = null; _hub = new HubScene(_game); break; case MenuScene.Choice.Continue when _game != null: _menu = null; _hub = new HubScene(_game) { Welcome = _welcome }; _welcome = null; break;
case MenuScene.Choice.New: _menu = null; _creator = new CreatorScene(DevShot.Active ? DevShot.Name : L.t("gladiator.defaultname")); break; case MenuScene.Choice.New: _menu = null; _creator = new CreatorScene(DevShot.Active ? DevShot.Name : L.t("gladiator.defaultname")); break;
case MenuScene.Choice.Intro: _menu = null; _intro = new IntroScene(); break; case MenuScene.Choice.Intro: _menu = null; _intro = new IntroScene(); break;
case MenuScene.Choice.Leaderboard: case MenuScene.Choice.Leaderboard:
@@ -329,7 +383,7 @@ namespace GladiatorIdle
{ {
if ((_saveIn -= dt) <= 0) { _saveIn = 30; _game!.Save(); } if ((_saveIn -= dt) <= 0) { _saveIn = 30; _game!.Save(); }
if (!IsActive && !DevShot.Active && !_scene.Over) _scene.Paused = true; // Fenster verlassen: Pause if (!IsActive && !DevShot.Active && !_scene.Over) _scene.Paused = true; // Fenster verlassen: Pause
if (input.Pressed(Keys.Escape) && !_scene.Over) _scene.Paused = !_scene.Paused; if ((input.Pressed(Keys.Escape) || input.PadPressed(Buttons.Start)) && !_scene.Over) _scene.Paused = !_scene.Paused;
if (_scene.Paused && input.Pressed(Keys.X)) _scene.GiveUp(); if (_scene.Paused && input.Pressed(Keys.X)) _scene.GiveUp();
_game!.Tick(dt); // Training läuft auch im Kampf weiter _game!.Tick(dt); // Training läuft auch im Kampf weiter
_scene.Update(dt, input); _scene.Update(dt, input);
@@ -388,6 +442,17 @@ namespace GladiatorIdle
if (m.Model == null) { DevShot.Log("model3d: no model"); Exit(); return; } if (m.Model == null) { DevShot.Log("model3d: no model"); Exit(); return; }
if (_capture != null) return; if (_capture != null) return;
var clips = m.Model.Clips; var clips = m.Model.Clips;
// --clip=<name>: 8 Bilder über eine Bewegung verteilt (Seitenansicht), mit Treffermoment im Protokoll
var only = Array.Find(Environment.GetCommandLineArgs(), a => a.StartsWith("--clip="))?.Substring(7);
int ci = only == null ? -1 : clips.FindIndex(c => c.Name == only);
if (ci >= 0)
{
float impact = m.Model.ImpactTime(clips[ci]);
if (_mStep >= 9) { DevShot.Log($"model3d clip {only}: length {clips[ci].Length:0.00} impact {impact:0.00}"); Exit(); return; }
if (!_mArmed) { m.Paused = true; m.SetView(2); m.Color = -1; m.Play(ci); m.Time = _mStep == 8 ? impact : clips[ci].Length * _mStep / 7f; _mArmed = true; _mWait = 0.35; return; }
if ((_mWait -= dt) > 0) return;
_capture = $"clip_{_mStep}"; _mStep++; _mArmed = false; return;
}
if (_mStep >= 3 + clips.Count) if (_mStep >= 3 + clips.Count)
{ {
DevShot.Log($"model3d: {clips.Count} clips, {m.Model.BoneCount} bones, {m.Model.Vertices.Length} vertices, {m.Model.Indices.Length / 3} triangles, draw {_drawMs / Math.Max(1, _frames):0.00} ms/frame"); DevShot.Log($"model3d: {clips.Count} clips, {m.Model.BoneCount} bones, {m.Model.Vertices.Length} vertices, {m.Model.Indices.Length / 3} triangles, draw {_drawMs / Math.Max(1, _frames):0.00} ms/frame");
@@ -424,17 +489,24 @@ namespace GladiatorIdle
if (DevFreedomRun && _game!.Legends.Count == 0 && _devTime > 0.5) { _game.DevFreedom(); return; } if (DevFreedomRun && _game!.Legends.Count == 0 && _devTime > 0.5) { _game.DevFreedom(); return; }
if (DevFreedomRun && _game!.Legends.Count > 0 && !_shots.Contains("m_end")) 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 > 0.8 && !_shots.Contains("h_hall_open")) { _shots.Add("h_hall_open"); _hub!.DevOpen("hall"); }
if (_devTime > 1.5) Shot("h_hall"); 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; } if (_devTime > 1.8 && _capture == null && _shots.Contains("h_hall")) { _hub!.DevOpen("none"); _hub.ChosenLegend = _game.Legends[0]; _devTime = 0; }
return;
}
if (Array.IndexOf(Environment.GetCommandLineArgs(), "--welcome") >= 0)
{
if (_devTime > 0.5 && !_shots.Contains("w_set")) { _shots.Add("w_set"); _hub!.Welcome = new OfflineReport(3 * 3600 + 1240, 1840, 96, 0, 0, 7); }
if (_devTime > 1.2) Shot("w_welcome");
if (_devTime > 1.6 && _capture == null && _shots.Contains("w_welcome")) Exit();
return; return;
} }
if (DevAdventureRun) if (DevAdventureRun)
{ {
// Expeditionen: Auswahl, unterwegs, Rückkehr-Bericht; dann ein Ereignis mit Entscheidung // Expeditionen: Auswahl, unterwegs, Rückkehr-Bericht; dann ein Ereignis mit Entscheidung
if (_devTime > 0.8 && !_shots.Contains("x_open")) { _shots.Add("x_open"); _hub!.DevOpen(6); } if (_devTime > 0.8 && !_shots.Contains("x_open")) { _shots.Add("x_open"); _hub!.DevOpen("expedition"); }
if (_devTime > 1.6) Shot("x_regions"); if (_devTime > 1.6) Shot("x_regions");
if (_devTime > 1.9 && !_shots.Contains("x_go")) { _shots.Add("x_go"); _hub!.DevOpen(0); _game!.StartExpedition("gallia", 1); } if (_devTime > 1.9 && !_shots.Contains("x_go")) { _shots.Add("x_go"); _hub!.DevOpen("none"); _game!.StartExpedition("gallia", 1); }
if (_devTime > 2.6) Shot("x_away"); if (_devTime > 2.6) Shot("x_away");
if (_devTime > 2.9 && !_shots.Contains("x_back")) { _shots.Add("x_back"); _game!.Tick(Adventures.Durations[1] + 1); } if (_devTime > 2.9 && !_shots.Contains("x_back")) { _shots.Add("x_back"); _game!.Tick(Adventures.Durations[1] + 1); }
if (_devTime > 3.6) Shot("x_report"); if (_devTime > 3.6) Shot("x_report");
@@ -452,26 +524,26 @@ namespace GladiatorIdle
if (!_shots.Contains("m_end")) if (!_shots.Contains("m_end"))
{ {
if (_devTime > 1.0) Shot("h_hub"); if (_devTime > 1.0) Shot("h_hub");
if (_devTime > 1.5 && !_shots.Contains("h_pick")) { _shots.Add("h_pick"); _hub!.DevOpen(1); } if (_devTime > 1.5 && !_shots.Contains("h_pick")) { _shots.Add("h_pick"); _hub!.DevOpen("gladiator"); }
if (_devTime > 2.2) Shot("h_gladiator"); if (_devTime > 2.2) Shot("h_gladiator");
if (_devTime > 2.6 && !_shots.Contains("h_ludus_open")) { _shots.Add("h_ludus_open"); _hub!.DevOpen(2); } if (_devTime > 2.6 && !_shots.Contains("h_ludus_open")) { _shots.Add("h_ludus_open"); _hub!.DevOpen("ludus"); }
if (_devTime > 3.3) Shot("h_ludus"); if (_devTime > 3.3) Shot("h_ludus");
if (_devTime > 3.5 && !_shots.Contains("h_forum_open")) { _shots.Add("h_forum_open"); _hub!.DevOpen(3); } if (_devTime > 3.5 && !_shots.Contains("h_forum_open")) { _shots.Add("h_forum_open"); _hub!.DevOpen("gladiator"); }
if (_devTime > 4.2) Shot("h_forum"); if (_devTime > 4.2) Shot("h_forum");
if (_devTime > 4.4 && !_shots.Contains("h_skills_open")) { _shots.Add("h_skills_open"); _hub!.DevOpen(4); } if (_devTime > 4.4 && !_shots.Contains("h_skills_open")) { _shots.Add("h_skills_open"); _hub!.DevOpen("skills"); }
if (_devTime > 5.1) Shot("h_skills"); if (_devTime > 5.1) Shot("h_skills");
if (_devTime > 5.3 && !_shots.Contains("h_hall_tab")) { _shots.Add("h_hall_tab"); _hub!.DevOpen(5); } if (_devTime > 5.3 && !_shots.Contains("h_hall_tab")) { _shots.Add("h_hall_tab"); _hub!.DevOpen("hall"); }
if (_devTime > 6.0) Shot("h_hall2"); if (_devTime > 6.0) Shot("h_hall2");
if (_devTime > 6.2 && !_shots.Contains("h_exp_tab")) { _shots.Add("h_exp_tab"); _hub!.DevOpen(6); } if (_devTime > 6.2 && !_shots.Contains("h_exp_tab")) { _shots.Add("h_exp_tab"); _hub!.DevOpen("expedition"); }
if (_devTime > 6.9) Shot("h_exp"); if (_devTime > 6.9) Shot("h_exp");
if (_devTime > 7.3 && _capture == null) { _hub!.DevOpen(0); var offers = _game!.Offers(); _hub.Chosen = offers[Math.Min(1, offers.Count - 1)]; _devTime = 0; } if (_devTime > 7.3 && _capture == null) { _hub!.DevOpen("none"); var offers = _game!.Offers(); _hub.Chosen = offers[Math.Min(1, offers.Count - 1)]; _devTime = 0; }
} }
else else
{ {
if (_devTime > 0.6) Shot("h_result"); if (_devTime > 0.6) Shot("h_result");
if (_devTime > 0.8 && !_shots.Contains("h_inv_open")) { _shots.Add("h_inv_open"); _hub!.DevOpen(1); } if (_devTime > 0.8 && !_shots.Contains("h_inv_open")) { _shots.Add("h_inv_open"); _hub!.DevOpen("gladiator"); }
if (_devTime > 1.4) Shot("h_inventory"); if (_devTime > 1.4) Shot("h_inventory");
if (_devTime > 1.6 && !_shots.Contains("h_pause_open")) { _shots.Add("h_pause_open"); _hub!.DevOpen(0); _paused = true; } if (_devTime > 1.6 && !_shots.Contains("h_pause_open")) { _shots.Add("h_pause_open"); _hub!.DevOpen("none"); _paused = true; }
if (_devTime > 2.0) Shot("h_pause"); if (_devTime > 2.0) Shot("h_pause");
if (_shots.Contains("h_pause") && _capture == null && _devTime > 2.2) if (_shots.Contains("h_pause") && _capture == null && _devTime > 2.2)
{ {
@@ -515,6 +587,7 @@ namespace GladiatorIdle
if (Perf) { PerfStep(); return; } if (Perf) { PerfStep(); return; }
void Shot(string name) { if (_shots.Add(name)) _capture = name; } void Shot(string name) { if (_shots.Add(name)) _capture = name; }
if (_scene.InIntro) { if (_devTime > 2.5) Shot("m_champintro"); return; } if (_scene.InIntro) { if (_devTime > 2.5) Shot("m_champintro"); return; }
if (_scene.Tutorial != DuelScene.TutStep.Off) { Shot("t_" + _scene.Tutorial.ToString().ToLowerInvariant()); }
if (_devTime > 0.5) Shot("m_countdown"); if (_devTime > 0.5) Shot("m_countdown");
if (d.Time > 0.6) Shot("m_fight"); 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"); if (d.Enemy.State == DuelState.Windup && d.Enemy.StateTime > d.Enemy.Windup * 0.6) Shot("m_telegraph");
@@ -545,15 +618,23 @@ namespace GladiatorIdle
static readonly bool Record = Array.IndexOf(Environment.GetCommandLineArgs(), "--record") >= 0; static readonly bool Record = Array.IndexOf(Environment.GetCommandLineArgs(), "--record") >= 0;
readonly System.Collections.Generic.List<double> _times = new(); readonly System.Collections.Generic.List<double> _times = new();
int _gcStart = -1, _duelsStarted;
void PerfStep() void PerfStep()
{ {
if (_devTime > 3) _times.Add(_lastFrameMs); if (_devTime > 3)
if (_scene!.Over) { var o = _offer!; EndDuel(); StartDuel(o); } {
if (_gcStart < 0) { _gcStart = GC.CollectionCount(0); _duelDraw = 0; _duelFrames = 0; }
_times.Add(_lastFrameMs);
}
// nach jedem Kampf sofort ein neuer: misst auch den Ruckler beim Duellstart
if (_scene!.Over) { var o = _offer!; EndDuel(); StartDuel(o); _duelsStarted++; }
if (_devTime < 18) return; if (_devTime < 18) return;
_times.Sort(); _times.Sort();
double avg = 0; foreach (var t in _times) avg += t; avg /= Math.Max(1, _times.Count); double avg = 0; foreach (var t in _times) avg += t; avg /= Math.Max(1, _times.Count);
DevShot.Log($"perf {GraphicsDevice.PresentationParameters.BackBufferWidth}x{GraphicsDevice.PresentationParameters.BackBufferHeight}: " + DevShot.Log($"perf {GraphicsDevice.PresentationParameters.BackBufferWidth}x{GraphicsDevice.PresentationParameters.BackBufferHeight}: " +
$"avg {avg:0.0} ms ({1000 / avg:0} fps), p95 {_times[(int)(_times.Count * 0.95)]:0.0} ms, frames {_times.Count}"); $"avg {avg:0.0} ms ({1000 / avg:0} fps), p95 {_times[(int)(_times.Count * 0.95)]:0.0} ms, p99 {_times[(int)(_times.Count * 0.99)]:0.0} ms, " +
$"max {_times[^1]:0.0} ms, draw {_duelDraw / Math.Max(1, _duelFrames):0.00} ms, gc0 {GC.CollectionCount(0) - _gcStart}, " +
$"duels restarted {_duelsStarted}, frames {_times.Count}");
Exit(); Exit();
} }
@@ -571,9 +652,10 @@ namespace GladiatorIdle
if (toTarget && (_rt == null || _rt.Width != w || _rt.Height != h)) if (toTarget && (_rt == null || _rt.Width != w || _rt.Height != h))
{ {
_rt?.Dispose(); _rt?.Dispose();
_rt = new RenderTarget2D(gd, w, h, false, SurfaceFormat.Color, DepthFormat.Depth24); _rt = new RenderTarget2D(gd, w, h, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
} }
if (toTarget) gd.SetRenderTarget(_rt); // Bild entsteht in einer Zwischenfläche (Kantenglättung), danach Nachleuchten
_post.Begin(gd, w, h, AppSettings.AntiAlias);
gd.Clear(Color.Black); gd.Clear(Color.Black);
float scale = Math.Min(w / Camera.W, h / Camera.H); float scale = Math.Min(w / Camera.W, h / Camera.H);
var offset = new Vector2((w - Camera.W * scale) / 2, (h - Camera.H * scale) / 2); var offset = new Vector2((w - Camera.W * scale) / 2, (h - Camera.H * scale) / 2);
@@ -591,8 +673,21 @@ namespace GladiatorIdle
_hub.Draw(gd, _sb, _fx, scale, offset); _hub.Draw(gd, _sb, _fx, scale, offset);
if (_paused && !_settings.Open) DrawPause(_sb, ui); if (_paused && !_settings.Open) DrawPause(_sb, ui);
} }
// weicher Wechsel zwischen Bildschirmen: neues Bild kommt kurz aus dem Schwarz
object? now = (object?)_model ?? _freedom ?? (object?)_board ?? _intro ?? (object?)_menu ?? _creator ?? (object?)_scene ?? _hub;
if (!ReferenceEquals(now, _shown)) { _shown = now; _fadeIn = 0; }
_fadeIn = Math.Min(1, _fadeIn + gameTime.ElapsedGameTime.TotalSeconds / 0.3);
if (_fadeIn < 1)
{
_sb.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, ui);
Gfx.Draw.Rect(_sb, new Gfx.RectangleF(0, 0, Camera.W, Camera.H), Color.Black * (float)(1 - _fadeIn * _fadeIn * (3 - 2 * _fadeIn)));
_sb.End();
}
if (_settings.Open) _settings.Draw(_sb, scale, offset); if (_settings.Open) _settings.Draw(_sb, scale, offset);
bool bloomOn = AppSettings.Bloom && !AppSettings.ReduceMotion && _intro == null;
_post.End(gd, _sb, toTarget ? _rt : null, bloomOn ? 1f : 0f);
if (toTarget) if (toTarget)
{ {
gd.SetRenderTarget(null); gd.SetRenderTarget(null);

View File

@@ -101,6 +101,43 @@ namespace GladiatorIdle.Gfx
return result; return result;
} }
// ── Mipmaps: verkleinerte Stufen für Texturen, die schräg oder weit weg zu sehen sind
// (Sand, Mauer, Publikum, Figuren) – sonst flimmern sie in der Tiefe ──
static readonly Dictionary<Texture2D, Texture2D> _mipped = new();
/// Dieselbe Textur mit allen Mipmap-Stufen (einmal je Quelle).
public static Texture2D Mipmapped(Texture2D src)
{
if (src.LevelCount > 1) return src;
if (_mipped.TryGetValue(src, out var t)) return t;
var data = new Color[src.Width * src.Height];
src.GetData(data);
return _mipped[src] = MipTexture(data, src.Width, src.Height);
}
/// Textur aus Pixeln mit Mipmap-Stufen (2×2-Mittel je Stufe).
public static Texture2D MipTexture(Color[] data, int w, int h)
{
var t = new Texture2D(_gd, w, h, true, SurfaceFormat.Color);
t.SetData(0, null, data, 0, data.Length);
var cur = data; int cw = w, ch = h;
for (int level = 1; level < t.LevelCount; level++)
{
int nw = Math.Max(1, cw / 2), nh = Math.Max(1, ch / 2);
var next = new Color[nw * nh];
for (int y = 0; y < nh; y++)
for (int x = 0; x < nw; x++)
{
int x0 = Math.Min(cw - 1, x * 2), x1 = Math.Min(cw - 1, x * 2 + 1), y0 = Math.Min(ch - 1, y * 2), y1 = Math.Min(ch - 1, y * 2 + 1);
var a = cur[y0 * cw + x0]; var b = cur[y0 * cw + x1]; var c = cur[y1 * cw + x0]; var d = cur[y1 * cw + x1];
next[y * nw + x] = new Color((a.R + b.R + c.R + d.R + 2) / 4, (a.G + b.G + c.G + d.G + 2) / 4, (a.B + b.B + c.B + d.B + 2) / 4, (a.A + b.A + c.A + d.A + 2) / 4);
}
t.SetData(level, null, next, 0, next.Length);
cur = next; cw = nw; ch = nh;
}
return t;
}
/// Bild eines Video-Sprites: Farbe vor Schwarz (JPEG, also schon vormultipliziert) /// Bild eines Video-Sprites: Farbe vor Schwarz (JPEG, also schon vormultipliziert)
/// plus Deckkraft (Graustufen-PNG) — zusammengesetzt zu einer Textur. /// plus Deckkraft (Graustufen-PNG) — zusammengesetzt zu einer Textur.
public static Texture2D? LoadFrame(string relBase) public static Texture2D? LoadFrame(string relBase)
@@ -160,8 +197,8 @@ namespace GladiatorIdle.Gfx
var data = new Color[src.Width * src.Height]; var data = new Color[src.Width * src.Height];
src.GetData(data); src.GetData(data);
PaintPixels(data, colorIndex); PaintPixels(data, colorIndex);
t = new Texture2D(_gd, src.Width, src.Height); if (src.LevelCount > 1) t = MipTexture(data, src.Width, src.Height); // Figuren: Stufen behalten
t.SetData(data); else { t = new Texture2D(_gd, src.Width, src.Height); t.SetData(data); }
_painted[(src, colorIndex)] = t; _painted[(src, colorIndex)] = t;
return t; return t;
} }

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
@@ -67,10 +68,33 @@ namespace GladiatorIdle.Gfx
public static Model3D? Load(string name) => Load(Assets.Device, name); public static Model3D? Load(string name) => Load(Assets.Device, name);
// Vorlagen je Datei: einmal gelesen, danach teilt jede Figur Gitter, Gewichte, Clips und Textur
// und hat nur eigene Haltung, eigene Puffer und eigene Waffen (Duellstart ohne Plattenzugriff).
static readonly Dictionary<string, Model3D?> _templates = new();
public static Model3D? Load(GraphicsDevice gd, string name) public static Model3D? Load(GraphicsDevice gd, string name)
{ {
string? path = Assets.RootDir is string root ? Path.Combine(root, "Models", name + ".gim") : null; if (!_templates.TryGetValue(name, out var t))
return path != null && File.Exists(path) ? new Model3D(gd, path) : null; {
string? path = Assets.RootDir is string root ? Path.Combine(root, "Models", name + ".gim") : null;
_templates[name] = t = path != null && File.Exists(path) ? new Model3D(gd, path) : null;
}
return t == null ? null : new Model3D(t);
}
/// Neue Figur auf den geteilten Daten einer Vorlage.
Model3D(Model3D src)
{
_names = src._names; _parent = src._parent; _rest = src._rest; _offset = src._offset;
_pos = src._pos; _nrm = src._nrm; _baseCol = src._baseCol; _bi = src._bi; _bw = src._bw;
Indices = src.Indices;
Clips = src.Clips;
Vertices = (VertexPNCT[])src.Vertices.Clone();
Bounds = src.Bounds;
_texture = src._texture;
Unit = src.Unit;
_pose = (float[])_rest.Clone(); _from = (float[])_rest.Clone();
_global = new Matrix[_names.Length]; _skin = new Matrix[_names.Length];
} }
Model3D(GraphicsDevice gd, string path) Model3D(GraphicsDevice gd, string path)
@@ -113,7 +137,7 @@ namespace GladiatorIdle.Gfx
Clips.Add(clip); Clips.Add(clip);
} }
if (v2 && r.ReadInt32() is int texLen && texLen > 0) if (v2 && r.ReadInt32() is int texLen && texLen > 0)
using (var ms = new MemoryStream(r.ReadBytes(texLen))) _texture = Texture2D.FromStream(gd, ms); using (var ms = new MemoryStream(r.ReadBytes(texLen))) _texture = Assets.Mipmapped(Texture2D.FromStream(gd, ms)); // Stufen: kein Flimmern klein/weit weg
Vertices = new VertexPNCT[nv]; Vertices = new VertexPNCT[nv];
for (int i = 0; i < nv; i++) Vertices[i] = new VertexPNCT { Position = _pos[i], Normal = _nrm[i], Color = _baseCol[i], Uv = uv[i] }; for (int i = 0; i < nv; i++) Vertices[i] = new VertexPNCT { Position = _pos[i], Normal = _nrm[i], Color = _baseCol[i], Uv = uv[i] };
Bounds = BoundingBox.CreateFromPoints(_pos); Bounds = BoundingBox.CreateFromPoints(_pos);
@@ -157,9 +181,7 @@ namespace GladiatorIdle.Gfx
nr = gray + (nr - gray) * boost; ng = gray + (ng - gray) * boost; nb = gray + (nb - gray) * boost; nr = gray + (nr - gray) * boost; ng = gray + (ng - gray) * boost; nb = gray + (nb - gray) * boost;
data[i] = new Color(Math.Clamp(nr, 0, 1), Math.Clamp(ng, 0, 1), Math.Clamp(nb, 0, 1), c.A / 255f); data[i] = new Color(Math.Clamp(nr, 0, 1), Math.Clamp(ng, 0, 1), Math.Clamp(nb, 0, 1), c.A / 255f);
} }
var t = new Texture2D(_texture.GraphicsDevice, _texture.Width, _texture.Height); _texture = Assets.MipTexture(data, _texture.Width, _texture.Height);
t.SetData(data);
_texture = t;
_color = -2; // Teamfarbe neu auf die geänderte Textur _color = -2; // Teamfarbe neu auf die geänderte Textur
} }
@@ -225,17 +247,39 @@ namespace GladiatorIdle.Gfx
var keep = (float[])_pose.Clone(); bool posed = _posed; var keep = (float[])_pose.Clone(); bool posed = _posed;
int hand = Bone("RightHand"); int hand = Bone("RightHand");
float best = float.MinValue; t = clip.Length * 0.5f; float best = float.MinValue; t = clip.Length * 0.5f;
// Zweihand-Waffe: Ausholen hinter dem Kopf, dann Schlag nach vorn – Treffer, wenn die Spitze
// am schnellsten nach vorn schnellt (die höchste Hand wäre mitten im Ausholen).
var weapon = _twoHand ? Props.Find(p => !p.Shield && !p.NoAvoid && p.Bone == hand) : null;
var dirZ = new List<float>();
for (int f = 0; f < clip.Frames && hand >= 0; f++) for (int f = 0; f < clip.Frames && hand >= 0; f++)
{ {
_posed = true; _posed = true;
Pose(clip, f / clip.Fps, false, 1, true, skin: false); Pose(clip, f / clip.Fps, false, 1, true, skin: false);
if (weapon != null)
{
var m = weapon.Local * _global[hand];
dirZ.Add(Vector3.Normalize(new Vector3(m.M11, m.M12, m.M13)).Z);
continue;
}
float z = _global[hand].Translation.Z; float z = _global[hand].Translation.Z;
if (z > best) { best = z; t = f / clip.Fps; } if (z > best) { best = z; t = f / clip.Fps; }
} }
if (dirZ.Count > 0)
{
// tiefstes Ausholen (Spitze am weitesten nach hinten), danach erster Moment mit Spitze nach vorn
int end = Math.Max(1, (int)(dirZ.Count * 0.85f)); // Rückkehr in die Grundhaltung zählt nicht
int back = 0;
for (int f = 1; f < end; f++) if (dirZ[f] < dirZ[back]) back = f;
int hit = -1;
for (int f = back; f < end && hit < 0; f++) if (dirZ[f] > 0.6f) hit = f;
if (hit < 0) { hit = back; for (int f = back; f < end; f++) if (dirZ[f] > dirZ[hit]) hit = f; }
t = hit / clip.Fps;
}
Array.Copy(keep, _pose, keep.Length); _posed = posed; Bones(); Array.Copy(keep, _pose, keep.Length); _posed = posed; Bones();
return _impact[clip] = t; return _impact[clip] = t;
} }
readonly Dictionary<Clip, float> _impact = new(); readonly Dictionary<Clip, float> _impact = new();
bool _twoHand; // Waffe beidhändig (Großschwert-Bewegungen), siehe AimBlades
/// Figur auf 180 Einheiten Höhe, Füße auf y = 0, mittig (aus der jetzigen Haltung, robust gegen Ausreißer). /// Figur auf 180 Einheiten Höhe, Füße auf y = 0, mittig (aus der jetzigen Haltung, robust gegen Ausreißer).
public Matrix FitNow() public Matrix FitNow()
@@ -291,12 +335,13 @@ namespace GladiatorIdle.Gfx
DynamicVertexBuffer? _vb; DynamicVertexBuffer? _vb;
bool _dirty; bool _dirty;
public void Draw(GraphicsDevice gd, BasicEffect fx, bool aura = false) /// Zeichnen; <paramref name="depth"/>/<paramref name="blend"/> überschreiben die Zustände (Schatten auf dem Boden).
public void Draw(GraphicsDevice gd, BasicEffect fx, bool aura = false, DepthStencilState? depth = null, BlendState? blend = null)
{ {
gd.DepthStencilState = aura ? DepthStencilState.None : DepthStencilState.Default; gd.DepthStencilState = depth ?? (aura ? DepthStencilState.None : DepthStencilState.Default);
gd.BlendState = aura ? BlendState.Additive : BlendState.Opaque; gd.BlendState = blend ?? (aura ? BlendState.Additive : BlendState.Opaque);
gd.RasterizerState = RasterizerState.CullNone; gd.RasterizerState = RasterizerState.CullNone;
fx.TextureEnabled = _texture != null && !aura; fx.TextureEnabled = _texture != null && !aura && blend == null;
fx.Texture = _painted ?? _texture; fx.Texture = _painted ?? _texture;
// Indizes liegen einmal auf der Grafikkarte, Punkte nur nach einer neuen Haltung neu // Indizes liegen einmal auf der Grafikkarte, Punkte nur nach einer neuen Haltung neu
if (_ib == null) if (_ib == null)
@@ -312,7 +357,7 @@ namespace GladiatorIdle.Gfx
foreach (var pass in fx.CurrentTechnique.Passes) foreach (var pass in fx.CurrentTechnique.Passes)
{ {
pass.Apply(); pass.Apply();
gd.SamplerStates[0] = SamplerState.LinearClamp; gd.SamplerStates[0] = SamplerState.AnisotropicClamp;
gd.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, Indices.Length / 3); gd.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, Indices.Length / 3);
} }
fx.TextureEnabled = false; fx.TextureEnabled = false;
@@ -390,8 +435,15 @@ namespace GladiatorIdle.Gfx
/// Ausrüstung nach Figur: Retiarius Dreizack und Netz, sonst Gladius und Scutum. /// Ausrüstung nach Figur: Retiarius Dreizack und Netz, sonst Gladius und Scutum.
public void Arm(string art) public void Arm(string art)
{ {
if (art.Contains("retiarius")) { AddTrident(); AddNet(); } bool Is(params string[] keys) => keys.Any(k => art.Contains(k));
else { AddSword(); AddShield(); } if (Is("retiarius")) { AddTrident(); AddNet(); }
else if (Is("thraex")) { AddSword(kind: "sica"); AddShield(kind: "parmula"); }
else if (Is("hoplomachus", "eques")) { AddSpear(); AddShield(kind: "round"); }
else if (Is("recruit")) { AddSword(kind: "rudis"); AddShield(); }
else if (Is("slave")) AddSword(kind: "club");
else if (Is("dimachaerus")) { AddSword(); AddSword("Left"); }
else if (Is("brawler", "sagittarius", "essedarius", "laquearius", "doctore")) { AddSword(); AddShield(kind: "round"); }
else { AddSword(); AddShield(); } // Murmillo, Secutor, Provocator, Prätorianer, Crupellarius, Champions
AimBlades(); AimBlades();
} }
@@ -403,9 +455,22 @@ namespace GladiatorIdle.Gfx
{ {
var clip = Find("slash") ?? (Clips.Count > 0 ? Clips[0] : null); var clip = Find("slash") ?? (Clips.Count > 0 ? Clips[0] : null);
if (clip == null) return; if (clip == null) return;
float t = ImpactTime(clip);
var keep = (float[])_pose.Clone(); bool posed = _posed; var keep = (float[])_pose.Clone(); bool posed = _posed;
_posed = true; _posed = true;
// Zweihand-Bewegungen (Großschwert-Pack): in der Grundhaltung liegen beide Hände am Griff –
// dann zeigt die Waffe entlang der Linie linke → rechte Hand, gemessen in der Grundhaltung.
int rh = Bone("RightHand"), lh = Bone("LeftHand");
bool twoHand = false;
if (Find("idle") is { } idle && rh >= 0 && lh >= 0)
{
Pose(idle, 0, false, 1, true, skin: false);
var gap = _global[rh].Translation - _global[lh].Translation;
float fore = Vector3.Distance(_global[rh].Translation, _global[_parent[rh]].Translation);
twoHand = gap.Length() < fore * 0.8f;
}
_twoHand = twoHand;
float t = twoHand ? 0 : ImpactTime(clip);
if (twoHand) clip = Find("idle")!;
Pose(clip, t, false, 1, true, skin: false); Pose(clip, t, false, 1, true, skin: false);
foreach (var p in Props) foreach (var p in Props)
{ {
@@ -413,9 +478,12 @@ namespace GladiatorIdle.Gfx
var m = p.Local * _global[p.Bone]; var m = p.Local * _global[p.Bone];
var dir = Vector3.Normalize(new Vector3(m.M11, m.M12, m.M13)); var dir = Vector3.Normalize(new Vector3(m.M11, m.M12, m.M13));
var (fa, fu, fs) = ArmFrame(p.Bone); var (fa, fu, fs) = ArmFrame(p.Bone);
BladeLog = $"blade z {dir.Z:0.00} arm {Vector3.Dot(dir, fa):0.000} up {Vector3.Dot(dir, fu):0.000} side {Vector3.Dot(dir, fs):0.000}"; // i18n-ok BladeLog = $"blade z {dir.Z:0.00} arm {Vector3.Dot(dir, fa):0.000} up {Vector3.Dot(dir, fu):0.000} side {Vector3.Dot(dir, fs):0.000} twohand {twoHand}"; // i18n-ok
// Ziel: Lage wie bei den Figuren mit sauberem Skelett (gemessen an vier Figuren) // Ziel: Lage wie bei den Figuren mit sauberem Skelett (gemessen an vier Figuren)
var target = Vector3.Normalize(fa * 0.31f + fu * 0.36f + fs * 0.88f); float mirror = _names[p.Bone].Contains("Left") ? -1 : 1; // linke Hand: gespiegelt
var target = twoHand && p.Bone == rh
? Vector3.Normalize(_global[rh].Translation - _global[lh].Translation)
: Vector3.Normalize(fa * 0.31f + fu * 0.36f + fs * (0.88f * mirror));
float cos = MathHelper.Clamp(Vector3.Dot(dir, target), -1, 1); float cos = MathHelper.Clamp(Vector3.Dot(dir, target), -1, 1);
if (cos < 0.97f) if (cos < 0.97f)
{ {
@@ -509,22 +577,73 @@ namespace GladiatorIdle.Gfx
} }
/// Gladius in der Faust (Knochen-Präfix "Right"/"Left"). Klinge zeigt vom kleinen Finger zum Zeigefinger. /// Gladius in der Faust (Knochen-Präfix "Right"/"Left"). Klinge zeigt vom kleinen Finger zum Zeigefinger.
public void AddSword(string side = "Right") public void AddSword(string side = "Right", string kind = "gladius")
{ {
var b = new MeshBuilder(); var b = new MeshBuilder();
var steel = new Color(196, 200, 206); var brass = new Color(176, 136, 62); var wood = new Color(92, 58, 34); var steel = new Color(196, 200, 206); var brass = new Color(176, 136, 62); var wood = new Color(92, 58, 34);
b.Box(new Vector3(-9, 0, 0), new Vector3(1.5f, 3.6f, 3.6f), brass); // Knauf var lightWood = new Color(150, 112, 70);
b.Box(new Vector3(-3.5f, 0, 0), new Vector3(10, 3, 3), wood); // Griff float length = 63;
b.Box(new Vector3(2.2f, 0, 0), new Vector3(1.6f, 4, 11), brass); // Parierstange switch (kind)
b.Box(new Vector3(30, 0, 0), new Vector3(54, 0.8f, 5.2f), steel); // Klinge {
b.Box(new Vector3(60, 0, 0), new Vector3(6, 0.7f, 2.6f), steel); // Spitze case "rudis": // Holzschwert der Rekruten
b.Box(new Vector3(-3.5f, 0, 0), new Vector3(10, 3, 3), wood);
b.Box(new Vector3(2, 0, 0), new Vector3(2, 3.6f, 8), wood);
b.Box(new Vector3(28, 0, 0), new Vector3(50, 1.6f, 4.6f), lightWood);
b.Box(new Vector3(55, 0, 0), new Vector3(4, 1.4f, 3), lightWood);
length = 57; break;
case "sica": // gebogenes Kurzschwert der Thraker: Klinge biegt zur Schneide hin
{
b.Box(new Vector3(-9, 0, 0), new Vector3(1.5f, 3.6f, 3.6f), brass);
b.Box(new Vector3(-3.5f, 0, 0), new Vector3(10, 3, 3), wood);
b.Box(new Vector3(2, 0, 0), new Vector3(1.6f, 4, 8), brass);
var at = new Vector3(3, 0, 0); float angle = 0;
for (int i = 0; i < 5; i++)
{
float seg = i < 4 ? 11 : 9, width = i < 4 ? 4.6f : 3;
var dir = new Vector3(MathF.Cos(angle), 0, -MathF.Sin(angle));
b.Box(at + dir * seg / 2, new Vector3(seg + 0.6f, 0.8f, width), steel, Matrix.CreateRotationY(angle));
at += dir * seg;
angle += MathHelper.ToRadians(11);
}
length = 50; break;
}
case "club": // Knüppel: dicker werdendes Holz
b.Box(new Vector3(-3, 0, 0), new Vector3(12, 3.2f, 3.2f), wood);
for (int i = 0; i < 4; i++)
b.Box(new Vector3(8 + i * 11, 0, 0), new Vector3(11.5f, 4 + i * 1.3f, 4 + i * 1.3f), i % 2 == 0 ? wood : lightWood);
length = 50; break;
default: // Gladius
b.Box(new Vector3(-9, 0, 0), new Vector3(1.5f, 3.6f, 3.6f), brass);
b.Box(new Vector3(-3.5f, 0, 0), new Vector3(10, 3, 3), wood);
b.Box(new Vector3(2.2f, 0, 0), new Vector3(1.6f, 4, 11), brass);
b.Box(new Vector3(30, 0, 0), new Vector3(54, 0.8f, 5.2f), steel);
b.Box(new Vector3(60, 0, 0), new Vector3(6, 0.7f, 2.6f), steel);
break;
}
var sword = b.Build(Bone(side + "Hand"), Grip(side)); var sword = b.Build(Bone(side + "Hand"), Grip(side));
sword.Length = 63; sword.Length = length;
Props.Add(sword); Props.Add(sword);
} }
/// Speer (Hasta) der Hoplomachi und Equites, in der Mitte gefasst: Blattspitze nach vorn.
public void AddSpear(string side = "Right")
{
var b = new MeshBuilder();
var wood = new Color(118, 82, 48); var bronze = new Color(184, 140, 70); var steel = new Color(200, 204, 210);
b.Box(new Vector3(25, 0, 0), new Vector3(170, 2.4f, 2.4f), wood); // Schaft (-60 … +110)
b.Box(new Vector3(-61, 0, 0), new Vector3(4, 3, 3), bronze); // Schuh
b.Box(new Vector3(111, 0, 0), new Vector3(5, 3.2f, 3.2f), bronze); // Tülle
// Blatt: zwei schräge Hälften bilden die Raute
b.Box(new Vector3(121, 0, 1.3f), new Vector3(16, 0.8f, 2.6f), steel, Matrix.CreateRotationY(MathHelper.ToRadians(-9)));
b.Box(new Vector3(121, 0, -1.3f), new Vector3(16, 0.8f, 2.6f), steel, Matrix.CreateRotationY(MathHelper.ToRadians(9)));
b.Box(new Vector3(131, 0, 0), new Vector3(7, 0.7f, 1.6f), steel);
var p = b.Build(Bone(side + "Hand"), Grip(side));
p.Length = 134;
Props.Add(p);
}
/// Gewölbter Schild (Scutum) am Unterarm, Bemalung in Magenta (Teamfarbe), Bronzerand und Buckel. /// Gewölbter Schild (Scutum) am Unterarm, Bemalung in Magenta (Teamfarbe), Bronzerand und Buckel.
public void AddShield(string side = "Left") public void AddShield(string side = "Left", string kind = "scutum")
{ {
var fa = BindPos(side + "ForeArm"); var h = BindPos(side + "Hand"); var fa = BindPos(side + "ForeArm"); var h = BindPos(side + "Hand");
var m = BindPos(side + "HandMiddle1"); var ix = BindPos(side + "HandIndex1"); var pk = BindPos(side + "HandPinky1"); var th = BindPos(side + "HandThumb1"); var m = BindPos(side + "HandMiddle1"); var ix = BindPos(side + "HandIndex1"); var pk = BindPos(side + "HandPinky1"); var th = BindPos(side + "HandThumb1");
@@ -538,11 +657,23 @@ namespace GladiatorIdle.Gfx
var centre = m + knuckles * 7 * Unit; var centre = m + knuckles * 7 * Unit;
var b = new MeshBuilder(); var b = new MeshBuilder();
var face = new Color(190, 30, 160); var rim = new Color(150, 112, 52); var boss = new Color(182, 150, 80); var face = new Color(190, 30, 160); var rim = new Color(150, 112, 52); var boss = new Color(182, 150, 80);
const float W = 50, H = 72, BEND = 0.011f; float W = 50, H = 72, BEND = 0.011f;
// x: Länge (entlang des Arms), y: Breite, z: nach außen (weg vom Arm), gewölbt um die Längsachse if (kind == "round")
b.Curved(W, H, BEND, face, 1.2f); {
b.Rim(W, H, BEND, rim); // Rundschild (Parma): flach gewölbte Scheibe mit Rand und Buckel
b.Dome(new Vector3(0, 0, 2.5f), 9, 5, boss); W = H = 60; BEND = 0.006f;
b.Disc(30, BEND, face, 1.2f);
b.Ring(30, BEND, rim);
b.Dome(new Vector3(0, 0, 1.5f), 8, 5, boss);
}
else
{
if (kind == "parmula") { W = 40; H = 48; BEND = 0.02f; } // kleiner Schild der Thraker
// x: Länge (entlang des Arms), y: Breite, z: nach außen (weg vom Arm), gewölbt um die Längsachse
b.Curved(W, H, BEND, face, 1.2f);
b.Rim(W, H, BEND, rim);
b.Dome(new Vector3(0, 0, 2.5f), kind == "parmula" ? 6 : 9, kind == "parmula" ? 4 : 5, boss);
}
// x (Höhe) = Griff (senkrecht gehalten, wie die Mixamo-Schildbewegungen es erwarten), // x (Höhe) = Griff (senkrecht gehalten, wie die Mixamo-Schildbewegungen es erwarten),
// y (Breite) = Knöchel × Griff, z (außen) = x × y = Knöchelrichtung // y (Breite) = Knöchel × Griff, z (außen) = x × y = Knöchelrichtung
var shield = b.Build(Bone(side + "Hand"), Matrix.CreateScale(Unit) * Attach(Bone(side + "Hand"), across, Vector3.Cross(knuckles, across), centre)); var shield = b.Build(Bone(side + "Hand"), Matrix.CreateScale(Unit) * Attach(Bone(side + "Hand"), across, Vector3.Cross(knuckles, across), centre));
@@ -710,10 +841,11 @@ namespace GladiatorIdle.Gfx
_i.AddRange(new[] { o, o + 1, o + 2, o, o + 2, o + 3 }); _i.AddRange(new[] { o, o + 1, o + 2, o, o + 2, o + 3 });
} }
public void Box(Vector3 c, Vector3 s, Color col) public void Box(Vector3 c, Vector3 s, Color col, Matrix? rot = null)
{ {
var h = s / 2; var h = s / 2;
Vector3 P(float x, float y, float z) => c + new Vector3(x * h.X, y * h.Y, z * h.Z); var r = rot ?? Matrix.Identity;
Vector3 P(float x, float y, float z) => c + Vector3.TransformNormal(new Vector3(x * h.X, y * h.Y, z * h.Z), r);
Quad(P(-1, -1, 1), P(1, -1, 1), P(1, 1, 1), P(-1, 1, 1), col); Quad(P(-1, -1, 1), P(1, -1, 1), P(1, 1, 1), P(-1, 1, 1), col);
Quad(P(1, -1, -1), P(-1, -1, -1), P(-1, 1, -1), P(1, 1, -1), col); Quad(P(1, -1, -1), P(-1, -1, -1), P(-1, 1, -1), P(1, 1, -1), col);
Quad(P(-1, 1, -1), P(-1, 1, 1), P(1, 1, 1), P(1, 1, -1), col); Quad(P(-1, 1, -1), P(-1, 1, 1), P(1, 1, 1), P(1, 1, -1), col);
@@ -772,6 +904,34 @@ namespace GladiatorIdle.Gfx
} }
} }
/// Runde, leicht gewölbte Scheibe (Rundschild), Vorder- und Rückseite.
public void Disc(float r, float bend, Color col, float thick)
{
const int SEG = 28, RINGS = 4;
var back = new Color(110, 78, 46);
Vector3 S(float rad, float a, float off) => new(MathF.Cos(a) * rad, MathF.Sin(a) * rad, -bend * rad * rad + off);
for (int side = 0; side < 2; side++)
for (int k = 0; k < RINGS; k++)
for (int i = 0; i < SEG; i++)
{
float r0 = r * k / RINGS, r1 = r * (k + 1) / RINGS, a0 = MathF.Tau * i / SEG, a1 = MathF.Tau * (i + 1) / SEG;
float off = side == 0 ? 0 : -thick;
Quad(S(r0, a0, off), S(r1, a0, off), S(r1, a1, off), S(r0, a1, off), side == 0 ? col : back);
}
}
/// Rand eines Rundschilds aus kurzen, gedrehten Stücken.
public void Ring(float r, float bend, Color col)
{
const int SEG = 20;
for (int i = 0; i < SEG; i++)
{
float a = MathF.Tau * (i + 0.5f) / SEG;
var c = new Vector3(MathF.Cos(a) * r, MathF.Sin(a) * r, -bend * r * r + 0.6f);
Box(c, new Vector3(3, MathF.Tau * r / SEG + 0.4f, 3), col, Matrix.CreateRotationZ(a));
}
}
public Prop Build(int bone, Matrix local) public Prop Build(int bone, Matrix local)
{ {
var v = _v.ToArray(); var v = _v.ToArray();

84
Mono/Gfx/PostFx.cs Normal file
View File

@@ -0,0 +1,84 @@
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace GladiatorIdle.Gfx
{
/// <summary>
/// Nachbearbeitung ohne eigene Shader: das Bild entsteht in einer Zwischenfläche (mit
/// Kantenglättung/MSAA), danach Nachleuchten (Bloom) aus SpriteBatch und Mischmodi:
/// verkleinern, dunkle Anteile abziehen (helle bleiben übrig), in drei Stufen weich
/// verkleinern und additiv über das Bild legen.
/// </summary>
internal sealed class PostFx
{
RenderTarget2D? _scene, _a, _b, _c;
int _msaa = -1;
// dunkle Anteile abziehen: Ziel = Ziel − Quelle
static readonly BlendState Subtract = new()
{
ColorBlendFunction = BlendFunction.ReverseSubtract, ColorSourceBlend = Blend.One, ColorDestinationBlend = Blend.One,
AlphaBlendFunction = BlendFunction.Add, AlphaSourceBlend = Blend.Zero, AlphaDestinationBlend = Blend.One,
};
static RenderTarget2D Make(GraphicsDevice gd, int w, int h, int msaa, DepthFormat depth) =>
new(gd, Math.Max(1, w), Math.Max(1, h), false, SurfaceFormat.Color, depth, msaa, RenderTargetUsage.PreserveContents);
/// Zeichnen in die Zwischenfläche beginnen (Größe wie der Bildschirm).
public void Begin(GraphicsDevice gd, int w, int h, bool antiAlias)
{
int msaa = antiAlias ? 4 : 0;
if (_scene == null || _scene.Width != w || _scene.Height != h || _msaa != msaa)
{
_scene?.Dispose(); _a?.Dispose(); _b?.Dispose(); _c?.Dispose();
_scene = Make(gd, w, h, msaa, DepthFormat.Depth24Stencil8);
_a = Make(gd, w / 4, h / 4, 0, DepthFormat.None);
_b = Make(gd, w / 8, h / 8, 0, DepthFormat.None);
_c = Make(gd, w / 16, h / 16, 0, DepthFormat.None);
_msaa = msaa;
}
gd.SetRenderTarget(_scene);
}
/// Fertiges Bild nach <paramref name="output"/> (null = Bildschirm), mit Nachleuchten der Stärke <paramref name="bloom"/>.
public void End(GraphicsDevice gd, SpriteBatch sb, RenderTarget2D? output, float bloom, float threshold = 0.76f)
{
if (_scene == null) return;
if (bloom > 0)
{
// ¼: verkleinern, dann Schwelle abziehen (nur Helles bleibt)
Blit(gd, sb, _scene, _a!, BlendState.Opaque, Color.White);
sb.Begin(SpriteSortMode.Immediate, Subtract);
sb.Draw(Assets.Pixel, new Rectangle(0, 0, _a!.Width, _a.Height), new Color(threshold, threshold, threshold, 0f));
sb.End();
// ⅛ und 1/16: weiter verkleinern = weicher
Blit(gd, sb, _a, _b!, BlendState.Opaque, Color.White);
Blit(gd, sb, _b!, _c!, BlendState.Opaque, Color.White);
}
gd.SetRenderTarget(output);
int w = output?.Width ?? gd.PresentationParameters.BackBufferWidth, h = output?.Height ?? gd.PresentationParameters.BackBufferHeight;
sb.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.PointClamp);
sb.Draw(_scene, new Rectangle(0, 0, w, h), Color.White);
sb.End();
if (bloom > 0)
{
sb.Begin(SpriteSortMode.Deferred, BlendState.Additive, SamplerState.LinearClamp);
var full = new Rectangle(0, 0, w, h);
sb.Draw(_a, full, Color.White * (0.30f * bloom));
sb.Draw(_b, full, Color.White * (0.45f * bloom));
sb.Draw(_c, full, Color.White * (0.60f * bloom));
sb.End();
}
}
static void Blit(GraphicsDevice gd, SpriteBatch sb, Texture2D from, RenderTarget2D to, BlendState blend, Color c)
{
gd.SetRenderTarget(to);
gd.Clear(Color.Black);
sb.Begin(SpriteSortMode.Immediate, blend, SamplerState.LinearClamp);
sb.Draw(from, new Rectangle(0, 0, to.Width, to.Height), c);
sb.End();
}
}
}

View File

@@ -61,7 +61,10 @@ namespace GladiatorIdle.Gfx
D.Rect(sb, r, fill * 0.95f); D.Rect(sb, r, fill * 0.95f);
D.Rect(sb, new RectangleF(r.X + 2, r.Y + 2, r.Width - 4, (r.Height - 4) * 0.45f), Color.White * (hover ? 0.08f : 0.04f)); D.Rect(sb, new RectangleF(r.X + 2, r.Y + 2, r.Width - 4, (r.Height - 4) * 0.45f), Color.White * (hover ? 0.08f : 0.04f));
D.Frame(sb, r, !enabled ? new Color(60, 48, 36) : selected || hover ? a : D.Border, selected ? 3 : 2); D.Frame(sb, r, !enabled ? new Color(60, 48, 36) : selected || hover ? a : D.Border, selected ? 3 : 2);
D.Text(sb, Assets.SansBold, size, text, r.Center, !enabled ? D.Dim : selected ? Color.White : D.Sand, Align.Center); // Beschriftung passt sich an (längere Texte in anderen Sprachen): verkleinern bis sie in den Knopf passt
float fit = size, room = r.Width - 18;
while (fit > 11 && D.Measure(Assets.SansBold, fit, text).X > room) fit -= 1;
D.Text(sb, Assets.SansBold, fit, text, r.Center, !enabled ? D.Dim : selected ? Color.White : D.Sand, Align.Center);
return enabled && Hit(r); return enabled && Hit(r);
} }
} }

View File

@@ -25,10 +25,46 @@ namespace GladiatorIdle
if (DevShot.Active) SoundManager.Enabled = false; // Testläufe stumm if (DevShot.Active) SoundManager.Enabled = false; // Testläufe stumm
if (DevShot.Playtest) { Playtest.Run(); return; } if (DevShot.Playtest) { Playtest.Run(); return; }
using var game = new ArenaGame(); AppDomain.CurrentDomain.UnhandledException += (_, e) => CrashLog(e.ExceptionObject as Exception);
game.Run(); try
SoundManager.StopAll(); {
SoundManager.Shutdown(); using var game = new ArenaGame();
_game = game;
game.Run();
}
catch (Exception ex)
{
CrashLog(ex);
throw;
}
finally
{
SoundManager.StopAll();
SoundManager.Shutdown();
}
}
static ArenaGame? _game;
static bool _crashed;
/// Absturz: erst den Spielstand sichern, dann die Ursache nach %AppData%\GladiatorIdle\crash.log
/// (die neueste oben). Testläufe schreiben ins Protokoll des Laufs.
static void CrashLog(Exception? ex)
{
if (_crashed) return;
_crashed = true;
try { _game?.SaveNow(); } catch { /* Spielstand nicht sicherbar */ }
try
{
string text = $"=== {DateTime.Now:yyyy-MM-dd HH:mm:ss} {typeof(Program).Assembly.GetName().Version}\n{ex}\n\n";
if (DevShot.Active) { DevShot.Log("CRASH " + ex); return; }
string dir = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "GladiatorIdle");
System.IO.Directory.CreateDirectory(dir);
string file = System.IO.Path.Combine(dir, "crash.log");
string old = System.IO.File.Exists(file) ? System.IO.File.ReadAllText(file) : "";
System.IO.File.WriteAllText(file, text + (old.Length > 200_000 ? old[..200_000] : old));
}
catch { /* nichts mehr zu tun */ }
} }
} }
} }

View File

@@ -121,7 +121,8 @@ Stufen, Fähigkeiten, Expeditionen, Ereignisse. Technik bleibt WinForms.
- Gladiator-Stufe durch Kampf-Erfahrung, je Stufe Attributpunkte frei verteilen (Trainingsplan bleibt). - Gladiator-Stufe durch Kampf-Erfahrung, je Stufe Attributpunkte frei verteilen (Trainingsplan bleibt).
- Gegenstände in 5 Slots (Waffe, Schild, Helm, Rüstung, Beinschienen), 5 Seltenheiten - Gegenstände in 5 Slots (Waffe, Schild, Helm, Rüstung, Beinschienen), 5 Seltenheiten
(gewöhnlich, gut, selten, episch, legendär) mit Grund- und Zufallswerten. (gewöhnlich, gut, selten, episch, legendär) mit Grund- und Zufallswerten.
- Beute aus Siegen/Champions, Inventar, Händler im Forum (kaufen/verkaufen). - Beute aus Siegen/Champions, Expeditionen und Ereignissen, Inventar (verkaufen); Schmied direkt am Ausrüstungsplatz.
(Händler und Forum am 2026-11-09 entfernt.)
- Ersetzt die Ausrüstungs-Stufen; Balance mit dem Bot neu. - Ersetzt die Ausrüstungs-Stufen; Balance mit dem Bot neu.
8. **Expeditionen & Ereignisse:** Gladiator für eine Zeit auf Mission schicken (Gallien, Germanien, 8. **Expeditionen & Ereignisse:** Gladiator für eine Zeit auf Mission schicken (Gallien, Germanien,
Ägypten, …): Idle-Zeit gegen Beute, Gold, Erfahrung, mit kurzen Ereignis-Texten. Ereignisse mit Ägypten, …): Idle-Zeit gegen Beute, Gold, Erfahrung, mit kurzen Ereignis-Texten. Ereignisse mit
@@ -141,22 +142,21 @@ Stufen, Fähigkeiten, Expeditionen, Ereignisse. Technik bleibt WinForms.
Zweiter Atem 15 %, Bollwerk = unverwundbar ohne Festhalten. Champion mit halbem Baum bei Zweiter Atem 15 %, Bollwerk = unverwundbar ohne Festhalten. Champion mit halbem Baum bei
Verhältnis 1,4–2: 65–99 % Siege je nach Geschick. Idle: erste Freiheit 4,6–5,3 h je Klasse. Verhältnis 1,4–2: 65–99 % Siege je nach Geschick. Idle: erste Freiheit 4,6–5,3 h je Klasse.
## Balance-Stand (Phase 2, Bot `--playtest`) ## Balance-Stand (2026-11-09, Bot `--playtest`)
Alle Zahlen in `Game/Balance.cs`. Bot kauft immer das billigste Upgrade, nutzt den Spezialschlag, Alle Zahlen in `Game/Balance.cs`. Seit dem 2026-11-09 gibt es keine Taberna (Denare pro Sekunde), keinen
fordert Champions an, sobald der Ruhm reicht (nach Niederlage 90 s Pause). Händler, kein „Kampflos siegen“ und keinen alten Idle-Kampf mehr: Denare kommen fast nur aus Duellen
(`FIGHT_GOLD` 2,5 × Lohn je Sieg), dazu Verkauf, Ereignisse und Expeditionen (Lohn = 3 / 8 / 20 Siege
je Dauer, Hauptlohn Beute). Offline steigen nur die Werte (Ausbilder) und eine Expedition läuft fertig.
| Treffsicherheit (Bot) | 1. Freiheit | 2. Leben | Bot (`--playtest <ordner>`): wählt Gegner, simuliert jedes Duell (Geschick `--skill`, Standard 0,6),
|---|---|---| legt Ausrüstung an, kauft das Billigste (Ausbilder, Gebäude, Schmied). Ergebnis: erste Freiheit nach
| 0 (nur idle) | 6,9 h | 2,9 h | **3,1 h**, je Arena 14–41 min; das Protokoll zeigt je Arena die Denare nach Quelle (`gold=[fight:…]`).
| 0,5 | 6,0 h | 2,4 h |
| 0,9 | 5,5 h | 2,4 h |
(Stand nach Umstellung auf Trainingsplan + Timing-Schlag.) Alle vier Klassen liegen bei 1 Klick/s zwischen 6,8 und 7,2 h. Das letzte Kapitel Hub: unten Gladiator (Seiten „Werte & Ausrüstung“ und „Fähigkeiten“), Ludus, Expedition; die
(Kaiser-Champion) ist das längste (~4 h). Offline: max. 8 h (+1 h je Jupiter-Stufe), Ehrenhalle erscheint nach der ersten Freiheit.
keine Champion-Kämpfe offline.
Test-Schalter: `--playtest <ordner> [--skill 0..1] [--hours H] [--runs R] [--class X]`, Test-Schalter: `--playtest <ordner> [--skill 0..1] [--hours H] [--class X]`,
`--playtest <ordner> --fastforward H` (Offline-Rechnung), `--playtest <ordner> --dueltest` (Echtzeit-Duelle per Bot: Siegquote je Kampfkraft-Verhältnis und Geschick). Prüft außerdem Speichern/Laden `--playtest <ordner> --fastforward H` (Offline-Rechnung), `--playtest <ordner> --dueltest` (Echtzeit-Duelle per Bot: Siegquote je Kampfkraft-Verhältnis und Geschick). Prüft außerdem Speichern/Laden
und ob alle gebauten Sprach-Keys existieren. und ob alle gebauten Sprach-Keys existieren.