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:
@@ -75,6 +75,8 @@ namespace GladiatorIdle
|
||||
internal static class Adventures
|
||||
{
|
||||
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 double EVENT_MIN = 480, EVENT_MAX = 840; // 8–14 min aktive Spielzeit
|
||||
|
||||
|
||||
@@ -13,13 +13,11 @@ namespace GladiatorIdle
|
||||
/// XP von Stufe <paramref name="level"/> zur nächsten.
|
||||
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.
|
||||
public const int PLAN_HOURS = 10;
|
||||
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).
|
||||
/// Tägliches Training: Grund-XP/s plus dieser Anteil der gesamten Ausbilder-Leistung,
|
||||
/// fest verteilt (Stärke, Ausdauer, Geschick, Showtalent) – wächst mit den Ausbildern mit.
|
||||
public const double DRILL_BASE = 1.0;
|
||||
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) ───────────────────────
|
||||
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 FameMult(int show) => 1 + 0.02 * show;
|
||||
|
||||
// ── Kampf-Takt ──────────────────────────────────────────────
|
||||
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
|
||||
// ── Kampf ───────────────────────────────────────────────────
|
||||
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 ──────────────────────────────────────────
|
||||
/// 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 %).
|
||||
public const double DUEL_POWER_SCALE = 0.5;
|
||||
public const double PRACTICE_COOLDOWN = 300; // Übungsduell alle 5 min
|
||||
/// 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, AUTO_RATIO = 2.5, AUTO_REWARD = 0.8;
|
||||
public const double PRACTICE_REWARD = 3;
|
||||
/// Lohn je Angebot (leichter / ebenbürtig / stärker).
|
||||
public const double OFFER_EASY = 0.7, OFFER_EVEN = 1.0, OFFER_HARD = 1.8;
|
||||
|
||||
// ── Selbst kämpfen (neues Spiel) ────────────────────────────
|
||||
/// 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];
|
||||
|
||||
/// 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,
|
||||
/// mittleres Verhältnis der gewählten Gegner um 1,0–1,4.
|
||||
public static double[] MANUAL_ENEMY = Tune("GI_ENEMY", new[] { 4.5, 13, 14, 7, 3.8, 1.4, 0.65 });
|
||||
/// Abgestimmt mit --playtest (ohne Taberna, Denare nur aus Kämpfen): ~3,1 h bis zur Freiheit,
|
||||
/// 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, 2.6, 1.3, 0.55 });
|
||||
/// 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.
|
||||
static double[] Tune(string env, double[] fallback)
|
||||
@@ -75,23 +66,7 @@ namespace GladiatorIdle
|
||||
if (string.IsNullOrWhiteSpace(v)) return fallback;
|
||||
var parts = v.Split(',').Select(x => double.Parse(x, System.Globalization.CultureInfo.InvariantCulture)).ToArray();
|
||||
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 ──────────────────────────────────────────────────
|
||||
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 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);
|
||||
/// 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 const double CHAMPION_REWARD = 5; // Gold und Ruhm × so viel wie ein normaler Sieg
|
||||
|
||||
// ── 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.
|
||||
public static double CrowdMult(double favor) => 1 + 2 * favor / 100;
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ namespace GladiatorIdle
|
||||
{
|
||||
public enum Stat { Strength, Endurance, Agility, Showmanship }
|
||||
public enum GladiatorClass { Murmillo, Retiarius, Thraex, Secutor }
|
||||
public enum Tactic { Attack, Balanced, Defense }
|
||||
public enum God { Mars, Fortuna, Minerva, Apollo, Bacchus, Jupiter }
|
||||
|
||||
/// Spezialschlag je Klasse.
|
||||
@@ -49,7 +48,6 @@ namespace GladiatorIdle
|
||||
new("building.baths", UpgradeKind.Building, 60, 1.90), // schnellere Erholung
|
||||
new("building.kitchen", UpgradeKind.Building, 80, 1.70), // mehr XP
|
||||
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);
|
||||
@@ -123,7 +121,6 @@ namespace GladiatorIdle
|
||||
internal static class TextKeys
|
||||
{
|
||||
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();
|
||||
|
||||
/// 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 (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 (var u in UpgradeDef.All)
|
||||
{
|
||||
|
||||
13
Game/Duel.cs
13
Game/Duel.cs
@@ -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 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 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;
|
||||
// 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;
|
||||
@@ -81,6 +81,11 @@ namespace GladiatorIdle
|
||||
// Eingaben des Spielers (von der Anzeige gesetzt)
|
||||
public int MoveDir;
|
||||
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;
|
||||
public void PressLeap() => _leap = true;
|
||||
public void PressSuper() => _super = true;
|
||||
@@ -204,9 +209,10 @@ namespace GladiatorIdle
|
||||
double dist = Math.Abs(p.X - e.X);
|
||||
double speed = e.Speed * (e.Slow > 0 ? 0.45 : 1);
|
||||
if (e.Busy && e.State != DuelState.Block) return;
|
||||
if (EnemyPassive) return;
|
||||
|
||||
// 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;
|
||||
return;
|
||||
@@ -388,7 +394,8 @@ namespace GladiatorIdle
|
||||
|
||||
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 && 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)
|
||||
|
||||
156
Game/Fight.cs
156
Game/Fight.cs
@@ -1,162 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
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.
|
||||
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);
|
||||
|
||||
/// <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); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,9 +56,6 @@ namespace GladiatorIdle
|
||||
public int Wins { get; private set; }
|
||||
public int Losses { 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)
|
||||
public int CharLevel { get; private set; }
|
||||
@@ -68,13 +65,11 @@ namespace GladiatorIdle
|
||||
/// Gelernte Fähigkeiten (Rang je Id).
|
||||
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];
|
||||
/// Verstärkung je Slot beim Schmied (bleibt beim Wechsel des Gegenstands).
|
||||
public int[] SlotLevels { get; private set; } = new int[5];
|
||||
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;
|
||||
|
||||
// Expedition, Ereignisse, Segen
|
||||
@@ -88,13 +83,8 @@ namespace GladiatorIdle
|
||||
string? _lastEvent;
|
||||
|
||||
// ── Laufend (nicht gespeichert) ─────────────────────────────
|
||||
public Fight? Fight { get; private set; }
|
||||
/// Der zuletzt beendete Kampf (Anzeige zwischen zwei Kämpfen, letzte Ereignisse).
|
||||
public Fight? LastFight { get; private set; }
|
||||
public double Pause { get; private set; } = 1;
|
||||
/// Erholung nach einer Niederlage: so lange kein Kampf.
|
||||
public double Recovery { get; private set; }
|
||||
public double SpecialCooldown { get; private set; }
|
||||
public bool ChampionNext { get; private set; }
|
||||
public List<GameEvent> Events { get; } = new();
|
||||
/// Aus = keine Ereignis-Listen (Offline-Rechnung, Bot).
|
||||
public bool CollectEvents { get; set; } = true;
|
||||
@@ -124,8 +114,7 @@ namespace GladiatorIdle
|
||||
GoldEarnedRun = FameRun = Crowd = RunSeconds = 0;
|
||||
Arena = Rank = Wins = Losses = _lossStreak = 0;
|
||||
FreedomEarned = false;
|
||||
Tactic = Tactic.Balanced;
|
||||
Fight = LastFight = null; Pause = 1; Recovery = 0; SpecialCooldown = 0; ChampionNext = false;
|
||||
Recovery = 0;
|
||||
CharLevel = 0; CharXp = 0; AttrPoints = 0; StatBonus = new int[4]; SkillRanks = new(); ExtraSkillPoints = 0;
|
||||
Equipped = new Item?[5];
|
||||
SlotLevels = new int[5];
|
||||
@@ -137,7 +126,6 @@ namespace GladiatorIdle
|
||||
var it = new Item { Id = _nextItemId++, Base = b, Rarity = Rarity.Common, Level = 0 };
|
||||
Equipped[(int)it.Slot] = it;
|
||||
}
|
||||
RefreshMerchant();
|
||||
}
|
||||
|
||||
// ── Erstellung ──────────────────────────────────────────────
|
||||
@@ -268,7 +256,7 @@ namespace GladiatorIdle
|
||||
var it = FindItem(id);
|
||||
if (it == null) return false;
|
||||
Inventory.Remove(it);
|
||||
EarnGold(Items.SellValue(it));
|
||||
EarnGold(Items.SellValue(it), "sell");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -280,7 +268,7 @@ namespace GladiatorIdle
|
||||
{
|
||||
double total = InventoryValue;
|
||||
Inventory.Clear();
|
||||
if (total > 0) EarnGold(total);
|
||||
if (total > 0) EarnGold(total, "sell");
|
||||
return total;
|
||||
}
|
||||
|
||||
@@ -297,23 +285,6 @@ namespace GladiatorIdle
|
||||
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).
|
||||
public int EquipBest()
|
||||
{
|
||||
@@ -339,7 +310,7 @@ namespace GladiatorIdle
|
||||
// voll: das schwächste Stück (nach Wert) wird automatisch verkauft
|
||||
var worst = Inventory.Append(it).OrderBy(Items.Value).First();
|
||||
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));
|
||||
if (worst == it) return;
|
||||
}
|
||||
@@ -362,28 +333,17 @@ namespace GladiatorIdle
|
||||
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)
|
||||
{
|
||||
double trainers = 0;
|
||||
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 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 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 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 =>
|
||||
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;
|
||||
|
||||
// ── Takt ────────────────────────────────────────────────────
|
||||
@@ -427,76 +382,26 @@ namespace GladiatorIdle
|
||||
double r = XpPerSec((Stat)i);
|
||||
if (r > 0) AddXp((Stat)i, r * dt);
|
||||
}
|
||||
double income = GoldPerSec * dt;
|
||||
if (income > 0) EarnGold(income);
|
||||
SpecialCooldown = Math.Max(0, SpecialCooldown - dt);
|
||||
PracticeCooldown = Math.Max(0, PracticeCooldown - dt);
|
||||
if ((MerchantRefreshIn -= dt) <= 0) RefreshMerchant();
|
||||
Recovery = Math.Max(0, Recovery - dt);
|
||||
for (int i = Buffs.Count - 1; i >= 0; i--)
|
||||
if ((Buffs[i].Left -= dt) <= 0) Buffs.RemoveAt(i);
|
||||
// Ereignisse nur beim aktiven Spielen (nicht offline, nicht unterwegs)
|
||||
if (CollectEvents && Away == null && PendingEvent == null && (EventIn -= dt) <= 0) StartEvent();
|
||||
|
||||
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();
|
||||
}
|
||||
if (Away != null && (Away.Left -= dt) <= 0) FinishExpedition(); // unterwegs: kein Kampf, Training läuft weiter
|
||||
}
|
||||
|
||||
void StartFight()
|
||||
{
|
||||
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).
|
||||
/// Ergebnis eines Duells: Lohn, Aufstieg bzw. Niederlage.
|
||||
/// <paramref name="bonus"/>: Faktor auf Gold/Ruhm/Erfahrung (Wahl des Gegners).
|
||||
void ApplyResult(Enemy enemy, bool won, double bonus)
|
||||
{
|
||||
var f = (Enemy: enemy, Won: won);
|
||||
Pause = Balance.FIGHT_PAUSE;
|
||||
if (f.Won)
|
||||
{
|
||||
Wins++; _lossStreak = 0;
|
||||
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;
|
||||
EarnGold(gold);
|
||||
EarnGold(gold, "fight");
|
||||
FameRun += fame;
|
||||
Crowd = Math.Min(100, Crowd + Balance.CROWD_WIN * CrowdGain);
|
||||
Emit(new GameEvent(GameEventType.FightWon, gold, fame, f.Enemy.NameKey));
|
||||
@@ -512,7 +417,6 @@ namespace GladiatorIdle
|
||||
else
|
||||
{
|
||||
Arena++; Rank = 0;
|
||||
RefreshMerchant(); // neue Arena, neue Ware
|
||||
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.
|
||||
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)
|
||||
{
|
||||
var r = RegionDef.Get(region);
|
||||
if (Away != null || !RegionOpen(r) || Fight is { Enemy.IsChampion: true } || FreedomEarned) return false;
|
||||
Fight = null; ChampionNext = false; Recovery = 0;
|
||||
if (Away != null || !RegionOpen(r) || FreedomEarned) return false;
|
||||
Recovery = 0;
|
||||
Away = new Expedition { Region = region, Duration = duration, Left = Adventures.Durations[duration], Chance = ExpeditionChance(r) };
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Zurückrufen: sofort zurück, ohne Belohnung.
|
||||
public void Recall() { Away = null; Pause = 1; }
|
||||
public void Recall() { Away = null; }
|
||||
|
||||
void FinishExpedition()
|
||||
{
|
||||
var a = Away!;
|
||||
Away = null;
|
||||
Pause = 1;
|
||||
var r = RegionDef.Get(a.Region);
|
||||
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;
|
||||
var rep = new ExpeditionReport
|
||||
{
|
||||
Region = a.Region, Success = ok,
|
||||
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,
|
||||
};
|
||||
EarnGold(rep.Gold);
|
||||
EarnGold(rep.Gold, "expedition");
|
||||
FameRun += rep.Fame;
|
||||
AddCharXp(rep.Xp);
|
||||
if (ok)
|
||||
@@ -641,7 +547,7 @@ namespace GladiatorIdle
|
||||
{
|
||||
case EffectKind.Gold:
|
||||
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;
|
||||
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;
|
||||
@@ -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.Buff: Buffs.Add(new ActiveBuff { Kind = e.Buff, Mult = e.Amount, Left = e.Seconds }); break;
|
||||
case EffectKind.Recovery:
|
||||
if (Fight is { Enemy.IsChampion: false }) Fight = null;
|
||||
Recovery = Math.Max(Recovery, e.Amount);
|
||||
break;
|
||||
}
|
||||
@@ -662,35 +567,13 @@ namespace GladiatorIdle
|
||||
|
||||
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) =>
|
||||
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 PracticeEnemy => Enemy.Create(Arena, Rank, false);
|
||||
|
||||
/// Ü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; }
|
||||
/// Kampf-Einführung gesehen (oder übersprungen); in den Einstellungen wieder einschaltbar.
|
||||
public bool TutorialDone { get; set; }
|
||||
|
||||
/// 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.
|
||||
@@ -707,15 +590,11 @@ namespace GladiatorIdle
|
||||
|
||||
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.
|
||||
public void ResolveFight(Offer o, bool won, bool auto = false)
|
||||
public void ResolveFight(Offer o, bool won)
|
||||
{
|
||||
int rank = Rank;
|
||||
Fight = null;
|
||||
ApplyResult(o.Enemy, won, o.Reward * (auto ? Balance.AUTO_REWARD : 1));
|
||||
ApplyResult(o.Enemy, won, o.Reward);
|
||||
if (won && !o.Enemy.IsChampion)
|
||||
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));
|
||||
}
|
||||
|
||||
public void AutoWin(Offer o) => ResolveFight(o, true, auto: true);
|
||||
|
||||
/// Lohn eines Sieges (Vorschau auf der Gegnerkarte).
|
||||
public (double Gold, double Fame, double Xp) RewardPreview(Offer o)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -759,37 +636,12 @@ namespace GladiatorIdle
|
||||
/// Testlauf: Gladiator-Stufe direkt setzen (Fähigkeitspunkte für den Duell-Test).
|
||||
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).
|
||||
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 bool Buy(string id)
|
||||
@@ -823,7 +675,6 @@ namespace GladiatorIdle
|
||||
Legends.Add(new Legend(Name, Class, Freedoms, Wins, FameRun, RunSeconds, DateTime.UtcNow, CharLevel, Power()));
|
||||
_pendingInherit = Balance.InheritGold(GoldEarnedRun, Freedoms);
|
||||
FreedomEarned = false;
|
||||
Fight = null;
|
||||
return favor;
|
||||
}
|
||||
|
||||
@@ -831,8 +682,7 @@ namespace GladiatorIdle
|
||||
|
||||
public double OfflineCapSeconds => Gods.OfflineHours(GodLevel(God.Jupiter)) * 3600;
|
||||
|
||||
/// Abwesenheit nachrechnen (gedeckelt): Kämpfe und Ausbilder laufen weiter, keine
|
||||
/// Champion-Kämpfe und keine Klicks.
|
||||
/// Abwesenheit nachrechnen (gedeckelt): Training, Erholung und eine laufende Expedition.
|
||||
public OfflineReport ApplyOffline(double seconds)
|
||||
{
|
||||
seconds = Math.Clamp(seconds, 0, OfflineCapSeconds);
|
||||
@@ -840,12 +690,9 @@ namespace GladiatorIdle
|
||||
int wins = Wins, losses = Losses, levels = StatLevels.Sum();
|
||||
bool collect = CollectEvents;
|
||||
CollectEvents = false;
|
||||
ChampionNext = false;
|
||||
if (Fight != null) Fight.CollectEvents = false;
|
||||
for (double t = 0; t < seconds; t += Balance.OFFLINE_STEP)
|
||||
Tick(Math.Min(Balance.OFFLINE_STEP, seconds - t));
|
||||
CollectEvents = collect;
|
||||
if (Fight != null) Fight.CollectEvents = collect;
|
||||
return new OfflineReport(seconds, GoldEarnedRun - gold, FameRun - fame, Wins - wins, Losses - losses,
|
||||
StatLevels.Sum() - levels);
|
||||
}
|
||||
@@ -872,6 +719,7 @@ namespace GladiatorIdle
|
||||
public HashSet<int> LegendsBeaten { get; set; } = new();
|
||||
public Appearance? Look { get; set; }
|
||||
public int ExtraSkillPoints { get; set; }
|
||||
public bool TutorialDone { get; set; }
|
||||
public double LifetimeFame { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
public GladiatorClass Class { get; set; }
|
||||
@@ -888,9 +736,7 @@ namespace GladiatorIdle
|
||||
public int Wins { get; set; }
|
||||
public int Losses { get; set; }
|
||||
public double RunSeconds { get; set; }
|
||||
public Tactic Tactic { get; set; }
|
||||
public double PendingInherit { get; set; }
|
||||
public int[] Plan { get; set; } = { 3, 3, 2, 2 };
|
||||
public int CharLevel { get; set; }
|
||||
public double CharXp { get; set; }
|
||||
public int AttrPoints { get; set; }
|
||||
@@ -898,8 +744,6 @@ namespace GladiatorIdle
|
||||
public Item?[] Equipped { get; set; } = new Item?[5];
|
||||
public int[] SlotLevels { get; set; } = new int[5];
|
||||
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 Expedition? Away { get; set; }
|
||||
public ExpeditionReport? ExpeditionResult { get; set; }
|
||||
@@ -913,13 +757,13 @@ namespace GladiatorIdle
|
||||
{
|
||||
SavedUtc = DateTime.UtcNow,
|
||||
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,
|
||||
Gold = Gold, GoldEarnedRun = GoldEarnedRun, FameRun = FameRun, Crowd = Crowd,
|
||||
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,
|
||||
Equipped = Equipped, SlotLevels = SlotLevels, Inventory = Inventory, Merchant = Merchant, MerchantRefreshIn = MerchantRefreshIn,
|
||||
Equipped = Equipped, SlotLevels = SlotLevels, Inventory = Inventory,
|
||||
NextItemId = _nextItemId,
|
||||
Away = Away, ExpeditionResult = ExpeditionResult, PendingEvent = PendingEvent, EventIn = EventIn, Buffs = Buffs,
|
||||
SkillRanks = SkillRanks
|
||||
@@ -930,21 +774,21 @@ namespace GladiatorIdle
|
||||
var g = new GameState(seed)
|
||||
{
|
||||
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),
|
||||
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),
|
||||
Arena = Math.Clamp(d.Arena, 0, Balance.ARENA_COUNT - 1),
|
||||
Rank = Math.Clamp(d.Rank, 0, Balance.RANKS_PER_ARENA - 1),
|
||||
FreedomEarned = d.FreedomEarned, Wins = d.Wins, Losses = d.Losses, RunSeconds = d.RunSeconds,
|
||||
Tactic = d.Tactic
|
||||
FreedomEarned = d.FreedomEarned, Wins = d.Wins, Losses = d.Losses, RunSeconds = d.RunSeconds
|
||||
};
|
||||
g._pendingInherit = d.PendingInherit;
|
||||
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.SlotLevels = Fit(d.SlotLevels, 5);
|
||||
g.Inventory = d.Inventory ?? new(); g.Merchant = d.Merchant ?? new();
|
||||
g.MerchantRefreshIn = d.MerchantRefreshIn; g._nextItemId = Math.Max(1, d.NextItemId);
|
||||
g.Inventory = d.Inventory ?? new();
|
||||
g._nextItemId = Math.Max(1, d.NextItemId);
|
||||
// ältere Spielstände ohne Ausrüstung: Startausrüstung der Klasse
|
||||
if (g.Equipped.All(e => e == null))
|
||||
foreach (var b in Items.StartKit(g.Class))
|
||||
@@ -952,13 +796,10 @@ namespace GladiatorIdle
|
||||
var it = new Item { Id = g._nextItemId++, Base = b };
|
||||
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.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.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;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,8 +87,6 @@ namespace GladiatorIdle
|
||||
|
||||
public const double DROP_CHANCE = 0.25;
|
||||
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).
|
||||
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);
|
||||
}
|
||||
|
||||
public static Item MerchantItem(Random rng, int tier, long id) =>
|
||||
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).
|
||||
/// Grundwert in Denaren (Verkauf bringt ein Viertel).
|
||||
public static double Value(Item it) =>
|
||||
25 * Math.Pow(1.5, it.EffLevel(0)) * (1 + 0.25 * it.Affixes.Count);
|
||||
|
||||
|
||||
132
Game/Playtest.cs
132
Game/Playtest.cs
@@ -22,97 +22,8 @@ namespace GladiatorIdle
|
||||
DevShot.Log(missing.Count == 0 ? "keys ok" : "keys MISSING: " + string.Join(", ", missing));
|
||||
if (DevShot.FastForwardHours > 0) { Offline(DevShot.FastForwardHours); return; }
|
||||
if (DevShot.DuelTest) { DuelTest(); return; }
|
||||
if (Array.IndexOf(Environment.GetCommandLineArgs(), "--arenatest") >= 0) { ArenaRun(); return; }
|
||||
|
||||
var gs = new GameState(seed: 1);
|
||||
gs.NewRun(DevShot.Name, DevShot.Class);
|
||||
DevShot.Log($"playtest: class={DevShot.Class} skill={DevShot.Skill} maxHours={DevShot.Hours} runs={DevShot.Runs}");
|
||||
double total = 0;
|
||||
for (int run = 1; run <= DevShot.Runs; run++)
|
||||
{
|
||||
double t = PlayRun(gs, run);
|
||||
total += t;
|
||||
if (!gs.FreedomEarned) { DevShot.Log($"run {run}: NO freedom after {H(t)}"); break; }
|
||||
int favor = gs.TakeFreedom();
|
||||
SpendFavor(gs);
|
||||
DevShot.Log($"run {run}: FREEDOM after {H(t)} wins={gs.Legends[^1].Wins} favor+{favor} " +
|
||||
$"gods=[{string.Join(",", gs.GodLevels)}] total {H(total)}");
|
||||
gs.NewRun(DevShot.Name, DevShot.Class);
|
||||
}
|
||||
}
|
||||
|
||||
/// Ein Leben spielen, bis zur Freiheit oder bis die Zeit um ist. Liefert die Spielzeit.
|
||||
static double PlayRun(GameState gs, int run)
|
||||
{
|
||||
var bot = new Bot(DevShot.Skill);
|
||||
double nextReport = 3600, arenaStart = 0;
|
||||
int champFails = 0;
|
||||
while (bot.Time < DevShot.Hours * 3600 && !gs.FreedomEarned)
|
||||
{
|
||||
bot.Step(gs, DT);
|
||||
foreach (var e in gs.Events)
|
||||
{
|
||||
if (e.Type == GameEventType.FightLost && e.Key!.StartsWith("champion.")) champFails++;
|
||||
else if (e.Type == GameEventType.ArenaUnlocked)
|
||||
{
|
||||
DevShot.Log($"run {run}: arena {(int)e.A} at {H(bot.Time)} (+{H(bot.Time - arenaStart)}, champion fails {champFails}) " +
|
||||
$"duelratio={gs.DuelRatio(Enemy.Create((int)e.A - 1, 9, true)):0.00} {Snapshot(gs)}");
|
||||
arenaStart = bot.Time; champFails = 0;
|
||||
}
|
||||
}
|
||||
gs.Events.Clear();
|
||||
if (bot.Time >= nextReport) { nextReport += 3600; DevShot.Log($"run {run}: {H(bot.Time)} {Snapshot(gs)}"); }
|
||||
}
|
||||
return bot.Time;
|
||||
}
|
||||
|
||||
/// Spielstand für Screenshots: <paramref name="hours"/> Spielzeit mit dem Bot vorspielen.
|
||||
public static void Advance(GameState gs, double hours, double skill = 0.6)
|
||||
{
|
||||
var bot = new Bot(skill);
|
||||
while (bot.Time < hours * 3600)
|
||||
{
|
||||
bot.Step(gs, DT);
|
||||
gs.Events.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
/// Der Testspieler: Timing-Schläge mit Treffsicherheit <c>skill</c> (0 = schlägt nie, 1 = fast
|
||||
/// immer perfekt), nutzt den Spezialschlag, kauft das Billigste, fordert Champions heraus
|
||||
/// (nach Niederlage 90 s Pause). Trainingsplan bleibt auf dem Standard.
|
||||
sealed class Bot
|
||||
{
|
||||
readonly double _skill;
|
||||
readonly Random _rng = new(5);
|
||||
double _nextBuy, _lastChampFail = -999, _aim = -1;
|
||||
public double Time { get; private set; }
|
||||
public Bot(double skill) => _skill = skill;
|
||||
|
||||
public void Step(GameState gs, double dt)
|
||||
{
|
||||
gs.Tick(dt);
|
||||
Time += dt;
|
||||
if (_skill > 0 && gs.Fight is { OpeningAge: >= 0 } f)
|
||||
{
|
||||
// Zeitpunkt je Lücke einmal wählen: je geschickter, desto näher am Ziel
|
||||
if (_aim < 0) _aim = Balance.OPENING_TARGET + (_rng.NextDouble() * 2 - 1) * (0.03 + 0.45 * (1 - _skill));
|
||||
if (f.OpeningAge >= _aim) { gs.Strike(); _aim = -1; }
|
||||
}
|
||||
else _aim = -1;
|
||||
if (gs.CanUseSpecial && gs.Fight!.Elapsed > 2) gs.UseSpecial();
|
||||
if (Time >= _nextBuy) { _nextBuy = Time + 1; ManageGear(gs); BuyCheapest(gs); }
|
||||
if (gs.PendingEvent != null)
|
||||
{
|
||||
int n = Adventures.GetEvent(gs.PendingEvent).Choices.Length;
|
||||
for (int i = 0; i < n && gs.Choose(i) == null; i++) { }
|
||||
}
|
||||
if (gs.ExpeditionResult != null) gs.DismissExpeditionResult();
|
||||
if (gs.CanChallenge && !gs.ChampionNext && Time - _lastChampFail > 90) gs.ChallengeChampion();
|
||||
foreach (var e in gs.Events)
|
||||
if (e.Type == GameEventType.FightLost && e.Key!.StartsWith("champion.")) _lastChampFail = Time;
|
||||
gs.Fight?.Events.Clear();
|
||||
gs.LastFight?.Events.Clear();
|
||||
}
|
||||
ArenaRun(); // Standard: der Bot spielt bis zur Freiheit
|
||||
}
|
||||
|
||||
/// Immer das Billigste: Ausbilder, Gebäude oder eine Schmied-Stufe für ein angelegtes Stück.
|
||||
@@ -127,7 +38,7 @@ namespace GladiatorIdle
|
||||
}
|
||||
}
|
||||
|
||||
/// Gegenstände: Bestes anlegen; Attributpunkte nach dem Trainingsplan verteilen.
|
||||
/// Gegenstände: Bestes anlegen; Attributpunkte wie das tägliche Training verteilen.
|
||||
static void ManageGear(GameState gs)
|
||||
{
|
||||
gs.EquipBest();
|
||||
@@ -139,8 +50,8 @@ namespace GladiatorIdle
|
||||
}
|
||||
while (gs.AttrPoints > 0)
|
||||
{
|
||||
// Wert, der im Verhältnis zum Plan am wenigsten Punkte hat
|
||||
var s = Enum.GetValues<Stat>().OrderBy(x => (gs.StatBonus[(int)x] + 1.0) / Math.Max(1, gs.Plan[(int)x])).First();
|
||||
// Wert, der im Verhältnis zum Training am wenigsten Punkte hat
|
||||
var s = Enum.GetValues<Stat>().OrderBy(x => (gs.StatBonus[(int)x] + 1.0) / Balance.DRILL_SPLIT[(int)x]).First();
|
||||
gs.SpendPoint(s);
|
||||
}
|
||||
}
|
||||
@@ -169,7 +80,7 @@ namespace GladiatorIdle
|
||||
{
|
||||
var gs = new GameState(seed: 2);
|
||||
gs.NewRun(DevShot.Name, DevShot.Class);
|
||||
// kurz anspielen, damit Ausbilder/Taberna laufen
|
||||
// kurz anspielen, damit die Ausbilder laufen
|
||||
for (double t = 0; t < 600; t += DT) gs.Tick(DT);
|
||||
BuyCheapest(gs);
|
||||
gs.Events.Clear();
|
||||
@@ -177,7 +88,7 @@ namespace GladiatorIdle
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
var r = gs.ApplyOffline(hours * 3600);
|
||||
DevShot.Log($"offline {hours} h (cap {gs.OfflineCapSeconds / 3600} h): simulated {r.Seconds / 3600:0.##} h in {sw.ElapsedMilliseconds} ms, " +
|
||||
$"gold+{r.Gold:0.##e0} fame+{r.Fame:0.##e0} wins {r.Wins} losses {r.Losses} levels+{r.LevelUps}");
|
||||
$"gold+{r.Gold:0.##e0} fame+{r.Fame:0.##e0} levels+{r.LevelUps}");
|
||||
DevShot.Log($"offline after: {Snapshot(gs)}");
|
||||
}
|
||||
|
||||
@@ -186,7 +97,6 @@ namespace GladiatorIdle
|
||||
{
|
||||
var gs = new GameState(seed: 3);
|
||||
gs.NewRun("Test", GladiatorClass.Thraex);
|
||||
gs.ChangePlan(Stat.Showmanship, -1);
|
||||
for (int i = 0; i < 3000; i++) gs.Tick(DT);
|
||||
BuyCheapest(gs);
|
||||
string a = Json(gs);
|
||||
@@ -205,6 +115,7 @@ namespace GladiatorIdle
|
||||
/// Duell-Bot: spielt Echtzeit-Duelle mit Geschick 0..1 und misst Siegquote und Dauer je Kampfkraft-Verhältnis.
|
||||
static void DuelTest()
|
||||
{
|
||||
HeavyProbe();
|
||||
// jede Fähigkeit einzeln (volle Ränge): Champion, Verhältnis 1,4, mittleres Geschick
|
||||
foreach (var sk in SkillDef.All)
|
||||
{
|
||||
@@ -248,6 +159,35 @@ namespace GladiatorIdle
|
||||
}
|
||||
}
|
||||
|
||||
/// Schwerer Schlag (W) gegen normalen Schlag: wie oft trifft er, wie viel Schaden macht er.
|
||||
static void HeavyProbe()
|
||||
{
|
||||
var perks = SkillPerks.From(id => id == "heavystrike" ? 1 : 0);
|
||||
int hSw = 0, hHit = 0, nSw = 0, nHit = 0; double hDmg = 0, nDmg = 0;
|
||||
for (int n = 0; n < 200; n++)
|
||||
{
|
||||
var rng = new Random(n * 31 + 7);
|
||||
var d = new Duel(1000, 0.0, Special.ShieldBash, 1000, 1.0, false, false, rng, perks);
|
||||
var bot = new DuelBot(0.6, rng);
|
||||
var last = d.Player.State;
|
||||
while (!d.Over && d.Time < 120)
|
||||
{
|
||||
bot.Act(d);
|
||||
var p = d.Player;
|
||||
if (p.HeavyCd <= 0 && p.Stamina >= Duel.HEAVY_COST && !p.Busy && Math.Abs(d.Enemy.X - p.X) < p.Reach) d.PressHeavy();
|
||||
d.Step(1 / 60.0);
|
||||
bool heavy = d.Player.Heavy;
|
||||
if (d.Player.State == DuelState.Strike && last != DuelState.Strike) { if (heavy) hSw++; else nSw++; }
|
||||
foreach (var e in d.Events)
|
||||
if (e.ByPlayer && e.Type == DuelEventType.Hit)
|
||||
{ if (heavy) { hHit++; hDmg += e.Amount; } else { nHit++; nDmg += e.Amount; } }
|
||||
last = d.Player.State;
|
||||
d.Events.Clear();
|
||||
}
|
||||
}
|
||||
DevShot.Log($"heavy probe: heavy swings={hSw} hits={hHit} ({100.0 * hHit / Math.Max(1, hSw):0}%) dmg/hit={hDmg / Math.Max(1, hHit):0.0} normal swings={nSw} hits={nHit} ({100.0 * nHit / Math.Max(1, nSw):0}%) dmg/hit={nDmg / Math.Max(1, nHit):0.0}");
|
||||
}
|
||||
|
||||
static string H(double s) => $"{s / 3600:0.00} h";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,12 +13,12 @@ namespace GladiatorIdle
|
||||
/// </summary>
|
||||
internal static partial class Playtest
|
||||
{
|
||||
const double HUB_TIME = 8, AUTO_TIME = 2;
|
||||
const double HUB_TIME = 8;
|
||||
|
||||
sealed class ArenaStats
|
||||
{
|
||||
public double Start;
|
||||
public int Fights, Wins, Losses, Autos, ChampTries;
|
||||
public int Fights, Wins, Losses, ChampTries;
|
||||
public readonly Dictionary<OfferKind, int> Picks = new();
|
||||
public double RatioSum; public int RatioN;
|
||||
public string Entry = "";
|
||||
@@ -29,12 +29,21 @@ namespace GladiatorIdle
|
||||
var gs = new GameState(seed: 1);
|
||||
var start = GameState.StartSkills(DevShot.Class).First().Id;
|
||||
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);
|
||||
double time = 0, nextReport = 1800;
|
||||
var st = new ArenaStats { Entry = OfferRatios(gs) };
|
||||
DevShot.Log($"arenatest: class={DevShot.Class} skill={DevShot.Skill} maxHours={DevShot.Hours}");
|
||||
DevShot.Log($"arena 0 offers: {st.Entry}");
|
||||
if (log) DevShot.Log($"arena 0 offers: {st.Entry}");
|
||||
|
||||
void Pass(double seconds)
|
||||
{
|
||||
@@ -42,10 +51,11 @@ namespace GladiatorIdle
|
||||
time += seconds;
|
||||
}
|
||||
|
||||
while (time < DevShot.Hours * 3600 && !gs.FreedomEarned)
|
||||
while (time < hours * 3600 && !gs.FreedomEarned)
|
||||
{
|
||||
ManageGear(gs);
|
||||
BuyCheapest(gs);
|
||||
if (gs.PendingEvent != null) gs.Choose(0);
|
||||
if (!gs.CanFight) { Pass(5); continue; } // Erholung abwarten
|
||||
|
||||
var offers = gs.Offers();
|
||||
@@ -55,33 +65,23 @@ namespace GladiatorIdle
|
||||
st.RatioSum += ratio; st.RatioN++;
|
||||
int arena = gs.Arena;
|
||||
|
||||
if (gs.CanAutoWin(pick) && pick.Kind != OfferKind.Hard)
|
||||
{
|
||||
gs.AutoWin(pick);
|
||||
st.Autos++; st.Wins++; st.Fights++;
|
||||
Pass(AUTO_TIME);
|
||||
}
|
||||
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++;
|
||||
}
|
||||
if (pick.Kind == OfferKind.Champion) st.ChampTries++;
|
||||
var (won, secs) = SimulateDuel(gs, pick.Enemy, rng, skill);
|
||||
Pass(secs + HUB_TIME);
|
||||
gs.ResolveFight(pick, won);
|
||||
st.Fights++;
|
||||
if (won) st.Wins++; else st.Losses++;
|
||||
gs.Events.Clear();
|
||||
|
||||
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) };
|
||||
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
|
||||
@@ -96,12 +96,12 @@ namespace GladiatorIdle
|
||||
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 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);
|
||||
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(); }
|
||||
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}"));
|
||||
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=[" +
|
||||
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}")) + "]");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user