fsharp(ygosim): feat: more work on normal summoning
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
581bf55a93
commit
ed384b45da
|
@ -132,8 +132,6 @@ module Board =
|
||||||
module Client =
|
module Client =
|
||||||
open Player
|
open Player
|
||||||
open Turn
|
open Turn
|
||||||
open Card.Card
|
|
||||||
open Board
|
|
||||||
|
|
||||||
type Log =
|
type Log =
|
||||||
| CardToHand of string
|
| CardToHand of string
|
||||||
|
@ -156,16 +154,24 @@ module Zone =
|
||||||
open Side
|
open Side
|
||||||
|
|
||||||
let freeMonsterZones player = List.filter Option.isNone player.side.monsters
|
let freeMonsterZones player = List.filter Option.isNone player.side.monsters
|
||||||
let freeMonsterZoneCount player = List.length <| freeMonsterZones player
|
let freeMonsterZoneCount = freeMonsterZones >> List.length
|
||||||
let hasFreeMonsterZones player count = freeMonsterZoneCount player >= count
|
let hasFreeMonsterZones = (>=) << freeMonsterZoneCount
|
||||||
let hasFreeMonsterZone player = hasFreeMonsterZones player 1
|
let hasFreeMonsterZone player = hasFreeMonsterZones player 1
|
||||||
|
|
||||||
module Summon =
|
module Summon =
|
||||||
|
open Card.Card
|
||||||
open Board
|
open Board
|
||||||
open Zone
|
open Zone
|
||||||
open Client
|
open Client
|
||||||
|
|
||||||
module Normal =
|
module Normal =
|
||||||
|
let inline numberOfTributes monster =
|
||||||
|
let level = monster ^. Card.level
|
||||||
|
|
||||||
|
if level <= 4 then 0
|
||||||
|
elif level <= 6 then 1
|
||||||
|
else 2
|
||||||
|
|
||||||
let canNormalSummon board =
|
let canNormalSummon board =
|
||||||
hasFreeMonsterZone <| board ^. Board.currentPlayer
|
hasFreeMonsterZone <| board ^. Board.currentPlayer
|
||||||
&& board ^. Board.currentPlayerLastNormalSummon < board ^. Board.turn
|
&& board ^. Board.currentPlayerLastNormalSummon < board ^. Board.turn
|
||||||
|
@ -181,6 +187,7 @@ module Summon =
|
||||||
|
|
||||||
let turn = board ^. Board.turn
|
let turn = board ^. Board.turn
|
||||||
|
|
||||||
|
|
||||||
board |> Board.currentPlayerLastNormalSummon .-> turn
|
board |> Board.currentPlayerLastNormalSummon .-> turn
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -116,9 +116,10 @@ module Card =
|
||||||
let inline attribute f card = f card.attribute <&> fun v -> { card with attribute = v }
|
let inline attribute f card = f card.attribute <&> fun v -> { card with attribute = v }
|
||||||
let inline level f card = f card.level <&> fun v -> { card with level = v }
|
let inline level f card = f card.level <&> fun v -> { card with level = v }
|
||||||
|
|
||||||
|
type Monster<'s> = BaseCard<'s> * MonsterCardDetails
|
||||||
|
|
||||||
type Card<'s> =
|
type Card<'s> =
|
||||||
| Monster of BaseCard<'s> * MonsterCardDetails
|
| Monster of Monster<'s>
|
||||||
| Spell of BaseCard<'s> * SpellCardDetails
|
| Spell of BaseCard<'s> * SpellCardDetails
|
||||||
| Trap of BaseCard<'s> * TrapCardDetails
|
| Trap of BaseCard<'s> * TrapCardDetails
|
||||||
|
|
||||||
|
@ -126,6 +127,8 @@ module Card =
|
||||||
let inline baseCard f card = _1 f card
|
let inline baseCard f card = _1 f card
|
||||||
let inline cardDetails f card = _2 f card
|
let inline cardDetails f card = _2 f card
|
||||||
|
|
||||||
|
let inline level f card = (_2 << MonsterCardDetails.level) f card
|
||||||
|
|
||||||
type CardInstance<'s> = Card<'s>
|
type CardInstance<'s> = Card<'s>
|
||||||
|
|
||||||
module Decklist =
|
module Decklist =
|
||||||
|
|
Loading…
Reference in a new issue