2019-12-05 18:17:05 +01:00
|
|
|
module Board
|
|
|
|
|
2019-12-06 10:51:27 +01:00
|
|
|
module Side =
|
|
|
|
open Card
|
2019-12-05 18:17:05 +01:00
|
|
|
|
2019-12-06 10:51:27 +01:00
|
|
|
type Side =
|
|
|
|
{ field: Card option
|
|
|
|
monsters: Card list
|
|
|
|
spells: Card list
|
|
|
|
graveyard: Card list
|
|
|
|
deck: Card list }
|
2019-12-05 18:25:03 +01:00
|
|
|
|
2019-12-06 10:51:27 +01:00
|
|
|
let emptySide =
|
|
|
|
{ field = None
|
|
|
|
monsters = []
|
|
|
|
spells = []
|
|
|
|
graveyard = []
|
|
|
|
deck = [] }
|
|
|
|
|
|
|
|
|
|
|
|
module Player =
|
|
|
|
open Side
|
|
|
|
|
|
|
|
type Player =
|
|
|
|
{ lifePoints: int
|
|
|
|
side: Side }
|
|
|
|
|
|
|
|
let inflictDamage (player: Player) amount = { player with lifePoints = player.lifePoints - amount }
|
|
|
|
|
|
|
|
let initialPlayer lp =
|
|
|
|
{ lifePoints = lp
|
|
|
|
side = emptySide }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module Board =
|
|
|
|
open Player
|
|
|
|
|
|
|
|
type Board =
|
|
|
|
{ players: Player * Player }
|
|
|
|
|
|
|
|
let emptyBoard = { players = (initialPlayer 8000, initialPlayer 8000) }
|