improvfmeents
This commit is contained in:
@@ -40,4 +40,7 @@ public class GameState
|
||||
|
||||
public int ActivePlayersCount => Players.Where(p => !p.IsEliminated).Count(p => !p.HasFinished);
|
||||
public List<Player> ActiveTournamentPlayers => Players.Where(p => !p.IsEliminated).ToList();
|
||||
|
||||
public GameMatchStats Stats { get; set; } = new();
|
||||
public List<GameLogItem> MoveLog { get; set; } = new();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
namespace Faraon.Core.Models;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public record GameLogItem(
|
||||
string Icon,
|
||||
string Text,
|
||||
string? SubText,
|
||||
DateTime Time,
|
||||
string? PlayerName = null,
|
||||
string? PlayerAvatar = null,
|
||||
string? AccentColor = null
|
||||
);
|
||||
|
||||
public class GameMatchStats
|
||||
{
|
||||
public DateTime StartTime { get; set; } = DateTime.UtcNow;
|
||||
public DateTime? EndTime { get; set; }
|
||||
public TimeSpan Duration => (EndTime ?? DateTime.UtcNow) - StartTime;
|
||||
public int TotalTurns { get; set; }
|
||||
public int TotalAcesPlayed { get; set; }
|
||||
public int TotalSevensPlayed { get; set; }
|
||||
public int TotalCardsBurned { get; set; }
|
||||
public int MaxPenaltyDrawnInOneTurn { get; set; }
|
||||
public string? MaxPenaltyPlayerName { get; set; }
|
||||
|
||||
public Dictionary<string, int> CardsPlayedPerPlayer { get; } = new();
|
||||
public Dictionary<string, int> CardsDrawnPerPlayer { get; } = new();
|
||||
public Dictionary<string, int> BurnsPerPlayer { get; } = new();
|
||||
|
||||
public void RecordCardPlayed(Player player, int count = 1)
|
||||
{
|
||||
CardsPlayedPerPlayer[player.Name] = CardsPlayedPerPlayer.GetValueOrDefault(player.Name) + count;
|
||||
}
|
||||
|
||||
public void RecordCardDrawn(Player player, int count = 1)
|
||||
{
|
||||
CardsDrawnPerPlayer[player.Name] = CardsDrawnPerPlayer.GetValueOrDefault(player.Name) + count;
|
||||
if (count > MaxPenaltyDrawnInOneTurn)
|
||||
{
|
||||
MaxPenaltyDrawnInOneTurn = count;
|
||||
MaxPenaltyPlayerName = player.Name;
|
||||
}
|
||||
}
|
||||
|
||||
public void RecordBurn(Player player)
|
||||
{
|
||||
TotalCardsBurned += 4;
|
||||
BurnsPerPlayer[player.Name] = BurnsPerPlayer.GetValueOrDefault(player.Name) + 1;
|
||||
}
|
||||
|
||||
public string GetMvpPlayerName()
|
||||
{
|
||||
string best = "Nikto";
|
||||
int bestScore = -999;
|
||||
foreach (var (name, played) in CardsPlayedPerPlayer)
|
||||
{
|
||||
int burns = BurnsPerPlayer.GetValueOrDefault(name);
|
||||
int drawn = CardsDrawnPerPlayer.GetValueOrDefault(name);
|
||||
int score = (played * 2) + (burns * 10) - drawn;
|
||||
if (score > bestScore)
|
||||
{
|
||||
bestScore = score;
|
||||
best = name;
|
||||
}
|
||||
}
|
||||
return best;
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,11 @@ public class Player
|
||||
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()
|
||||
|
||||
@@ -14,8 +14,20 @@ public enum GreenUnderKnaveMode
|
||||
UniversalWildcard // Ruší sedmy, ide na čokoľvek a súper naňho môže dať čokoľvek
|
||||
}
|
||||
|
||||
public enum TableTheme
|
||||
{
|
||||
ClassicGreen = 0,
|
||||
RoyalBurgundy = 1,
|
||||
WoodCabin = 2,
|
||||
CyberNeon = 3
|
||||
}
|
||||
|
||||
public class RuleOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Vizuálna téma a atmosféra herného stola.
|
||||
/// </summary>
|
||||
public TableTheme TableTheme { get; set; } = TableTheme.ClassicGreen;
|
||||
/// <summary>
|
||||
/// Počet kariet rozdaných každému hráčovi na začiatku (zvyčajne 4 alebo 5).
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user