-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make effects usable outside the context of abilities. (These changes bring breaking changes for the Ability API) Fixes #115
- Loading branch information
1 parent
4b3e1e3
commit 950d93b
Showing
18 changed files
with
564 additions
and
203 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
litiengine/src/main/java/de/gurkenlabs/litiengine/abilities/effects/AbilityEffect.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package de.gurkenlabs.litiengine.abilities.effects; | ||
|
||
import de.gurkenlabs.litiengine.abilities.Ability; | ||
import de.gurkenlabs.litiengine.abilities.targeting.TargetingStrategy; | ||
|
||
/** | ||
* The `AbilityEffect` class is an abstract class that represents an effect | ||
* associated with a specific ability. It extends the `Effect` class and is | ||
* used to apply effects that are tied to a particular ability. | ||
* <p> | ||
* This class provides a way to manage and access the ability that triggers the effect, | ||
* allowing for the integration of ability-specific attributes such as the executor and duration. | ||
*/ | ||
public abstract class AbilityEffect extends Effect { | ||
private final Ability ability; | ||
|
||
/** | ||
* Constructs a new `AbilityEffect` with the specified targeting strategy and ability. | ||
* <p> | ||
* The effect will inherit the executor and duration attributes from the provided ability. | ||
* | ||
* @param targetingStrategy The strategy used to select the targets for this effect. | ||
* @param ability The ability associated with this effect, providing information such as the executor and duration. | ||
*/ | ||
protected AbilityEffect(TargetingStrategy targetingStrategy, Ability ability) { | ||
super(targetingStrategy, ability.getExecutor(), ability.getAttributes().duration().get()); | ||
this.ability = ability; | ||
} | ||
|
||
public Ability getAbility() { | ||
return ability; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.