diff --git a/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfATerribleDiscovery.hs b/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfATerribleDiscovery.hs index 66f746b85..c1f99164d 100644 --- a/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfATerribleDiscovery.hs +++ b/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfATerribleDiscovery.hs @@ -1,15 +1,40 @@ module Arkham.Enemy.Cards.MemoryOfATerribleDiscovery (memoryOfATerribleDiscovery) where +import Arkham.Ability +import Arkham.Asset.Cards qualified as Assets import Arkham.Enemy.Cards qualified as Cards -import Arkham.Enemy.Import.Lifted +import Arkham.Enemy.Import.Lifted hiding (EnemyAttacks, EnemyDefeated) +import Arkham.Helpers.Story +import Arkham.Matcher +import Arkham.Story.Cards qualified as Stories newtype MemoryOfATerribleDiscovery = MemoryOfATerribleDiscovery EnemyAttrs deriving anyclass (IsEnemy, HasModifiersFor) - deriving newtype (Show, Eq, ToJSON, FromJSON, Entity, HasAbilities) + deriving newtype (Show, Eq, ToJSON, FromJSON, Entity) memoryOfATerribleDiscovery :: EnemyCard MemoryOfATerribleDiscovery -memoryOfATerribleDiscovery = enemy MemoryOfATerribleDiscovery Cards.memoryOfATerribleDiscovery (3, PerPlayer 4, 3) (1, 1) +memoryOfATerribleDiscovery = + enemyWith MemoryOfATerribleDiscovery Cards.memoryOfATerribleDiscovery (3, PerPlayer 4, 3) (1, 1) + $ preyL + .~ Prey (ControlsAsset $ assetIs Assets.averyClaypoolAntarcticGuide) + +instance HasAbilities MemoryOfATerribleDiscovery where + getAbilities (MemoryOfATerribleDiscovery a) = + extend + a + [ restricted a 1 OnSameLocation $ parleyAction (AddFrostTokenCost 1) + , mkAbility a 2 $ forced $ EnemyDefeated #when You ByAny (be a) + ] instance RunMessage MemoryOfATerribleDiscovery where - runMessage msg (MemoryOfATerribleDiscovery attrs) = runQueueT $ case msg of + runMessage msg e@(MemoryOfATerribleDiscovery attrs) = runQueueT $ case msg of + UseThisAbility _iid (isSource attrs -> True) 1 -> do + nonAttackEnemyDamage (attrs.ability 1) 4 attrs.id + pure e + UseThisAbility iid (isSource attrs -> True) 2 -> do + flipOverBy iid (attrs.ability 2) attrs + pure e + Flip iid _ (isTarget attrs -> True) -> do + readStory iid attrs Stories.memoryOfATerribleDiscovery + pure e _ -> MemoryOfATerribleDiscovery <$> liftRunMessage msg attrs diff --git a/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnAlienTranslation.hs b/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnAlienTranslation.hs index 26baa56f0..d1f3a2002 100644 --- a/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnAlienTranslation.hs +++ b/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnAlienTranslation.hs @@ -22,7 +22,9 @@ instance HasAbilities MemoryOfAnAlienTranslation where getAbilities (MemoryOfAnAlienTranslation a) = extend a - [ mkAbility a 1 $ freeReaction $ EnemyExhausts #after (be a) + [ restricted a 1 (thisExists a $ EnemyAt LocationWithAttachment) + $ freeReaction + $ EnemyExhausts #after (be a) , mkAbility a 2 $ forced $ EnemyDefeated #when You ByAny (be a) ] diff --git a/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnUnrequitedLove.hs b/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnUnrequitedLove.hs index edc86e61c..e6ffb0a7d 100644 --- a/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnUnrequitedLove.hs +++ b/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnUnrequitedLove.hs @@ -1,15 +1,41 @@ module Arkham.Enemy.Cards.MemoryOfAnUnrequitedLove (memoryOfAnUnrequitedLove) where +import Arkham.Ability +import Arkham.Asset.Cards qualified as Assets import Arkham.Enemy.Cards qualified as Cards -import Arkham.Enemy.Import.Lifted +import Arkham.Enemy.Import.Lifted hiding (DiscoverClues, EnemyDefeated) +import Arkham.Helpers.Story +import Arkham.Helpers.Window +import Arkham.Matcher +import Arkham.Story.Cards qualified as Stories newtype MemoryOfAnUnrequitedLove = MemoryOfAnUnrequitedLove EnemyAttrs deriving anyclass (IsEnemy, HasModifiersFor) - deriving newtype (Show, Eq, ToJSON, FromJSON, Entity, HasAbilities) + deriving newtype (Show, Eq, ToJSON, FromJSON, Entity) memoryOfAnUnrequitedLove :: EnemyCard MemoryOfAnUnrequitedLove -memoryOfAnUnrequitedLove = enemy MemoryOfAnUnrequitedLove Cards.memoryOfAnUnrequitedLove (4, PerPlayer 3, 3) (1, 1) +memoryOfAnUnrequitedLove = + enemyWith MemoryOfAnUnrequitedLove Cards.memoryOfAnUnrequitedLove (4, PerPlayer 3, 3) (1, 1) + $ preyL + .~ Prey (ControlsAsset $ assetIs Assets.drAmyKenslerProfessorOfBiology) + +instance HasAbilities MemoryOfAnUnrequitedLove where + getAbilities (MemoryOfAnUnrequitedLove a) = + extend + a + [ mkAbility a 1 $ freeReaction $ DiscoverClues #after You (locationWithEnemy a) (atLeast 1) + , mkAbility a 2 $ forced $ EnemyDefeated #when You ByAny (be a) + ] instance RunMessage MemoryOfAnUnrequitedLove where - runMessage msg (MemoryOfAnUnrequitedLove attrs) = runQueueT $ case msg of + runMessage msg e@(MemoryOfAnUnrequitedLove attrs) = runQueueT $ case msg of + UseCardAbility _iid (isSource attrs -> True) 1 (discoveredClues -> n) _ -> do + nonAttackEnemyDamage (attrs.ability 1) n attrs.id + pure e + UseThisAbility iid (isSource attrs -> True) 2 -> do + flipOverBy iid (attrs.ability 2) attrs + pure e + Flip iid _ (isTarget attrs -> True) -> do + readStory iid attrs Stories.memoryOfAnUnrequitedLove + pure e _ -> MemoryOfAnUnrequitedLove <$> liftRunMessage msg attrs diff --git a/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnUnspeakableEvil.hs b/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnUnspeakableEvil.hs index 09ced6d0c..570c8b447 100644 --- a/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnUnspeakableEvil.hs +++ b/backend/arkham-api/library/Arkham/Enemy/Cards/MemoryOfAnUnspeakableEvil.hs @@ -23,7 +23,7 @@ instance HasAbilities MemoryOfAnUnspeakableEvil where getAbilities (MemoryOfAnUnspeakableEvil a) = extend a - [ restricted a 1 (thisExists a ExhaustedEnemy) + [ restricted a 1 OnSameLocation $ ActionAbility [#parley] (ActionCost 2 <> ShuffleTopOfScenarioDeckIntoYourDeck 3 TekeliliDeck) , mkAbility a 2 $ forced $ EnemyDefeated #when You ByAny (be a) ] diff --git a/backend/arkham-api/library/Arkham/Game.hs b/backend/arkham-api/library/Arkham/Game.hs index b64b29f1f..16b0a7f5d 100644 --- a/backend/arkham-api/library/Arkham/Game.hs +++ b/backend/arkham-api/library/Arkham/Game.hs @@ -1543,6 +1543,14 @@ getLocationsMatching lmatcher = do flip filterM ls $ \l -> do lmEvents <- select $ EventAttachedTo $ TargetIs $ toTarget l pure . notNull $ List.intersect events lmEvents + LocationWithAttachment -> do + flip filterM ls $ \l -> do + orM + [ selectAny $ EventAttachedTo $ TargetIs $ toTarget l + , selectAny $ AssetAttachedTo $ TargetIs $ toTarget l + , selectAny $ TreacheryIsAttachedTo $ toTarget l + , selectAny $ EnemyAttachedTo $ TargetIs $ toTarget l + ] LocationWithInvestigator (InvestigatorWithId iid) -> do mLocation <- field InvestigatorLocation iid pure $ filter ((`elem` mLocation) . toId) ls @@ -2908,6 +2916,12 @@ enemyMatcherFilter es matcher' = case matcher' of MovingEnemy -> flip filterM es \enemy -> (== Just (toId enemy)) . view enemyMovingL <$> getGame EvadingEnemy -> flip filterM es \enemy -> (== Just (toId enemy)) . view enemyEvadingL <$> getGame EnemyWithVictory -> filterM (getHasVictoryPoints . toId) es + EnemyAttachedTo targetMatcher -> do + let + isValid a = case (enemyPlacement (toAttrs a)).attachedTo of + Just target -> targetMatches target targetMatcher + _ -> pure False + filterM isValid es EnemyAttachedToAsset assetMatcher -> do placements <- select assetMatcher flip filterM es \enemy -> do diff --git a/backend/arkham-api/library/Arkham/Game/Helpers.hs b/backend/arkham-api/library/Arkham/Game/Helpers.hs index 3d9e2512a..39b9e015b 100644 --- a/backend/arkham-api/library/Arkham/Game/Helpers.hs +++ b/backend/arkham-api/library/Arkham/Game/Helpers.hs @@ -3298,6 +3298,7 @@ locationMatches investigatorId source window locationId matcher' = do Nothing -> pure False Just shroud -> gameValueMatches shroud valueMatcher Matcher.LocationWithAttachedEvent {} -> locationId <=~> matcher + Matcher.LocationWithAttachment {} -> locationId <=~> matcher Matcher.LocationWithShroudLessThanOrEqualToLessThanEnemyMaybeField {} -> locationId <=~> matcher Matcher.LocationWithMostClues locationMatcher -> elem locationId diff --git a/backend/arkham-api/library/Arkham/Matcher/Enemy.hs b/backend/arkham-api/library/Arkham/Matcher/Enemy.hs index 8f3b1db7b..93260654e 100644 --- a/backend/arkham-api/library/Arkham/Matcher/Enemy.hs +++ b/backend/arkham-api/library/Arkham/Matcher/Enemy.hs @@ -17,6 +17,7 @@ import {-# SOURCE #-} Arkham.Matcher.Event import {-# SOURCE #-} Arkham.Matcher.Investigator import {-# SOURCE #-} Arkham.Matcher.Location import {-# SOURCE #-} Arkham.Matcher.Source +import {-# SOURCE #-} Arkham.Matcher.Target import Arkham.Matcher.Value import {-# SOURCE #-} Arkham.Modifier import {-# SOURCE #-} Arkham.Placement @@ -49,6 +50,7 @@ data EnemyMatcher | EnemyWithToken Token | EnemyAt LocationMatcher | EnemyAttachedToAsset AssetMatcher + | EnemyAttachedTo TargetMatcher | EnemyCanEnter LocationMatcher | EnemyCanSpawnIn LocationMatcher | EnemyCanMove diff --git a/backend/arkham-api/library/Arkham/Matcher/Location.hs b/backend/arkham-api/library/Arkham/Matcher/Location.hs index a86a22d4b..08252f1c5 100644 --- a/backend/arkham-api/library/Arkham/Matcher/Location.hs +++ b/backend/arkham-api/library/Arkham/Matcher/Location.hs @@ -90,6 +90,7 @@ data LocationMatcher | LocationCanBeEnteredBy EnemyId | LocationWithAsset AssetMatcher | LocationWithAttachedEvent EventMatcher + | LocationWithAttachment | LocationWithCardsUnderneath CardListMatcher | LocationWithInvestigator InvestigatorMatcher | CanEnterLocation InvestigatorMatcher diff --git a/backend/arkham-api/library/Arkham/Matcher/Target.hs-boot b/backend/arkham-api/library/Arkham/Matcher/Target.hs-boot new file mode 100644 index 000000000..a33202046 --- /dev/null +++ b/backend/arkham-api/library/Arkham/Matcher/Target.hs-boot @@ -0,0 +1,12 @@ +module Arkham.Matcher.Target where + +import Arkham.Prelude + +data TargetMatcher + +instance Data TargetMatcher +instance Show TargetMatcher +instance Eq TargetMatcher +instance Ord TargetMatcher +instance ToJSON TargetMatcher +instance FromJSON TargetMatcher diff --git a/backend/arkham-api/library/Arkham/Story/Cards/MemoryOfATerribleDiscovery.hs b/backend/arkham-api/library/Arkham/Story/Cards/MemoryOfATerribleDiscovery.hs index 785fae314..482cc7d47 100644 --- a/backend/arkham-api/library/Arkham/Story/Cards/MemoryOfATerribleDiscovery.hs +++ b/backend/arkham-api/library/Arkham/Story/Cards/MemoryOfATerribleDiscovery.hs @@ -1,5 +1,11 @@ module Arkham.Story.Cards.MemoryOfATerribleDiscovery (memoryOfATerribleDiscovery) where +import Arkham.Asset.Cards qualified as Assets +import Arkham.CampaignLog (PartnerStatus (Resolute)) +import Arkham.CampaignLogKey +import Arkham.Campaigns.EdgeOfTheEarth.Helpers +import Arkham.Matcher +import Arkham.Scenarios.FatalMirage.Helpers import Arkham.Story.Cards qualified as Cards import Arkham.Story.Import.Lifted @@ -13,5 +19,11 @@ memoryOfATerribleDiscovery = story MemoryOfATerribleDiscovery Cards.memoryOfATer instance RunMessage MemoryOfATerribleDiscovery where runMessage msg s@(MemoryOfATerribleDiscovery attrs) = runQueueT $ case msg of ResolveStory _ ResolveIt story' | story' == toId attrs -> do + record ClaypoolHasConfrontedHisDemons + setPartnerStatus Assets.averyClaypoolAntarcticGuide Resolute + selectForMaybeM (assetIs Assets.averyClaypoolAntarcticGuide) \claypool -> + push $ ReplaceAsset claypool Assets.averyClaypoolAntarcticGuideResolute + addToVictory attrs + mayAdvance attrs pure s _ -> MemoryOfATerribleDiscovery <$> liftRunMessage msg attrs diff --git a/backend/arkham-api/library/Arkham/Story/Cards/MemoryOfAnUnrequitedLove.hs b/backend/arkham-api/library/Arkham/Story/Cards/MemoryOfAnUnrequitedLove.hs index 117f92eb6..10bcfdb13 100644 --- a/backend/arkham-api/library/Arkham/Story/Cards/MemoryOfAnUnrequitedLove.hs +++ b/backend/arkham-api/library/Arkham/Story/Cards/MemoryOfAnUnrequitedLove.hs @@ -1,5 +1,11 @@ module Arkham.Story.Cards.MemoryOfAnUnrequitedLove (memoryOfAnUnrequitedLove) where +import Arkham.Asset.Cards qualified as Assets +import Arkham.CampaignLog (PartnerStatus (Resolute)) +import Arkham.CampaignLogKey +import Arkham.Campaigns.EdgeOfTheEarth.Helpers +import Arkham.Matcher +import Arkham.Scenarios.FatalMirage.Helpers import Arkham.Story.Cards qualified as Cards import Arkham.Story.Import.Lifted @@ -13,5 +19,11 @@ memoryOfAnUnrequitedLove = story MemoryOfAnUnrequitedLove Cards.memoryOfAnUnrequ instance RunMessage MemoryOfAnUnrequitedLove where runMessage msg s@(MemoryOfAnUnrequitedLove attrs) = runQueueT $ case msg of ResolveStory _ ResolveIt story' | story' == toId attrs -> do + record DrKenslerHasConfrontedHerDemons + setPartnerStatus Assets.drAmyKenslerProfessorOfBiology Resolute + selectForMaybeM (assetIs Assets.drAmyKenslerProfessorOfBiology) \drKensler -> + push $ ReplaceAsset drKensler Assets.drAmyKenslerProfessorOfBiologyResolute + addToVictory attrs + mayAdvance attrs pure s _ -> MemoryOfAnUnrequitedLove <$> liftRunMessage msg attrs