Package net.demilich.metastone.game


package net.demilich.metastone.game
The core engine code for Spellsource.

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: