Files
2026-09-04 11:31:52 +02:00

94 lines
2.6 KiB
C#

namespace Faraon.Core.Models;
using Faraon.Core.AI;
public enum PlayerType
{
Human = 0,
AI = 1
}
public enum AIDifficulty
{
Easy = 0,
Medium = 1,
Hard = 2
}
public class Player
{
public string Id { get; init; } = Guid.NewGuid().ToString("N");
public string Name { get; set; } = "Hráč";
public PlayerType Type { get; set; } = PlayerType.Human;
public AIDifficulty Difficulty { get; set; } = AIDifficulty.Medium;
public string Avatar { get; set; } = "👑";
public string? PersonalityId { get; set; }
public PlayerEmotion CurrentEmotion { get; set; } = PlayerEmotion.Neutral;
public List<Card> Hand { get; } = new();
public int? FinishedPosition { get; set; }
public bool HasFinished => FinishedPosition.HasValue;
public bool IsSkipped { get; set; }
/// <summary>
/// Počet kariet do ruky v Olympijskom režime (kto prehrá kolo, klesá o 1).
/// </summary>
public int OlympicCardsCount { get; set; } = 5;
/// <summary>
/// Či je hráč vyradený z Olympijského turnaja.
/// </summary>
public bool IsEliminated => OlympicCardsCount <= 0;
public Player() { }
public Player(string name, PlayerType type, string avatar = "👤", AIDifficulty difficulty = AIDifficulty.Medium, string? personalityId = null)
{
Name = name;
Type = type;
Avatar = avatar;
Difficulty = difficulty;
PersonalityId = personalityId;
if (type == PlayerType.AI && string.IsNullOrEmpty(PersonalityId))
{
var pers = AIPersonality.All.FirstOrDefault(a => a.BaseAvatar == avatar);
PersonalityId = pers?.Id ?? "fox";
}
}
public string GetLiveAvatar()
{
if (Type == PlayerType.AI && !string.IsNullOrEmpty(PersonalityId))
{
var p = AIPersonality.GetById(PersonalityId);
return p.GetAvatarForEmotion(CurrentEmotion);
}
return Avatar;
}
public string? GetEmotionBadge()
{
return CurrentEmotion switch
{
PlayerEmotion.Thinking => "💡",
PlayerEmotion.Confident => "✨",
PlayerEmotion.Shocked => "💧",
PlayerEmotion.Freezing => "❄️",
PlayerEmotion.Angry => "🔥",
PlayerEmotion.Relieved => "🍀",
PlayerEmotion.Desperate => "💀",
PlayerEmotion.Celebrating => "🎉",
_ => null
};
}
public void Reset()
{
Hand.Clear();
FinishedPosition = null;
IsSkipped = false;
CurrentEmotion = PlayerEmotion.Neutral;
}
}