Class DraftLogic

java.lang.Object
com.hiddenswitch.spellsource.draft.DraftLogic

public class DraftLogic extends Object
Implements a basic draft where the user is given a selection of champions from all DeckFormat.spellsource() champions, and 30 rounds of 3-card choices pulled from a weighted selection of DeckFormat.spellsource() catalogue cards.
  • Field Details

    • CARDS_PER_ROUND

      public static int CARDS_PER_ROUND
      The number of cards per round the player will choose from.
    • ROUNDS

      public static int ROUNDS
      Indicates the number of rounds of choices the user will make among CARDS_PER_ROUND options to build a deck for a draft.
  • Constructor Details

    • DraftLogic

      public DraftLogic(DraftContext context)
      Creates an instance associated weakly with the specified context.

      As a side effect, this will initialize the context's PrivateDraftState if it is null.

      Parameters:
      context -
  • Method Details

    • initializeDraft

      public void initializeDraft()
      Begins a draft, initializing the PublicDraftState on the context and notifying the behaviour that the state has changed.
    • startDraft

      public void startDraft(String heroClass)
      Starts the draft given the choice of the specified hero class.
      Parameters:
      heroClass -
    • requireDraftStatus

      protected void requireDraftStatus(DraftStatus requiredStatus)
    • selectCard

      public void selectCard(int choiceIndex)
      Selects a card from teh current choice index.
      Parameters:
      choiceIndex -
      Throws:
      InvalidDraftCardSelectionException - if the choice does not exist or the state is invalid.
    • isDraftOver

      public boolean isDraftOver()
      Is the draft over?
      Returns:
      true if the number of cards remaining is equal to 0.
    • getContext

      public DraftContext getContext()
      Gets a reference to the draft context. Held weakly by this instance.
      Returns:
    • getCardChoices

      public List<String> getCardChoices()
      Gets a list of card choices currently available to the player.
      Returns:
      The choices, or Collections.emptyList() if there are none.