Skip to content

Proposal for Effects

Razvan Deaconescu edited this page Aug 23, 2014 · 1 revision

Effects are the updates to a player's stats or game behavior, caused by modifiers or triggers. For example an artifact worn by a player could have the effect of allowing him to get 50% bonus when answering a question of day; or a spell cast on player could have the effect of disabling him the ability to run challenges; or a skill of a player may allow her to get an extra question when running a challenge; or the ending of a quest could provide a player with resources; or the running of a challenge could consume resources from player.

Effects are enabled and customized in game and then attached to a modifier item or a trigger. Both a modifier item or a trigger may use multiple effects, though it would mostly be a single one, to keep things simple.

Implementing Effects

There should be an Effect top-level class/model that defines what an effect should look like. Each instance of the class would be an actual effect that is to be attached to a modifier or a trigger. The effect is applied whenever a modifier is used/cast and when a trigger condition is met.

The Effect class would consist of the following attributes:

  • name: a unique name/identifier of the effect
  • description: a description of the what the effect does: what is the effect outcome on the player
  • expression: an expression of the effect condition; for example, the expression could allow the privileged user to configure the amount of resources to deliver
  • owner: what type of trigger or modifier items can the effect be attached to; it may be general or it may only apply to a certain set of modifier items or triggers

There would be a single method:

  • apply: apply the effect and alter some attributes of the player

Actions on Effects

Effect types are predefined in the implementation. An effect type is defined as a tuple of the effect name, description, expression and owner. The expression is a user customizable string, such as "%config-provided-resource-type%, %config-provided-amount%". This expression translates to giving a player the configuration provided amount of the resource type. A sample of the constraint type tuple would be: ("give-resource", "Give resources to player", "%config-provided-resource-type%, %config-provided-amount%", "2, 100", "general"). The last two items are the default values for the resource type and the resource amount and the owner of the effect (in this situation, it's general).

In the Control Panel interface, the privileged user may create effect instances. Effect instances may only be created in conjunction with creating modifier items or triggers. For example, if creating a spell, we might configure the effect for that spell to give players an extra question for a challenge. Or, if creating a trigger for starting a quest, we might configure the quest to withdraw resources from the player.

The privileged user may do the following effect:

  1. Add effect

    Adding an effect may only be done in the context of adding a modifier item or a trigger. Adding an effect means first selecting an effect identifier. After this the player can see the description and fill a set of elements, those required by the effect expression. It may so be that there is no element to be filled.

  2. Edit effect

    When editing an effect, the privileged user may update the elements in the expression.

  3. Remove effect

    Removing an effect requires no precondition.

Sample Effects

Below is an initial set of effect types. Each shows the effect name, the description, expression and owner.

  1. give-resource

    • description: Give configuration provided amount of configuration provided resource type to player
    • expression: %config-provided-resource-type%, %config-provided-amount%
    • owner: general
  2. take-resource

    • description: Take configuration provided amount of configuration provided resource type from player
    • expression: %config-provided-resource-type%, %config-provided-amount%
    • owner: general
  3. give-resource-to-other-player

    • description: Give configuration provided amount of configuration provided resource type to competing player
    • expression: %config-provided-resource-type%, %config-provided-amount%
    • owner: challenge-constraint
  4. give-resource-from-other-player

    • description: Take configuration provided amount of configuration provided resource type from competing player
    • expression: %config-provided-resource-type%, %config-provided-amount%
    • owner: challenge-constraint
  5. give-spell-scroll

    • description: Give configuration provided spell scroll to player
    • expression: %config-provided-spell-scroll-type%
    • owner: general
  6. give-artifact

    • description: Give configuration provided artifact to player
    • expression: %config-provided-artifact-type%
    • owner: general
  7. give-skill

    • description: Give configuration provided skill to player
    • expression: %config-provided-skill-type%
    • owner: general
  8. give-badge

    • description: Give configuration provided badge to player
    • expression: %config-provided-badge-type%
    • owner: general
  9. give-achievement

    • description: Give configuration provided achievement to player
    • expression: %config-provided-achievement-type%
    • owner: general
  10. increase-resource-when-challenge-won

    • description: Increase configuration provided resource type by configuration provided percentage when challenge won
    • expression: %config-provided-resource-type%, %config-provided-percentage%
    • owner: challenge-constraint