swarm-0.5.0.0: 2D resource gathering game with programmable robots
LicenseBSD-3-Clause
Safe HaskellSafe-Inferred
LanguageHaskell2010

Swarm.Game.Scenario.Objective

Description

 
Synopsis

Documentation

data PrerequisiteConfig Source #

Constructors

PrerequisiteConfig 

Fields

  • previewable :: Bool

    Typically, only the currently "active" objectives are displayed to the user in the Goals dialog. An objective is "active" if all of its prerequisites are met.

    However, some objectives may be "high-level", in that they may explain the broader intention behind potentially multiple prerequisites.

    Set this option to True to display this goal in the "upcoming" section even if the objective has currently unmet prerequisites.

  • logic :: Prerequisite ObjectiveLabel

    Boolean expression of dependencies upon other objectives. Variables in this expression are the "id"s of other objectives, and become "true" if the corresponding objective is completed. The "condition" of the objective at hand shall not be evaluated until its prerequisite expression evaluates as True.

    Note that the achievement of these objective dependencies is persistent; once achieved, they still count even if their "condition" might not still hold. The condition is never re-evaluated once true.

Instances

Instances details
FromJSON PrerequisiteConfig Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

ToJSON PrerequisiteConfig Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Generic PrerequisiteConfig Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Associated Types

type Rep PrerequisiteConfig :: Type -> Type #

Show PrerequisiteConfig Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Eq PrerequisiteConfig Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

type Rep PrerequisiteConfig Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

type Rep PrerequisiteConfig = D1 ('MetaData "PrerequisiteConfig" "Swarm.Game.Scenario.Objective" "swarm-0.5.0.0-6qXEbhCmuXA4wRndqqhBu" 'False) (C1 ('MetaCons "PrerequisiteConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "previewable") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Bool) :*: S1 ('MetaSel ('Just "logic") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Prerequisite ObjectiveLabel))))

data Objective Source #

An objective is a condition to be achieved by a player in a scenario.

Instances

Instances details
FromJSON Objective Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

ToJSON Objective Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Generic Objective Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Associated Types

type Rep Objective :: Type -> Type #

Show Objective Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Eq Objective Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

ToSample Objective Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

ToJSON (SCC Objective) Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective.Graph

type Rep Objective Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

objectiveGoal :: Lens' Objective (Document Syntax) Source #

An explanation of the goal of the objective, shown to the player during play. It is represented as a list of paragraphs.

objectiveTeaser :: Lens' Objective (Maybe Text) Source #

A very short (3-5 words) description of the goal for displaying on the left side of the Objectives modal.

objectiveCondition :: Lens' Objective ProcessedTerm Source #

A winning condition for the objective, expressed as a program of type cmd bool. By default, this program will be run to completion every tick (the usual limits on the number of CESK steps per tick do not apply).

objectiveId :: Lens' Objective (Maybe Text) Source #

Optional name by which this objective may be referenced as a prerequisite for other objectives.

objectiveOptional :: Lens' Objective Bool Source #

Indicates whether the objective is not required in order to "win" the scenario. Useful for (potentially hidden) achievements. If the field is not supplied, it defaults to False (i.e. the objective is mandatory to "win").

objectivePrerequisite :: Lens' Objective (Maybe PrerequisiteConfig) Source #

Dependencies upon other objectives

objectiveHidden :: Lens' Objective Bool Source #

Whether the goal is displayed in the UI before completion. The goal will always be revealed after it is completed.

This attribute often goes along with an Achievement.

objectiveAchievement :: Lens' Objective (Maybe AchievementInfo) Source #

An optional achievement that is to be registered globally when this objective is completed.

data CompletionBuckets Source #

Instances

Instances details
FromJSON CompletionBuckets Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

ToJSON CompletionBuckets Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Generic CompletionBuckets Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Associated Types

type Rep CompletionBuckets :: Type -> Type #

Show CompletionBuckets Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

type Rep CompletionBuckets Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

type Rep CompletionBuckets = D1 ('MetaData "CompletionBuckets" "Swarm.Game.Scenario.Objective" "swarm-0.5.0.0-6qXEbhCmuXA4wRndqqhBu" 'False) (C1 ('MetaCons "CompletionBuckets" 'PrefixI 'True) (S1 ('MetaSel ('Just "incomplete") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Objective]) :*: (S1 ('MetaSel ('Just "completed") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Objective]) :*: S1 ('MetaSel ('Just "unwinnable") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [Objective]))))

newtype Announcement Source #

TODO: #1044 Could also add an ObjectiveFailed constructor...

Instances

Instances details
ToJSON Announcement Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Generic Announcement Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Associated Types

type Rep Announcement :: Type -> Type #

Show Announcement Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

type Rep Announcement Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

type Rep Announcement = D1 ('MetaData "Announcement" "Swarm.Game.Scenario.Objective" "swarm-0.5.0.0-6qXEbhCmuXA4wRndqqhBu" 'True) (C1 ('MetaCons "ObjectiveCompleted" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Objective)))

data ObjectiveCompletion Source #

Constructors

ObjectiveCompletion 

Fields

  • completionBuckets :: CompletionBuckets

    This is the authoritative "completion status" for all objectives. Note that there is a separate Set to store the completion status of prerequisite objectives, which must be carefully kept in sync with this. Those prerequisite objectives are required to have labels, but other objectives are not. Therefore only prerequisites exist in the completion map keyed by label.

  • completedIDs :: Set ObjectiveLabel
     

Instances

Instances details
FromJSON ObjectiveCompletion Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

ToJSON ObjectiveCompletion Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Generic ObjectiveCompletion Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

Associated Types

type Rep ObjectiveCompletion :: Type -> Type #

Show ObjectiveCompletion Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

type Rep ObjectiveCompletion Source # 
Instance details

Defined in Swarm.Game.Scenario.Objective

type Rep ObjectiveCompletion = D1 ('MetaData "ObjectiveCompletion" "Swarm.Game.Scenario.Objective" "swarm-0.5.0.0-6qXEbhCmuXA4wRndqqhBu" 'False) (C1 ('MetaCons "ObjectiveCompletion" 'PrefixI 'True) (S1 ('MetaSel ('Just "completionBuckets") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 CompletionBuckets) :*: S1 ('MetaSel ('Just "completedIDs") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Set ObjectiveLabel))))

listAllObjectives :: CompletionBuckets -> [Objective] Source #

Concatenates all incomplete and completed objectives.

extractIncomplete :: ObjectiveCompletion -> (ObjectiveCompletion, [Objective]) Source #

Returns the ObjectiveCompletion with the "incomplete" goals extracted to a separate tuple member. This is intended as input to a "fold".