fsharp(ygosim): chore: grouped the Board, Side and Player modules
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
c6689fd6fa
commit
34751250ae
|
@ -1,8 +1,42 @@
|
||||||
module Board
|
module Board
|
||||||
|
|
||||||
open Player
|
module Side =
|
||||||
|
open Card
|
||||||
|
|
||||||
type Board =
|
type Side =
|
||||||
{ players: Player * Player }
|
{ field: Card option
|
||||||
|
monsters: Card list
|
||||||
|
spells: Card list
|
||||||
|
graveyard: Card list
|
||||||
|
deck: Card list }
|
||||||
|
|
||||||
let emptyBoard = { players = (initialPlayer 8000, initialPlayer 8000) }
|
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) }
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
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 }
|
|
|
@ -1,17 +0,0 @@
|
||||||
module Side
|
|
||||||
|
|
||||||
open Card
|
|
||||||
|
|
||||||
type Side =
|
|
||||||
{ field: Card option
|
|
||||||
monsters: Card list
|
|
||||||
spells: Card list
|
|
||||||
graveyard: Card list
|
|
||||||
deck: Card list }
|
|
||||||
|
|
||||||
let emptySide =
|
|
||||||
{ field = None
|
|
||||||
monsters = []
|
|
||||||
spells = []
|
|
||||||
graveyard = []
|
|
||||||
deck = [] }
|
|
|
@ -7,8 +7,6 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="src/Card.fs" />
|
<Compile Include="src/Card.fs" />
|
||||||
<Compile Include="src/Side.fs" />
|
|
||||||
<Compile Include="src/Player.fs" />
|
|
||||||
<Compile Include="src/Board.fs" />
|
<Compile Include="src/Board.fs" />
|
||||||
<Compile Include="src/Program.fs" />
|
<Compile Include="src/Program.fs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
Loading…
Reference in a new issue