... | ... | @@ -2,7 +2,33 @@ |
|
|
|
|
|
Here is the description of the Ability/Effect module of the game, to allow everyone to create new abilities for the game.
|
|
|
|
|
|
**Typographical convention**: As the same word can have different meanings, I'll use some convention to distinguish these meanings. For example, "Ability" means the Ability class of the java code (or maybe an instance of this class) while "ability" is the ability as seen from the game design point of view (the word in the common language and not in the programming meaning).
|
|
|
**Typographical convention**: As the same word can have different meanings, I'll try to use some convention to distinguish these meanings. For example, "Ability" means the Ability class of the java code (or maybe an instance of this class) while "ability" is the ability as seen from the game design point of view (the word in the common language and not in the programming meaning).
|
|
|
## 1) Overview
|
|
|
Each character has abilities. This is represented by each Character having a List of instances of Ability.
|
|
|
These instances are "owned" by the Character, and not shared with another Character.
|
|
|
But the code of the class Ability only contains the cast/cooldown mechanism and , it does not contain the actual "effects" of the ability. This is where the Effect class comes in.
|
|
|
The instances of the Effect class contain the code that will apply modifications to the gameContent.
|
|
|
|
|
|
**WORK IN PROGRESS** |
|
|
\ No newline at end of file |
|
|
## 3) Effects
|
|
|
### a) Definition
|
|
|
Here is the main method of an Effect, which defines a modification of the gameContent:
|
|
|
```
|
|
|
/**
|
|
|
* What the Effect does to its targets, in a given gameContent
|
|
|
* @param targetCharacterIDList a List of the IDs of the Characters to apply this effect on
|
|
|
* @param gameContent the gameContent in which the target characters lives
|
|
|
* @param casterCharacterID the ID of the Character that casted the Ability containing this Effect
|
|
|
*/
|
|
|
abstract public void effect(List<Integer> targetCharacterIDList, GameContent gameContent, int casterCharacterID);
|
|
|
```
|
|
|
For example a damage effect will query the gameContent for for the Characters that have the ID stored in targetCharacterIDList and remove let's say 5 HP to each of them.
|
|
|
### b) How to design new Effects
|
|
|
Effects are built using the methods from EffectBuilder and composing them. There are "base case" methods, that just produce an Effect that does something to the gameContent, and there are "induction" methods, that takes an existing Effect, plug something before it and create a new Effect whose effect method does this. To illustrate this, here is an extract of the documentation of the "randomTest" method:
|
|
|
```
|
|
|
* Take an instance of Effect and return another instance of Effect that, for each Character it receives as input,
|
|
|
* makes a random test that has chances/outOf probability of success. On a success, the character is added to a list l.
|
|
|
* After this loop, the original Event is applied to the list l.
|
|
|
```
|
|
|
## 2) How to add an ability to the game
|
|
|
|
|
|
`AbilityKey` is an enum whose members correspond to particular abilities. |
|
|
\ No newline at end of file |