Package net.demilich.metastone.game
GameContext
contains the state, player delegates and state-manipulation code
(i.e. the GameLogic
). This is the starting point for interacting with the
engine. You'll create an instance of a GameContext
for nearly anything you want to do.
To create new player behaviours like AIs, explore the Behaviour
hierarchy of classes. In particular, GameStateValueBehaviour
represents a complex AI.
The CardCatalogue
contains references to the cards. They are accessed by
their IDs, which correspond to their filenames in the cards/src/main/resources/cards
directory, minus the
".json"
extension.
Cards are deserialized from CardDesc
objects. The type system for the
card JSON is not straight forward. Some types, like CardDesc
, EnchantmentDesc
and OpenerDesc
deserialize conventionally, where each field in the class corresponds exactly in name and type to a field in a JSON
object. However, all other types are modeled as interable maps that subclass Desc
. These have corresponding key enums, like SpellArg
, whose camelCased
version appears in the JSON. The type of
the value can be discovered by looking at the corresponding DescDeserializer
subclass's DescDeserializer.init(net.demilich.metastone.game.cards.desc.DescDeserializer.SerializationContext)
method and cross-referencing the ParseValueType
that appears as a
value of an enum, ParseValueType key pair with ParseUtils.parse(com.fasterxml.jackson.databind.JsonNode, net.demilich.metastone.game.cards.desc.ParseValueType, com.fasterxml.jackson.databind.DeserializationContext)
.
- See Also:
-
for more about how to start a Spellsource game and how game state is stored and manipulated.
for more about how the rules of the game are implemented
for more about how to get player actions
for more about the card JSON format
for more about spell effects
for more about how data is stored in the game
-
ClassesClassDescriptionA game context helps execute a match of Spellsource, providing a place to store state, deliver requests for actions to players, apply those player actions through a
GameLogic
, and then save the updated state as a result of those actions.ThePlayer
class stores almost the state that corresponds to a particular player, like a collection ofEntityZone
objects and selectAttribute
andPlayerAttribute
attributes as anEntity
that exists in the game.