Added UnblockableTargetEffect and used it where necessary.

This commit is contained in:
North 2012-09-06 23:49:05 +03:00
parent dbb782569b
commit c89a4fd535
10 changed files with 130 additions and 35 deletions

View file

@ -30,17 +30,16 @@ package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ReturnToHandTargetCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.UnblockableTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.UnblockableAbility;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.common.FilterControlledPermanent;
@ -71,8 +70,11 @@ public class SoratamiMirrorGuard extends CardImpl<SoratamiMirrorGuard> {
this.color.setBlue(true);
this.power = new MageInt(3);
this.toughness = new MageInt(1);
// Flying
this.addAbility(FlyingAbility.getInstance());
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityTargetEffect(UnblockableAbility.getInstance(), Constants.Duration.EndOfTurn), new GenericManaCost(2));
// {2}, Return a land you control to its owner's hand: Target creature with power 2 or less is unblockable this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UnblockableTargetEffect(), new GenericManaCost(2));
ability.addCost(new ReturnToHandTargetCost(new TargetControlledPermanent(filter)));
ability.addTarget(new TargetCreaturePermanent(filterCreature));
this.addAbility(ability);

View file

@ -29,16 +29,16 @@ package mage.sets.conflux;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.PreventDamageTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.UnblockableAbility;
import mage.abilities.effects.common.UnblockableTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreatureOrPlayer;
import mage.target.common.TargetCreaturePermanent;
@ -61,11 +61,11 @@ public class JhessianBalmgiver extends CardImpl<JhessianBalmgiver> {
this.toughness = new MageInt(1);
// {tap}: Prevent the next 1 damage that would be dealt to target creature or player this turn.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new PreventDamageTargetEffect(Constants.Duration.EndOfTurn, 1), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageTargetEffect(Duration.EndOfTurn, 1), new TapSourceCost());
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability);
// {tap}: Target creature is unblockable this turn.
ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityTargetEffect(UnblockableAbility.getInstance(), Constants.Duration.EndOfTurn), new TapSourceCost());
// {tap}: Target creature is unblockable this turn.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UnblockableTargetEffect(), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -29,13 +29,11 @@ package mage.sets.darkascension;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.TimingRule;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.UnblockableTargetEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.abilities.keyword.UnblockableAbility;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -52,7 +50,7 @@ public class ArtfulDodge extends CardImpl<ArtfulDodge> {
this.color.setBlue(true);
// Target creature is unblockable this turn.
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(UnblockableAbility.getInstance(), Duration.EndOfTurn));
this.getSpellAbility().addEffect(new UnblockableTargetEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
// Flashback {U}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{U}"), TimingRule.SORCERY));

View file

@ -38,9 +38,8 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.UnblockableTargetEffect;
import mage.abilities.effects.common.continious.BoostControlledEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.UnblockableAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
@ -68,8 +67,10 @@ public class MerfolkSovereign extends CardImpl<MerfolkSovereign> {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Other Merfolk creatures you control get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter1, true)));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(UnblockableAbility.getInstance(), Duration.EndOfTurn), new TapSourceCost());
// {tap}: Target Merfolk creature is unblockable this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UnblockableTargetEffect(), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent(filter2));
this.addAbility(ability);
}

View file

@ -29,7 +29,6 @@ package mage.sets.ravnika;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
@ -37,9 +36,8 @@ import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.UnblockableTargetEffect;
import mage.abilities.keyword.TransmuteAbility;
import mage.abilities.keyword.UnblockableAbility;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -60,7 +58,7 @@ public class EtherealUsher extends CardImpl<EtherealUsher> {
// {U}, {tap}: Target creature is unblockable this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new GainAbilityTargetEffect(UnblockableAbility.getInstance(), Duration.EndOfTurn),
new UnblockableTargetEffect(),
new ManaCostsImpl("{U}"));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());

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.effects.common.UnblockableTargetEffect;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.ReboundAbility;
import mage.abilities.keyword.UnblockableAbility;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -50,9 +49,11 @@ public class DistortionStrike extends CardImpl<DistortionStrike> {
this.color.setBlue(true);
// Target creature gets +1/+0 until end of turn and is unblockable this turn.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new BoostTargetEffect(1, 0, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(UnblockableAbility.getInstance(), Duration.EndOfTurn));
this.getSpellAbility().addEffect(new UnblockableTargetEffect());
// Rebound
this.addAbility(new ReboundAbility());
}

View file

@ -30,15 +30,13 @@ package mage.sets.riseoftheeldrazi;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.UnblockableAbility;
import mage.abilities.effects.common.UnblockableTargetEffect;
import mage.cards.CardImpl;
import mage.filter.Filter.ComparisonType;
import mage.filter.common.FilterCreaturePermanent;
@ -66,7 +64,8 @@ public class GoblinTunneler extends CardImpl<GoblinTunneler> {
this.power = new MageInt(1);
this.toughness = new MageInt(1);
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(UnblockableAbility.getInstance(), Duration.EndOfTurn), new TapSourceCost());
// {tap}: Target creature with power 2 or less is unblockable this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UnblockableTargetEffect(), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
}

View file

@ -30,12 +30,11 @@ package mage.sets.scarsofmirrodin;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Duration;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.effects.common.UnblockableTargetEffect;
import mage.abilities.keyword.UnblockableAbility;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
@ -54,8 +53,11 @@ public class NeurokInvisimancer extends CardImpl<NeurokInvisimancer> {
this.color.setBlue(true);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Neurok Invisimancer is unblockable.
this.addAbility(UnblockableAbility.getInstance());
Ability ability = new EntersBattlefieldTriggeredAbility(new GainAbilityTargetEffect(UnblockableAbility.getInstance(), Duration.EndOfTurn));
// When Neurok Invisimancer enters the battlefield, target creature is unblockable this turn.
Ability ability = new EntersBattlefieldTriggeredAbility(new UnblockableTargetEffect());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -29,15 +29,14 @@ package mage.sets.tenth;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
import mage.abilities.keyword.UnblockableAbility;
import mage.abilities.effects.common.UnblockableTargetEffect;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.common.FilterCreaturePermanent;
@ -64,7 +63,9 @@ public class CraftyPathmage extends CardImpl<CraftyPathmage> {
this.color.setBlue(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainAbilityTargetEffect(UnblockableAbility.getInstance(), Constants.Duration.EndOfTurn), new TapSourceCost());
// {tap}: Target creature with power 2 or less is unblockable this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new UnblockableTargetEffect(), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
}

View file

@ -0,0 +1,93 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
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;
/**
*
* @author North
*/
public class UnblockableTargetEffect extends RestrictionEffect<UnblockableTargetEffect> {
public UnblockableTargetEffect() {
super(Duration.EndOfTurn);
}
public UnblockableTargetEffect(UnblockableTargetEffect effect) {
super(effect);
}
@Override
public UnblockableTargetEffect copy() {
return new UnblockableTargetEffect(this);
}
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
return false;
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
return permanent.getId().equals(source.getFirstTarget());
}
@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(" is unblockable");
if (Duration.EndOfTurn.equals(this.duration)) {
sb.append(" this turn");
}
return sb.toString();
}
}