This commit is contained in:
Brad Woods 2015-01-22 17:54:10 -08:00
commit 3b1829e9fe
105 changed files with 2098 additions and 347 deletions

View file

@ -28,29 +28,22 @@
package mage.sets.alarareborn;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.cards.CardImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
/**
*

View file

@ -35,8 +35,8 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.CantCounterControlledEffect;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredControlledEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.cards.CardImpl;
import mage.filter.Filter;
import mage.filter.FilterSpell;
@ -66,8 +66,8 @@ public class SpellbreakerBehemoth extends CardImpl {
this.power = new MageInt(5);
this.toughness = new MageInt(5);
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantCounterSourceEffect()));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantCounterControlledEffect(filter, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantBeCounteredSourceEffect()));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeCounteredControlledEffect(filter, Duration.WhileOnBattlefield)));
}
public SpellbreakerBehemoth(final SpellbreakerBehemoth card) {

View file

@ -0,0 +1,65 @@
/*
* 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.sets.apocalypse;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.filter.common.FilterCreatureCard;
import mage.target.common.TargetCardInYourGraveyard;
import java.util.UUID;
/**
* @author Laxika
*/
public class UrborgUprising extends CardImpl {
public UrborgUprising(UUID ownerId) {
super(ownerId, 53, "Urborg Uprising", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{4}{B}");
this.expansionSetCode = "APC";
// Return up to two target creature cards from your graveyard to your hand.
this.getSpellAbility().addEffect(new ReturnFromGraveyardToHandTargetEffect());
this.getSpellAbility().addTarget(new TargetCardInYourGraveyard(0, 2, new FilterCreatureCard("creature cards from your graveyard")));
// Draw a card.
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
}
public UrborgUprising(final UrborgUprising card) {
super(card);
}
@Override
public UrborgUprising copy() {
return new UrborgUprising(this);
}
}

View file

@ -0,0 +1,77 @@
/*
* 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.sets.arabiannights;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continious.GainAbilityAttachedEffect;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.keyword.IslandwalkAbility;
import mage.cards.CardImpl;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
/**
* @author Laxika
*/
public class FishliverOil extends CardImpl {
public FishliverOil(UUID ownerId) {
super(ownerId, 17, "Fishliver Oil", Rarity.COMMON, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
this.expansionSetCode = "ARN";
this.subtype.add("Aura");
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.AddAbility));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Enchanted creature has islandwalk.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new GainAbilityAttachedEffect(new IslandwalkAbility(), AttachmentType.AURA, Duration.WhileOnBattlefield)));
}
public FishliverOil(final FishliverOil card) {
super(card);
}
@Override
public FishliverOil copy() {
return new FishliverOil(this);
}
}

View file

@ -33,7 +33,7 @@ import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.RegenerateTargetEffect;
@ -67,7 +67,7 @@ public class IsaoEnlightenedBushi extends CardImpl {
this.toughness = new MageInt(1);
// Isao, Enlightened Bushi can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
this.addAbility(new BushidoAbility(2));
// {2}: Regenerate target Samurai.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateTargetEffect(), new GenericManaCost(2));

View file

@ -137,13 +137,16 @@ class SpiritOfTheLabyrinthEffect extends ContinuousRuleModifiyingEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DRAW_CARD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.DRAW_CARD) {
SpiritOfTheLabyrinthWatcher watcher = (SpiritOfTheLabyrinthWatcher) game.getState().getWatchers().get("DrewCard");
if (watcher != null && watcher.hasPlayerDrewCardThisTurn(event.getPlayerId())) {
return true;
}
SpiritOfTheLabyrinthWatcher watcher = (SpiritOfTheLabyrinthWatcher) game.getState().getWatchers().get("DrewCard");
if (watcher != null && watcher.hasPlayerDrewCardThisTurn(event.getPlayerId())) {
return true;
}
return false;
}

View file

@ -0,0 +1,73 @@
/*
* 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.sets.coldsnap;
import java.util.UUID;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.constants.Duration;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
import mage.abilities.common.delayed.AtTheBeginOfNextUpkeepDelayedTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.filter.common.FilterAttackingCreature;
/**
* @author duncancmt
*/
public class BalduvianRage extends CardImpl {
public BalduvianRage(UUID ownerId) {
super(ownerId, 76, "Balduvian Rage", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{X}{R}");
this.expansionSetCode = "CSP";
// Target attacking creature gets +X/+0 until end of turn.
this.getSpellAbility().addEffect(new BoostTargetEffect(new ManacostVariableValue(), new StaticValue(0), Duration.EndOfTurn));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(new FilterAttackingCreature()));
// Draw a card at the beginning of the next turn's upkeep.
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextUpkeepDelayedTriggeredAbility(new DrawCardSourceControllerEffect(1)),false));
}
public BalduvianRage(final BalduvianRage card) {
super(card);
}
@Override
public BalduvianRage copy() {
return new BalduvianRage(this);
}
}

View file

@ -30,7 +30,7 @@ package mage.sets.commander;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continious.BoostSourceEffect;
@ -65,12 +65,11 @@ public class AkromaAngelOfFury extends CardImpl {
this.supertype.add("Legendary");
this.subtype.add("Angel");
this.color.setRed(true);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// Akroma, Angel of Fury can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// Flying
this.addAbility(FlyingAbility.getInstance());
// Trample

View file

@ -106,9 +106,14 @@ class WakeTheDeadEffect extends ContinuousRuleModifiyingEffectImpl {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.CAST_SPELL) && event.getSourceId().equals(source.getSourceId())) {
if (event.getSourceId().equals(source.getSourceId())) {
if (game.getPhase().getType().equals(TurnPhase.COMBAT)) {
return !game.getOpponents(source.getControllerId()).contains(game.getActivePlayerId());
}

View file

@ -30,7 +30,7 @@ package mage.sets.conflux;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.effects.common.DamageEverythingEffect;
import mage.cards.CardImpl;
@ -47,7 +47,7 @@ public class VolcanicFallout extends CardImpl {
this.color.setRed(true);
// Volcanic Fallout can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// Volcanic Fallout deals 2 damage to each creature and each player.
this.getSpellAbility().addEffect(new DamageEverythingEffect(2));
}

View file

@ -31,7 +31,7 @@ package mage.sets.darksteel;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.cards.CardImpl;
import mage.target.TargetSpell;
@ -46,7 +46,7 @@ public class LastWord extends CardImpl {
super(ownerId, 23, "Last Word", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{2}{U}{U}");
this.expansionSetCode = "DST";
this.color.setBlue(true);
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
this.getSpellAbility().addEffect(new CounterTargetEffect());
this.getSpellAbility().addTarget(new TargetSpell());
}

View file

@ -0,0 +1,109 @@
/*
* 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.sets.dissension;
import java.util.UUID;
import mage.MageObject;
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.OneShotEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author someoneseth@gmail.com
*/
public class NovijenHeartOfProgress extends CardImpl {
public NovijenHeartOfProgress(UUID ownerId) {
super(ownerId, 175, "Novijen, Heart of Progress", Rarity.UNCOMMON, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "DIS";
// {T}: Add {1} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {G}{U}, {T}: Put a +1/+1 counter on each creature that entered the battlefield this turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new NovijenHeartOfProgressEffect(), new ManaCostsImpl<>("{G}{U}"));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
}
public NovijenHeartOfProgress(final NovijenHeartOfProgress card) {
super(card);
}
@Override
public NovijenHeartOfProgress copy() {
return new NovijenHeartOfProgress(this);
}
}
class NovijenHeartOfProgressEffect extends OneShotEffect {
public NovijenHeartOfProgressEffect() {
super(Outcome.BoostCreature);
staticText = "put a +1/+1 counter on each creature that came into play this turn";
}
public NovijenHeartOfProgressEffect(final NovijenHeartOfProgressEffect effect) {
super(effect);
}
@Override
public NovijenHeartOfProgressEffect copy() {
return new NovijenHeartOfProgressEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
for (Permanent permanent: game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), game)) {
if (permanent.getTurnsOnBattlefield() == 0) {
permanent.addCounters(CounterType.P1P1.createInstance(), game);
game.informPlayers(sourceObject.getLogName()+ ": " + controller.getName() + " puts a +1/+1 counter on " + permanent.getLogName());
}
}
return true;
}
return false;
}
}

View file

@ -29,11 +29,6 @@
package mage.sets.dragonsmaze;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
@ -41,21 +36,20 @@ import mage.abilities.SpellAbility;
import mage.abilities.common.AsEntersBattlefieldAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.NameACardEffect;
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.repository.CardRepository;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.CostModificationType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.util.CardUtil;
/**
@ -83,7 +77,6 @@ public class CouncilOfTheAbsolute extends CardImpl {
// Spells with the chosen name cost 2 less for you to cast.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CouncilOfTheAbsoluteCostReductionEffect()));
}
public CouncilOfTheAbsolute (final CouncilOfTheAbsolute card) {
@ -127,9 +120,14 @@ class CouncilOfTheAbsoluteReplacementEffect extends ContinuousRuleModifiyingEffe
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.CAST_SPELL && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
MageObject object = game.getObject(event.getSourceId());
if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString() + NameACardEffect.INFO_KEY))) {
return true;

View file

@ -146,13 +146,16 @@ class RenderSilentEffect extends ContinuousRuleModifiyingEffectImpl {
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL ) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null && player.getId().equals(event.getPlayerId())) {
return true;
}
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null && player.getId().equals(event.getPlayerId())) {
return true;
}
return false;
}

View file

@ -33,7 +33,7 @@ import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.abilities.keyword.ReachAbility;
@ -65,7 +65,7 @@ public class Skylasher extends CardImpl {
// Flash
this.addAbility(FlashAbility.getInstance());
// Skylasher can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// Reach, protection from blue
this.addAbility(ReachAbility.getInstance());
this.addAbility(new ProtectionAbility(filter));

View file

@ -110,15 +110,19 @@ class MoonholdEffect extends ContinuousRuleModifiyingEffectImpl {
public String getInfoMessage(Ability source, GameEvent event, Game game) {
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject != null) {
return "You can't play land cards this turn (" + mageObject.getLogName() + ").";
return "you can't play land cards this turn (" + mageObject.getLogName() + ").";
}
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.PLAY_LAND;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.PLAY_LAND
&& event.getPlayerId().equals(source.getFirstTarget())) {
if (event.getPlayerId().equals(source.getFirstTarget())) {
return true;
}
return false;
@ -154,10 +158,14 @@ class MoonholdEffect2 extends ContinuousRuleModifiyingEffectImpl {
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL
&& event.getPlayerId().equals(source.getFirstTarget())) {
if (event.getPlayerId().equals(source.getFirstTarget())) {
Card card = game.getCard(event.getSourceId());
if (card != null && card.getCardType().contains(CardType.CREATURE)) {
return true;

View file

@ -30,6 +30,7 @@ package mage.sets.fatereforged;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -86,7 +87,7 @@ class ArcbondDelayedTriggeredAbility extends DelayedTriggeredAbility {
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.DAMAGED_CREATURE && event.getTargetId().equals(this.getFirstTarget())) {
for (Effect effect : this.getEffects()) {
effect.setValue("damage", event.getAmount());
effect.setValue("damage", event.getAmount());
}
return true;
}
@ -126,7 +127,7 @@ class ArcbondEffect extends OneShotEffect {
if (damage > 0) {
FilterPermanent filter = new FilterCreaturePermanent("each other creature");
filter.add(Predicates.not(new PermanentIdPredicate(source.getTargets().getFirstTarget())));
return new DamageEverythingEffect(damage, filter).apply(game, source);
return new DamageEverythingEffect(new StaticValue(damage), filter, source.getTargets().getFirstTarget()).apply(game, source);
}
return false;
}

View file

@ -79,9 +79,14 @@ class HewedStoneRetainersEffect extends ContinuousRuleModifiyingEffectImpl {
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL && event.getSourceId().equals(source.getSourceId())) {
if (event.getSourceId().equals(source.getSourceId())) {
CastSpellLastTurnWatcher watcher = (CastSpellLastTurnWatcher) game.getState().getWatchers().get("CastSpellLastTurnWatcher");
if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(source.getControllerId()) == 0) {
return true;

View file

@ -88,7 +88,7 @@ class VaultbreakerEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Cards discardedCard = controller.discard(1, true, source, game);
Cards discardedCard = controller.discard(1, false, source, game);
if (discardedCard != null) {
controller.drawCards(1, game);
return true;

View file

@ -96,13 +96,16 @@ class WardscaleDragonRuleEffect extends ContinuousRuleModifiyingEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL ) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && sourcePermanent.isAttacking()) {
return event.getPlayerId() == game.getCombat().getDefendingPlayerId(sourcePermanent.getId(), game);
}
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null && sourcePermanent.isAttacking()) {
return event.getPlayerId() == game.getCombat().getDefendingPlayerId(sourcePermanent.getId(), game);
}
return false;
}

View file

@ -81,7 +81,7 @@ class DamageCantBePreventedEffect extends ContinuousRuleModifiyingEffectImpl {
public DamageCantBePreventedEffect() {
super(Duration.EndOfTurn, Outcome.Benefit, false, false);
staticText = "Damage can't be prevented this turn";
staticText = "damage can't be prevented this turn";
}
public DamageCantBePreventedEffect(final DamageCantBePreventedEffect effect) {
@ -98,11 +98,13 @@ class DamageCantBePreventedEffect extends ContinuousRuleModifiyingEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.PREVENT_DAMAGE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.PREVENT_DAMAGE)) {
return true;
}
return false;
return true;
}
}

View file

@ -0,0 +1,106 @@
/*
* 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.sets.futuresight;
import java.util.UUID;
import mage.cards.CardImpl;
import mage.constants.Rarity;
import mage.constants.CardType;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.filter.FilterSpell;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.abilities.Ability;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.events.GameEvent.EventType;
/**
* @author duncancmt
*/
public class VeilstoneAmulet extends CardImpl {
public VeilstoneAmulet(UUID ownerId) {
super(ownerId, 166, "Veilstone Amulet", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "FUT";
// Whenever you cast a spell, creatures you control can't be the targets of spells or abilities your opponents control this turn.
this.addAbility(new SpellCastControllerTriggeredAbility(new VeilstoneAmuletEffect(), new FilterSpell("a spell"), false));
}
public VeilstoneAmulet(final VeilstoneAmulet card) {
super(card);
}
@Override
public VeilstoneAmulet copy() {
return new VeilstoneAmulet(this);
}
}
// Veilstone Amulet's effect is strange. It effects all creatures you control,
// even if they entered the battlefield after the ability resolved. It modifies
// the rules of the game until end of turn.
class VeilstoneAmuletEffect extends ContinuousRuleModifiyingEffectImpl {
public VeilstoneAmuletEffect() {
super(Duration.EndOfTurn, Outcome.Benefit);
staticText = "creatures you control can't be the targets of spells or abilities your opponents control this turn";
}
public VeilstoneAmuletEffect(final VeilstoneAmuletEffect effect) {
super(effect);
}
@Override
public VeilstoneAmuletEffect copy() {
return new VeilstoneAmuletEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability ability, Game game) {
if (event.getType() == EventType.TARGET) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null) {
if (permanent.getCardType().contains(CardType.CREATURE) &&
permanent.getControllerId().equals(ability.getControllerId()) &&
game.getPlayer(ability.getControllerId()).hasOpponent(event.getPlayerId(), game)) {
return true;
}
}
}
return false;
}
}

View file

@ -0,0 +1,244 @@
/*
* 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.sets.guildpact;
import java.util.Collection;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.cards.CardImpl;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterSpell;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.stack.Spell;
import java.util.Map;
import java.util.List;
import mage.target.Target;
import mage.abilities.Modes;
import mage.filter.predicate.mageobject.FromSetPredicate;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.util.SpellTargetAddress;
/**
* @author duncancmt
*/
public class InkTreaderNephilim extends CardImpl {
public InkTreaderNephilim(UUID ownerId) {
super(ownerId, 117, "Ink-Treader Nephilim", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{R}{G}{W}{U}");
this.expansionSetCode = "GPT";
this.subtype.add("Nephilim");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever a player casts an instant or sorcery spell, if that spell targets only Ink-Treader Nephilim, copy the spell for each other creature that spell could target. Each copy targets a different one of those creatures.
this.addAbility(new InkTreaderNephilimTriggeredAbility());
}
public InkTreaderNephilim(final InkTreaderNephilim card) {
super(card);
}
@Override
public InkTreaderNephilim copy() {
return new InkTreaderNephilim(this);
}
}
class InkTreaderNephilimTriggeredAbility extends TriggeredAbilityImpl {
private static final FilterSpell filter = new FilterSpell();
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.INSTANT),
new CardTypePredicate(CardType.SORCERY)));
}
InkTreaderNephilimTriggeredAbility() {
super(Zone.BATTLEFIELD, new InkTreaderNephilimEffect(), false);
}
InkTreaderNephilimTriggeredAbility(final InkTreaderNephilimTriggeredAbility ability) {
super(ability);
}
@Override
public InkTreaderNephilimTriggeredAbility copy() {
return new InkTreaderNephilimTriggeredAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.SPELL_CAST) {
Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null &&
(spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))){
for (Effect effect : getEffects()) {
effect.setValue("TriggeringSpell", spell);
}
return true;
}
}
return false;
}
@Override
public boolean checkInterveningIfClause(Game game) {
Spell spell = (Spell) getEffects().get(0).getValue("TriggeringSpell");
if (spell != null) {
boolean allTargetsInkTreaderNephilim = true;
boolean atLeastOneTargetsInkTreaderNephilim = false;
for (SpellAbility spellAbility: spell.getSpellAbilities()){
Modes modesSpell = spellAbility.getModes();
for (UUID mode : modesSpell.getSelectedModes()) {
for (Target targetInstance : modesSpell.get(mode).getTargets()) {
for (UUID target : targetInstance.getTargets()) {
allTargetsInkTreaderNephilim &= target.equals(sourceId);
atLeastOneTargetsInkTreaderNephilim |= target.equals(sourceId);
}
}
}
}
if (allTargetsInkTreaderNephilim && atLeastOneTargetsInkTreaderNephilim) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever a player casts an instant or sorcery spell, if that spell targets only {this}, copy the spell for each other creature that spell could target. Each copy targets a different one of those creatures.";
}
}
class InkTreaderNephilimEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent();
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
}
public InkTreaderNephilimEffect() {
super(Outcome.Copy);
staticText = "copy the spell for each other creature that spell could target. Each copy targets a different one of those creatures";
}
public InkTreaderNephilimEffect(final InkTreaderNephilimEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
Spell spell = (Spell) getValue("TriggeringSpell");
if (spell != null) {
Map<UUID, Spell> targetable = new HashMap<>();
// gather all creatures that can be targeted from the spell to copy
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, controller.getId(), source.getSourceId(), game)) {
Spell copy = spell.copySpell();
copy.setControllerId(controller.getId());
copy.setCopiedSpell(true);
if (permanent.getId().equals(source.getSourceId())) {
continue; // copy only for other creatures
}
boolean legal = true;
for (SpellTargetAddress addr : SpellTargetAddress.walk(copy)) {
Target targetInstance = addr.getTarget(copy);
legal &= targetInstance.canTarget(permanent.getId(), addr.getSpellAbility(copy), game);
}
if (legal) {
for (SpellTargetAddress addr : SpellTargetAddress.walk(copy)) {
Target targetInstance = addr.getTarget(copy);
int numTargets = targetInstance.getNumberOfTargets();
targetInstance.clearChosen();
while (numTargets > 0) {
targetInstance.add(permanent.getId(), game);
numTargets--;
}
}
targetable.put(permanent.getId(), copy);
}
}
// controller
while (targetable.size() > 0) {
FilterPermanent filterCreatures = new FilterPermanent("creature that spell could target ("+ targetable.size() + " remaining)");
filterCreatures.add(new FromSetPredicate(targetable.keySet()));
TargetPermanent target = new TargetPermanent(0, 1, filterCreatures, true);
if (target.possibleTargets(controller.getId(), game).size() > 1
&& target.canChoose(source.getSourceId(), controller.getId(), game)) {
controller.choose(Outcome.Neutral, target, source.getId(), game);
}
Collection<UUID> choosenIds = target.getTargets();
if (choosenIds.isEmpty()) {
choosenIds = targetable.keySet();
}
List<UUID> toDelete = new ArrayList<>();
for (UUID chosenId : choosenIds) {
Spell chosenCopy = targetable.get(chosenId);
if (chosenCopy != null) {
game.getStack().push(chosenCopy);
toDelete.add(chosenId);
}
}
for (UUID idToDelte : toDelete) {
targetable.remove(idToDelte);
}
}
return true;
}
return false;
}
@Override
public InkTreaderNephilimEffect copy() {
return new InkTreaderNephilimEffect(this);
}
}

View file

@ -30,7 +30,7 @@ package mage.sets.guildpact;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
@ -57,7 +57,7 @@ public class WreakHavoc extends CardImpl {
this.expansionSetCode = "GPT";
this.color.setRed(true);
this.color.setGreen(true);
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
this.getSpellAbility().addEffect(new DestroyTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
}

View file

@ -105,9 +105,14 @@ class LaboratoryManiacEffect extends ReplacementEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOSES;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.LOSES && event.getPlayerId().equals(source.getControllerId())) {
if (event.getPlayerId().equals(source.getControllerId())) {
Player player = game.getPlayer(event.getPlayerId());
if (!player.hasLost() && (
(player.getLife() > 0 || !player.canLoseByZeroOrLessLife())

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.keyword.ShroudAbility;
import mage.cards.CardImpl;
@ -51,7 +51,7 @@ public class BlurredMongoose extends CardImpl {
this.toughness = new MageInt(1);
// Blurred Mongoose can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
this.addAbility(ShroudAbility.getInstance());
}

View file

@ -30,7 +30,7 @@ package mage.sets.invasion;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
@ -59,7 +59,7 @@ public class Obliterate extends CardImpl {
this.color.setRed(true);
// Obliterate can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// Destroy all artifacts, creatures, and lands. They can't be regenerated.
this.getSpellAbility().addEffect(new DestroyAllEffect(filter));
}

View file

@ -29,7 +29,7 @@ package mage.sets.khansoftarkir;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.ReturnToHandTargetCost;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
@ -61,7 +61,7 @@ public class PearlLakeAncient extends CardImpl {
this.addAbility(FlashAbility.getInstance());
// Pearl Lake Ancient can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// Prowess
this.addAbility(new ProwessAbility());

View file

@ -29,9 +29,9 @@ package mage.sets.khansoftarkir;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.CantCounterControlledEffect;
import mage.abilities.effects.common.CantBeCounteredControlledEffect;
import mage.abilities.effects.common.continious.GainAbilityControlledEffect;
import mage.abilities.keyword.FlashAbility;
import mage.abilities.keyword.TrampleAbility;
@ -74,10 +74,10 @@ public class SurrakDragonclaw extends CardImpl {
this.addAbility(FlashAbility.getInstance());
// Surrak Dragonclaw can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// Creature spells you control can't be countered.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantCounterControlledEffect(filterTarget, null, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeCounteredControlledEffect(filterTarget, null, Duration.WhileOnBattlefield)));
// Other creatures you control have trample.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,

View file

@ -31,8 +31,8 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.CantCounterControlledEffect;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredControlledEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
@ -65,9 +65,9 @@ public class RootSliver extends CardImpl {
this.toughness = new MageInt(2);
// Root Sliver can't be countered.
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantCounterSourceEffect()));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantBeCounteredSourceEffect()));
// Sliver spells can't be countered by spells or abilities.
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantCounterControlledEffect(filter, new FilterStackObject(), Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantBeCounteredControlledEffect(filter, new FilterStackObject(), Duration.WhileOnBattlefield)));
}

View file

@ -35,7 +35,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
@ -64,7 +64,7 @@ public class GreatSableStag extends CardImpl {
this.addAbility(new ProtectionAbility(filter1));
this.addAbility(new ProtectionAbility(filter2));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantCounterSourceEffect()));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantBeCounteredSourceEffect()));
}
public GreatSableStag(final GreatSableStag card) {

View file

@ -182,9 +182,14 @@ class AngelicArbiterEffect2 extends ContinuousRuleModifiyingEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.CAST_SPELL && game.getActivePlayerId().equals(event.getPlayerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
if (game.getActivePlayerId().equals(event.getPlayerId()) && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
AngelicArbiterWatcher2 watcher = (AngelicArbiterWatcher2) game.getState().getWatchers().get("PlayerAttacked");
if (watcher != null && watcher.hasPlayerAttackedThisTurn(event.getPlayerId())) {
return true;

View file

@ -33,7 +33,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.ObjectColor;
import mage.abilities.effects.common.CantCounterControlledEffect;
import mage.abilities.effects.common.CantBeCounteredControlledEffect;
import mage.abilities.effects.common.CantBeTargetedAllEffect;
import mage.cards.CardImpl;
import mage.filter.FilterSpell;
@ -62,7 +62,7 @@ public class AutumnsVeil extends CardImpl {
this.expansionSetCode = "M11";
this.color.setGreen(true);
// Spells you control can't be countered by blue or black spells this turn
this.getSpellAbility().addEffect(new CantCounterControlledEffect(filterTarget1, filterSource, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new CantBeCounteredControlledEffect(filterTarget1, filterSource, Duration.EndOfTurn));
// and creatures you control can't be the targets of blue or black spells this turn.
this.getSpellAbility().addEffect(new CantBeTargetedAllEffect(filterTarget2, filterSource, Duration.EndOfTurn));
}

View file

@ -34,7 +34,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
@ -62,7 +62,7 @@ public class Combust extends CardImpl {
this.color.setRed(true);
this.getSpellAbility().addEffect(new DamageTargetEffect(5, false));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantCounterSourceEffect()));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantBeCounteredSourceEffect()));
}
public Combust(final Combust card) {

View file

@ -36,7 +36,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.effects.common.CantBeTargetedSourceEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
@ -64,7 +64,7 @@ public class GaeasRevenge extends CardImpl {
this.power = new MageInt(8);
this.toughness = new MageInt(5);
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantCounterSourceEffect()));
this.addAbility(new SimpleStaticAbility(Zone.STACK, new CantBeCounteredSourceEffect()));
this.addAbility(HasteAbility.getInstance());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantBeTargetedSourceEffect(filter, Duration.WhileOnBattlefield)));

View file

@ -35,7 +35,7 @@ import java.util.Set;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.effects.AsThoughEffectImpl;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
@ -67,7 +67,7 @@ public class SavageSummoning extends CardImpl {
this.color.setGreen(true);
// Savage Summoning can't be countered.
Ability ability = new CantCounterAbility();
Ability ability = new CantBeCounteredAbility();
ability.setRuleAtTheTop(true);
this.addAbility(ability);

View file

@ -97,9 +97,14 @@ class AggressiveMiningEffect extends ContinuousRuleModifiyingEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.PLAY_LAND;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getType().equals(GameEvent.EventType.PLAY_LAND) && event.getPlayerId().equals(source.getControllerId());
return event.getPlayerId().equals(source.getControllerId());
}
}

View file

@ -99,17 +99,20 @@ class HushwingGryffEffect extends ContinuousRuleModifiyingEffectImpl {
}
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Permanent permanent = ((EntersTheBattlefieldEvent)event).getTarget();
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
// Because replacement events have to be executed
// call replaceEvent here without calling the triggering event after
game.getContinuousEffects().replaceEvent(event, game);
return true;
}
Permanent permanent = ((EntersTheBattlefieldEvent)event).getTarget();
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
// Because replacement events have to be executed
// call replaceEvent here without calling the triggering event after
game.getContinuousEffects().replaceEvent(event, game);
return true;
}
return false;
}

View file

@ -36,7 +36,7 @@ import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.effects.common.RegenerateSourceEffect;
import mage.abilities.keyword.HexproofAbility;
import mage.cards.CardImpl;
@ -58,7 +58,7 @@ public class ThrunTheLastTroll extends CardImpl {
this.power = new MageInt(4);
this.toughness = new MageInt(4);
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CantCounterSourceEffect()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CantBeCounteredSourceEffect()));
this.addAbility(HexproofAbility.getInstance());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{1}{G}")));
}

View file

@ -0,0 +1,51 @@
/*
* 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.sets.ninthedition;
import java.util.UUID;
/**
* @author Laxika
*/
public class FishliverOil extends mage.sets.arabiannights.FishliverOil {
public FishliverOil(UUID ownerId) {
super(ownerId);
this.cardNumber = 77;
this.expansionSetCode = "9ED";
}
public FishliverOil(final FishliverOil card) {
super(card);
}
@Override
public FishliverOil copy() {
return new FishliverOil(this);
}
}

View file

@ -110,9 +110,14 @@ class CeaseFireEffect extends ContinuousRuleModifiyingEffectImpl {
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL && event.getPlayerId().equals(source.getFirstTarget())) {
if (event.getPlayerId().equals(source.getFirstTarget())) {
MageObject object = game.getObject(event.getSourceId());
if (filter.match((Spell) object, game)) {
return true;

View file

@ -0,0 +1,188 @@
/*
* 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.sets.ravnika;
import java.util.UUID;
import mage.cards.CardImpl;
import mage.constants.Rarity;
import mage.constants.CardType;
import mage.target.TargetPermanent;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.abilities.effects.common.AttachEffect;
import mage.constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.keyword.EnchantAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.constants.Zone;
import mage.game.events.GameEvent;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.abilities.effects.OneShotEffect;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.game.turn.TurnMod;
import mage.constants.TurnPhase;
import mage.MageObject;
import mage.filter.predicate.Predicate;
/**
* @author duncancmt
*/
public class BreathOfFury extends CardImpl {
public BreathOfFury(UUID ownerId) {
super(ownerId, 116, "Breath of Fury", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{2}{R}{R}");
this.expansionSetCode = "RAV";
this.subtype.add("Aura");
// Enchant creature you control
TargetPermanent auraTarget = new TargetControlledCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Benefit));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// When enchanted creature deals combat damage to a player, sacrifice it and attach Breath of Fury to a creature you control. If you do, untap all creatures you control and after this phase, there is an additional combat phase.
this.addAbility(new BreathOfFuryAbility());
}
public BreathOfFury(final BreathOfFury card) {
super(card);
}
@Override
public BreathOfFury copy() {
return new BreathOfFury(this);
}
}
class BreathOfFuryAbility extends TriggeredAbilityImpl {
public BreathOfFuryAbility() {
super(Zone.BATTLEFIELD, new BreathOfFuryEffect());
}
public BreathOfFuryAbility(final BreathOfFuryAbility ability) {
super(ability);
}
@Override
public BreathOfFuryAbility copy() {
return new BreathOfFuryAbility(this);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event instanceof DamagedPlayerEvent) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
Permanent enchantment = game.getPermanent(getSourceId());
if (damageEvent.isCombatDamage() &&
enchantment != null &&
enchantment.getAttachedTo().equals(event.getSourceId())) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "When enchanted creature deals combat damage to a player, " + super.getRule();
}
}
class BreathOfFuryEffect extends OneShotEffect {
public BreathOfFuryEffect() {
super(Outcome.Benefit);
staticText = "sacrifice enchanted creature and attach {this} to a creature you control. If you do, untap all creatures you control and after this phase, there is an additional combat phase.";
}
public BreathOfFuryEffect(final BreathOfFuryEffect effect) {
super(effect);
}
@Override
public BreathOfFuryEffect copy() {
return new BreathOfFuryEffect(this);
}
@Override
public boolean apply(Game game, Ability source){
Permanent enchantment = game.getPermanent(source.getSourceId());
if (enchantment == null) {
return false;
}
Permanent enchantedCreature = game.getPermanent(enchantment.getAttachedTo());
Player controller = game.getPlayer(source.getControllerId());
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature you control that could be enchanted by " + enchantment.getName());
filter.add(new CanBeEnchantedPredicate(enchantment));
Target target = new TargetControlledCreaturePermanent(filter);
target.setNotTarget(true);
if (enchantedCreature != null && controller != null) {
// sacrifice the enchanted creature (don't check return state because controller has sarificed independant if something replaced later);
// e.g. Commander replacement effect going to command zone
enchantedCreature.sacrifice(source.getSourceId(), game);
if (target.canChoose(source.getSourceId(), source.getControllerId(), game)) {
controller.choose(outcome, target, source.getSourceId(), game);
Permanent newCreature = game.getPermanent(target.getFirstTarget());
if (newCreature != null &&
newCreature.addAttachment(enchantment.getId(), game)) {
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(new FilterControlledCreaturePermanent(), controller.getId(), game)) {
permanent.untap(game);
}
game.getState().getTurnMods().add(new TurnMod(source.getControllerId(), TurnPhase.COMBAT, null, false));
}
}
return true;
}
return false;
}
}
class CanBeEnchantedPredicate implements Predicate<Permanent> {
private final MageObject auraEnchantment;
public CanBeEnchantedPredicate(MageObject auraEnchantment){
this.auraEnchantment = auraEnchantment;
}
@Override
public boolean apply(Permanent input, Game game) {
return !input.cantBeEnchantedBy(auraEnchantment, game);
}
@Override
public String toString() {
return "CanBeEnchanted(" + auraEnchantment.toString() + ")";
}
}

View file

@ -0,0 +1,152 @@
/*
* 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.sets.ravnika;
import java.util.UUID;
import mage.MageObjectReference;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Outcome;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.SubLayer;
import mage.game.permanent.Permanent;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.game.Game;
/**
* @author duncancmt
*/
public class RallyTheRighteous extends CardImpl {
public RallyTheRighteous(UUID ownerId) {
super(ownerId, 222, "Rally the Righteous", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{1}{R}{W}");
this.expansionSetCode = "RAV";
// Radiance Untap target creature and each other creature that shares a color with it. Those creatures get +2/+0 until end of turn.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new RallyTheRighteousUntapEffect());
this.getSpellAbility().addEffect(new RallyTheRighteousBoostEffect());
}
public RallyTheRighteous(final RallyTheRighteous card) {
super(card);
}
@Override
public RallyTheRighteous copy() {
return new RallyTheRighteous(this);
}
}
class RallyTheRighteousUntapEffect extends OneShotEffect {
public RallyTheRighteousUntapEffect() {
super(Outcome.Untap);
staticText = "<i>Radiance</i> — Untap target creature and each other creature that shares a color with it";
}
public RallyTheRighteousUntapEffect(final RallyTheRighteousUntapEffect effect) {
super(effect);
}
@Override
public RallyTheRighteousUntapEffect copy() {
return new RallyTheRighteousUntapEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
if (target != null) {
ObjectColor color = target.getColor();
target.untap(game);
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
if (permanent.getColor().shares(color) && !permanent.getId().equals(target.getId())) {
permanent.untap(game);
}
}
return true;
}
return false;
}
}
class RallyTheRighteousBoostEffect extends ContinuousEffectImpl {
public RallyTheRighteousBoostEffect() {
super(Duration.EndOfTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
staticText = "Those creatures get +2/+0 until end of turn";
}
public RallyTheRighteousBoostEffect(final RallyTheRighteousBoostEffect effect) {
super(effect);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
if (target != null) {
affectedObjectList.add(new MageObjectReference(target));
ObjectColor color = target.getColor();
target.addPower(2);
for (Permanent permanent : game.getBattlefield().getActivePermanents(new FilterCreaturePermanent(), source.getControllerId(), source.getSourceId(), game)) {
if (!permanent.getId().equals(target.getId()) && permanent.getColor().shares(color)) {
affectedObjectList.add(new MageObjectReference(permanent));
}
}
}
}
@Override
public boolean apply(Game game, Ability source) {
for(MageObjectReference mageObjectReference :affectedObjectList) {
Permanent permanent = mageObjectReference.getPermanent(game);
if (permanent != null) {
permanent.addPower(2);
}
}
return true;
}
@Override
public RallyTheRighteousBoostEffect copy() {
return new RallyTheRighteousBoostEffect(this);
}
}

View file

@ -35,7 +35,7 @@ import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.filter.Filter;
@ -62,7 +62,7 @@ public class AbruptDecay extends CardImpl {
this.color.setBlack(true);
// Abrupt Decay can't be countered by spells or abilities.
Effect effect = new CantCounterSourceEffect();
Effect effect = new CantBeCounteredSourceEffect();
effect.setText("{this} can't be countered by spells or abilities");
Ability ability = new SimpleStaticAbility(Zone.STACK,effect);
ability.setRuleAtTheTop(true);

View file

@ -38,7 +38,7 @@ import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.effects.common.CounterTargetEffect;
import mage.abilities.keyword.OverloadAbility;
import mage.cards.CardImpl;
@ -73,7 +73,7 @@ public class Counterflux extends CardImpl {
this.color.setRed(true);
// Counterflux can't be countered by spells or abilities.
Effect effect = new CantCounterSourceEffect();
Effect effect = new CantBeCounteredSourceEffect();
effect.setText("{this} can't be countered by spells or abilities");
Ability ability = new SimpleStaticAbility(Zone.STACK,effect);
ability.setRuleAtTheTop(true);

View file

@ -30,7 +30,7 @@ package mage.sets.returntoravnica;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.Card;
@ -64,7 +64,7 @@ public class LoxodonSmiter extends CardImpl {
this.toughness = new MageInt(4);
// Loxodon Smiter can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// If a spell or ability an opponent controls causes you to discard Loxodon Smiter, put it onto the battlefield instead of putting it into your graveyard.
this.addAbility(new SimpleStaticAbility(Zone.HAND, new LoxodonSmiterEffect()));

View file

@ -36,7 +36,7 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.effects.common.search.SearchTargetGraveyardHandLibraryForCardNameAndExileEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
@ -62,7 +62,7 @@ public class SlaughterGames extends CardImpl {
this.color.setRed(true);
// Slaughter Games can't be countered by spells or abilities.
Effect effect = new CantCounterSourceEffect();
Effect effect = new CantBeCounteredSourceEffect();
effect.setText("{this} can't be countered by spells or abilities");
Ability ability = new SimpleStaticAbility(Zone.STACK,effect);
ability.setRuleAtTheTop(true);

View file

@ -30,12 +30,12 @@ package mage.sets.returntoravnica;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.Effect;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.effects.common.DestroyAllEffect;
import mage.cards.CardImpl;
import mage.constants.Zone;
@ -55,7 +55,7 @@ public class SupremeVerdict extends CardImpl {
this.color.setBlue(true);
// Supreme Verdict can't be countered.
Ability ability = new CantCounterAbility();
Ability ability = new CantBeCounteredAbility();
ability.setRuleAtTheTop(true);
this.addAbility(ability);

View file

@ -36,7 +36,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.PutIntoGraveFromAnywhereSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.AnnihilatorAbility;
@ -73,7 +73,7 @@ public class EmrakulTheAeonsTorn extends CardImpl {
this.toughness = new MageInt(15);
// Emrakul, the Aeons Torn can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// When you cast Emrakul, take an extra turn after this one.
this.addAbility(new EmrakulTheAeonsTornOnCastAbility());
// Flying, protection from colored spells, annihilator 6

View file

@ -27,6 +27,11 @@
*/
package mage.sets.scarsofmirrodin;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
@ -53,6 +58,9 @@ import mage.target.Target;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
import mage.filter.predicate.mageobject.FromSetPredicate;
import mage.target.TargetPermanent;
import mage.util.SpellTargetAddress;
/**
* @author nantuko
@ -122,27 +130,25 @@ class PrecursorGolemCopyTriggeredAbility extends TriggeredAbilityImpl {
if (spell != null &&
(spell.getCardType().contains(CardType.INSTANT) || spell.getCardType().contains(CardType.SORCERY))) {
UUID targetGolem = null;
SpellAbility sa = spell.getSpellAbility();
for (Effect effect : sa.getEffects()) {
for (UUID target : effect.getTargetPointer().getTargets(game, sa)) {
for (SpellTargetAddress addr : SpellTargetAddress.walk(spell)) {
Target targetInstance = addr.getTarget(spell);
for (UUID target : targetInstance.getTargets()) {
Permanent permanent = game.getPermanent(target);
if (permanent != null) {
if (!permanent.hasSubtype("Golem")) {
if (permanent == null || !permanent.hasSubtype("Golem")) {
return false;
}
if (targetGolem == null) {
targetGolem = target;
} else {
// If a spell has multiple targets, but it's targeting the same Golem with all of them, Precursor Golem's last ability will trigger
if (!targetGolem.equals(target)) {
return false;
}
if (targetGolem == null) {
targetGolem = target;
} else {
// If a spell has multiple targets, but it's targeting the same Golem with all of them, Precursor Golem's last ability will trigger
if (!targetGolem.equals(target)) {
return false;
}
}
}
}
}
if (targetGolem != null) {
getEffects().get(0).setTargetPointer(new FixedTarget(spell.getId()));
getEffects().get(0).setValue("triggeringSpell", spell);
getEffects().get(0).setValue("targetedGolem", targetGolem);
return true;
}
@ -174,16 +180,17 @@ class PrecursorGolemCopySpellEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Spell spell = game.getStack().getSpell(targetPointer.getFirst(game, source));
Spell spell = (Spell) getValue("triggeringSpell");
if (spell != null) {
SpellAbility sa = spell.getSpellAbility();
UUID targetedGolem = (UUID) getValue("targetedGolem");
Map<UUID, Spell> targetable = new HashMap<>();
for (Permanent permanent : game.getBattlefield().getActivePermanents(filterGolem, source.getControllerId(), source.getSourceId(), game)) {
if (permanent.getId().equals(targetedGolem)) {
continue; // copy only for other golems
}
boolean legal = true;
for (Target target : sa.getTargets()) {
for (SpellTargetAddress addr : SpellTargetAddress.walk(spell)) {
Target target = addr.getTarget(spell);
if (!target.canTarget(permanent.getId(), game)) {
legal = false;
break;
@ -191,16 +198,40 @@ class PrecursorGolemCopySpellEffect extends OneShotEffect {
}
if (legal) {
Spell copy = spell.copySpell();
copy.setControllerId(spell.getControllerId());
copy.setCopiedSpell(true);
for (Effect effect : copy.getSpellAbility().getEffects()) {
effect.setTargetPointer(new FixedTarget(permanent.getId()));
}
for (Target target : copy.getSpellAbility().getTargets()) {
for (SpellTargetAddress addr : SpellTargetAddress.walk(copy)) {
Target target = addr.getTarget(copy);
target.clearChosen();
target.add(permanent.getId(), game);
}
game.getStack().push(copy);
targetable.put(permanent.getId(), copy);
}
}
UUID spellController = spell.getControllerId();
while (targetable.size() > 0) {
FilterPermanent filter = new FilterPermanent("Golem",
"Golem that spell could target ("+targetable.size()+" remaining)");
filter.add(new FromSetPredicate(targetable.keySet()));
TargetPermanent target = new TargetPermanent(0, 1, filter, true);
if (target.possibleTargets(spellController, game).size() > 1
&& target.canChoose(spell.getSourceId(), spellController, game)) {
game.getPlayer(spellController).choose(Outcome.Neutral, target, source.getId(), game);
}
Collection<UUID> chosen = target.getTargets();
if (chosen.size() == 0) {
chosen = targetable.keySet();
}
List<UUID> toDelete = new ArrayList<>();
for (UUID chosenId : chosen) {
Spell chosenCopy = targetable.get(chosenId);
if (chosenCopy != null) {
game.getStack().push(chosenCopy);
toDelete.add(chosenId);
}
}
for (UUID id : toDelete) {
targetable.remove(id);
}
}
return true;

View file

@ -129,13 +129,16 @@ class XantidSwarmReplacementEffect extends ContinuousRuleModifiyingEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL ) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null && player.getId().equals(event.getPlayerId())) {
return true;
}
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
if (player != null && player.getId().equals(event.getPlayerId())) {
return true;
}
return false;
}

View file

@ -27,16 +27,24 @@
*/
package mage.sets.shadowmoor;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.UUID;
import mage.MageInt;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.choices.Choice;
import mage.choices.ChoiceImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -53,7 +61,7 @@ public class ManaforgeCinder extends CardImpl {
this.toughness = new MageInt(1);
// {1}: Add {B} or {R} to your mana pool. Activate this ability no more than three times each turn.
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BasicManaEffect(Mana.BlackMana), new ManaCostsImpl("{1}"), 3));
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new ManaforgeCinderManaEffect(), new ManaCostsImpl("{1}"), 3));
}
@ -66,3 +74,55 @@ public class ManaforgeCinder extends CardImpl {
return new ManaforgeCinder(this);
}
}
class ManaforgeCinderManaEffect extends OneShotEffect {
public ManaforgeCinderManaEffect() {
super(Outcome.PutManaInPool);
this.staticText = "Add {B} or {R} to your mana pool";
}
public ManaforgeCinderManaEffect(final ManaforgeCinderManaEffect effect) {
super(effect);
}
@Override
public ManaforgeCinderManaEffect copy() {
return new ManaforgeCinderManaEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Choice manaChoice = new ChoiceImpl();
Set<String> choices = new LinkedHashSet<>();
choices.add("Black");
choices.add("Red");
manaChoice.setChoices(choices);
manaChoice.setMessage("Select black or red mana to add to your mana pool");
Mana mana = new Mana();
while (!controller.choose(Outcome.Benefit, manaChoice, game)) {
if (!controller.isInGame()) {
return false;
}
}
if (manaChoice.getChoice() == null) {
return false;
}
switch (manaChoice.getChoice()) {
case "Black":
mana.addBlack();
break;
case "Red":
mana.addRed();
break;
}
controller.getManaPool().addMana(mana, game, source);
return true;
}
return false;
}
}

View file

@ -0,0 +1,111 @@
/*
* 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.sets.shadowmoor;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Zone;
import mage.game.Game;
import mage.abilities.Ability;
import mage.game.permanent.Permanent;
import mage.constants.Outcome;
import mage.game.permanent.token.Token;
import mage.MageInt;
/**
* @author duncancmt
*/
public class MercyKilling extends CardImpl {
public MercyKilling(UUID ownerId) {
super(ownerId, 231, "Mercy Killing", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{G/W}");
this.expansionSetCode = "SHM";
// Target creature's controller sacrifices it, then puts X 1/1 green and white Elf Warrior creature tokens onto the battlefield, where X is that creature's power.
this.getSpellAbility().addEffect(new SacrificeTargetEffect("Target creature's controller sacrifices it"));
this.getSpellAbility().addEffect(new MercyKillingTokenEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public MercyKilling(final MercyKilling card) {
super(card);
}
@Override
public MercyKilling copy() {
return new MercyKilling(this);
}
}
class MercyKillingTokenEffect extends OneShotEffect {
public MercyKillingTokenEffect() {
super(Outcome.PutCreatureInPlay);
staticText = ", then puts X 1/1 green and white Elf Warrior creature tokens onto the battlefield, where X is that creature's power";
}
public MercyKillingTokenEffect(final MercyKillingTokenEffect effect) {
super(effect);
}
@Override
public MercyKillingTokenEffect copy() {
return new MercyKillingTokenEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanentOrLKIBattlefield(getTargetPointer().getFirst(game, source));
if (permanent != null) {
int power = permanent.getPower().getValue();
return new MercyKillingToken().putOntoBattlefield(power, game, source.getSourceId(), permanent.getControllerId());
}
return false;
}
}
class MercyKillingToken extends Token {
public MercyKillingToken() {
super("Elf Warrior", "1/1 green and white Elf Warrior creature token");
cardType.add(CardType.CREATURE);
color.setGreen(true);
color.setWhite(true);
subtype.add("Elf");
subtype.add("Warrior");
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -31,7 +31,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
@ -64,7 +64,7 @@ public class VexingShusher extends CardImpl {
this.toughness = new MageInt(2);
// Vexing Shusher can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// {R/G}: Target spell can't be countered by spells or abilities.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new VexingShusherCantCounterTargetEffect(), new ManaCostsImpl("{R/G}"));
ability.addTarget(new TargetSpell());
@ -111,9 +111,14 @@ class VexingShusherCantCounterTargetEffect extends ContinuousRuleModifiyingEffec
return null;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.COUNTER;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return event.getType() == EventType.COUNTER && event.getTargetId().equals(targetPointer.getFirst(game, source));
return event.getTargetId().equals(targetPointer.getFirst(game, source));
}
}

View file

@ -144,14 +144,17 @@ class EtherswornCanonistReplacementEffect extends ContinuousRuleModifiyingEffect
return new EtherswornCanonistReplacementEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
EtherswornCanonistWatcher watcher = (EtherswornCanonistWatcher)game.getState().getWatchers().get("EtherswornCanonistWatcher");
Card card = game.getCard(event.getSourceId());
if (card != null && !card.getCardType().contains(CardType.ARTIFACT) && watcher.castNonArtifactSpell(event.getPlayerId())) {
return true;
}
EtherswornCanonistWatcher watcher = (EtherswornCanonistWatcher)game.getState().getWatchers().get("EtherswornCanonistWatcher");
Card card = game.getCard(event.getSourceId());
if (card != null && !card.getCardType().contains(CardType.ARTIFACT) && watcher.castNonArtifactSpell(event.getPlayerId())) {
return true;
}
return false;
}

View file

@ -119,9 +119,14 @@ class LichsMirrorEffect extends ReplacementEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.LOSES;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.LOSES && event.getPlayerId().equals(source.getControllerId())) {
if (event.getPlayerId().equals(source.getControllerId())) {
return true;
}
return false;

View file

@ -30,7 +30,7 @@ package mage.sets.tempest;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.keyword.ProtectionAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -59,7 +59,7 @@ public class Scragnoth extends CardImpl {
this.toughness = new MageInt(4);
// Scragnoth can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// Protection from blue
this.addAbility(new ProtectionAbility(filter));
}

View file

@ -91,13 +91,16 @@ class IncinerateEffect extends ContinuousRuleModifiyingEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.REGENERATE;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.REGENERATE) {
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
if (watcher != null) {
return watcher.wasDamaged(event.getTargetId(), game);
}
DamagedByWatcher watcher = (DamagedByWatcher) game.getState().getWatchers().get("DamagedByWatcher", source.getSourceId());
if (watcher != null) {
return watcher.wasDamaged(event.getTargetId(), game);
}
return false;
}

View file

@ -37,6 +37,7 @@ import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -70,10 +71,10 @@ public class PlatinumAngel extends CardImpl {
return new PlatinumAngel(this);
}
class PlatinumAngelEffect extends ReplacementEffectImpl {
class PlatinumAngelEffect extends ContinuousRuleModifiyingEffectImpl {
public PlatinumAngelEffect() {
super(Duration.WhileOnBattlefield, Outcome.Benefit);
super(Duration.WhileOnBattlefield, Outcome.Benefit, false, false);
staticText = "You can't lose the game and your opponents can't win the game";
}
@ -91,11 +92,6 @@ public class PlatinumAngel extends CardImpl {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ((event.getType() == EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) ||

View file

@ -32,7 +32,7 @@ import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.CantCounterAbility;
import mage.abilities.common.CantBeCounteredAbility;
import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.HasteAbility;
@ -68,7 +68,7 @@ public class MistcutterHydra extends CardImpl {
this.toughness = new MageInt(0);
// Mistcutter Hydra can't be countered.
this.addAbility(new CantCounterAbility());
this.addAbility(new CantBeCounteredAbility());
// Haste
this.addAbility(HasteAbility.getInstance());
// protection from blue

View file

@ -28,19 +28,13 @@
package mage.sets.theros;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.keyword.ScryEffect;
import mage.abilities.effects.common.ruleModifying.CantRegenerateTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.common.TargetCreaturePermanent;
import mage.watchers.common.DamagedByWatcher;

View file

@ -105,6 +105,13 @@ class ShipbreakerKrakenReplacementEffect extends ContinuousRuleModifiyingEffectI
return false;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.LOST_CONTROL ||
event.getType() == GameEvent.EventType.ZONE_CHANGE ||
event.getType() == GameEvent.EventType.UNTAP;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
// Source must be on the battlefield (it's neccessary to check here because if as response to the enter

View file

@ -105,16 +105,19 @@ class UnderworldCerberusEffect extends ContinuousRuleModifiyingEffectImpl {
return true;
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TARGET;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.TARGET) {
Card targetCard = game.getCard(event.getTargetId());
StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId());
if (targetCard != null && stackObject != null) {
Zone zone = game.getState().getZone(targetCard.getId());
if (zone != null && (zone == Zone.GRAVEYARD)) {
return true;
}
Card targetCard = game.getCard(event.getTargetId());
StackObject stackObject = (StackObject) game.getStack().getStackObject(event.getSourceId());
if (targetCard != null && stackObject != null) {
Zone zone = game.getState().getZone(targetCard.getId());
if (zone != null && (zone == Zone.GRAVEYARD)) {
return true;
}
}
return false;

View file

@ -29,6 +29,7 @@ package mage.sets.timespiral;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.abilities.keyword.SplitSecondAbility;
import mage.cards.CardImpl;
@ -71,10 +72,10 @@ public class AngelsGrace extends CardImpl {
}
}
class AngelsGraceEffect extends ReplacementEffectImpl {
class AngelsGraceEffect extends ContinuousRuleModifiyingEffectImpl {
public AngelsGraceEffect() {
super(Duration.EndOfTurn, Outcome.Benefit);
super(Duration.EndOfTurn, Outcome.Benefit, false, false);
staticText = "You can't lose the game this turn and your opponents can't win the game this turn";
}
@ -92,11 +93,6 @@ class AngelsGraceEffect extends ReplacementEffectImpl {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ((event.getType() == EventType.WINS && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) ||
@ -124,10 +120,15 @@ class AngelsGraceReplacementEffect extends ReplacementEffectImpl {
return new AngelsGraceReplacementEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType().equals(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_CAUSES_LIFE_LOSS)
&& event.getPlayerId().equals(source.getControllerId())) {
if (event.getPlayerId().equals(source.getControllerId())) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null
&& (controller.getLife() - event.getAmount()) < 1 ) {

View file

@ -49,7 +49,7 @@ import mage.target.common.TargetCardInLibrary;
public class MysticalTeachings extends CardImpl {
private static final FilterCard filter = new FilterCard("creature an opponent controls");
private static final FilterCard filter = new FilterCard("an instant card or a card with flash");
static {
filter.add(Predicates.or(

View file

@ -0,0 +1,24 @@
package mage.sets.vintagemasters;
import java.util.UUID;
/**
* @author Laxika
*/
public class UrborgUprising extends mage.sets.apocalypse.UrborgUprising {
public UrborgUprising(UUID ownerId) {
super(ownerId);
this.cardNumber = 144;
this.expansionSetCode = "VMA";
}
public UrborgUprising(final UrborgUprising card) {
super(card);
}
@Override
public UrborgUprising copy() {
return new UrborgUprising(this);
}
}

View file

@ -79,7 +79,7 @@ public class AbyssalPersecutor extends CardImpl {
class AbyssalPersecutorCannotWinEffect extends ContinuousRuleModifiyingEffectImpl {
AbyssalPersecutorCannotWinEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
super(Duration.WhileOnBattlefield, Outcome.Detriment, false, false);
staticText = "You can't win the game and your opponents can't lose the game";
}
@ -87,6 +87,11 @@ class AbyssalPersecutorCannotWinEffect extends ContinuousRuleModifiyingEffectImp
super(effect);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.LOSES || event.getType() == EventType.WINS ;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if ((event.getType() == EventType.LOSES && game.getOpponents(source.getControllerId()).contains(event.getPlayerId()))

View file

@ -33,7 +33,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.CantCounterSourceEffect;
import mage.abilities.effects.common.CantBeCounteredSourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
@ -52,7 +52,7 @@ public class TerraStomper extends CardImpl {
this.power = new MageInt(8);
this.toughness = new MageInt(8);
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CantCounterSourceEffect()));
this.addAbility(new SimpleStaticAbility(Zone.ALL, new CantBeCounteredSourceEffect()));
this.addAbility(TrampleAbility.getInstance());
}