Files
OAiP-Presnyakov_Ilya-Practi…/CheatSuspectAccount.cs
2026-02-17 06:46:24 +03:00

73 lines
2.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Practice6_Presnyakov
{
internal class CheatSuspectAccount : PlayerAccount
{
public int SuspicionScore { get; private set; }
public string DetectedCheatType { get; private set; }
public CheatSuspectAccount(string nickname, int level, int reputation)
: base(nickname, level, reputation)
{
SuspicionScore = 0;
DetectedCheatType = "None";
}
public override void PerformCheck()
{
int delta = 0;
if (Level > 50) delta += 15;
if (Reputation < 20) delta += 20;
SuspicionScore = Math.Min(100, SuspicionScore + delta);
if (SuspicionScore >= 60)
{
DetectedCheatType = "Aimbot / Macro";
} else if (SuspicionScore >= 30)
{
DetectedCheatType = "Suspicious behavior";
} else
{
DetectedCheatType = "None";
}
Console.WriteLine($"[CHECK] Anti-cheat проверка {Nickname}: SuspicionScore={SuspicionScore}, Type={DetectedCheatType}");
WriteLog($"Anti-cheat check: +{delta} suspicion, now {SuspicionScore}, type={DetectedCheatType}");
}
public override void ApplyPenalty()
{
if (SuspicionScore >= 80)
{
IsBanned = true;
Console.WriteLine($"[PENALTY] {Nickname}: аккаунт забанен. Причина: {DetectedCheatType}");
WriteLog("Penalty applied: BAN");
}
else
{
Reputation = Math.Max(0, Reputation - 25);
Console.WriteLine($"[PENALTY] {Nickname}: репутация жёстко снижена до {Reputation} (anti-cheat action)");
WriteLog("Penalty applied: reputation -25");
}
}
public new void ShowStatus()
{
Console.WriteLine($"[STATUS:anti-cheat] {Nickname}: Level={Level}, Rep={Reputation}, " +
$"Banned={IsBanned}, Suspicion={SuspicionScore}, CheatType={DetectedCheatType}");
}
public new void WriteLog(string msg)
{
Console.WriteLine($"[LOG:anti-cheat] {Nickname}: {msg}");
}
}
}