Previously, I wrote about character and player attributes. This time I will give an overview of special abilities.
PAD has a lot special effects that can be combined into any one skill. Lets take a look at a skill representation in the RPG database.
The above skill will do the following:
- Reduce all enemy characters’ defense by 50% for 4 turns.
The TookDamage method is invoked when an enemy character takes damage. Line 102 checks the character’s skill effect stack for a guard break effect and evaluates the modified value based on the current value of the defense attribute.
- Prevent all enemy characters’ turn counter from decrementing for the next 2 turns.
The TakeTurn method is invoked when players and their characters take turns. Here you can see the enemy character taking a turn. But before it decrements its attack counter attribute, it verifies that a delay skill effect is not on its skill effect stack.
If we look at the base character class, you can see that the skill effects stack also takes a turn, decrementing each skill effect until it reaches zero and is removed from the stack.
- The character that executed the skill will attack all enemy characters on the next turn.
When it is the human player’s turn to attack we run each character through an enemy selector and based on various conditions we choose which enemy character to attack. Below you can see the skill effect stack being checked for spread attack skill effect. If it is present then we allow our character to attack every living enemy character.
- The human player will recover 3-orbs worth of health over the next 2 turns. We have also decided that recovery should happen immediately as well.
Here is a little more complicated skill effect. The Heal method basically reaches into our game engine and creates a fake match chain of orbs, in this case 3-orbs long. Then it passes that chain to our recovery calculator and adjusts the player’s health. The Distribute method is invoked when the skill is first executed. In here we decide whose skill effect stack to put the the effect on. By default we will place it on the casting character’s stack. As mentioned before we call the Heal method at this time as well as on each turn. There are two types of turns in PAD, a turn where the player matches orbs and one where the player does not match orbs (aka NullTurn).