Powers - torilmud/docs GitHub Wiki

Powers

Powers are special abilities that characters can use to do interesting things. A power can be a spell, a special melee ability, or an NPC's innate ability. Many of the game's powers are "core powers" that are available for players to use, and you can also create custom powers for NPCs that are bundled with zones.

The basics

Powers are defined in the JSON data format and are composed of data only. That is, you don't have to write any code to create a power, you just have to define its attributes.

A power consists of two basic pieces:

  1. Settings: These include the type of power (spell, melee, etc), the casting time, the restrictions on when and who can use it, etc.

  2. Effects: Effects describe what a power does. There are many types of effects, and a power can consist of many effects chained together. Examples of effect types included damage, lag, add condition, teleport, and much more.

Getting started

To add powers to your zone you need to include a <zonename>.pow file. That file should contain a top-level powers array that contains all of the powers for your zone.

Here's an example of a simple .pow file with a single power named Electricity Torrent.

    {
      "powers" : [
        {
          "name": "Electricity Torrent",
          "type": "Melee",
          "attack": "Auto",
          "activate": 0,
          "recharge": 16,
          "restricts": [
            "Standing"
          ],
          "targets": [
            "Offense",
            "Character in room"
          ],
          "effects": [
            {
              "type": "Damage",
              "damageType": "electricity",
              "diceNumber": 10,
              "diceSize": 10,
              "targets": [
                "Character in room"
              ],
              "messages": {
                "death": {
                  "actor": "&f147You blast $N into a &f238smoldering corpse&f147 with a torrent of &f129crackling electricity&f147!",
                  "target": "$n &f147blasts you into a &f238smoldering corpse&f147 with a torrent of &f129crackling electricity&f147!",
                  "room": "$n &f147blasts $N into a &f238smoldering corpse&f147 with a torrent of &f129crackling electricity&f147!"
                },
                "hit": {
                  "actor": "&f147You unleash a torrent of crack&f129ling elect&f147ricity into $N!",
                  "target": "&f147$n unleashes a torrent of crack&f129ling elect&f147ricity into you! ",
                  "room": "$n &f147unleashes a torrent of crack&f129ling elect&f147ricity into $N! "
                }
              }
            }
          ]
        }
      ]
    }

Let's break each piece of the power down.

Header

    {
      "powers" : [

This is the definition of an array (or list) of powers, named "powers". Every zone power file contains this at the top.

Settings

    "name": "Electricity Torrent",
    "type": "Melee",
    "attack": "Auto",
    "activate": 0,
    "recharge": 16,
    "restricts": [
      "Standing"
    ],
    "targets": [
      "Offense",
      "Character in room"
    ],

These top-level attributes define what type of power this is, how it is invoked, who it targets, and how you can use it. In this case, We can see that this is a offensive melee power named Electricity Torrent that auto-hits a character, has a recharge of 1 round and can only be used while standing. We'll go over all of these fields in more detail.

Effects

    "effects": [
      {
        "type": "Damage",
        "damageType": "electricity",
        "diceNumber": 10,
        "diceSize": 10,
        "targets": [
          "Character in room"
        ],
        "messages": {
          "death": {
            "actor": "&f147You blast $N into a &f238smoldering corpse&f147 with a torrent of &f129crackling electricity&f147!",
            "target": "$n &f147blasts you into a &f238smoldering corpse&f147 with a torrent of &f129crackling electricity&f147!",
            "room": "$n &f147blasts $N into a &f238smoldering corpse&f147 with a torrent of &f129crackling electricity&f147!"
          },
          "hit": {
            "actor": "&f147You unleash a torrent of crack&f129ling elect&f147ricity into $N!",
            "target": "&f147$n unleashes a torrent of crack&f129ling elect&f147ricity into you! ",
            "room": "$n &f147unleashes a torrent of crack&f129ling elect&f147ricity into $N! "
          }
        }
      }
    ]

Powers can contain up to 50 effects, though most have much fewer than that. Each effect defines something that this power does and the fields it must contain vary depending on what type of effect it is. In this case, we have one damage effect defined. We can see that this power does 10d10 electricity damage to a single target and has accompanying damage and death messages. When a power is invoked, each effect will be executed in the order they are defined.

More examples

See the examples page for a list of common powers to use as a starting place.

Power settings

Let's breakdown all of the power settings and their possible values.

  • name : This is the unique name for this power. Make sure not to re-use an existing power name here.
  • type: Valid power types are: Spell, Melee, Psionic, Enchantment, and Inherent. More types will be added in the future, but for now if it's not cast as a spell, just use melee.
  • attack: This defines what target stat the power is trying to overcome to hit the target. Valid attack types are: Armor, Strength, Dexterity, Constitution, Agility, Wisdom, Intelligence, Charisma, Auto. Use Auto for powers that you want to hit automatically.
  • activate: Cast time for spells only, zero for everything else. The time is in pulses, which are 1/4 of a second.
  • recharge: How long this power takes to recharge. The time is in pulses, and you can leave this as zero or omit it altogether for powers that do not have a recharge.
  • restricts: Restrictions that determine how the power can be used. This is an array that takes as many values as needed. Link to full list
  • targets: Determines the valid targets for this power. This tells the game whether this power is targeted at characters, objects, rooms, etc, as well as where they have to be in relation to the user. Link to full list
  • stack: Can this power be stacked? This is also evaluated at the effect level. Defaults to 0 (or false.)
  • component: The object vnum of a component required to use this power. The component will be consumed upon use.
  • implement: An array that specifies what weapons, shields, etc need to be present in order to use this power. For instance, the bash power requires a shield implement. Link to full list
  • conflicts: An array of power names that this power conflicts with. If any of those powers are present on the target, the power will not work.
  • hitMods: Modifiers to the hit chances for this power. This is an array of modifier objects, which have a name and a value. Link to Hit Mods
  • inherit: If a power name is specified here, this power will inherit all effects and settings from that power. Anything set in the current power will override the inherited values.
  • replace: If a power name is specified here, this power will replace that user's power. This can be used to create custom spells or melee attacks, such as an icy bash.
  • raceRestrict: A race pattern array specifying races that can not use this power. Link to Races
  • raceAllow: A race pattern array specifying races that can use this power. Link to Races
  • raceRestrictTarget: A race pattern array specifying races that can not be targeted with this power. Link to Races
  • raceAllowTarget: A race pattern array specifying races that can be targeted with this power. Link to Races

Power effects

Effects have many possible fields, and each effect type requires different fields. We'll go over the possible fields here and define which ones are required for each type in the following section.

  • type: What this effect does. Damage, healing, teleportation, etc. Link to full list

  • radius: If this is set, the power will affect multiple targets. The number of targets are determined by the size of radius, which can be Small, Medium, Large, Huge or All.

  • disperse: Affects how damage is dispersed throughout a radius' targets. Possible values are Full, Focal, Wave, Spread, and Splash.

  • condition: The condition type to be used by this effect. Link to conditions

  • damageType: The damage type for this effect. Link to damage types

  • template: The racial template to be used for this effect. Link to the Template List

  • power: The power name to be targetted by this effect. (Not the name of the power being used.)

  • stack: Does this effect stack? Defaults to 0. Putting a 1 here will make this effect stack. It does not affect any other effects used in this power.

  • chain: A 1 here indicates that this effect is chained to the previous effect and will not go off unless that earlier effect was successful.

  • chance: A % chance for this effect to go off.

  • randomTargets: Specify a number of random targets to be hit by this effect. You must set a radius value for this to be used. It will then pick x number of targets from the radius list to be hit by the effect.

  • group: Specify an effect group ID for advanced effects that have timers or triggers.

  • reorderEffect: When inherited or replacing a power, you can set this to reorder an effect to the specified index. For example, you could inherit from bash and add an effect that hastes the user before they hit the target by setting the new haste effect to 1 in this field.

  • replaceEffect: Indicates that the current effect should completely replace the target effect index in the replaced or inherited power. For example, you could inherit from backstab and replace the lag effect with an effect that knocks the target down instead.

  • repeat: Repeat this effect x times. Only used for attack and damage effects.

  • duration: The duration in pulses of this effect.

  • diceNumber: The number of dice to roll, or the x in xDy or 3 * 6-sided dice rolled (3D6)

  • diceSize: The size of dice to roll, or the y in xDy or 3 * 6-sided dice rolled (3D6)

  • offensiveLevel: A pre-set damage value for spell powers. This overrides the dice values when set and can be a number from 1-20.

  • modifier: The modifier amount for this effect.

  • position: A character position to be set for this effect. This is a number, and the values can be found at mob positions

  • triggerGroup: A trigger group ID for advanced powers.

  • statusFlags: Affected flags to be used by this effect. This is an array of multiple values. Link to Affect Flags

  • location: The object apply location to be used by this effect. Link to Location

  • statusSublocations: The object apply sublocation to be used by this effect. Link to Sub-Locations

  • roomFlags: Room flags to be used by this effect. Link to Room Flags

  • targets: Target type array for this effect. Note: Effects have to have their target values set, it isn't enough to set them on the power only. This is how an effect knows who it is supposed to hit. Link to power targets

  • implements: The implement list for this effect. This tells the effect which implements are required for it, event though the power may have other effects that have different requirements.

  • effectOptions: Various options for effects. Some are universal, others are used only by specific effects. Link to Effect Options

  • triggers: Trigger types for advanced powers. Link to trigger types

  • restricts: Restriction values for this effect. Like targeting and implements, restricts are evaluated individually for each effect, though the power's restrictions are checked first. An effect has to pass both the power and its own restricts in order to fire.

  • values: Array of 8 integers used by various effect types.

  • raceRestrict: A race pattern array specifying races that can not use this effect. Link to Races

  • raceAllow: A race pattern array specifying races that can use this effect. Link to Races

  • raceRestrictTarget: A race pattern array specifying races that can not be targeted with this effect. Link to Races

  • raceAllowTarget: A race pattern array specifying races that can be targeted with this effect. Link to Races

  • effectMods: An array of effect modifier objects that consist of a name, value and target. These are used to modify saving throws, modifiers, and durations. Link to Effect Mods

  • savingThrow: A saving throw object that consists of a saveType, saveChance and saveMod. Link to savingThrows

  • timer: A timer object that consists of timerDuration, timerCycles, and timerOptions. Link to Timers

  • messages: Messages object that controls how this effect is communicated. TODO: [Link to messages section]

⚠️ **GitHub.com Fallback** ⚠️