app

Safe Haskell None
Language Haskell2010

Board

Synopsis

Documentation

appliesTo :: ID -> T Core -> Player -> Card -> Bool #

type family ManaType (p :: Phase) where ... #

Equations

ManaType Core = Nat  
ManaType UI = Int  

bottomSpotOfTopVisual :: Card -> Card #

Returns a bottom position, by taking a position that makes sense visually I.e. if you give this method [TopLeft], it'll correspond to the [TopLeft] bottom position that you SEE; even if positions make sense for the top part. This method takes care of translating correctly.

TODO smelc rename me to bottomSpot@

empty :: Empty a b => a -> b #

type family InPlaceType (p :: Phase) where ... #

Equations

InPlaceType Core = CardsOnTable  
InPlaceType UI = Ts  

initial #

Arguments

:: RandomGen r  
=> r  
-> Teams (Team, [Card Core])

The initial decks

-> (r, T Core)

The shared model, with its RNG updated; and the initial board

The initial board, appropriately shuffled with a rng, and the starting decks of both teams.

newtype HandIndex #

Constructors

HandIndex  

Fields

Instances
Enum HandIndex #  
Instance details

Defined in Board

Eq HandIndex #  
Instance details

Defined in Board

Methods

(==) :: HandIndex -> HandIndex -> Bool #

(/=) :: HandIndex -> HandIndex -> Bool #

Ord HandIndex #  
Instance details

Defined in Board

Show HandIndex #  
Instance details

Defined in Board

Generic HandIndex #  
Instance details

Defined in Board

Associated Types

type Rep HandIndex :: Type -> Type #

Methods

from :: HandIndex -> Rep HandIndex x #

to :: Rep HandIndex x -> HandIndex #

type Rep HandIndex #  
Instance details

Defined in Board

type Rep HandIndex = D1 (MetaData "HandIndex" "Board" "main" True) (C1 (MetaCons "HandIndex" PrefixI True) (S1 (MetaSel (Just "unHandIndex") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Int)))

type family InHandType (p :: Phase) where ... #

Equations

InHandType p = [HandElemType p]  

data Kind #

Data whose only purpose is to be lifted as a type, for disambiguating classes instances.

Constructors

Discarded  
Hand  
Mana  
Score  
Stack  

lookupHand :: [a] -> Int -> Either Text a #

lookupHandM :: MonadError Text m => [a] -> Int -> m a #

class Mappable a p where #

Functions to update content within T values

Methods

adjust :: Player -> Card -> (a -> a) -> T p -> T p #

Maps over the data at the given Player and Card

adjustMany :: Player -> [Card] -> (a -> a) -> T p -> T p #

Maps over the data at the given Player and Card

insert :: Player -> Card -> a -> T p -> T p #

Sets the data at the given Player and Card

update :: Player -> Card -> (a -> Maybe a) -> T p -> T p #

Updates the data at the given Player and Card. Updates if the function returns Just _ or removes the data if f returns Nothing.

Instances
PlayerIndexed (Map Card a) p => Mappable a p #

Lift lenses over maps to the Mappable class. Used with a being Creature 'Core (to map over inPlace) and with a being Deco (to map over deco).

Instance details

Defined in Board

Methods

adjust :: Player -> Card -> (a -> a) -> T p -> T p #

adjustMany :: Player -> [Card] -> (a -> a) -> T p -> T p #

insert :: Player -> Card -> a -> T p -> T p #

update :: Player -> Card -> (a -> Maybe a) -> T p -> T p #

data Neighborhood #

The various kinds of neighbors

Constructors

Cardinal

Neighbors to the left and the right

Diagonal

Neighbors in diagonals

All

Cardinal + diagnoal neighbors

Instances
Eq Neighborhood #  
Instance details

Defined in Spots

Show Neighborhood #  
Instance details

Defined in Spots

Generic Neighborhood #  
Instance details

Defined in Spots

Associated Types

type Rep Neighborhood :: Type -> Type #

type Rep Neighborhood #  
Instance details

Defined in Spots

type Rep Neighborhood = D1 (MetaData "Neighborhood" "Spots" "main" False) (C1 (MetaCons "Cardinal" PrefixI False) (U1 :: Type -> Type) :+: (C1 (MetaCons "Diagonal" PrefixI False) (U1 :: Type -> Type) :+: C1 (MetaCons "All" PrefixI False) (U1 :: Type -> Type)))

class PlayerIndexed a p where #

Lenses for data that belongs to a player

Methods

getp :: Player -> T p -> a #

setp :: a -> Player -> T p -> T p #

Instances
PlayerIndexed (Map Card Fade) UI #

Generic access to the deco in 'UI phase.

Instance details

Defined in Board

Methods

getp :: Player -> T UI -> Map Card Fade #

setp :: Map Card Fade -> Player -> T UI -> T UI #

PlayerIndexed (Map Card T) UI #

Generic access to effects in 'UI phase

Instance details

Defined in Board

Methods

getp :: Player -> T0 UI -> Map Card T #

setp :: Map Card T -> Player -> T0 UI -> T0 UI #

PlayerIndexed (Map Card Deco) Core #

Generic access to the deco in 'Core phase.

Instance details

Defined in Board

Methods

getp :: Player -> T Core -> Map Card Deco #

setp :: Map Card Deco -> Player -> T Core -> T Core #

PlayerIndexed (Map Card (Creature Core)) Core #

Generic access to creatures in 'Core phase. XXX @smelc Can this be abstracted over the phase if the type family applies to the entire Map? To remove the 'UI instance below.

Instance details

Defined in Board

Methods

getp :: Player -> T Core -> Map Card (Creature Core) #

setp :: Map Card (Creature Core) -> Player -> T Core -> T Core #

class PlayerKindIndexed (k :: Kind) p a where #

Class to generically getmapset over the data of a player

Methods

getpk :: Player -> T p -> a #

mappk :: (a -> a) -> Player -> T p -> T p #

setpk :: Player -> a -> T p -> T p #

Instances
DiscardedType p ~ fam => PlayerKindIndexed Discarded p fam #

Instance of PlayerKindIndexed to generically getmapset over the discarded stack

Instance details

Defined in Board

Methods

getpk :: Player -> T p -> fam #

mappk :: (fam -> fam) -> Player -> T p -> T p #

setpk :: Player -> fam -> T p -> T p #

InHandType p ~ fam => PlayerKindIndexed Hand p fam #

Instance of PlayerKindIndexed to generically getmapset over the hand

Instance details

Defined in Board

Methods

getpk :: Player -> T p -> fam #

mappk :: (fam -> fam) -> Player -> T p -> T p #

setpk :: Player -> fam -> T p -> T p #

ManaType p ~ fam => PlayerKindIndexed Mana p fam #

Instance of PlayerKindIndexed to generically getmapset over mana

Instance details

Defined in Board

Methods

getpk :: Player -> T p -> fam #

mappk :: (fam -> fam) -> Player -> T p -> T p #

setpk :: Player -> fam -> T p -> T p #

ScoreType p ~ fam => PlayerKindIndexed Score p fam #

Instance of PlayerKindIndexed to generically getmapset over score

Instance details

Defined in Board

Methods

getpk :: Player -> T p -> fam #

mappk :: (fam -> fam) -> Player -> T p -> T p #

setpk :: Player -> fam -> T p -> T p #

StackType p ~ fam => PlayerKindIndexed Stack p fam #

Instance of PlayerKindIndexed to generically getmapset over the stack

Instance details

Defined in Board

Methods

getpk :: Player -> T p -> fam #

mappk :: (fam -> fam) -> Player -> T p -> T p #

setpk :: Player -> fam -> T p -> T p #

data PlayerPart (p :: Phase) #

Constructors

PlayerPart  

Fields

Instances
Forall Eq p => Eq (PlayerPart p) #  
Instance details

Defined in Board

Methods

(==) :: PlayerPart p -> PlayerPart p -> Bool #

(/=) :: PlayerPart p -> PlayerPart p -> Bool #

Forall Ord p => Ord (PlayerPart p) #  
Instance details

Defined in Board

Forall Show p => Show (PlayerPart p) #  
Instance details

Defined in Board

Methods

showsPrec :: Int -> PlayerPart p -> ShowS #

show :: PlayerPart p -> String #

showList :: [PlayerPart p] -> ShowS #

Generic (PlayerPart p) #  
Instance details

Defined in Board

Associated Types

type Rep (PlayerPart p) :: Type -> Type #

Methods

from :: PlayerPart p -> Rep (PlayerPart p) x #

to :: Rep (PlayerPart p) x -> PlayerPart p #

Semigroup (PlayerPart UI) #  
Instance details

Defined in Board

Monoid (PlayerPart UI) #  
Instance details

Defined in Board

Startable (PlayerPart Core) #  
Instance details

Defined in BoardInstances

type Rep (PlayerPart p) #  
Instance details

Defined in Board

type Rep (PlayerPart p)

type family StackType (p :: Phase) where ... #

Equations

StackType Core = [ID]  
StackType UI = Int  

small :: Model -> Teams Team -> CreatureID -> [Item] -> Player -> Card -> T Core #

A board with a single creature in place. Hands are empty. Handy for debugging for example.

setInPlace :: Player -> InPlaceType p -> T p -> T p #

setPart :: T p -> Player -> PlayerPart p -> T p #

switchLine :: Card -> Card #

Given a frontline spot, the corresponding backline spot. Given a backline spot, the corresponding frontline spot.

line :: Line -> [Card] #

All spots in a given line

data StackKind #

Constructors

Handed

Button to display the hand (only used for the enemy, in Debug mode)

Stacked

Button to display the stack

Discarded'

Button to display discarded cards

data Teams a #

Constructors

Teams  

Fields

Instances
Functor Teams #  
Instance details

Defined in Board

Methods

fmap :: (a -> b) -> Teams a -> Teams b #

(<$) :: a -> Teams b -> Teams a #

Show a => Show (Teams a) #  
Instance details

Defined in Board

Methods

showsPrec :: Int -> Teams a -> ShowS #

show :: Teams a -> String #

showList :: [Teams a] -> ShowS #

Generic (Teams a) #  
Instance details

Defined in Board

Associated Types

type Rep (Teams a) :: Type -> Type #

Methods

from :: Teams a -> Rep (Teams a) x #

to :: Rep (Teams a) x -> Teams a #

type Rep (Teams a) #  
Instance details

Defined in Board

data T (p :: Phase) #

Things on the board (hand excluded)

Constructors

T  
Instances
Forall Eq p => Eq (T p) #  
Instance details

Defined in Board

Methods

(==) :: T p -> T p -> Bool #

(/=) :: T p -> T p -> Bool #

Forall Ord p => Ord (T p) #  
Instance details

Defined in Board

Methods

compare :: T p -> T p -> Ordering #

(<) :: T p -> T p -> Bool #

(<=) :: T p -> T p -> Bool #

(>) :: T p -> T p -> Bool #

(>=) :: T p -> T p -> Bool #

max :: T p -> T p -> T p #

min :: T p -> T p -> T p #

Forall Show p => Show (T p) #  
Instance details

Defined in Board

Methods

showsPrec :: Int -> T p -> ShowS #

show :: T p -> String #

showList :: [T p] -> ShowS #

Generic (T p) #  
Instance details

Defined in Board

Associated Types

type Rep (T p) :: Type -> Type #

Methods

from :: T p -> Rep (T p) x #

to :: Rep (T p) x -> T p #

Semigroup (T UI) #  
Instance details

Defined in Board

Methods

(<>) :: T UI -> T UI -> T UI #

sconcat :: NonEmpty (T UI) -> T UI #

stimes :: Integral b => b -> T UI -> T UI #

Monoid (T UI) #  
Instance details

Defined in Board

Methods

mempty :: T UI #

mappend :: T UI -> T UI -> T UI #

mconcat :: [T UI] -> T UI #

Stupid (T Core) #  
Instance details

Defined in BoardInstances

Methods

isStupid :: T Core -> Player -> Card -> Bool #

With (Playable a) (T Core) #  
Instance details

Defined in Game

Methods

with :: Playable a -> T Core -> Playable a #

Contains (Playable a) (T Core) #  
Instance details

Defined in Game

Methods

to :: Playable a -> T Core #

(With (Playable a) (T Core), With (Playable a) a) => With (Playable a) (T Core, a) #  
Instance details

Defined in Game

Methods

with :: Playable a -> (T Core, a) -> Playable a #

(Contains (Playable a) (T Core), Contains (Playable a) a) => Contains (Playable a) (T Core, a) #  
Instance details

Defined in Game

Methods

to :: Playable a -> (T Core, a) #

With (Kernel a) (Model, T Core, T UI) #  
Instance details

Defined in Move

Methods

with :: Kernel a -> (Model, T Core, T UI) -> Kernel a #

Contains (Kernel a) (Model, T Core, T UI) #  
Instance details

Defined in Move

Methods

to :: Kernel a -> (Model, T Core, T UI) #

With (Kernel a) (Model, T Core, T UI, Animation) #  
Instance details

Defined in Move

Methods

with :: Kernel a -> (Model, T Core, T UI, Animation) -> Kernel a #

Contains (Kernel a) (Model, T Core, T UI, Animation) #  
Instance details

Defined in Move

Methods

to :: Kernel a -> (Model, T Core, T UI, Animation) #

type Rep (T p) #  
Instance details

Defined in Board

toPart :: T p -> Player -> PlayerPart p #

toNeighbors :: T Core -> Player -> Card -> Neighborhood -> [(Card, Creature Core)] #

The neighbors of the card at the given spot, for the given player, and for the given kind of neighbors.

toPlayerCardSpots :: T Core -> Player -> CardTargetKind -> [Card] #

Returns the spots available for playing a card with the given target kind. For creature cards for example it returns empty spots. For item cards it returns occupied spots.

toData :: Player -> Teams a -> a #