Fixed cards to use CantBlockTargetEffect instead of adding CantBlockAbility

This commit is contained in:
North 2012-07-08 14:35:06 +03:00
parent 3e0d565f97
commit 2e457fda1d
13 changed files with 63 additions and 138 deletions

View file

@ -27,14 +27,13 @@
*/
package mage.sets.avacynrestored;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -59,7 +58,7 @@ public class FerventCathar extends CardImpl<FerventCathar> {
this.addAbility(HasteAbility.getInstance());
// When Fervent Cathar enters the battlefield, target creature can't block this turn.
Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Constants.Duration.EndOfTurn));
Ability ability = new EntersBattlefieldTriggeredAbility(new CantBlockTargetEffect(Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent(true));
this.addAbility(ability);
}

View file

@ -31,13 +31,12 @@ import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.cards.CardImpl;
import mage.target.TargetPermanent;
@ -67,7 +66,7 @@ public class MaliciousIntent extends CardImpl<MaliciousIntent> {
this.addAbility(ability);
// Enchanted creature has "{tap}: Target creature can't block this turn."
Ability gainedAbility = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Constants.Duration.EndOfTurn), new TapSourceCost());
Ability gainedAbility = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new CantBlockTargetEffect(Constants.Duration.EndOfTurn), new TapSourceCost());
gainedAbility.addTarget(new TargetCreaturePermanent());
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(gainedAbility, Constants.AttachmentType.AURA)));
}

View file

@ -30,14 +30,13 @@ package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.SpellCastTriggeredAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterSpiritOrArcaneCard;
import mage.target.common.TargetCreaturePermanent;
@ -56,7 +55,9 @@ public class KamiOfFiresRoar extends CardImpl<KamiOfFiresRoar> {
this.color.setRed(true);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
Ability ability = new SpellCastTriggeredAbility(new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Constants.Duration.EndOfTurn), filter, false);
// Whenever you cast a Spirit or Arcane spell, target creature can't block this turn.
Ability ability = new SpellCastTriggeredAbility(new CantBlockTargetEffect(Duration.EndOfTurn), filter, false);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -30,14 +30,11 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.Mode;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.cards.CardImpl;
import mage.target.Target;
import mage.target.common.TargetCreaturePermanent;
/**
@ -51,12 +48,9 @@ public class UnearthlyBlizzard extends CardImpl<UnearthlyBlizzard> {
this.subtype.add("Arcane");
this.color.setRed(true);
Target target = new TargetCreaturePermanent(0, 3);
target.setTargetName("Select up to three creatures that can't block this turn.");
// Up to three target creatures can't block this turn.
this.getSpellAbility().addEffect(new UnearthlyBlizzardEffect());
this.getSpellAbility().addTarget(target);
this.getSpellAbility().addEffect(new CantBlockTargetEffect(Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 3));
}
@ -69,25 +63,3 @@ public class UnearthlyBlizzard extends CardImpl<UnearthlyBlizzard> {
return new UnearthlyBlizzard(this);
}
}
class UnearthlyBlizzardEffect extends GainAbilityTargetEffect {
public UnearthlyBlizzardEffect() {
super(CantBlockAbility.getInstance(), Constants.Duration.EndOfTurn);
staticText = "Up to three target creatures can't block this turn";
}
public UnearthlyBlizzardEffect(final UnearthlyBlizzardEffect effect) {
super(effect);
}
@Override
public UnearthlyBlizzardEffect copy() {
return new UnearthlyBlizzardEffect(this);
}
@Override
public String getText(Mode mode) {
return staticText;
}
}

View file

@ -32,10 +32,8 @@ import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Mode;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -58,7 +56,7 @@ public class MarkovWarlord extends CardImpl<MarkovWarlord> {
this.addAbility(HasteAbility.getInstance());
// When Markov Warlord enters the battlefield, up to two target creatures can't block this turn.
EntersBattlefieldAbility ability = new EntersBattlefieldAbility(new MarkovWarlordEffect());
EntersBattlefieldAbility ability = new EntersBattlefieldAbility(new CantBlockTargetEffect(Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent(0, 2));
this.addAbility(ability);
@ -73,25 +71,3 @@ public class MarkovWarlord extends CardImpl<MarkovWarlord> {
return new MarkovWarlord(this);
}
}
class MarkovWarlordEffect extends GainAbilityTargetEffect {
public MarkovWarlordEffect() {
super(CantBlockAbility.getInstance(), Duration.EndOfTurn);
staticText = "Up to two target creatures can't block this turn";
}
public MarkovWarlordEffect(final MarkovWarlordEffect effect) {
super(effect);
}
@Override
public MarkovWarlordEffect copy() {
return new MarkovWarlordEffect(this);
}
@Override
public String getText(Mode mode) {
return staticText;
}
}

View file

@ -33,9 +33,8 @@ import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -55,7 +54,7 @@ public class CrosswayVampire extends CardImpl<CrosswayVampire> {
this.toughness = new MageInt(2);
// When Crossway Vampire enters the battlefield, target creature can't block this turn.
Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Duration.EndOfTurn));
Ability ability = new EntersBattlefieldTriggeredAbility(new CantBlockTargetEffect(Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent(true));
this.addAbility(ability);
}

View file

@ -32,10 +32,8 @@ import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.TimingRule;
import mage.abilities.Mode;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -53,7 +51,7 @@ public class NightbirdsClutches extends CardImpl<NightbirdsClutches> {
this.color.setRed(true);
// Up to two target creatures can't block this turn.
this.getSpellAbility().addEffect(new NightbirdsClutchesEffect());
this.getSpellAbility().addEffect(new CantBlockTargetEffect(Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2));
// Flashback {3}{R}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{3}{R}"), TimingRule.SORCERY));
@ -68,25 +66,3 @@ public class NightbirdsClutches extends CardImpl<NightbirdsClutches> {
return new NightbirdsClutches(this);
}
}
class NightbirdsClutchesEffect extends GainAbilityTargetEffect {
public NightbirdsClutchesEffect() {
super(CantBlockAbility.getInstance(), Duration.EndOfTurn);
staticText = "Up to two target creatures can't block this turn";
}
public NightbirdsClutchesEffect(final NightbirdsClutchesEffect effect) {
super(effect);
}
@Override
public NightbirdsClutchesEffect copy() {
return new NightbirdsClutchesEffect(this);
}
@Override
public String getText(Mode mode) {
return staticText;
}
}

View file

@ -31,9 +31,7 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.Mode;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -50,7 +48,7 @@ public class PanicAttack extends CardImpl<PanicAttack> {
this.color.setRed(true);
// Up to three target creatures can't block this turn.
this.getSpellAbility().addEffect(new PanicAttackEffect());
this.getSpellAbility().addEffect(new CantBlockTargetEffect(Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 3));
}
@ -63,25 +61,3 @@ public class PanicAttack extends CardImpl<PanicAttack> {
return new PanicAttack(this);
}
}
class PanicAttackEffect extends GainAbilityTargetEffect {
public PanicAttackEffect() {
super(CantBlockAbility.getInstance(), Duration.EndOfTurn);
staticText = "Up to three target creatures can't block this turn";
}
public PanicAttackEffect(final PanicAttackEffect effect) {
super(effect);
}
@Override
public PanicAttackEffect copy() {
return new PanicAttackEffect(this);
}
@Override
public String getText(Mode mode) {
return staticText;
}
}

View file

@ -33,11 +33,10 @@ import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.CantBlockAttachedEffect;
import mage.abilities.effects.common.continious.BoostEquippedEffect;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
@ -53,8 +52,9 @@ public class CopperCarapace extends CardImpl<CopperCarapace> {
this.subtype.add("Equipment");
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3)));
// Equipped creature gets +2/+2 and can't block.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(2, 2)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAttachedEffect(CantBlockAbility.getInstance(), AttachmentType.EQUIPMENT)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBlockAttachedEffect(AttachmentType.EQUIPMENT)));
}
public CopperCarapace(final CopperCarapace card) {

View file

@ -33,15 +33,14 @@ import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -55,7 +54,7 @@ public class PanicSpellbomb extends CardImpl<PanicSpellbomb> {
super(ownerId, 191, "Panic Spellbomb", Rarity.COMMON, new CardType[]{CardType.ARTIFACT}, "{1}");
this.expansionSetCode = "SOM";
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Duration.EndOfTurn), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantBlockTargetEffect(Duration.EndOfTurn), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);

View file

@ -31,10 +31,9 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.abilities.mana.RedManaAbility;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -51,7 +50,8 @@ public class SmolderingSpires extends CardImpl<SmolderingSpires> {
this.addAbility(new EntersBattlefieldTappedAbility());
this.addAbility(new RedManaAbility());
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Duration.EndOfTurn));
// When Smoldering Spires enters the battlefield, target creature can't block this turn.
EntersBattlefieldTriggeredAbility ability = new EntersBattlefieldTriggeredAbility(new CantBlockTargetEffect(Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -33,9 +33,8 @@ import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CantBlockAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.CantBlockTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -55,7 +54,8 @@ public class GoblinShortcutter extends CardImpl<GoblinShortcutter> {
this.power = new MageInt(2);
this.toughness = new MageInt(1);
Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(CantBlockAbility.getInstance(), Duration.EndOfTurn));
// When Goblin Shortcutter enters the battlefield, target creature can't block this turn.
Ability ability = new EntersBattlefieldTriggeredAbility(new CantBlockTargetEffect(Duration.EndOfTurn));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -29,9 +29,11 @@ package mage.abilities.effects.common;
import mage.Constants.Duration;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.RestrictionEffect;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
/**
*
@ -41,7 +43,6 @@ public class CantBlockTargetEffect extends RestrictionEffect<CantBlockTargetEffe
public CantBlockTargetEffect(Duration duration) {
super(duration);
this.staticText = "target creature can't block this turn";
}
public CantBlockTargetEffect(final CantBlockTargetEffect effect) {
@ -50,7 +51,7 @@ public class CantBlockTargetEffect extends RestrictionEffect<CantBlockTargetEffe
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(source.getFirstTarget())) {
if (this.targetPointer.getTargets(game, source).contains(permanent.getId())) {
return true;
}
return false;
@ -65,4 +66,31 @@ public class CantBlockTargetEffect extends RestrictionEffect<CantBlockTargetEffe
public CantBlockTargetEffect copy() {
return new CantBlockTargetEffect(this);
}
@Override
public String getText(Mode mode) {
if (mode.getTargets().isEmpty()) {
return "";
}
StringBuilder sb = new StringBuilder();
Target target = mode.getTargets().get(0);
if (target.getMaxNumberOfTargets() > 1) {
if (target.getMaxNumberOfTargets() != target.getNumberOfTargets()) {
sb.append("up to ");
}
sb.append(target.getMaxNumberOfTargets()).append(" ");
}
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
if (target.getMaxNumberOfTargets() > 1) {
sb.append("s");
}
sb.append(" can't block");
if (Duration.EndOfTurn.equals(this.duration)) {
sb.append(" this turn");
}
return sb.toString();
}
}