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

Stand von main 20cd8ba2.

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

View File

@@ -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;
}