fix errors for disabled tactics #188

v4.6.0-bump
Jon Eugster 1 year ago
parent 26202e5f36
commit 37582e04d4

@ -149,7 +149,10 @@ partial def findForbiddenTactics (inputCtx : Parser.InputContext) (workerState :
addMessageByDifficulty info s!"The tactic '{val}' is not available in this game!" addMessageByDifficulty info s!"The tactic '{val}' is not available in this game!"
| some tac => | some tac =>
-- Tactic is introduced at some point in the game. -- Tactic is introduced at some point in the game.
if tac.locked then if tac.disabled then
-- Tactic is disabled in this level.
addMessageByDifficulty info s!"The tactic '{val}' is disabled in this level!"
else if tac.locked then
match workerState.inventory.find? (· == val) with match workerState.inventory.find? (· == val) with
| none => | none =>
-- Tactic is marked as locked and not in the inventory. -- Tactic is marked as locked and not in the inventory.
@ -157,9 +160,6 @@ partial def findForbiddenTactics (inputCtx : Parser.InputContext) (workerState :
| some _ => | some _ =>
-- Tactic is in the inventory, allow it. -- Tactic is in the inventory, allow it.
pure () pure ()
else if tac.disabled then
-- Tactic is disabled in this level.
addMessageByDifficulty info s!"The tactic '{val}' is disabled in this level!"
| .ident info _rawVal val _preresolved => | .ident info _rawVal val _preresolved =>
-- Try to resolve the name -- Try to resolve the name
let ns ← let ns ←
@ -181,12 +181,13 @@ partial def findForbiddenTactics (inputCtx : Parser.InputContext) (workerState :
addMessageByDifficulty info s!"You have not unlocked the theorem/definition '{n}' yet!" addMessageByDifficulty info s!"You have not unlocked the theorem/definition '{n}' yet!"
| some thm => | some thm =>
-- Theorem is introduced at some point in the game. -- Theorem is introduced at some point in the game.
if thm.locked then if thm.disabled then
-- Theorem is still locked.
addMessageByDifficulty info s!"You have not unlocked the theorem/definition '{n}' yet!"
else if thm.disabled then
-- Theorem is disabled in this level. -- Theorem is disabled in this level.
addMessageByDifficulty info s!"The theorem/definition '{n}' is disabled in this level!" addMessageByDifficulty info s!"The theorem/definition '{n}' is disabled in this level!"
else if thm.locked then
-- Theorem is still locked.
addMessageByDifficulty info s!"You have not unlocked the theorem/definition '{n}' yet!"
where addMessageByDifficulty (info : SourceInfo) (s : MessageData) := where addMessageByDifficulty (info : SourceInfo) (s : MessageData) :=
-- See `GameServer.FileWorker.WorkerState.difficulty`. Send nothing/warnings/errors -- See `GameServer.FileWorker.WorkerState.difficulty`. Send nothing/warnings/errors
-- deppending on difficulty. -- deppending on difficulty.

Loading…
Cancel
Save