mirror of
https://github.com/magefree/mage.git
synced 2026-01-25 04:39:18 -08:00
* Fixed Stifle rule text and some other minor things related to TragetActivatedAbility.
This commit is contained in:
parent
cdbe1b0ad9
commit
9a95e49ac9
7 changed files with 80 additions and 93 deletions
|
|
@ -37,16 +37,13 @@ import mage.abilities.effects.common.CounterUnlessPaysEffect;
|
|||
import mage.abilities.keyword.BandingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.target.common.TargetActivatedOrTriggeredAbility;
|
||||
import mage.filter.FilterAbility;
|
||||
import mage.filter.predicate.ability.ArtifactSourcePredicate;
|
||||
import mage.target.common.TargetActivatedAbility;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -54,26 +51,26 @@ import mage.target.common.TargetActivatedOrTriggeredAbility;
|
|||
*/
|
||||
public class AyeshaTanaka extends CardImpl {
|
||||
|
||||
private final static FilterStackObject filter = new FilterStackObject("activated ability from an artifact source");
|
||||
private final static FilterAbility filter = new FilterAbility("activated ability from an artifact source");
|
||||
|
||||
static {
|
||||
filter.add(new ArtifactSourcePredicate());
|
||||
}
|
||||
|
||||
public AyeshaTanaka(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{W}{U}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{W}{U}{U}");
|
||||
addSuperType(SuperType.LEGENDARY);
|
||||
this.subtype.add(SubType.HUMAN);
|
||||
this.subtype.add(SubType.ARTIFICER);
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
|
||||
|
||||
// Banding
|
||||
this.addAbility(BandingAbility.getInstance());
|
||||
|
||||
// {T}: Counter target activated ability from an artifact source unless that ability's controller pays {W}.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterUnlessPaysEffect(new ManaCostsImpl("{W}")), new TapSourceCost());
|
||||
ability.addTarget(new TargetActivatedOrTriggeredAbility(filter));
|
||||
ability.addTarget(new TargetActivatedAbility(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
@ -86,22 +83,3 @@ public class AyeshaTanaka extends CardImpl {
|
|||
return new AyeshaTanaka(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ArtifactSourcePredicate implements Predicate<Ability> {
|
||||
|
||||
public ArtifactSourcePredicate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Ability input, Game game) {
|
||||
if (input instanceof StackAbility) {
|
||||
return input.getSourceObject(game).isArtifact() && input.getAbilityType() == AbilityType.ACTIVATED;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Source(Artifact)";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
|
@ -35,17 +36,12 @@ import mage.abilities.costs.mana.ManaCostsImpl;
|
|||
import mage.abilities.effects.common.CounterTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.target.common.TargetActivatedOrTriggeredAbility;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.filter.FilterAbility;
|
||||
import mage.filter.predicate.ability.ArtifactSourcePredicate;
|
||||
import mage.target.common.TargetActivatedAbility;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -53,7 +49,7 @@ import java.util.UUID;
|
|||
*/
|
||||
public class BrownOuphe extends CardImpl {
|
||||
|
||||
private final static FilterStackObject filter = new FilterStackObject("activated ability from an artifact source");
|
||||
private final static FilterAbility filter = new FilterAbility("activated ability from an artifact source");
|
||||
|
||||
static {
|
||||
filter.add(new ArtifactSourcePredicate());
|
||||
|
|
@ -69,7 +65,7 @@ public class BrownOuphe extends CardImpl {
|
|||
// {1}{G}, {tap}: Counter target activated ability from an artifact source.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CounterTargetEffect(), new ManaCostsImpl<>("{1}{G}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetActivatedOrTriggeredAbility(filter));
|
||||
ability.addTarget(new TargetActivatedAbility(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
@ -82,22 +78,3 @@ public class BrownOuphe extends CardImpl {
|
|||
return new BrownOuphe(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ArtifactSourcePredicate implements Predicate<Ability> {
|
||||
|
||||
public ArtifactSourcePredicate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Ability input, Game game) {
|
||||
if (input instanceof StackAbility) {
|
||||
return input.getSourceObject(game).isArtifact() && input.getAbilityType() == AbilityType.ACTIVATED;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Source(Artifact)";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
package mage.cards.i;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
|
|
@ -88,7 +89,7 @@ class InterdictPredicate implements Predicate<Ability> {
|
|||
@Override
|
||||
public boolean apply(Ability input, Game game) {
|
||||
if (input instanceof StackAbility && input.getAbilityType() == AbilityType.ACTIVATED) {
|
||||
Permanent sourceObject = game.getPermanentOrLKIBattlefield(input.getSourceId());
|
||||
MageObject sourceObject = input.getSourceObject(game);
|
||||
if (sourceObject != null) {
|
||||
return (sourceObject.isArtifact()
|
||||
|| sourceObject.isEnchantment()
|
||||
|
|
@ -120,9 +121,12 @@ class InterdictCounterEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
|
||||
if (stackObject != null && game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) {
|
||||
InterdictCantActivateEffect effect = new InterdictCantActivateEffect();
|
||||
effect.setTargetPointer(new FixedTarget(stackObject.getSourceId()));
|
||||
game.getContinuousEffects().addEffect(effect, source);
|
||||
Permanent sourcePermanent = stackObject.getStackAbility().getSourcePermanentIfItStillExists(game);
|
||||
if (sourcePermanent != null) {
|
||||
InterdictCantActivateEffect effect = new InterdictCantActivateEffect();
|
||||
effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
|
||||
game.getContinuousEffects().addEffect(effect, source);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -143,7 +147,7 @@ class InterdictCantActivateEffect extends RestrictionEffect {
|
|||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return getTargetPointer().getFirst(game, source).equals(permanent.getId());
|
||||
return permanent.getId().equals(getTargetPointer().getFirst(game, source));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -28,17 +28,13 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.common.CounterTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.AbilityType;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.FilterStackObject;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.stack.StackAbility;
|
||||
import mage.target.common.TargetActivatedOrTriggeredAbility;
|
||||
import mage.filter.FilterAbility;
|
||||
import mage.filter.predicate.ability.ArtifactSourcePredicate;
|
||||
import mage.target.common.TargetActivatedAbility;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -46,7 +42,7 @@ import mage.target.common.TargetActivatedOrTriggeredAbility;
|
|||
*/
|
||||
public class Rust extends CardImpl {
|
||||
|
||||
private final static FilterStackObject filter = new FilterStackObject("activated ability from an artifact source");
|
||||
private final static FilterAbility filter = new FilterAbility("activated ability from an artifact source");
|
||||
|
||||
static {
|
||||
filter.add(new ArtifactSourcePredicate());
|
||||
|
|
@ -57,7 +53,7 @@ public class Rust extends CardImpl {
|
|||
|
||||
// Counter target activated ability from an artifact source.
|
||||
this.getSpellAbility().addEffect(new CounterTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetActivatedOrTriggeredAbility(filter));
|
||||
this.getSpellAbility().addTarget(new TargetActivatedAbility(filter));
|
||||
}
|
||||
|
||||
public Rust(final Rust card) {
|
||||
|
|
@ -69,22 +65,3 @@ public class Rust extends CardImpl {
|
|||
return new Rust(this);
|
||||
}
|
||||
}
|
||||
|
||||
class ArtifactSourcePredicate implements Predicate<Ability> {
|
||||
|
||||
public ArtifactSourcePredicate() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Ability input, Game game) {
|
||||
if (input instanceof StackAbility) {
|
||||
return input.getSourceObject(game).isArtifact() && input.getAbilityType() == AbilityType.ACTIVATED;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Source(Artifact)";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue