Nur was zum Bauen und Starten nötig ist: Mono/ (Spiel), Game/, Core/, Languages/, Assets/ (Bilder, Clips, 3D-Figuren, Ton), build-release.bat. Bauen: build-release.bat → Spiel\GladiatorIdle.exe Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
470 lines
23 KiB
C#
470 lines
23 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
|
||
namespace GladiatorIdle
|
||
{
|
||
public enum DuelState { Ready, Windup, Strike, Recover, Block, Dodge, Hit, Stunned, Down, Victory, Wall, Leap, Super }
|
||
public enum DuelEventType { Hit, Blocked, Parry, Dodged, GuardBreak, Special, Heal, Stun, Ko, Leap, Super, SuperReady }
|
||
|
||
/// Ereignis für Anzeige/Ton. ByPlayer: wer es ausgelöst hat (Treffer: der Angreifer).
|
||
internal readonly record struct DuelEvent(DuelEventType Type, bool ByPlayer, double Amount = 0, bool Crit = false);
|
||
|
||
/// <summary>Ein Kämpfer im Echtzeit-Duell (Seitenansicht, Design-Pixel auf der x-Achse).</summary>
|
||
internal sealed class DuelFighter
|
||
{
|
||
public bool IsPlayer;
|
||
public double X, MaxHp, Hp, Stamina = 100;
|
||
public int Facing = 1; // +1 nach rechts, −1 nach links
|
||
public DuelState State = DuelState.Ready;
|
||
public double StateTime; // seit wann im Zustand
|
||
public double Reach = 290 * Duel.SCALE, Speed = 440 * Duel.SCALE;
|
||
public double HitFraction; // Schaden je Treffer als Anteil des gegnerischen Lebens
|
||
public double Crit;
|
||
public double Windup = 0.12, StrikeTime = 0.10, RecoverTime = 0.28;
|
||
public double SpecialCooldown;
|
||
public double Slow, SicaHits; // Netz (langsamer), Sica (nächste Treffer kritisch)
|
||
public double BlockSince = -1; // Zeitpunkt, seit dem geblockt wird (für die Parade)
|
||
public double StunLeft;
|
||
public bool StruckThisSwing;
|
||
public bool Heavy; // gerade ein Schwerer Schlag
|
||
public double HeavyCd, WallCd, WallTime;
|
||
public double Invulnerable; // Bollwerk: kein Schaden, aber frei beweglich
|
||
public bool SecondWindUsed;
|
||
public double Rage; // Wut 0..100: voll → Super-Angriff
|
||
public double LeapCd;
|
||
public int SuperHits; // Hiebe der Super-Serie bisher
|
||
public double DmgMult = 1; // für den nächsten Treffer (Sprung, Super)
|
||
public bool Unblockable; // nächster Treffer geht durch Block und Parade
|
||
|
||
public bool Busy => State is DuelState.Windup or DuelState.Strike or DuelState.Recover or DuelState.Dodge
|
||
or DuelState.Hit or DuelState.Stunned or DuelState.Down or DuelState.Victory or DuelState.Wall
|
||
or DuelState.Leap or DuelState.Super;
|
||
public bool Alive => Hp > 0;
|
||
|
||
public void Set(DuelState s) { State = s; StateTime = 0; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// Echtzeit-Duell gegen einen Champion (oder ein Übungsduell): Bewegen, Schlag, Block (mit Parade
|
||
/// im letzten Moment), Ausweichen, Spezialschlag, Ausdauer. Schaden hängt vom Verhältnis der
|
||
/// Kampfkraft ab — Werte zählen, entschieden wird mit Geschick. Reine Logik, die Anzeige liest
|
||
/// Zustände und Ereignisse.
|
||
/// </summary>
|
||
internal sealed class Duel
|
||
{
|
||
public const double FLOOR_MIN = 160, FLOOR_MAX = 1760;
|
||
/// Maßstab der Kämpfer (0.6 = 60 % der früheren Größe): alle Abstände und Tempi wachsen mit,
|
||
/// damit Reichweite und Schwertlänge zusammenpassen und die Balance gleich bleibt.
|
||
public const double SCALE = 0.6;
|
||
const double GAP = 230 * SCALE;
|
||
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 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;
|
||
const double LEAP_AIR_FROM = 0.06, LEAP_AIR_TO = 0.46;
|
||
// Super-Angriff (R, volle Wut): Aufladen, dann drei Hiebe, die jeden Block durchbrechen
|
||
public const double SUPER_CHARGE = 0.6, SUPER_TIME = 2.0, SUPER_MULT = 1.25;
|
||
public static readonly double[] SUPER_HITS = { 0.85, 1.2, 1.6 };
|
||
const double RAGE_HIT = 9, RAGE_HURT = 8, RAGE_BLOCK = 6, RAGE_PARRY = 25;
|
||
|
||
public DuelFighter Player { get; }
|
||
public DuelFighter Enemy { get; }
|
||
public Special PlayerSpecial { get; }
|
||
public bool Over { get; private set; }
|
||
public bool PlayerWon { get; private set; }
|
||
public double Time { get; private set; }
|
||
public List<DuelEvent> Events { get; } = new();
|
||
|
||
// Eingaben des Spielers (von der Anzeige gesetzt)
|
||
public int MoveDir;
|
||
public bool BlockHeld;
|
||
bool _attack, _dodge, _special, _heavy, _wall, _leap, _super;
|
||
public void PressLeap() => _leap = true;
|
||
public void PressSuper() => _super = true;
|
||
public void PressHeavy() => _heavy = true;
|
||
public void PressWall() => _wall = true;
|
||
public void PressAttack() => _attack = true;
|
||
public void PressDodge() => _dodge = true;
|
||
public void PressSpecial() => _special = true;
|
||
|
||
readonly Random _rng;
|
||
readonly bool _champion;
|
||
readonly SkillPerks _perks;
|
||
public SkillPerks Perks => _perks;
|
||
public double SpecialCooldownTotal => SPECIAL_COOLDOWN + _perks.SpecialCdAdd;
|
||
double _thinkIn, _aiMove;
|
||
|
||
/// <param name="ratio">Kampfkraft Spieler / Gegner (1 = ausgeglichen)</param>
|
||
public Duel(double playerHp, double playerCrit, Special special, double enemyHp, double ratio, bool champion,
|
||
bool trident, Random rng, SkillPerks? perks = null)
|
||
{
|
||
_rng = rng;
|
||
_perks = perks ?? new SkillPerks();
|
||
_champion = champion;
|
||
PlayerSpecial = special;
|
||
double r = Math.Clamp(ratio, 0.05, 20);
|
||
Player = new DuelFighter
|
||
{
|
||
IsPlayer = true, X = 960 - 400 * SCALE, Facing = 1, MaxHp = playerHp, Hp = playerHp, Crit = playerCrit,
|
||
HitFraction = Math.Clamp(0.05 * Math.Pow(r, 0.35), 0.012, 0.25), Reach = ((trident ? 345 : 300) + _perks.ReachAdd) * SCALE,
|
||
Windup = 0.12 * _perks.WindupMult, Speed = 440 * _perks.SpeedMult * SCALE
|
||
};
|
||
Enemy = new DuelFighter
|
||
{
|
||
IsPlayer = false, X = 960 + 400 * SCALE, Facing = -1, MaxHp = enemyHp, Hp = enemyHp, Crit = 0.08,
|
||
HitFraction = Math.Clamp(Balance.DUEL_ENEMY_HIT * Math.Pow(r, -0.35), 0.02, 0.4),
|
||
Speed = (champion ? 350 : 320) * SCALE, Windup = champion ? 0.38 : 0.46, RecoverTime = champion ? 0.40 : 0.50
|
||
};
|
||
_thinkIn = 0.6;
|
||
}
|
||
|
||
public void Step(double dt)
|
||
{
|
||
if (Over) { Time += dt; Tick(Player, dt); Tick(Enemy, dt); return; }
|
||
Time += dt;
|
||
PlayerInput(dt);
|
||
EnemyAi(dt);
|
||
Tick(Player, dt);
|
||
Tick(Enemy, dt);
|
||
// immer einander zugewandt (außer beim Ausweichen/Schlagen)
|
||
if (!Player.Busy) Player.Facing = Enemy.X >= Player.X ? 1 : -1;
|
||
if (!Enemy.Busy) Enemy.Facing = Player.X >= Enemy.X ? 1 : -1;
|
||
_attack = _dodge = _special = _heavy = _wall = _leap = _super = false;
|
||
}
|
||
|
||
// ── Spieler ─────────────────────────────────────────────────
|
||
|
||
void PlayerInput(double dt)
|
||
{
|
||
var p = Player;
|
||
if (p.Busy && p.State != DuelState.Recover) return;
|
||
if (p.State == DuelState.Recover && p.StateTime < p.RecoverTime * 0.6) return; // Ende der Erholung: schon wieder handeln
|
||
|
||
if (_super && p.Rage >= 100)
|
||
{
|
||
p.Rage = 0; p.SuperHits = 0; p.Heavy = false;
|
||
p.Set(DuelState.Super);
|
||
Events.Add(new DuelEvent(DuelEventType.Super, true));
|
||
return;
|
||
}
|
||
if (_leap && p.LeapCd <= 0 && p.Stamina >= LEAP_COST)
|
||
{
|
||
p.Stamina -= LEAP_COST; p.LeapCd = LEAP_COOLDOWN;
|
||
p.StruckThisSwing = false; p.Heavy = false;
|
||
p.Set(DuelState.Leap);
|
||
Events.Add(new DuelEvent(DuelEventType.Leap, true));
|
||
return;
|
||
}
|
||
if (_special && p.SpecialCooldown <= 0) { DoSpecial(p, Enemy); return; }
|
||
if (_wall && _perks.ShieldWall && p.WallCd <= 0) { StartWall(p, WALL_TIME); p.WallCd = WALL_COOLDOWN; return; }
|
||
if (_heavy && _perks.HeavyStrike && p.HeavyCd <= 0 && p.Stamina >= HEAVY_COST)
|
||
{
|
||
p.Stamina -= HEAVY_COST;
|
||
p.HeavyCd = HEAVY_COOLDOWN;
|
||
p.StruckThisSwing = false;
|
||
p.Heavy = true;
|
||
p.Set(DuelState.Windup);
|
||
return;
|
||
}
|
||
double dodgeCost = DODGE_COST * _perks.DodgeCostMult;
|
||
if (_dodge && p.Stamina >= dodgeCost)
|
||
{
|
||
p.Stamina -= dodgeCost;
|
||
p.Set(DuelState.Dodge);
|
||
_dodgeDir = MoveDir != 0 ? MoveDir : -p.Facing;
|
||
return;
|
||
}
|
||
if (_attack && p.Stamina >= ATTACK_COST)
|
||
{
|
||
p.Stamina -= ATTACK_COST;
|
||
p.StruckThisSwing = false;
|
||
p.Heavy = false;
|
||
p.Set(DuelState.Windup);
|
||
return;
|
||
}
|
||
if (BlockHeld)
|
||
{
|
||
if (p.State != DuelState.Block) { p.Set(DuelState.Block); p.BlockSince = Time; }
|
||
return;
|
||
}
|
||
if (p.State == DuelState.Block) { p.Set(DuelState.Ready); p.BlockSince = -1; }
|
||
if (MoveDir != 0) Move(p, MoveDir * p.Speed * dt);
|
||
}
|
||
|
||
int _dodgeDir;
|
||
|
||
// ── Gegner-KI ───────────────────────────────────────────────
|
||
|
||
void EnemyAi(double dt)
|
||
{
|
||
var e = Enemy; var p = Player;
|
||
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;
|
||
|
||
// 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)
|
||
{
|
||
e.Set(DuelState.Block); e.BlockSince = Time;
|
||
return;
|
||
}
|
||
if (e.State == DuelState.Block)
|
||
{
|
||
if (e.StateTime > 0.5 + _rng.NextDouble() * 0.4) { e.Set(DuelState.Ready); e.BlockSince = -1; }
|
||
return;
|
||
}
|
||
|
||
_thinkIn -= dt;
|
||
if (_thinkIn <= 0)
|
||
{
|
||
_thinkIn = 0.12 + _rng.NextDouble() * 0.18;
|
||
if (e.Stamina < 25) _aiMove = -1; // erschöpft: zurückweichen
|
||
else if (dist > e.Reach * 0.9) _aiMove = 1; // heran
|
||
else if (dist < e.Reach * 0.45) _aiMove = -1; // zu nah
|
||
else _aiMove = _rng.NextDouble() < 0.2 ? (_rng.NextDouble() < 0.5 ? 1 : -1) : 0;
|
||
|
||
if (dist < e.Reach && e.Stamina >= ATTACK_COST && _rng.NextDouble() < (_champion ? 0.65 : 0.5))
|
||
{
|
||
e.Stamina -= ATTACK_COST;
|
||
e.StruckThisSwing = false;
|
||
e.Set(DuelState.Windup);
|
||
_feint = _champion && _rng.NextDouble() < 0.15; // Champions täuschen an
|
||
return;
|
||
}
|
||
}
|
||
int toward = p.X >= e.X ? 1 : -1;
|
||
if (_aiMove != 0) Move(e, _aiMove * toward * speed * dt);
|
||
}
|
||
|
||
bool _feint;
|
||
|
||
// ── Ablauf je Kämpfer ───────────────────────────────────────
|
||
|
||
void Tick(DuelFighter f, double dt)
|
||
{
|
||
f.StateTime += dt;
|
||
f.SpecialCooldown = Math.Max(0, f.SpecialCooldown - dt);
|
||
f.HeavyCd = Math.Max(0, f.HeavyCd - dt);
|
||
f.WallCd = Math.Max(0, f.WallCd - dt);
|
||
f.LeapCd = Math.Max(0, f.LeapCd - dt);
|
||
f.Invulnerable = Math.Max(0, f.Invulnerable - dt);
|
||
f.Slow = Math.Max(0, f.Slow - dt);
|
||
double regen = (f.State == DuelState.Block ? REGEN_BLOCKING : REGEN) * (f.IsPlayer ? _perks.RegenMult : 1);
|
||
if (!f.Busy) f.Stamina = Math.Min(100, f.Stamina + regen * dt);
|
||
if (f.IsPlayer) f.Stamina = Math.Max(f.Stamina, _perks.StaminaFloor);
|
||
var other = f.IsPlayer ? Enemy : Player;
|
||
double windup = (f.Heavy ? HEAVY_WINDUP * _perks.WindupMult : f.Windup) * (f.Slow > 0 ? 1.6 : 1);
|
||
|
||
switch (f.State)
|
||
{
|
||
case DuelState.Windup:
|
||
if (!f.IsPlayer && _feint && f.StateTime > windup * 0.6) { _feint = false; f.Set(DuelState.Ready); break; }
|
||
if (f.StateTime >= windup) f.Set(DuelState.Strike);
|
||
break;
|
||
case DuelState.Strike:
|
||
if (!f.StruckThisSwing) { f.StruckThisSwing = true; TryHit(f, other); }
|
||
if (f.StateTime >= f.StrikeTime) f.Set(DuelState.Recover);
|
||
break;
|
||
case DuelState.Recover:
|
||
if (f.StateTime >= f.RecoverTime) { f.Heavy = false; f.Set(DuelState.Ready); }
|
||
break;
|
||
case DuelState.Dodge:
|
||
Move(f, _dodgeDir * DODGE_DIST / DODGE_TIME * dt);
|
||
if (f.StateTime >= DODGE_TIME) f.Set(DuelState.Ready);
|
||
break;
|
||
case DuelState.Hit:
|
||
if (f.StateTime >= HIT_TIME) f.Set(DuelState.Ready);
|
||
break;
|
||
case DuelState.Stunned:
|
||
if (f.StateTime >= f.StunLeft) f.Set(DuelState.Ready);
|
||
break;
|
||
case DuelState.Wall:
|
||
if (f.StateTime >= f.WallTime) f.Set(DuelState.Ready);
|
||
break;
|
||
case DuelState.Leap:
|
||
if (f.StateTime < LEAP_HIT) Move(f, f.Facing * LEAP_DIST / LEAP_HIT * dt);
|
||
else if (!f.StruckThisSwing)
|
||
{
|
||
f.StruckThisSwing = true;
|
||
f.DmgMult = LEAP_MULT;
|
||
TryHit(f, other);
|
||
f.DmgMult = 1;
|
||
}
|
||
if (f.StateTime >= LEAP_TIME) f.Set(DuelState.Recover);
|
||
break;
|
||
case DuelState.Super:
|
||
if (f.SuperHits < SUPER_HITS.Length && f.StateTime >= SUPER_HITS[f.SuperHits])
|
||
{
|
||
// nachsetzen, falls der Gegner zurückgewichen ist
|
||
double gap = Math.Abs(other.X - f.X) - f.Reach * 0.75;
|
||
if (gap > 0) Move(f, f.Facing * Math.Min(gap, 160 * SCALE));
|
||
f.SuperHits++;
|
||
f.DmgMult = SUPER_MULT; f.Unblockable = true;
|
||
TryHit(f, other);
|
||
f.DmgMult = 1; f.Unblockable = false;
|
||
}
|
||
if (f.StateTime >= SUPER_TIME) f.Set(DuelState.Recover);
|
||
break;
|
||
}
|
||
}
|
||
|
||
void Move(DuelFighter f, double dx)
|
||
{
|
||
var other = f.IsPlayer ? Enemy : Player;
|
||
double nx = Math.Clamp(f.X + dx, FLOOR_MIN, FLOOR_MAX);
|
||
// nicht durcheinander hindurch (Mindestabstand)
|
||
if (Math.Abs(nx - other.X) < GAP && Math.Abs(nx - other.X) < Math.Abs(f.X - other.X)) return;
|
||
f.X = nx;
|
||
}
|
||
|
||
void TryHit(DuelFighter a, DuelFighter d)
|
||
{
|
||
double dist = Math.Abs(d.X - a.X);
|
||
bool inFront = Math.Sign(d.X - a.X) == a.Facing || dist < 80 * SCALE;
|
||
if (dist > a.Reach || !inFront || Over) return;
|
||
if (d.State == DuelState.Dodge) { Events.Add(new DuelEvent(DuelEventType.Dodged, d.IsPlayer)); return; }
|
||
// in der Luft (Sprungangriff) trifft nichts
|
||
if (d.State == DuelState.Leap && d.StateTime >= LEAP_AIR_FROM && d.StateTime <= LEAP_AIR_TO)
|
||
{ Events.Add(new DuelEvent(DuelEventType.Dodged, d.IsPlayer)); return; }
|
||
// Super-Angriff: nicht zu unterbrechen
|
||
if (d.State == DuelState.Super) { Events.Add(new DuelEvent(DuelEventType.Blocked, d.IsPlayer)); return; }
|
||
|
||
if (d.State == DuelState.Wall || d.Invulnerable > 0) { Events.Add(new DuelEvent(DuelEventType.Blocked, d.IsPlayer)); return; }
|
||
bool crit = a.SicaHits > 0 || _rng.NextDouble() < a.Crit;
|
||
if (a.SicaHits > 0) a.SicaHits--;
|
||
double critMult = a.IsPlayer ? _perks.CritMult : Balance.CRIT_MULT;
|
||
double dmg = a.HitFraction * d.MaxHp * (0.9 + 0.2 * _rng.NextDouble()) * (crit ? critMult : 1) * a.DmgMult;
|
||
if (a.IsPlayer && d.Hp < d.MaxHp * 0.3) dmg *= 1 + _perks.Execute; // Gnadenstoß
|
||
if (a.Heavy)
|
||
{
|
||
dmg *= HEAVY_MULT;
|
||
if (d.State == DuelState.Block)
|
||
{
|
||
// Schwerer Schlag durchbricht jeden Block
|
||
d.StunLeft = 0.6; d.Set(DuelState.Stunned);
|
||
Events.Add(new DuelEvent(DuelEventType.GuardBreak, a.IsPlayer));
|
||
Damage(a, d, dmg, crit);
|
||
return;
|
||
}
|
||
}
|
||
|
||
double parryWindow = PARRY_WINDOW + (d.IsPlayer ? _perks.ParryBonus : 0);
|
||
if (a.Unblockable && d.State == DuelState.Block)
|
||
{
|
||
Events.Add(new DuelEvent(DuelEventType.GuardBreak, a.IsPlayer));
|
||
d.BlockSince = -1;
|
||
}
|
||
else if (d.State == DuelState.Block && Math.Sign(a.X - d.X) == d.Facing)
|
||
{
|
||
// Parade: Block erst kurz vor dem Treffer gehoben → Angreifer betäubt, kein Schaden
|
||
if (d.BlockSince >= 0 && Time - d.BlockSince <= parryWindow)
|
||
{
|
||
a.StunLeft = PARRY_STUN; a.Set(DuelState.Stunned);
|
||
Events.Add(new DuelEvent(DuelEventType.Parry, d.IsPlayer));
|
||
AddRage(d, RAGE_PARRY);
|
||
// Riposte: sofortiger kritischer Gegenschlag
|
||
Damage(d, a, d.HitFraction * a.MaxHp * Balance.CRIT_MULT, true);
|
||
return;
|
||
}
|
||
d.Stamina -= BLOCK_HIT_COST * (d.IsPlayer ? _perks.BlockCostMult : 1);
|
||
if (d.Stamina <= 0)
|
||
{
|
||
d.Stamina = 0; d.StunLeft = 0.6; d.Set(DuelState.Stunned);
|
||
Events.Add(new DuelEvent(DuelEventType.GuardBreak, a.IsPlayer));
|
||
Damage(a, d, dmg * 0.5, false);
|
||
return;
|
||
}
|
||
Events.Add(new DuelEvent(DuelEventType.Blocked, d.IsPlayer));
|
||
AddRage(d, RAGE_BLOCK);
|
||
Damage(a, d, dmg * 0.05, false, silent: true);
|
||
return;
|
||
}
|
||
Damage(a, d, dmg, crit);
|
||
if (d.Alive) d.Set(DuelState.Hit);
|
||
}
|
||
|
||
void Damage(DuelFighter a, DuelFighter d, double dmg, bool crit, bool silent = false)
|
||
{
|
||
d.Hp = Math.Max(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)
|
||
{
|
||
d.SecondWindUsed = true;
|
||
double heal = d.MaxHp * _perks.SecondWind;
|
||
d.Hp += heal;
|
||
Events.Add(new DuelEvent(DuelEventType.Heal, true, heal));
|
||
}
|
||
if (d.Hp <= 0 && !Over)
|
||
{
|
||
Over = true;
|
||
PlayerWon = a.IsPlayer;
|
||
d.Set(DuelState.Down);
|
||
a.Set(DuelState.Victory);
|
||
Events.Add(new DuelEvent(DuelEventType.Ko, a.IsPlayer));
|
||
}
|
||
}
|
||
|
||
void DoSpecial(DuelFighter f, DuelFighter other)
|
||
{
|
||
f.SpecialCooldown = SpecialCooldownTotal;
|
||
Events.Add(new DuelEvent(DuelEventType.Special, true));
|
||
double dist = Math.Abs(other.X - f.X);
|
||
switch (PlayerSpecial)
|
||
{
|
||
case Special.ShieldBash:
|
||
if (dist <= f.Reach * 1.2)
|
||
{
|
||
other.StunLeft = 1.4 + _perks.StunAdd; other.Set(DuelState.Stunned);
|
||
Damage(f, other, f.HitFraction * other.MaxHp * 0.5, false);
|
||
Events.Add(new DuelEvent(DuelEventType.Stun, true));
|
||
}
|
||
if (_perks.BulwarkTime > 0) f.Invulnerable = _perks.BulwarkTime; // Bollwerk
|
||
break;
|
||
case Special.Net:
|
||
if (dist <= f.Reach * 1.8 * _perks.NetRangeMult)
|
||
{
|
||
other.Slow = 3.5 + _perks.NetSlowAdd;
|
||
if (_perks.NetStun > 0) { other.StunLeft = _perks.NetStun; other.Set(DuelState.Stunned); }
|
||
Events.Add(new DuelEvent(DuelEventType.Stun, true));
|
||
}
|
||
break;
|
||
case Special.Sica:
|
||
f.SicaHits = 3 + _perks.SicaExtra;
|
||
break;
|
||
case Special.Endure:
|
||
double heal = Math.Min(f.MaxHp - f.Hp, f.MaxHp * (0.3 + _perks.HealAdd));
|
||
f.Hp += heal;
|
||
Events.Add(new DuelEvent(DuelEventType.Heal, true, heal));
|
||
break;
|
||
}
|
||
}
|
||
|
||
/// Wut sammeln (nur der Spieler hat einen Super-Angriff); einmal melden, wenn sie voll ist.
|
||
void AddRage(DuelFighter f, double amount)
|
||
{
|
||
if (!f.IsPlayer || f.Rage >= 100) return;
|
||
f.Rage = Math.Min(100, f.Rage + amount);
|
||
if (f.Rage >= 100) Events.Add(new DuelEvent(DuelEventType.SuperReady, true));
|
||
}
|
||
|
||
void StartWall(DuelFighter f, double seconds)
|
||
{
|
||
f.WallTime = seconds;
|
||
f.Set(DuelState.Wall);
|
||
Events.Add(new DuelEvent(DuelEventType.Special, f.IsPlayer));
|
||
}
|
||
|
||
/// Aufgeben (Pause → Aufgeben): zählt als Niederlage.
|
||
public void Surrender()
|
||
{
|
||
if (Over) return;
|
||
Over = true; PlayerWon = false;
|
||
Player.Set(DuelState.Down); Enemy.Set(DuelState.Victory);
|
||
}
|
||
}
|
||
}
|