1
Fork 0

fsharp(ygosim): feat: tribtues are now sent to the graveyard

Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
Matei Adriel 2019-12-18 21:21:53 +02:00 committed by prescientmoon
parent 99ff363652
commit ab4bd21306
Signed by: prescientmoon
SSH key fingerprint: SHA256:UUF9JT2s8Xfyv76b8ZuVL7XrmimH4o49p4b+iexbVH4
2 changed files with 11 additions and 5 deletions

View file

@ -58,6 +58,7 @@ module Player =
let inline deck f player = (side << Side.deck) f player let inline deck f player = (side << Side.deck) f player
let inline monsters f player = (side << Side.monsters) f player let inline monsters f player = (side << Side.monsters) f player
let inline graveyard f player = (side << Side.graveyard) f player
let initialPlayer lp id = let initialPlayer lp id =
{ lifePoints = lp { lifePoints = lp
@ -217,6 +218,9 @@ module Zone =
let hasFreeMonsterZones = (>=) << freeMonsterZoneCount let hasFreeMonsterZones = (>=) << freeMonsterZoneCount
let hasFreeMonsterZone player = hasFreeMonsterZones player 1 let hasFreeMonsterZone player = hasFreeMonsterZones player 1
module Movement =
let toDeckBottom (card: CardInstance) = over Player.deck (fun deck -> deck @ [ card ])
let toGraveyard cards = over Player.graveyard (fun deck -> cards @ deck)
module Summon = module Summon =
open Card.Card open Card.Card
@ -226,6 +230,7 @@ module Summon =
open Card open Card
open Board open Board
open Zone open Zone
open Zone.Movement
open Client open Client
open Utils open Utils
@ -285,10 +290,12 @@ module Summon =
let replaceTributes = map <| Option.bind replaceInstance let replaceTributes = map <| Option.bind replaceInstance
// Tribute monsters // Tribute monsters
let boardWithoutTributes = board |> over Board.currentPlayerMonsters replaceTributes let boardWithoutTributes =
let free = freeMonsterZones <| boardWithoutTributes ^. Board.currentPlayer board
|> over Board.currentPlayerMonsters replaceTributes
|> over Board.currentPlayer (tributes |>> toCardInstance |> toGraveyard)
// TODO: move tributes to graveyard let free = freeMonsterZones <| boardWithoutTributes ^. Board.currentPlayer
// Choose a zone to summon the monster // Choose a zone to summon the monster
let zone = chooseZone client free let zone = chooseZone client free
@ -334,8 +341,6 @@ module Game =
|> Board.currentPlayerHand .-> hand |> Board.currentPlayerHand .-> hand
|> Board.currentPlayerDeck .-> deck |> Board.currentPlayerDeck .-> deck
let toDeckBottom (card: CardInstance) (player: Player) = over Player.deck (fun d -> rev <| card :: rev d) player
let handleMainPhase client board = let handleMainPhase client board =
if canNormalSummon board then performNormalSummon client board if canNormalSummon board then performNormalSummon client board
else board else board

View file

@ -7,6 +7,7 @@
open Card.Card open Card.Card
open Card.MonsterTypes open Card.MonsterTypes
open Card.BaseCard open Card.BaseCard
open Board.Zone.Movement
let printState state = let printState state =
match state with match state with