diff --git a/yaifl/run_no b/yaifl/run_no index 1d88773..18af9ba 100644 --- a/yaifl/run_no +++ b/yaifl/run_no @@ -1 +1 @@ -727 \ No newline at end of file +731 \ No newline at end of file diff --git a/yaifl/test/Yaifl/Test/Chapter3/Common.hs b/yaifl/test/Yaifl/Test/Chapter3/Common.hs index 7f3a180..4b56fdd 100644 --- a/yaifl/test/Yaifl/Test/Chapter3/Common.hs +++ b/yaifl/test/Yaifl/Test/Chapter3/Common.hs @@ -19,6 +19,7 @@ import Yaifl (PlainWorldModel, Game) import Yaifl.Test.Chapter3.FirstNameBasis import Yaifl.Test.Chapter3.MidsummerDay import Yaifl.Test.Chapter3.Tamed +import Yaifl.Test.Chapter3.Replanting c3Harness :: (Text, [Text], Game PlainWorldModel ()) -> (String, IO Text) c3Harness (n, ac, g) = (toString n, testHarness False n ac defaultOptions g) @@ -39,4 +40,5 @@ spec _allTenses = M.fromList , c3Harness ex13 -- Tamed , c3Harness ex14 -- Disenchantment Bay , c3Harness ex15 -- Disenchantment Bay 2 + , c3Harness ex16 -- Replanting ] diff --git a/yaifl/test/Yaifl/Test/Chapter3/Replanting.hs b/yaifl/test/Yaifl/Test/Chapter3/Replanting.hs new file mode 100644 index 0000000..5a24415 --- /dev/null +++ b/yaifl/test/Yaifl/Test/Chapter3/Replanting.hs @@ -0,0 +1,38 @@ +module Yaifl.Test.Chapter3.Replanting where + +import Yaifl.Prelude + +import Yaifl (PlainWorldModel) + +import Yaifl.Game.Create.Object +import Yaifl.Game.EffectHandlers +import Yaifl.Game.ObjectSpecifics +import Yaifl.Model.Kinds.Container +import Yaifl.Model.Kinds.Openable +import Yaifl.Model.Kinds.Supporter +import Yaifl.Model.Metadata +import Yaifl.Test.Common +import Yaifl.Model.Kinds.Object +import Yaifl.Model.Query +import Yaifl.Game.Create +import Yaifl.Model.Rules (Precondition(..), variables, say) +import Yaifl.Model.Kinds.Thing ( thingIsScenery ) + +ex16 :: (Text, [Text], Game PlainWorldModel ()) +ex16 = ("Replanting", replantingTestMeWith, replantingWorld) + +replantingWorld :: Game PlainWorldModel () +replantingWorld = do + setTitle "Replanting" + addRoom "The Orchard" ! #description + "Within this quadrille of pear trees, a single gnarled old oak remains as a memory of centuries past." + + addThing "gnarled oak tree" + ! #modify makeItScenery + ! done + insteadOf (ActionRule #taking) [Precondition (pure "taking scenery") $ + \t -> return (thingIsScenery (variables t))] (const $ say @Text "You lack the hulk-like strength.") + pass + +replantingTestMeWith :: [Text] +replantingTestMeWith = ["take oak"] diff --git a/yaifl/test/testcases/Chapter3/Replanting b/yaifl/test/testcases/Chapter3/Replanting new file mode 100644 index 0000000..3c6d0d0 --- /dev/null +++ b/yaifl/test/testcases/Chapter3/Replanting @@ -0,0 +1,10 @@ +---------------------- +----- Replanting ----- +---------------------- + +The Orchard +Within this quadrille of pear trees, a single gnarled old oak remains as a memory of centuries past. + +>take oak + +You lack the hulk-like strength. diff --git a/yaifl/yaifl.cabal b/yaifl/yaifl.cabal index 12076db..01f97e4 100644 --- a/yaifl/yaifl.cabal +++ b/yaifl/yaifl.cabal @@ -204,6 +204,7 @@ test-suite yaifl-test Yaifl.Test.Chapter3.DisenchantmentBay2 Yaifl.Test.Chapter3.FirstNameBasis Yaifl.Test.Chapter3.MidsummerDay + Yaifl.Test.Chapter3.Replanting Yaifl.Test.Chapter3.PortRoyal Yaifl.Test.Chapter3.PortRoyal2 Yaifl.Test.Chapter3.PortRoyal3