Page 1 of 1

Help implementing Chainer, Dementia Master

PostPosted: 02 Feb 2015, 23:07
by fireshoes
Can anyone help me with Chainer's reanimation ability? I have the return from the graveyard done, but am not sure how to set the creature's color to black and subtype to Nightmare. I looked at Ashiok, Nightmare Weaver's second ability, but am not sure how to work it into Chainer. Also with Chainer's exile ability, can I use the same filter, which uses FilterCreaturePermanent, or do I need to create a second filter using FilterPermanent in case some non-creature permanent has somehow gained the Nightmare subtype?

Code: Select all
public class ChainerDementiaMaster extends CardImpl {
   
    private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Nightmare creatures");

    static {
        filter.add(new SubtypePredicate("Nightmare"));
    }

    public ChainerDementiaMaster(UUID ownerId) {
        super(ownerId, 56, "Chainer, Dementia Master", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
        this.expansionSetCode = "TOR";
        this.supertype.add("Legendary");
        this.subtype.add("Human");
        this.subtype.add("Minion");
        this.power = new MageInt(3);
        this.toughness = new MageInt(3);

        // Nightmare creatures get +1/+1.
        this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false)));

        // {B}{B}{B}, Pay 3 life: Put target creature card from a graveyard onto the battlefield under your control. That creature is black and is a Nightmare in addition to its other creature types.
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new ManaCostsImpl("{B}{B}{B}"));
        ability.addCost(new PayLifeCost(3));
        this.addAbility(ability);
       
        // When Chainer, Dementia Master leaves the battlefield, exile all Nightmares.
        Ability ability2 = new LeavesBattlefieldTriggeredAbility(new ExileAllEffect(filter), false);
        this.addAbility(ability2);
    }

    public ChainerDementiaMaster(final ChainerDementiaMaster card) {
        super(card);
    }

    @Override
    public ChainerDementiaMaster copy() {
        return new ChainerDementiaMaster(this);
    }
}

Re: Help implementing Chainer, Dementia Master

PostPosted: 03 Feb 2015, 00:59
by LevelX
Use or check the use of this classes:
AddCardSubTypeTargetEffect
BecomesColorTargetEffect
They are used for such effects.

You don't need a second filter because of:
205.1a
If an object’s card type is removed, the subtypes correlated with that card type will remain if they are also the subtypes of a card type the object currently has; otherwise, they are also removed for the entire time the object’s card type is removed.

Re: Help implementing Chainer, Dementia Master

PostPosted: 02 Jun 2015, 03:13
by Ukki
Would this code work then? I added the two classes mentioned by LevelX using Sensei Golden-Tail as a template. I'm not sure about the duration being "custom" but that was used for golden tail so I rolled with it, maybe it should be WhileOnBattlefield?.

(This is my first crack at making a card, figured I'd start with one that someone had already begun if that's ok. I can't figure out how to get my mage server to run so I can't test it.)

Code: Select all
public class ChainerDementiaMaster extends CardImpl {

    private static final FilterCreaturePermanent filterCreatures = new FilterCreaturePermanent("Nightmare creatures");
   
    static {
        filterCreatures.add(new SubtypePredicate("Nightmare"));
    }
    public ChainerDementiaMaster(UUID ownerId) {
        super(ownerId, 56, "Chainer, Dementia Master", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}{B}");
        this.expansionSetCode = "TOR";
        this.supertype.add("Legendary");
        this.subtype.add("Human");
        this.subtype.add("Minion");
        this.power = new MageInt(3);
        this.toughness = new MageInt(3);

        // Nightmare creatures get +1/+1.
        this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filterCreatures, false)));
        // {B}{B}{B}, Pay 3 life: Put target creature card from a graveyard onto the battlefield under your control. That creature is black and is a Nightmare in addition to its other creature types.
        Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnFromGraveyardToBattlefieldTargetEffect(), new ManaCostsImpl("{B}{B}{B}"));
        ability.addCost(new PayLifeCost(3));
        ability.addEffect(new AddCardSubTypeTargetEffect("Nightmare",Duration.Custom));
        ability.addEffect(new BecomesColorTargetEffect(ObjectColor.BLACK,Duration.Custom));
        this.addAbility(ability);
       
        // When Chainer, Dementia Master leaves the battlefield, exile all Nightmares.
        Ability ability2 = new LeavesBattlefieldTriggeredAbility(new ExileAllEffect(filterCreatures), false);
        this.addAbility(ability2);
    }
   

    public ChainerDementiaMaster(final ChainerDementiaMaster card) {
        super(card);
    }

    @Override
    public ChainerDementiaMaster copy() {
        return new ChainerDementiaMaster(this);
    }
}