Skip to content

Commit

Permalink
the second test passes if I fix the golden test-ness
Browse files Browse the repository at this point in the history
  • Loading branch information
PPKFS committed Oct 21, 2023
1 parent 8d7cd92 commit db80784
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
7 changes: 6 additions & 1 deletion src/Yaifl/Actions/ActionProcessing.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ actionProcessingRules = ActionProcessing $ \aSpan Action{..} u -> withoutMissing
return (first Just $ fromMaybe (v, Nothing) r))
, notImplementedRule "after stage rule"
, notImplementedRule "investigate player awareness after rule"
, notImplementedRule "report stage rule"
, Rule "report stage rule"
[]
( \v -> do
ignoreSpan
r <- runRulebookAndReturnVariables (Just aSpan) reportRules v
return (first Just $ fromMaybe (v, Nothing) r))
, notImplementedRule "clean actions rule"
]) u) (handleMissingObject "" (Just False))
9 changes: 5 additions & 4 deletions src/Yaifl/Actions/Going.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ goingAction = Action
describeRoomGoneInto :: Rule wm (Args wm (GoingActionVariables wm)) Bool
describeRoomGoneInto = makeRule "describe room gone into rule" [] $ \a -> ifM
(isPlayer (source a))
(when (silently . actionOptions $ a) (error "") >> error "")
(error "")
(unless (silently . actionOptions $ a) (void $ do
sayLn @Text ""
parseAction ((actionOptions a) { silently = True }) "look") >> rulePass)
(error "other actors cant report going yet")


carryOutGoingRules :: WMHasProperty wm Enclosing => ActionRulebook wm (GoingActionVariables wm)
Expand All @@ -80,7 +82,6 @@ movePlayerAndVehicle = makeRule "move player and vehicle rule" [] $ \a@Args{vari
Just _x -> error "failed to move with a vehicle"
pure $ if moveSuccessful then Nothing else Just False


goingActionSet ::
forall wm es.
(ParseArgumentEffects wm es, WMStdDirections wm, WMHasProperty wm DoorSpecifics)
Expand Down Expand Up @@ -150,7 +151,7 @@ getMatchingThing matchElement = do
Just e' -> getThingMaybe e'

setDoorGoneThrough :: AnyObject wm -> Eff es (Maybe Entity)
setDoorGoneThrough = error ""
setDoorGoneThrough _ = pure Nothing

getDoorMaybe :: Thing wm -> AnyObject wm
getDoorMaybe = error ""
Expand Down
2 changes: 1 addition & 1 deletion src/Yaifl/Actions/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ runActionHandlerAsWorldActions ::
runActionHandlerAsWorldActions = interpret $ \_ -> \case
ParseAction actionOpts t -> withSpan' "action" t $ do
-- print the prompt
unless (silently actionOpts || hidePrompt actionOpts) $ printLn $ "> " <> t
unless (silently actionOpts || hidePrompt actionOpts) $ printLn $ "\n>" <> t
--we assume that the verb is the first thing in the command
possVerbs <- findVerb t
ac <- case possVerbs of
Expand Down
3 changes: 2 additions & 1 deletion test/Yaifl/Test/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import qualified Data.Text as T
import Yaifl.Text.AdaptiveNarrative
import Yaifl.Text.Print
import Yaifl.Text.Verb
import Yaifl.Rules.Args

expQQ :: (String -> Q Exp) -> QuasiQuoter
expQQ quoteExp = QuasiQuoter quoteExp notSupported notSupported notSupported where
Expand Down Expand Up @@ -89,7 +90,7 @@ testHarness allTenses fullTitle actionsToDo conOptions initWorld = do
unless (suffix == "") $ printLn suffix
--when I write a proper game loop, this is where it needs to go
failHorriblyIfMissing (runRulebook Nothing (wa ^. #whenPlayBegins) ())
mapM_ (parseAction (ActionOptions False Nothing)) actionsToDo
mapM_ (parseAction (ActionOptions False False)) actionsToDo
(w2 :: World wm) <- get
let (x, _) = runPureEff $ runStateShared w2 $ do
-- take it down and flip it around
Expand Down
2 changes: 1 addition & 1 deletion traceid.temp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
/��)<�d��lM
�>�y��;:x���W%�

0 comments on commit db80784

Please sign in to comment.