Skip to content
Newer
Older
100644 41 lines (34 sloc) 1.24 KB
d337bc5 @MedeaMelana First version
authored
1 {-# LANGUAGE OverloadedStrings #-}
2
3c6e916 @MedeaMelana Verder
authored
3 module M12 where
4
cdc74d0 @MedeaMelana Implemented Shock
authored
5 import Core
a7ec2b1 @MedeaMelana Renamed ^. -> .^
authored
6 import Utils
3c6e916 @MedeaMelana Verder
authored
7
a7ec2b1 @MedeaMelana Renamed ^. -> .^
authored
8 import Control.Applicative
cdc74d0 @MedeaMelana Implemented Shock
authored
9 import Data.Label.PureM ((=:))
10
11
12 shock :: Card
13 shock = mkCard $ do
14 name =: Just "Shock"
15 types =: instantType
16 play =: (Just $ \rSelf rActivator ->
17 ClosedAbility
18 { _available =
19 case rSelf of
20 (Hand rp, _) -> return (rp == rActivator)
21 _ -> return False
22 , _manaCost = ManaCost [Red] 0
23 , _additionalCosts = []
24 , _effect = StackingAction (shockEffect rSelf rActivator)
25 })
26
27 shockEffect :: ObjectRef -> PlayerRef -> Magic StackItem
28 shockEffect rSelf rActivator = do
29 -- TODO check for hexproof
30 -- TODO check for protection
31 -- TODO realise rSelf is sometimes in hand, sometimes on the stack
32 let ok t = case t of
33 TargetObject (Battlefield, _) -> return True
34 TargetPlayer _ -> return True
35 _ -> return False
36 ts <- askMagicTargets rActivator (singleTarget <?> ok)
37 let f t = case t of
38 TargetObject or -> return [WillSimpleEffect (DamageObject rSelf or 2 False True)]
39 TargetPlayer pr -> return [WillSimpleEffect (DamagePlayer rSelf pr 2 False True)]
40 return (f <$> ts)
Something went wrong with that request. Please try again.