Safe Haskell | None |
---|---|
Language | Haskell98 |
- currentHand :: PlayerId -> Dominion [Card]
- has :: PlayerId -> Card -> Dominion Bool
- countNum :: PlayerId -> Card -> Dominion Int
- 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 :: Map Card Int -> Bool
- drawFromDeck :: PlayerId -> Int -> Dominion [Card]
- modifyPlayer :: PlayerId -> (Player -> Player) -> Dominion ()
- modifyOtherPlayers :: PlayerId -> (Player -> Player) -> Dominion ()
- setupForTurn :: PlayerId -> Dominion ()
- playTurn :: PlayerId -> Strategy -> Dominion ()
- makeGameState :: [Option] -> [Player] -> IO GameState
- 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]
- eitherToBool :: Either String () -> Bool
- shuffleDeck :: PlayerId -> Dominion ()
- shuffleDeck_ :: Player -> Player
- 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.
currentHand :: PlayerId -> Dominion [Card] Source #
see all of the cards in a player's hand.
cards <- currentHand playerId
has :: PlayerId -> Card -> Dominion Bool Source #
see if a player has a card in his hand.
hasCard <- playerId `has` chapel
countNum :: PlayerId -> Card -> Dominion Int Source #
see how many of this card a player has.
numMarkets <- countNum playerId market
handValue :: PlayerId -> Dominion Int Source #
How much money this player's hand is worth (also counts any money you get from action cards, like +1 from market).
pileEmpty :: Card -> Dominion Bool Source #
Check if this card's pile is empty. Returns True is the card is not in play.
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.
modifyOtherPlayers :: PlayerId -> (Player -> Player) -> Dominion () Source #
Like modifyPlayer
, but modifies every player *except* the one specified with the player id.
setupForTurn :: PlayerId -> Dominion () Source #
isReaction :: Card -> Bool Source #
isTreasure :: Card -> Bool Source #
countPoints :: Player -> Int Source #
getPlayer :: PlayerId -> Dominion Player Source #
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
shuffleDeck :: PlayerId -> Dominion () Source #
Move this players discards + hand into his deck and shuffle the deck.
shuffleDeck_ :: Player -> Player Source #
validateBuy :: PlayerId -> Card -> Dominion (PlayResult ()) Source #
validatePlay :: PlayerId -> Card -> Dominion (PlayResult ()) Source #
discardHand :: PlayerId -> Dominion () Source #
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 -> Bool Source #
returnVPCard :: Player -> Player Source #
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 -> Player Source #
Given a name, creates a player with that name.
gainCardUpTo :: PlayerId -> Int -> Card -> Dominion (PlayResult (Maybe [Followup])) Source #