package com.ghost.technic.server.card;

import com.ghost.technic.server.card.effect.impl.MurmookAbility;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import com.ghost.technic.server.Player;
import com.ghost.technic.server.board.Flank;
import com.ghost.technic.server.card.playable.usable.impl.CreatureCard;
import com.ghost.technic.server.game.GameActionService;
import com.ghost.technic.server.game.GameState;
import com.ghost.technic.server.game.event.EventBus;

import java.util.List;

import static org.junit.jupiter.api.Assertions.assertEquals;

class MurmookTest {

    GameActionService actionService;
    GameState gameState;
    Player alice;
    Player bob;

    @BeforeEach
    void setup() {
        gameState = new GameState(new EventBus());
        actionService = new GameActionService(gameState);
        alice = Player.builder().name("Alice").build();
        bob = Player.builder().name("Bob").build();
        gameState.setPlayers(alice, bob);
    }

    @Test
    void testMurmookIncreasesOpponentKeyCost() {
        CreatureCard murmook = CreatureCard.builder()
                .name("Murmook")
                .power(3)
                .armor(0)
                .abilities(List.of(new MurmookAbility()))
                .build();

        gameState.setOwner(murmook, alice);
        actionService.playCreature(alice, murmook, Flank.LEFT);

        assertEquals(1, actionService.calculateKeyCostModifier(bob), "Bob's key cost should be +1");
        assertEquals(0, actionService.calculateKeyCostModifier(alice), "Alice's key cost should be unaffected");
    }
}
