Safe Haskell | None |
---|
- has :: PlayerId -> Card -> Dominion Bool
- coinValue :: Card -> Int
- getRound :: Dominion Int
- handValue :: PlayerId -> Dominion Int
- pileEmpty :: Card -> Dominion Bool
- getCard :: Card -> Dominion (Maybe Card)
- log :: PlayerId -> String -> Dominion ()
- log_ :: String -> Dominion ()
- gameOver :: [Card] -> Bool
- drawFromDeck :: PlayerId -> Int -> Dominion [Card]
- modifyPlayer :: PlayerId -> (Player -> Player) -> Dominion ()
- modifyOtherPlayers :: PlayerId -> (Player -> Player) -> Dominion ()
- setupForTurn :: PlayerId -> Dominion ()
- playTurn :: PlayerId -> Strategy -> Dominion ()
- game :: [Strategy] -> Dominion ()
- run :: GameState -> [Strategy] -> IO Result
- returnResults :: GameState -> IO Result
- isAction :: Card -> Bool
- isAttack :: Card -> Bool
- isReaction :: Card -> Bool
- isTreasure :: Card -> Bool
- isVictory :: Card -> Bool
- countPoints :: Player -> Int
- getPlayer :: PlayerId -> Dominion Player
- cardsOf :: Int -> a -> [a]
- pileOf :: a -> [a]
- eitherToBool :: Either String () -> Bool
- shuffleDeck :: PlayerId -> Dominion ()
- shuffleDeck_ :: Player -> Player
- drawFromFull :: PlayerId -> Int -> Dominion [Card]
- validateBuy :: PlayerId -> Card -> Dominion (PlayResult ())
- validatePlay :: PlayerId -> Card -> Dominion (PlayResult ())
- discardHand :: PlayerId -> Dominion ()
- findIteration :: [Option] -> Maybe Int
- findLog :: [Option] -> Maybe Bool
- findCards :: [Option] -> Maybe [Card]
- drawsUntil :: PlayerId -> ([Card] -> Dominion Bool) -> Dominion [Card]
- drawsUntil_ :: [Card] -> PlayerId -> ([Card] -> Dominion Bool) -> Dominion [Card]
- trashThisCard :: Card -> Bool
- trashesCard :: PlayerId -> Card -> Dominion ()
- discardsCard :: PlayerId -> Card -> Dominion ()
- returnsCard :: PlayerId -> Card -> Dominion ()
- discardTopCard :: [Card] -> Player -> Player
- returnVPCard :: Player -> Player
- discardsTo :: Player -> Int -> Player
- usesEffect :: PlayerId -> CardEffect -> Dominion (Maybe Followup)
- makePlayer :: String -> Player
- gainCardUpTo :: PlayerId -> Int -> Card -> Dominion (PlayResult (Maybe [Followup]))
Documentation
Note: You shouldn't need to import this module...the interesting functions are re-exported by the Dominion module.
Use any other functions in here at your own risk.
has :: PlayerId -> Card -> Dominion BoolSource
see if a player has a card in his hand.
hasCard <- playerId `has` chapel
handValue :: PlayerId -> Dominion IntSource
How much money this player's hand is worth (also counts any money you get from action cards, like +1 from market).
getCard :: Card -> Dominion (Maybe Card)Source
Returns the card, or Nothing if that pile is empty. Useful because it automatically checks whether the pile is empty, and modifies state to subtract a card from the pile correctly.
drawFromDeck :: PlayerId -> Int -> Dominion [Card]Source
Given a player id and a number of cards to draw, draws that many cards from the deck, shuffling if necessary. TODO if the deck doesn't have enough cards, we should draw the cards in the deck before shuffling and drawing the rest.
modifyOtherPlayers :: PlayerId -> (Player -> Player) -> Dominion ()Source
Like modifyPlayer
, but modifies every player *except* the one specified with the player id.
setupForTurn :: PlayerId -> Dominion ()Source
returnResults :: GameState -> IO ResultSource
isReaction :: Card -> BoolSource
isTreasure :: Card -> BoolSource
countPoints :: Player -> IntSource
getPlayer :: PlayerId -> Dominion PlayerSource
Get player from game state specified by this id. This is useful sometimes:
import qualified Dominion.Types as T import Control.Lens player <- getPlayer playerId -- How many buys does this player have? player ^. T.buys -- How many actions does this player have? player ^. T.actions
cardsOf :: Int -> a -> [a]Source
Convenience function. 4 `cardsOf` estate
is the same as take 4 . repeat $ estate
eitherToBool :: Either String () -> BoolSource
shuffleDeck :: PlayerId -> Dominion ()Source
Move this players discards + hand into his deck and shuffle the deck.
shuffleDeck_ :: Player -> PlayerSource
validateBuy :: PlayerId -> Card -> Dominion (PlayResult ())Source
validatePlay :: PlayerId -> Card -> Dominion (PlayResult ())Source
discardHand :: PlayerId -> Dominion ()Source
findIteration :: [Option] -> Maybe IntSource
drawsUntil :: PlayerId -> ([Card] -> Dominion Bool) -> Dominion [Card]Source
Keep drawing a card until the provided function returns true. The function gets a list of the cards drawn so far, most recent first. Returns a list of all the cards drawn (these cards are also placed into the player's hand)
trashThisCard :: Card -> BoolSource
trashesCard :: PlayerId -> Card -> Dominion ()Source
Player trashes the given card.
discardsCard :: PlayerId -> Card -> Dominion ()Source
Player discards the given card.
returnsCard :: PlayerId -> Card -> Dominion ()Source
discardTopCard :: [Card] -> Player -> PlayerSource
returnVPCard :: Player -> PlayerSource
discardsTo :: Player -> Int -> PlayerSource
Player discards down to x cards.
usesEffect :: PlayerId -> CardEffect -> Dominion (Maybe Followup)Source
Used internally by the plays
function. Each card has a list of
effects (like smithy has `PlusCard 3`). This function applies the given
effect. It returns Nothing
if the effect doesn't need a Followup
,
or it returns a `Just Followup`.
makePlayer :: String -> PlayerSource
Given a name, creates a player with that name.
gainCardUpTo :: PlayerId -> Int -> Card -> Dominion (PlayResult (Maybe [Followup]))Source