forked from External/mage
[PIP] Implement Shaun, Father of Synths (#12109)
* Added method to set triggered abilities to optional * TokenCopy effect now copies permanentModifier * Implemented Shaun, Father of Synths * remove TODO * Made `setOptional` chainable
This commit is contained in:
parent
96939b31eb
commit
8271686cb4
5 changed files with 101 additions and 1 deletions
|
|
@ -363,6 +363,21 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
|||
return optional;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TriggeredAbility setOptional() {
|
||||
this.optional = true;
|
||||
|
||||
if (getEffects().stream().filter(
|
||||
effect -> effect instanceof DoIfCostPaid && (this.optional && ((DoIfCostPaid) effect).isOptional()))
|
||||
.findAny().isPresent()) {
|
||||
throw new IllegalArgumentException(
|
||||
"DoIfCostPaid effect must have only one optional settings, but it have two (trigger + DoIfCostPaid): "
|
||||
+ this.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TriggeredAbilityImpl setAbilityWord(AbilityWord abilityWord) {
|
||||
super.setAbilityWord(abilityWord);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue