Files
GladiatorIdle/Game/Skills.cs

99 lines
5.1 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Linq;
namespace GladiatorIdle
{
public enum SkillBranch { Offense, Defense, Class }
/// <summary>
/// Fähigkeit im Baum: Zweig, Stufe (0–3, braucht 2 × Stufe Punkte im Zweig), Ränge.
/// Klassen-Fähigkeiten gehören zu genau einer Klasse. Active = neue Taste im Echtzeit-Kampf.
/// </summary>
internal sealed record SkillDef(string Id, SkillBranch Branch, int Tier, int MaxRank, GladiatorClass? Class = null, bool Active = false)
{
public string Key => "skill." + Id;
public string Desc => "skill." + Id + ".desc";
public string Icon => "skill_" + Id;
public static readonly SkillDef[] All =
{
new("power", SkillBranch.Offense, 0, 3),
new("heavystrike", SkillBranch.Offense, 1, 1, Active: true),
new("frenzy", SkillBranch.Offense, 2, 3),
new("execute", SkillBranch.Offense, 3, 1),
new("toughness", SkillBranch.Defense, 0, 3),
new("shieldwall", SkillBranch.Defense, 1, 1, Active: true),
new("steadfast", SkillBranch.Defense, 2, 3),
new("secondwind", SkillBranch.Defense, 3, 1),
new("shieldmaster", SkillBranch.Class, 0, 3, GladiatorClass.Murmillo),
new("shieldbash2", SkillBranch.Class, 1, 1, GladiatorClass.Murmillo),
new("unbending", SkillBranch.Class, 2, 2, GladiatorClass.Murmillo),
new("bulwark", SkillBranch.Class, 3, 1, GladiatorClass.Murmillo),
new("fleetfoot", SkillBranch.Class, 0, 3, GladiatorClass.Retiarius),
new("widenet", SkillBranch.Class, 1, 1, GladiatorClass.Retiarius),
new("tridentmaster", SkillBranch.Class, 2, 2, GladiatorClass.Retiarius),
new("ensnared", SkillBranch.Class, 3, 1, GladiatorClass.Retiarius),
new("sharpsica", SkillBranch.Class, 0, 3, GladiatorClass.Thraex),
new("sicawhirl", SkillBranch.Class, 1, 1, GladiatorClass.Thraex),
new("precision", SkillBranch.Class, 2, 2, GladiatorClass.Thraex),
new("quickblade", SkillBranch.Class, 3, 1, GladiatorClass.Thraex),
new("tough", SkillBranch.Class, 0, 3, GladiatorClass.Secutor),
new("endure2", SkillBranch.Class, 1, 1, GladiatorClass.Secutor),
new("pursuer", SkillBranch.Class, 2, 2, GladiatorClass.Secutor),
new("tireless", SkillBranch.Class, 3, 1, GladiatorClass.Secutor),
};
public static IEnumerable<SkillDef> For(GladiatorClass c) => All.Where(s => s.Class == null || s.Class == c);
public static SkillDef Get(string id) => All.First(s => s.Id == id);
/// Punkte, die im Zweig schon ausgegeben sein müssen, um diese Stufe zu lernen.
public int Requires => 2 * Tier;
}
/// <summary>Was die gelernten Fähigkeiten zusammen bewirken (Idle-Kampf und Echtzeit-Duell).</summary>
internal sealed class SkillPerks
{
// überall
public double DmgMult = 1, HpMult = 1, CritAdd, CritMult = Balance.CRIT_MULT, TakenMult = 1, BlockAdd, AgiAdd;
public double Execute, SecondWind, RecoveryMult = 1;
// Echtzeit-Duell
public bool HeavyStrike, ShieldWall;
public double ParryBonus, BlockCostMult = 1, DodgeCostMult = 1, ReachAdd, WindupMult = 1, SpeedMult = 1, RegenMult = 1;
public double StaminaFloor, SpecialCdAdd, StunAdd, HealAdd, NetRangeMult = 1, NetSlowAdd, NetStun, SicaExtra, BulwarkTime;
public static SkillPerks From(Func<string, int> rank)
{
var p = new SkillPerks();
int r;
p.DmgMult *= 1 + 0.06 * rank("power");
p.HeavyStrike = rank("heavystrike") > 0;
p.CritAdd += 0.03 * rank("frenzy");
if (rank("execute") > 0) p.Execute = 0.25;
p.HpMult *= 1 + 0.07 * rank("toughness");
p.ShieldWall = rank("shieldwall") > 0;
r = rank("steadfast"); p.TakenMult *= 1 - 0.04 * r; p.BlockCostMult *= 1 - 0.2 * r;
if (rank("secondwind") > 0) p.SecondWind = 0.15;
r = rank("shieldmaster"); p.BlockAdd += 3 * r; p.ParryBonus += 0.04 * r;
if (rank("shieldbash2") > 0) { p.StunAdd += 0.6; p.SpecialCdAdd -= 3; }
p.HpMult *= 1 + 0.12 * rank("unbending");
if (rank("bulwark") > 0) p.BulwarkTime = 3;
r = rank("fleetfoot"); p.AgiAdd += 3 * r; p.DodgeCostMult *= 1 - 0.2 * r;
if (rank("widenet") > 0) { p.NetRangeMult = 1.5; p.NetSlowAdd = 1.5; }
r = rank("tridentmaster"); p.ReachAdd += 40 * r; p.DmgMult *= 1 + 0.08 * r;
if (rank("ensnared") > 0) p.NetStun = 1.0;
p.CritAdd += 0.05 * rank("sharpsica");
if (rank("sicawhirl") > 0) p.SicaExtra = 2;
p.CritMult += 0.3 * rank("precision");
if (rank("quickblade") > 0) p.WindupMult = 0.7;
p.HpMult *= 1 + 0.08 * rank("tough");
if (rank("endure2") > 0) { p.HealAdd += 0.15; p.SpecialCdAdd -= 3; }
r = rank("pursuer"); p.SpeedMult *= 1 + 0.15 * r; p.RegenMult *= 1 + 0.2 * r;
if (rank("tireless") > 0) { p.StaminaFloor = 20; p.RecoveryMult *= 0.7; }
return p;
}
}
}