mirror of
https://github.com/correl/mage.git
synced 2025-04-09 01:01:06 -09:00
- Chainer, Nightmare Adept will now gain haste when it enters the battlefield.
This commit is contained in:
parent
9824c9bfd2
commit
6478ef3ff4
1 changed files with 25 additions and 14 deletions
|
@ -18,7 +18,6 @@ import mage.constants.*;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||||
import mage.filter.predicate.Predicates;
|
import mage.filter.predicate.Predicates;
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
|
||||||
import mage.filter.predicate.permanent.TokenPredicate;
|
import mage.filter.predicate.permanent.TokenPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
|
@ -42,11 +41,14 @@ public final class ChainerNightmareAdept extends CardImpl {
|
||||||
this.power = new MageInt(3);
|
this.power = new MageInt(3);
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
// Discard a card: You may cast a creature card from your graveyard this turn. Activate this ability only once each turn.
|
// Discard a card: You may cast a creature card from your graveyard this turn.
|
||||||
Ability ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new ChainerNightmareAdeptContinuousEffect(), new DiscardCardCost());
|
// Activate this ability only once each turn.
|
||||||
|
Ability ability = new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD,
|
||||||
|
new ChainerNightmareAdeptContinuousEffect(), new DiscardCardCost());
|
||||||
this.addAbility(ability, new ChainerNightmareAdeptWatcher());
|
this.addAbility(ability, new ChainerNightmareAdeptWatcher());
|
||||||
|
|
||||||
// Whenever a nontoken creature enters the battlefield under your control, if you didn't cast it from your hand, it gains haste until your next turn.
|
// Whenever a nontoken creature enters the battlefield under your control,
|
||||||
|
// if you didn't cast it from your hand, it gains haste until your next turn.
|
||||||
this.addAbility(new ChainerNightmareAdeptTriggeredAbility(), new CastFromHandWatcher());
|
this.addAbility(new ChainerNightmareAdeptTriggeredAbility(), new CastFromHandWatcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +82,9 @@ class ChainerNightmareAdeptContinuousEffect extends ContinuousEffectImpl {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
|
||||||
if (player == null || game.getActivePlayerId() == null || !game.isActivePlayer(player.getId())) {
|
if (player == null
|
||||||
|
|| game.getActivePlayerId() == null
|
||||||
|
|| !game.isActivePlayer(player.getId())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +128,10 @@ class ChainerNightmareAdeptCastFromGraveyardEffect extends AsThoughEffectImpl {
|
||||||
&& affectedControllerId != null
|
&& affectedControllerId != null
|
||||||
&& card.getSpellAbility().spellCanBeActivatedRegularlyNow(affectedControllerId, game)
|
&& card.getSpellAbility().spellCanBeActivatedRegularlyNow(affectedControllerId, game)
|
||||||
&& affectedControllerId.equals(source.getControllerId())) {
|
&& affectedControllerId.equals(source.getControllerId())) {
|
||||||
ChainerNightmareAdeptWatcher watcher = game.getState().getWatcher(ChainerNightmareAdeptWatcher.class, source.getSourceId());
|
ChainerNightmareAdeptWatcher watcher = game.getState().getWatcher(
|
||||||
return watcher != null && !watcher.isAbilityUsed();
|
ChainerNightmareAdeptWatcher.class, source.getSourceId());
|
||||||
|
return watcher != null
|
||||||
|
&& !watcher.isAbilityUsed();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -141,9 +147,11 @@ class ChainerNightmareAdeptWatcher extends Watcher {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void watch(GameEvent event, Game game) {
|
public void watch(GameEvent event, Game game) {
|
||||||
if (event.getType() == GameEvent.EventType.SPELL_CAST && event.getZone() == Zone.GRAVEYARD) {
|
if (event.getType() == GameEvent.EventType.SPELL_CAST
|
||||||
|
&& event.getZone() == Zone.GRAVEYARD) {
|
||||||
Spell spell = (Spell) game.getObject(event.getTargetId());
|
Spell spell = (Spell) game.getObject(event.getTargetId());
|
||||||
if (spell.isCreature()) {
|
if (spell.isCreature()
|
||||||
|
&& abilityUsed == false) {
|
||||||
abilityUsed = true;
|
abilityUsed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,19 +170,22 @@ class ChainerNightmareAdeptWatcher extends Watcher {
|
||||||
|
|
||||||
class ChainerNightmareAdeptTriggeredAbility extends EntersBattlefieldAllTriggeredAbility {
|
class ChainerNightmareAdeptTriggeredAbility extends EntersBattlefieldAllTriggeredAbility {
|
||||||
|
|
||||||
private final static String abilityText = "Whenever a nontoken creature enters the battlefield under your control, "
|
private final static String abilityText = "Whenever a nontoken creature "
|
||||||
|
+ "enters the battlefield under your control, "
|
||||||
+ "if you didn't cast it from your hand, it gains haste until your next turn.";
|
+ "if you didn't cast it from your hand, it gains haste until your next turn.";
|
||||||
private final static ContinuousEffect gainHasteUntilNextTurnEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.UntilYourNextTurn);
|
private final static ContinuousEffect gainHasteUntilNextTurnEffect
|
||||||
private final static FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another nontoken creature");
|
= new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.UntilYourNextTurn);
|
||||||
|
private final static FilterControlledCreaturePermanent filter
|
||||||
|
= new FilterControlledCreaturePermanent("nontoken creature");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(Predicates.not(TokenPredicate.instance));
|
filter.add(Predicates.not(TokenPredicate.instance));
|
||||||
filter.add(TargetController.YOU.getControllerPredicate());
|
filter.add(TargetController.YOU.getControllerPredicate());
|
||||||
filter.add(AnotherPredicate.instance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChainerNightmareAdeptTriggeredAbility() {
|
public ChainerNightmareAdeptTriggeredAbility() {
|
||||||
super(Zone.BATTLEFIELD, gainHasteUntilNextTurnEffect, filter, false, SetTargetPointer.PERMANENT, abilityText);
|
super(Zone.BATTLEFIELD, gainHasteUntilNextTurnEffect, filter, false,
|
||||||
|
SetTargetPointer.PERMANENT, abilityText);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChainerNightmareAdeptTriggeredAbility(final ChainerNightmareAdeptTriggeredAbility effect) {
|
ChainerNightmareAdeptTriggeredAbility(final ChainerNightmareAdeptTriggeredAbility effect) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue