Added common interface to conditional effects (#9208)

This commit is contained in:
Alex Vasile 2022-07-04 20:28:54 -04:00 committed by GitHub
parent 5c54eccffd
commit 78f3547644
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 62 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package mage.abilities.effects;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.condition.Condition;
import mage.constants.EffectType;
import mage.constants.Outcome;
import mage.game.Game;
@ -67,4 +68,18 @@ public interface Effect extends Serializable, Copyable<Effect> {
Effect concatBy(String concatPrefix);
String getConcatPrefix();
/**
* Used to check if this is a conditional version without needed any Java reflection hacks or chained instanceof checks.
* Only conditions on the activation of the ability are checked, and not on how the effects can be used.
* E.g. For a conditional mana ability this will only return the condition under which it can be activated,
* and NOT the conditions on the mane produced.
*
* Assumed that if the returned condition is null then this is not a conditional version, or that it does not matter.
*
* @return
*/
public default Condition getCondition() {
return null;
}
}