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 =
|
||||
open Player
|
||||
open Turn
|
||||
open Card.Card
|
||||
open Board
|
||||
|
||||
type Log =
|
||||
| CardToHand of string
|
||||
|
@ -156,16 +154,24 @@ module Zone =
|
|||
open Side
|
||||
|
||||
let freeMonsterZones player = List.filter Option.isNone player.side.monsters
|
||||
let freeMonsterZoneCount player = List.length <| freeMonsterZones player
|
||||
let hasFreeMonsterZones player count = freeMonsterZoneCount player >= count
|
||||
let freeMonsterZoneCount = freeMonsterZones >> List.length
|
||||
let hasFreeMonsterZones = (>=) << freeMonsterZoneCount
|
||||
let hasFreeMonsterZone player = hasFreeMonsterZones player 1
|
||||
|
||||
module Summon =
|
||||
open Card.Card
|
||||
open Board
|
||||
open Zone
|
||||
open Client
|
||||
|
||||
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 =
|
||||
hasFreeMonsterZone <| board ^. Board.currentPlayer
|
||||
&& board ^. Board.currentPlayerLastNormalSummon < board ^. Board.turn
|
||||
|
@ -181,6 +187,7 @@ module Summon =
|
|||
|
||||
let turn = board ^. Board.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 level f card = f card.level <&> fun v -> { card with level = v }
|
||||
|
||||
type Monster<'s> = BaseCard<'s> * MonsterCardDetails
|
||||
|
||||
type Card<'s> =
|
||||
| Monster of BaseCard<'s> * MonsterCardDetails
|
||||
| Monster of Monster<'s>
|
||||
| Spell of BaseCard<'s> * SpellCardDetails
|
||||
| Trap of BaseCard<'s> * TrapCardDetails
|
||||
|
||||
|
@ -126,6 +127,8 @@ module Card =
|
|||
let inline baseCard f card = _1 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>
|
||||
|
||||
module Decklist =
|
||||
|
|
Loading…
Reference in a new issue