001 (ns cc.journeyman.the-great-game.agent.agent
002 "Anything in the game world with agency; primarily but not exclusively
003 characters."
004 (:require [cc.journeyman.the-great-game.objects.game-object :refer [ProtoObject]]
005 [cc.journeyman.the-great-game.objects.container :refer [ProtoContainer]]))
006
007 ;;; hierarchy of needs probably gets implemented here
008 ;;; I'm probably going to want to defprotocol stuff, to define the hierarchy
009 ;;; of things in the gameworld; either that or drop to Java, wich I'd rather not do.
010
011 (defprotocol ProtoAgent
012 "An object which can act in the world"
013 (act
014 [actor world circle]
015 "Allow `actor` to do something in this `world`, in the context of this
016 `circle`; return the new state of the actor if something was done, `nil`
017 if nothing was done. Circle is expected to be one of
018
019 * `:active` - actors within visual/audible range of the player
020 character;
021 * `:pending` - actors not in the active circle, but sufficiently close
022 to it that they may enter the active circle within a short period;
023 * `:background` - actors who are active in the background in order to
024 handle trade, news, et cetera;
025 * `other` - actors who are not members of any other circle, although
026 I'm not clear whether it would ever be appropriate to invoke an
027 `act` method on them.
028
029 The `act` method *must not* have side effects; it must *only* return a
030 new state. If the actor's intention is to seek to change the state of
031 something else in the game world, it must add a representation of that
032 intention to the sequence which will be returned by its
033 `pending-intentions` method.")
034 (pending-intentions
035 [actor]
036 "Returns a sequence of effects an actor intends, as a consequence of
037 acting. The encoding of these is not yet defined."))
038
039 (defrecord Agent
040 ;; "A default agent."
041 [name craft home culture]
042 ProtoObject
043 ProtoContainer
044 ProtoAgent
045 )