AI human mode

This commit is contained in:
Michal Vrba
2026-09-03 21:11:25 +02:00
parent 035da18584
commit 9005b4b9be
8 changed files with 1220 additions and 247 deletions
+45
View File
@@ -431,4 +431,49 @@ public class GameEngineTests
// When facing penalty and disabled, Green Under Knave cannot be played
Assert.False(ActionValidator.CanPlayCard(greenUnderKnave, topSeven, null, 3, false, rules));
}
[Fact]
public void AIDialogueService_ReturnsAppropriateDialogues()
{
var easyAI = new Player("AI Easy", PlayerType.AI, "🦊", AIDifficulty.Easy);
var hardAI = new Player("AI Hard", PlayerType.AI, "🤖", AIDifficulty.Hard);
var state = new GameState();
easyAI.Hand.Add(new Card(Suit.Hearts, Rank.Eight));
easyAI.Hand.Add(new Card(Suit.Hearts, Rank.Nine));
// Thinking dialogue for easy AI
var easyThought = AIDialogueService.GetThinkingDialogue(easyAI, state);
Assert.False(string.IsNullOrWhiteSpace(easyThought));
// Thinking dialogue for hard AI
var hardThought = AIDialogueService.GetThinkingDialogue(hardAI, state);
Assert.False(string.IsNullOrWhiteSpace(hardThought));
// Event reactions
var freezeEvent = new GameEvent(GameEventType.AceSkipped, easyAI);
var freezeReaction = AIDialogueService.GetEventReaction(freezeEvent, easyAI);
Assert.False(string.IsNullOrWhiteSpace(freezeReaction));
var penaltyEvent = new GameEvent(GameEventType.SevenStacked, null, TargetPlayer: easyAI, ExtraData: 6);
var penaltyReaction = AIDialogueService.GetEventReaction(penaltyEvent, easyAI);
Assert.False(string.IsNullOrWhiteSpace(penaltyReaction));
var cancelEvent = new GameEvent(GameEventType.SevenCanceled, easyAI);
var cancelReaction = AIDialogueService.GetEventReaction(cancelEvent, easyAI);
Assert.False(string.IsNullOrWhiteSpace(cancelReaction));
// Card jokes
var multiDrawJoke = AIDialogueService.GetContextualJoke(GameEventType.SevenStacked, 12, 10);
Assert.NotNull(multiDrawJoke);
Assert.False(string.IsNullOrWhiteSpace(multiDrawJoke.Punchline));
var burnJoke = AIDialogueService.GetContextualJoke(GameEventType.CardsBurned, 0, 10);
Assert.NotNull(burnJoke);
Assert.False(string.IsNullOrWhiteSpace(burnJoke.Setup));
var longGameJoke = AIDialogueService.GetContextualJoke(null, 0, 32);
Assert.NotNull(longGameJoke);
Assert.False(string.IsNullOrWhiteSpace(longGameJoke.Punchline));
}
}