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
81
Mage.Sets/src/mage/cards/s/ShaunFatherOfSynths.java
Normal file
81
Mage.Sets/src/mage/cards/s/ShaunFatherOfSynths.java
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
|
||||
import mage.abilities.effects.common.ExileAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.mageobject.AnotherPredicate;
|
||||
import mage.filter.predicate.permanent.AttackingPredicate;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author alexander-novo
|
||||
*/
|
||||
public class ShaunFatherOfSynths extends CardImpl {
|
||||
|
||||
private static final FilterControlledCreaturePermanent attackFilter = new FilterControlledCreaturePermanent(
|
||||
"attacking legendary creature you control other than {this}");
|
||||
private static final FilterControlledPermanent exileFilter = new FilterControlledPermanent(SubType.SYNTH,
|
||||
"Synth tokens you control");
|
||||
|
||||
static {
|
||||
attackFilter.add(AnotherPredicate.instance);
|
||||
attackFilter.add(AttackingPredicate.instance);
|
||||
attackFilter.add(SuperType.LEGENDARY.getPredicate());
|
||||
|
||||
exileFilter.add(TokenPredicate.TRUE);
|
||||
}
|
||||
|
||||
public ShaunFatherOfSynths(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[] { CardType.CREATURE }, "{3}{U}{R}");
|
||||
|
||||
this.supertype.add(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.SCIENTIST);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
// Whenever you attack, you may create a tapped and attacking token that's a copy of target attacking legendary creature you control other than Shaun, except it's not legendary and it's a Synth artifact creature in addition to its other types.
|
||||
Effect effect = new CreateTokenCopyTargetEffect(
|
||||
null, null,
|
||||
false, 1, true, true)
|
||||
.setPermanentModifier((token) -> {
|
||||
token.removeSuperType(SuperType.LEGENDARY);
|
||||
token.addCardType(CardType.CREATURE);
|
||||
token.addCardType(CardType.ARTIFACT);
|
||||
token.addSubType(SubType.SYNTH);
|
||||
}).setText(
|
||||
"create a tapped and attacking token that's a copy of target attacking legendary creature you control other than Shaun, except it's not legendary and it's a Synth artifact creature in addition to its other types");
|
||||
TriggeredAbility ability = new AttacksWithCreaturesTriggeredAbility(effect, 1);
|
||||
ability.addTarget(new TargetPermanent(attackFilter));
|
||||
ability.setOptional();
|
||||
this.addAbility(ability);
|
||||
|
||||
// When Shaun leaves the battlefield, exile all Synth tokens you control.
|
||||
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ExileAllEffect(exileFilter), false));
|
||||
}
|
||||
|
||||
private ShaunFatherOfSynths(final ShaunFatherOfSynths card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShaunFatherOfSynths copy() {
|
||||
return new ShaunFatherOfSynths(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -268,6 +268,7 @@ public final class Fallout extends ExpansionSet {
|
|||
cards.add(new SetCardInfo("Sentry Bot", 552, Rarity.RARE, mage.cards.s.SentryBot.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Sentry Bot", 899, Rarity.RARE, mage.cards.s.SentryBot.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Shadowblood Ridge", 288, Rarity.RARE, mage.cards.s.ShadowbloodRidge.class));
|
||||
cards.add(new SetCardInfo("Shaun, Father of Synths", 119, Rarity.RARE, mage.cards.s.ShaunFatherOfSynths.class));
|
||||
cards.add(new SetCardInfo("Sheltered Thicket", 289, Rarity.RARE, mage.cards.s.ShelteredThicket.class));
|
||||
cards.add(new SetCardInfo("Sierra, Nuka's Biggest Fan", 25, Rarity.RARE, mage.cards.s.SierraNukasBiggestFan.class, NON_FULL_USE_VARIOUS));
|
||||
cards.add(new SetCardInfo("Sierra, Nuka's Biggest Fan", 372, Rarity.RARE, mage.cards.s.SierraNukasBiggestFan.class, NON_FULL_USE_VARIOUS));
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public interface TriggeredAbility extends Ability {
|
|||
|
||||
boolean isOptional();
|
||||
|
||||
TriggeredAbility setOptional();
|
||||
|
||||
boolean isLeavesTheBattlefieldTrigger();
|
||||
|
||||
void setLeavesTheBattlefieldTrigger(boolean leavesTheBattlefieldTrigger);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
private final int tokenPower;
|
||||
private final int tokenToughness;
|
||||
private boolean useLKI = false;
|
||||
private PermanentModifier permanentModifier = null; // TODO: miss copy constructor? Make serializable?
|
||||
private PermanentModifier permanentModifier = null;
|
||||
|
||||
// TODO: These constructors are a mess. Copy effects need to be reworked altogether, hopefully clean it up then.
|
||||
|
||||
|
|
@ -154,6 +154,7 @@ public class CreateTokenCopyTargetEffect extends OneShotEffect {
|
|||
this.tokenPower = effect.tokenPower;
|
||||
this.tokenToughness = effect.tokenToughness;
|
||||
this.useLKI = effect.useLKI;
|
||||
this.permanentModifier = effect.permanentModifier;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue