import { RNG } from '../utils/RNG.js';

export class CombatAI {
  constructor(deck, cardManager, seed) {
    this.cardManager = cardManager;
    this.rng = new RNG(seed || Date.now());
    // Create instances
    this.commander = cardManager.createInstance(deck.commander);
    this.deckCards = deck.cards.map(id => cardManager.createInstance(id));
    this.rng.shuffle(this.deckCards);
    this.deckIndex = 0;
    this.hand = [];
  }

  drawCards(count = 1) {
    for (let i = 0; i < count; i++) {
      if (this.deckIndex < this.deckCards.length) {
        this.hand.push(this.deckCards[this.deckIndex++]);
      }
    }
  }

  getNextCard() {
    if (this.hand.length === 0) return null;
    return this.hand.shift();
  }
}
