forked from External/mage
68 lines
2.4 KiB
Java
68 lines
2.4 KiB
Java
package mage.cards.c;
|
|
|
|
import mage.MageInt;
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
|
import mage.abilities.condition.Condition;
|
|
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
|
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
|
import mage.abilities.keyword.VigilanceAbility;
|
|
import mage.cards.CardImpl;
|
|
import mage.cards.CardSetInfo;
|
|
import mage.constants.CardType;
|
|
import mage.constants.SubType;
|
|
import mage.counters.CounterType;
|
|
import mage.game.Game;
|
|
import mage.game.permanent.Permanent;
|
|
import mage.target.common.TargetCreaturePermanent;
|
|
import mage.watchers.common.CastSpellLastTurnWatcher;
|
|
|
|
import java.util.UUID;
|
|
|
|
/**
|
|
* @author TheElk801
|
|
*/
|
|
public final class CodespellCleric extends CardImpl {
|
|
|
|
public CodespellCleric(UUID ownerId, CardSetInfo setInfo) {
|
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}");
|
|
|
|
this.subtype.add(SubType.HUMAN);
|
|
this.subtype.add(SubType.CLERIC);
|
|
this.power = new MageInt(1);
|
|
this.toughness = new MageInt(1);
|
|
|
|
// Vigilance
|
|
this.addAbility(VigilanceAbility.getInstance());
|
|
|
|
// When Codespell Cleric enters the battlefield, if it was the second spell you cast this turn, put a +1/+1 counter on target creature.
|
|
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
|
new EntersBattlefieldTriggeredAbility(new AddCountersTargetEffect(CounterType.P1P1.createInstance())),
|
|
CodespellClericCondition.instance, "When {this} enters the battlefield, " +
|
|
"if it was the second spell you cast this turn, put a +1/+1 counter on target creature."
|
|
);
|
|
ability.addTarget(new TargetCreaturePermanent());
|
|
this.addAbility(ability);
|
|
}
|
|
|
|
private CodespellCleric(final CodespellCleric card) {
|
|
super(card);
|
|
}
|
|
|
|
@Override
|
|
public CodespellCleric copy() {
|
|
return new CodespellCleric(this);
|
|
}
|
|
}
|
|
|
|
enum CodespellClericCondition implements Condition {
|
|
instance;
|
|
|
|
@Override
|
|
public boolean apply(Game game, Ability source) {
|
|
CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class);
|
|
return watcher != null && watcher.getPermanentSpellOrder(
|
|
(Permanent) source.getEffects().get(0).getValue("permanentEnteredBattlefield"), game
|
|
) == 2;
|
|
}
|
|
}
|