1
Fork 0

fsharp(ygosim): feat: basic normal summoning zone cli input

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-12-15 01:43:45 +02:00 committed by prescientmoon
parent d48af38573
commit 9cc3e22dbd
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
3 changed files with 22 additions and 9 deletions

View file

@ -191,6 +191,8 @@ module Summon =
let freeZones = 5 - possibleTributes + requiredTributes let freeZones = 5 - possibleTributes + requiredTributes
printfn "%i" freeZones
Some(requiredTributes <= possibleTributes && freeZones > 0) Some(requiredTributes <= possibleTributes && freeZones > 0)
| None -> None | None -> None
@ -211,12 +213,9 @@ module Summon =
let performNormalSummon client board = let performNormalSummon client board =
let free = freeMonsterZones <| board ^. Board.currentPlayer let free = freeMonsterZones <| board ^. Board.currentPlayer
printfn "%A" free
let zone = chooseZone client free let zone = chooseZone client free
printfn "%A" zone
let turn = board ^. Board.turn let turn = board ^. Board.turn

View file

@ -107,8 +107,9 @@ module Card =
type MonsterCardDetails = type MonsterCardDetails =
{ attack: int { attack: int
defense: int defense: int
level: int
attribute: Attribute attribute: Attribute
level: int } race: Race }
module MonsterCardDetails = module MonsterCardDetails =
let inline attack f card = f card.attack <&> fun v -> { card with attack = v } let inline attack f card = f card.attack <&> fun v -> { card with attack = v }

View file

@ -4,7 +4,7 @@
open Board.Board open Board.Board
open Board.Game open Board.Game
open Board.Client open Board.Client
open Card open Card.Card
let printState state = let printState state =
match state with match state with
@ -14,8 +14,18 @@
[<EntryPoint>] [<EntryPoint>]
let main _ = let main _ =
let sampleCard = Card.Spell ({name= "sampleCard"; text="something"; effects = []}, {spellType = Card.ContinuosSpell}) let sampleCard =
let board = over Board.currentPlayer <| toDeckBottom sampleCard <| emptyBoard Monster ({ name= "sampleCard"
text="something"
effects = []}
,{ attack = 0
defense = 0
level = 3
attribute = Fire
race = Warrior })
let board = over Board.firstPlayer <| toDeckBottom sampleCard <| emptyBoard
let client action = let client action =
match action with match action with
@ -27,7 +37,10 @@
printfn "New phse: %A" phase printfn "New phse: %A" phase
0 0
| ChooseZone free -> | ChooseZone free ->
List.head free printfn "What Zone do wou want to use? %A" free
let i = System.Console.ReadLine() |> int
free.[i]
| _ -> | _ ->
printfn "Something unkown happened" printfn "Something unkown happened"
0 0