Class Quest

All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Entity>, HasCard, Trigger

public class Quest
extends Enchantment
A quest is an enchantment and entity that goes into the Zones.QUEST zone. The player typically triggers the quest EnchantmentDesc.countUntilCast times, when its EnchantmentDesc.spell is cast.

For example, to implement the quest, "Quest: Gain 10 armor. Reward: The Coin":

   {
     "eventTrigger": {
       "class": "ArmorChangedTrigger",
       "condition": {
         "class": "ComparisonCondition",
         "value1": {
           "class": "EventValueProvider"
         },
         "value2": 0,
         "operation": "GREATER"
       }
     },
     "spell": {
       "class": "ReceiveCardSpell",
       "card": "spell_the_coin"
     },
     "countUntilCast": 10,
     "countByValue": true
   }
 
This is a complex quest. Observe that the quest can count up using an event's value by setting EnchantmentDesc.countByValue to true (in this case, the amount of armor gained, computed by listening to armor change events that have an event value greater than zero). EnchantmentDesc.countUntilCast is equal to the amount of armor needed to be gained to fulfill the quest, in this case.
See Also:
for a full description of all the fields that make a valid quest. Since a quest is just an enchantment put into play a special way, the way it should be implemented is exactly the same as any other enchantment., Serialized Form
  • Constructor Details

  • Method Details

    • setPact

      public void setPact​(boolean pact)
      Set to true by the AddPactSpell.
      Parameters:
      pact -
    • isPact

      public boolean isPact()
      Pacts are a kind of quest that can be triggered by either player.
      Returns:
      true if this quest should behave like a pact.
      See Also:
      for more on pacts.
    • process

      @Suspendable protected boolean process​(int ownerId, SpellDesc spell, GameEvent event)
      Description copied from class: Enchantment
      Casts the effects of this enchantment.
      Overrides:
      process in class Enchantment
      Returns:
      true if processing succeeded.
    • cast

      @Suspendable protected void cast​(int ownerId, SpellDesc spell, GameEvent event)
      Overrides:
      cast in class Enchantment
    • getZones

      public Zones[] getZones()
      Overrides:
      getZones in class Enchantment
    • getEntityType

      public com.hiddenswitch.spellsource.client.models.EntityType getEntityType()
      Description copied from class: Entity
      Gets the type of entity this is. These will very nearly match up with the classes, but are primarily used for filters that e.g. draw a Spell or destroy all Secrets.
      Overrides:
      getEntityType in class Enchantment
      Returns:
      An EntityType
    • clone

      public Quest clone()
      Description copied from class: Entity
      Clone an entity, including its ID and location.

      Use this method for emulating an "immutable" view on an entity. This kind of cloning is not suitable for most gameplay situations, because using the clone will cause two entities with identical IDs and locations to exist. Instead, a subclass will provide a getCopy() method that is more helpful for gameplay.

      Specified by:
      clone in interface Trigger
      Overrides:
      clone in class Enchantment
      Returns:
      An exact clone.