... | ... | @@ -5,14 +5,16 @@ Here is the description of the Ability/Effect module of the game, to allow every |
|
|
**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.
|
|
|
These instances are "owned" by the Character, and not shared with other Characters.
|
|
|
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.
|
|
|
By design, and due to the fact that anonymous lambda functions are not serialisable, most of the components of the Ability/Effect system use keys to define what they do, rather than actual code. Whenever the Ability is cast, the server is notified of it, get the keys of the Ability, uses its factories to generate the relevant Effects, thanks to the keys, and execute these Effects.
|
|
|
**The keys**:
|
|
|
Several enums are used as keys in the factory patterns implemented in the Ability/Effect modules, here is a list of them, and the concepts they are bound to:
|
|
|
* AbilityKey: represent an ability (from game design perspective). They are bound to Supplier<Ability> (the type of functions that can generate instances of Ability by calling their "get" method) in the AbilityFactory.
|
|
|
* EffectKey: bound to EffectGenerators (see below) in EffectFactory.
|
|
|
|
|
|
## 2) Abilities
|
|
|
|
|
|
|
|
|
## 3) Effects
|
|
|
## 2) Effects
|
|
|
### a) Definition
|
|
|
Here is the main method of an Effect, which defines a modification of the gameContent:
|
|
|
```
|
... | ... | @@ -33,6 +35,28 @@ Effects are built using the methods from EffectBuilder and composing them. There |
|
|
* After this loop, the original Event is applied to the list l.
|
|
|
```
|
|
|
So
|
|
|
|
|
|
## 3) EffectDescriptors
|
|
|
Here is the doc on them:
|
|
|
```
|
|
|
* Contains an EffectKey and an array of int. The EffectKey defines an Effect (basic or composed), and the array of int
|
|
|
* is the set of parameters required by the Effect to be instanciated.
|
|
|
```
|
|
|
Each EffectDescriptor
|
|
|
|
|
|
## 4) EffectGenerators
|
|
|
Here is the doc on them:
|
|
|
```
|
|
|
* The type of functions able to generate instances of Effect out of the ID of the character that cast the ability triggering this effect,
|
|
|
* and a given number (this number depends on the actual EffectGenerator instance) of int values, provided in an array.
|
|
|
```
|
|
|
## 5) Abilities
|
|
|
The Ability class essentially contains:
|
|
|
* The cast/cooldown mechanism
|
|
|
* A key (a member of the AbilityIconKeys enum) to define which icon should be displayed on the player's screen to represent the ability
|
|
|
* A member of the Action enum (used to animate the character when she casts the ability)
|
|
|
* A list of instances of EffectDescriptor
|
|
|
|
|
|
## 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 |