mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Replaced more replacement effects by ContinuousRuleModifyingEffects or RestrictionEffects.
This commit is contained in:
parent
b195b81316
commit
df3b6afc8d
38 changed files with 285 additions and 434 deletions
|
@ -38,7 +38,6 @@ import mage.abilities.common.AsEntersBattlefieldAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.mana.ColorlessManaAbility;
|
||||
import mage.abilities.mana.ConditionalAnyColorManaAbility;
|
||||
import mage.abilities.mana.builder.ConditionalManaBuilder;
|
||||
|
|
|
@ -32,6 +32,7 @@ import java.util.UUID;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
@ -116,10 +117,10 @@ class SpiritOfTheLabyrinthWatcher extends Watcher {
|
|||
|
||||
}
|
||||
|
||||
class SpiritOfTheLabyrinthEffect extends ReplacementEffectImpl {
|
||||
class SpiritOfTheLabyrinthEffect extends ContinuousRuleModifiyingEffectImpl {
|
||||
|
||||
public SpiritOfTheLabyrinthEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment, false, false);
|
||||
staticText = "Each player can't draw more than one card each turn";
|
||||
}
|
||||
|
||||
|
@ -137,11 +138,6 @@ class SpiritOfTheLabyrinthEffect 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() == GameEvent.EventType.DRAW_CARD) {
|
||||
|
|
|
@ -38,7 +38,6 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.costs.common.PayLifeCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.mana.SimpleManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
@ -52,7 +51,6 @@ import mage.filter.common.FilterInstantOrSorceryCard;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
|
|
|
@ -79,7 +79,7 @@ class ShimatsuTheBloodcloakedEffect extends ReplacementEffectImpl {
|
|||
|
||||
public ShimatsuTheBloodcloakedEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.BoostCreature);
|
||||
this.staticText = "As Shimatsu the Bloodcloaked enters the battlefield, sacrifice any number of permanents. Shimatsu enters the battlefield with that many +1/+1 counters on it";
|
||||
this.staticText = "As {this} enters the battlefield, sacrifice any number of permanents. {this} enters the battlefield with that many +1/+1 counters on it";
|
||||
}
|
||||
|
||||
public ShimatsuTheBloodcloakedEffect(final ShimatsuTheBloodcloakedEffect effect) {
|
||||
|
|
|
@ -34,8 +34,8 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.effects.ContinuousEffect;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RequirementEffect;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
|
@ -143,7 +143,7 @@ class IllusionistsGambitRemoveFromCombatEffect extends OneShotEffect {
|
|||
game.getState().getTurnMods().add(new TurnMod(game.getActivePlayerId(), TurnPhase.COMBAT, null, false));
|
||||
ContinuousEffect effect = new IllusionistsGambitRequirementEffect(attackers, phase);
|
||||
game.addEffect(effect, source);
|
||||
effect = new IllusionistsGambitReplacementEffect(attackers, phase);
|
||||
effect = new IllusionistsGambitRestrictionEffect(attackers, phase);
|
||||
game.addEffect(effect, source);
|
||||
|
||||
}
|
||||
|
@ -203,32 +203,27 @@ class IllusionistsGambitRequirementEffect extends RequirementEffect {
|
|||
}
|
||||
}
|
||||
|
||||
class IllusionistsGambitReplacementEffect extends ReplacementEffectImpl {
|
||||
class IllusionistsGambitRestrictionEffect extends RestrictionEffect {
|
||||
|
||||
private final List attackers;
|
||||
private final Phase phase;
|
||||
|
||||
IllusionistsGambitReplacementEffect(List attackers, Phase phase) {
|
||||
public IllusionistsGambitRestrictionEffect(List attackers, Phase phase) {
|
||||
super(Duration.Custom, Outcome.Benefit);
|
||||
this.attackers = attackers;
|
||||
this.phase = phase;
|
||||
staticText = "They can't attack you or a planeswalker you control that combat";
|
||||
}
|
||||
|
||||
IllusionistsGambitReplacementEffect(IllusionistsGambitReplacementEffect effect) {
|
||||
public IllusionistsGambitRestrictionEffect(final IllusionistsGambitRestrictionEffect effect) {
|
||||
super(effect);
|
||||
this.attackers = effect.attackers;
|
||||
this.phase = effect.phase;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return attackers.contains(permanent.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -242,24 +237,37 @@ class IllusionistsGambitReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && attackers.contains(event.getSourceId())) {
|
||||
if (event.getTargetId().equals(source.getControllerId()) ) {
|
||||
return true;
|
||||
}
|
||||
// planeswalker
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())
|
||||
&& permanent.getCardType().contains(CardType.PLANESWALKER)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean canAttack(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IllusionistsGambitReplacementEffect copy() {
|
||||
return new IllusionistsGambitReplacementEffect(this);
|
||||
public boolean canAttack(UUID defenderId, Ability source, Game game) {
|
||||
if (defenderId.equals(source.getControllerId()) ) {
|
||||
return false;
|
||||
}
|
||||
// planeswalker
|
||||
Permanent permanent = game.getPermanent(defenderId);
|
||||
if (permanent != null && permanent.getControllerId().equals(source.getControllerId())
|
||||
&& permanent.getCardType().contains(CardType.PLANESWALKER)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IllusionistsGambitRestrictionEffect copy() {
|
||||
return new IllusionistsGambitRestrictionEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -119,7 +119,7 @@ class MysticBarrierTriggeredAbility extends TriggeredAbilityImpl {
|
|||
class MysticBarrierChooseEffect extends OneShotEffect {
|
||||
|
||||
public static final String[] SET_VALUES = new String[] { MysticBarrier.ALLOW_ATTACKING_LEFT, MysticBarrier.ALLOW_ATTACKING_RIGHT };
|
||||
public static final Set<String> CHOICES = new HashSet<String>(Arrays.asList(SET_VALUES));
|
||||
public static final Set<String> CHOICES = new HashSet<>(Arrays.asList(SET_VALUES));
|
||||
final static Choice DIRECTION_CHOICE = new ChoiceImpl(true);
|
||||
static {
|
||||
DIRECTION_CHOICE.setChoices(CHOICES);
|
||||
|
|
|
@ -35,7 +35,6 @@ import mage.abilities.dynamicvalue.DynamicValue;
|
|||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
|
|
@ -33,7 +33,6 @@ import mage.constants.*;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
|
@ -38,6 +38,7 @@ import mage.abilities.effects.common.combat.CantBlockAttackActivateAttachedEffec
|
|||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
|
|
|
@ -42,6 +42,7 @@ import mage.abilities.effects.common.combat.CantBlockAttackActivateAttachedEffec
|
|||
import mage.abilities.effects.common.counter.AddPlusOneCountersAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
|
|
@ -89,7 +89,7 @@ public class FullMoonsRise extends CardImpl {
|
|||
|
||||
class FullMoonsRiseEffect extends OneShotEffect {
|
||||
|
||||
private FilterPermanent filter;
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public FullMoonsRiseEffect(FilterPermanent filter) {
|
||||
super(Outcome.Regenerate);
|
||||
|
|
|
@ -30,16 +30,13 @@ package mage.sets.innistrad;
|
|||
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.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
|
@ -55,7 +52,7 @@ public class StonySilence extends CardImpl {
|
|||
this.color.setWhite(true);
|
||||
|
||||
// Activated abilities of artifacts can't be activated.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new StonySilenceEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new StonySilenceCantActivateEffect()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -69,41 +66,30 @@ public class StonySilence extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class StonySilenceEffect extends ReplacementEffectImpl {
|
||||
class StonySilenceCantActivateEffect extends RestrictionEffect {
|
||||
|
||||
public StonySilenceEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
public StonySilenceCantActivateEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "Activated abilities of artifacts can't be activated";
|
||||
}
|
||||
|
||||
public StonySilenceEffect(final StonySilenceEffect effect) {
|
||||
public StonySilenceCantActivateEffect(final StonySilenceCantActivateEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return permanent.getCardType().contains(CardType.ARTIFACT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StonySilenceEffect copy() {
|
||||
return new StonySilenceEffect(this);
|
||||
}
|
||||
|
||||
@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.ACTIVATE_ABILITY) {
|
||||
Permanent artifact = game.getPermanent(event.getSourceId());
|
||||
if (artifact != null && artifact.getCardType().contains(CardType.ARTIFACT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StonySilenceCantActivateEffect copy() {
|
||||
return new StonySilenceCantActivateEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,8 +32,10 @@ import java.util.UUID;
|
|||
import mage.constants.*;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.effects.common.CantActivateAbilitiesAttachedEffect;
|
||||
import mage.abilities.effects.common.SkipEnchantedUntapEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -74,8 +76,10 @@ public class Encrust extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// Enchanted permanent doesn't untap during its controller's untap step and its activated abilities can't be activated.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipEnchantedUntapEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new EncrustEffect()));
|
||||
ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new SkipEnchantedUntapEffect());
|
||||
Effect effect = new CantActivateAbilitiesAttachedEffect();
|
||||
effect.setText("and its activated abilities can't be activated");
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public Encrust(final Encrust card) {
|
||||
|
@ -87,43 +91,3 @@ public class Encrust extends CardImpl {
|
|||
return new Encrust(this);
|
||||
}
|
||||
}
|
||||
|
||||
class EncrustEffect extends ReplacementEffectImpl {
|
||||
|
||||
public EncrustEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "Its activated abilities can't be activated";
|
||||
}
|
||||
|
||||
public EncrustEffect(final EncrustEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EncrustEffect copy() {
|
||||
return new EncrustEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
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() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
Permanent enchanted = game.getPermanent(enchantment.getAttachedTo());
|
||||
if (event.getSourceId().equals(enchanted.getId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.abilities.effects.common.continious.AddCardTypeTargetEffect;
|
||||
import mage.abilities.effects.common.continious.GainAbilityTargetEffect;
|
||||
import mage.abilities.effects.common.continious.SetCardColorTargetEffect;
|
||||
|
@ -45,12 +45,10 @@ import mage.abilities.keyword.DefenderAbility;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
|
@ -83,7 +81,7 @@ public class XathridGorgon extends CardImpl {
|
|||
effect.setText("and becomes a colorless artifact in addition to its other types");
|
||||
ability.addEffect(effect);
|
||||
ability.addEffect(new SetCardColorTargetEffect(new ObjectColor(), Duration.Custom, ""));
|
||||
ability.addEffect(new XathridGorgonEffect());
|
||||
ability.addEffect(new XathridGorgonCantActivateEffect());
|
||||
this.addAbility(ability);
|
||||
|
||||
}
|
||||
|
@ -98,43 +96,36 @@ public class XathridGorgon extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class XathridGorgonEffect extends ReplacementEffectImpl {
|
||||
class XathridGorgonCantActivateEffect extends RestrictionEffect {
|
||||
|
||||
public XathridGorgonEffect() {
|
||||
super(Duration.Custom, Outcome.Detriment);
|
||||
public XathridGorgonCantActivateEffect() {
|
||||
super(Duration.Custom);
|
||||
staticText = "Its activated abilities can't be activated";
|
||||
}
|
||||
|
||||
public XathridGorgonEffect(final XathridGorgonEffect effect) {
|
||||
public XathridGorgonCantActivateEffect(final XathridGorgonCantActivateEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XathridGorgonEffect copy() {
|
||||
return new XathridGorgonEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
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().equals(GameEvent.EventType.ACTIVATE_ABILITY) && event.getSourceId().equals(targetPointer.getFirst(game, source))) {
|
||||
Permanent target = game.getPermanent(targetPointer.getFirst(game, source));
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
Permanent target = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (target != null) {
|
||||
return true;
|
||||
} else {
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public XathridGorgonCantActivateEffect copy() {
|
||||
return new XathridGorgonCantActivateEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,18 +28,15 @@
|
|||
package mage.sets.mirage;
|
||||
|
||||
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.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
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;
|
||||
|
||||
/**
|
||||
|
@ -53,7 +50,7 @@ public class CursedTotem extends CardImpl {
|
|||
this.expansionSetCode = "MIR";
|
||||
|
||||
// Activated abilities of creatures can't be activated.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CursedTotemEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CursedTotemCantActivateEffect()));
|
||||
}
|
||||
|
||||
public CursedTotem(final CursedTotem card) {
|
||||
|
@ -66,41 +63,30 @@ public class CursedTotem extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CursedTotemEffect extends ReplacementEffectImpl {
|
||||
class CursedTotemCantActivateEffect extends RestrictionEffect {
|
||||
|
||||
public CursedTotemEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
public CursedTotemCantActivateEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "Activated abilities of creatures can't be activated";
|
||||
}
|
||||
|
||||
public CursedTotemEffect(final CursedTotemEffect effect) {
|
||||
public CursedTotemCantActivateEffect(final CursedTotemCantActivateEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return permanent.getCardType().contains(CardType.CREATURE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CursedTotemEffect copy() {
|
||||
return new CursedTotemEffect(this);
|
||||
}
|
||||
|
||||
@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.ACTIVATE_ABILITY) {
|
||||
Permanent creature = game.getPermanent(event.getSourceId());
|
||||
if (creature != null && creature.getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CursedTotemCantActivateEffect copy() {
|
||||
return new CursedTotemCantActivateEffect(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -39,6 +39,7 @@ import mage.abilities.effects.common.AttachEffect;
|
|||
import mage.abilities.effects.common.combat.CantBlockAttackActivateAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
|
|
@ -148,7 +148,7 @@ class PhyrexianRevokerEffect2 extends ContinuousRuleModifiyingEffectImpl {
|
|||
public String getInfoMessage(Ability source, GameEvent event, Game game) {
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject != null) {
|
||||
return "You can't activate sources with that name (" + mageObject.getLogName() + " in play).";
|
||||
return "You can't activate abilities of sources with that name (" + mageObject.getLogName() + " in play).";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
|
|
|
@ -37,7 +37,6 @@ import mage.abilities.common.AsEntersBattlefieldAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
|
@ -45,6 +44,7 @@ import mage.choices.Choice;
|
|||
import mage.choices.ChoiceImpl;
|
||||
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;
|
||||
|
@ -71,7 +71,7 @@ public class VoidstoneGargoyle extends CardImpl {
|
|||
// The named card can't be cast.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VoidstoneGargoyleReplacementEffect1()));
|
||||
// Activated abilities of sources with the chosen name can't be activated.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VoidstoneGargoyleReplacementEffect2()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new VoidstoneGargoyleRuleModifyingEffect2()));
|
||||
}
|
||||
|
||||
public VoidstoneGargoyle(final VoidstoneGargoyle card) {
|
||||
|
@ -167,14 +167,14 @@ class VoidstoneGargoyleReplacementEffect1 extends ContinuousRuleModifiyingEffect
|
|||
|
||||
}
|
||||
|
||||
class VoidstoneGargoyleReplacementEffect2 extends ReplacementEffectImpl {
|
||||
class VoidstoneGargoyleRuleModifyingEffect2 extends ContinuousRuleModifiyingEffectImpl {
|
||||
|
||||
public VoidstoneGargoyleReplacementEffect2() {
|
||||
public VoidstoneGargoyleRuleModifyingEffect2() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "Activated abilities of sources with the chosen name can't be activated.";
|
||||
staticText = "Activated abilities of sources with the chosen name can't be activated";
|
||||
}
|
||||
|
||||
public VoidstoneGargoyleReplacementEffect2(final VoidstoneGargoyleReplacementEffect2 effect) {
|
||||
public VoidstoneGargoyleRuleModifyingEffect2(final VoidstoneGargoyleRuleModifyingEffect2 effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -184,18 +184,22 @@ class VoidstoneGargoyleReplacementEffect2 extends ReplacementEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public VoidstoneGargoyleReplacementEffect2 copy() {
|
||||
return new VoidstoneGargoyleReplacementEffect2(this);
|
||||
public VoidstoneGargoyleRuleModifyingEffect2 copy() {
|
||||
return new VoidstoneGargoyleRuleModifyingEffect2(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
public String getInfoMessage(Ability source, GameEvent event, Game game) {
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject != null) {
|
||||
return "You can't activate abilities of sources with that name (" + mageObject.getLogName() + " in play).";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||
if (event.getType() == EventType.ACTIVATE_ABILITY) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object != null && object.getName().equals(game.getState().getValue(source.getSourceId().toString()))) {
|
||||
return true;
|
||||
|
|
|
@ -29,23 +29,19 @@
|
|||
package mage.sets.riseoftheeldrazi;
|
||||
|
||||
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.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
|
@ -60,8 +56,10 @@ public class LinvalaKeeperOfSilence extends CardImpl {
|
|||
this.color.setWhite(true);
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(4);
|
||||
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LinvalaKeeperOfSilenceEffect()));
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LinvalaKeeperOfSilenceCantActivateEffect()));
|
||||
}
|
||||
|
||||
public LinvalaKeeperOfSilence (final LinvalaKeeperOfSilence card) {
|
||||
|
@ -74,39 +72,30 @@ public class LinvalaKeeperOfSilence extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class LinvalaKeeperOfSilenceEffect extends ReplacementEffectImpl {
|
||||
LinvalaKeeperOfSilenceEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
class LinvalaKeeperOfSilenceCantActivateEffect extends RestrictionEffect {
|
||||
|
||||
public LinvalaKeeperOfSilenceCantActivateEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "Activated abilities of creatures your opponents control can't be activated";
|
||||
}
|
||||
|
||||
LinvalaKeeperOfSilenceEffect(final LinvalaKeeperOfSilenceEffect effect) {
|
||||
public LinvalaKeeperOfSilenceCantActivateEffect(final LinvalaKeeperOfSilenceCantActivateEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return permanent.getCardType().contains(CardType.CREATURE) && game.getOpponents(source.getControllerId()).contains(permanent.getControllerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
Permanent p = game.getPermanent(event.getSourceId());
|
||||
if ( event.getType() == GameEvent.EventType.ACTIVATE_ABILITY && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())
|
||||
&& p != null && p.getCardType().contains(CardType.CREATURE)) {
|
||||
return true;
|
||||
}
|
||||
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LinvalaKeeperOfSilenceEffect copy() {
|
||||
return new LinvalaKeeperOfSilenceEffect(this);
|
||||
public LinvalaKeeperOfSilenceCantActivateEffect copy() {
|
||||
return new LinvalaKeeperOfSilenceCantActivateEffect(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -28,18 +28,22 @@
|
|||
package mage.sets.saviorsofkamigawa;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
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.ReplacementEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.repository.CardRepository;
|
||||
import mage.choices.Choice;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.AbilityType;
|
||||
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.players.Player;
|
||||
|
@ -108,7 +112,7 @@ class NameCard extends OneShotEffect {
|
|||
|
||||
}
|
||||
|
||||
class PithingNeedleEffect extends ReplacementEffectImpl {
|
||||
class PithingNeedleEffect extends ContinuousRuleModifiyingEffectImpl {
|
||||
|
||||
public PithingNeedleEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
|
@ -129,11 +133,6 @@ class PithingNeedleEffect 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() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||
|
|
|
@ -35,7 +35,6 @@ import mage.abilities.common.CantCounterAbility;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
|
|
|
@ -32,7 +32,6 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesMonstrousSourceTriggeredAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.abilities.keyword.MonstrosityAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
|
@ -33,7 +33,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.DiesTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.ExileSourceEffect;
|
||||
import mage.abilities.effects.common.ReturnToHandFromGraveyardAllEffect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedByOneEffect;
|
||||
|
|
|
@ -37,7 +37,6 @@ 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.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
|
@ -34,7 +34,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.keyword.FlashAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
|
|
|
@ -28,17 +28,17 @@
|
|||
package mage.sets.timespiral;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.abilities.keyword.SplitSecondAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.keyword.SplitSecondAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.target.common.TargetActivatedOrTriggeredAbility;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
@ -93,7 +93,7 @@ class TrickbindCounterEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
StackObject stackObject = game.getStack().getStackObject(source.getFirstTarget());
|
||||
if(stackObject != null && game.getStack().counter(source.getFirstTarget(), source.getSourceId(), game)) {
|
||||
TrickbindReplacementEffect effect = new TrickbindReplacementEffect();
|
||||
TrickbindCantActivateEffect effect = new TrickbindCantActivateEffect();
|
||||
effect.setTargetPointer(new FixedTarget(stackObject.getSourceId()));
|
||||
game.getContinuousEffects().addEffect(effect, source);
|
||||
return true;
|
||||
|
@ -103,39 +103,33 @@ class TrickbindCounterEffect extends OneShotEffect {
|
|||
|
||||
}
|
||||
|
||||
class TrickbindReplacementEffect extends ReplacementEffectImpl {
|
||||
class TrickbindCantActivateEffect extends RestrictionEffect {
|
||||
|
||||
public TrickbindReplacementEffect() {
|
||||
super(Duration.EndOfTurn, Outcome.LoseAbility);
|
||||
public TrickbindCantActivateEffect() {
|
||||
super(Duration.EndOfTurn);
|
||||
staticText = "Activated abilities of that permanent can't be activated this turn";
|
||||
}
|
||||
|
||||
public TrickbindReplacementEffect(final TrickbindReplacementEffect effect) {
|
||||
public TrickbindCantActivateEffect(final TrickbindCantActivateEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrickbindReplacementEffect copy() {
|
||||
return new TrickbindReplacementEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
if (getTargetPointer().getFirst(game, source).equals(permanent.getId())) {
|
||||
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() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||
if (this.targetPointer.getFirst(game, source).equals(event.getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TrickbindCantActivateEffect copy() {
|
||||
return new TrickbindCantActivateEffect(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -30,15 +30,13 @@ package mage.sets.weatherlight;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.cards.CardImpl;
|
||||
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.permanent.Permanent;
|
||||
|
||||
/**
|
||||
|
@ -52,7 +50,7 @@ public class NullRod extends CardImpl {
|
|||
this.expansionSetCode = "WTH";
|
||||
|
||||
// Activated abilities of artifacts can't be activated.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantActivateAbilitiesEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new NullRodCantActivateEffect()));
|
||||
}
|
||||
|
||||
public NullRod(final NullRod card) {
|
||||
|
@ -65,40 +63,30 @@ public class NullRod extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CantActivateAbilitiesEffect extends ReplacementEffectImpl {
|
||||
class NullRodCantActivateEffect extends RestrictionEffect {
|
||||
|
||||
public CantActivateAbilitiesEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "Activated abilities of artifacts can't be activated.";
|
||||
public NullRodCantActivateEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "Activated abilities of artifacts can't be activated";
|
||||
}
|
||||
|
||||
public CantActivateAbilitiesEffect(final CantActivateAbilitiesEffect effect) {
|
||||
public NullRodCantActivateEffect(final NullRodCantActivateEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CantActivateAbilitiesEffect copy() {
|
||||
return new CantActivateAbilitiesEffect(this);
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return permanent.getCardType().contains(CardType.ARTIFACT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
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() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||
Permanent permanent = game.getPermanent(event.getSourceId());
|
||||
if (permanent.getCardType().contains(CardType.ARTIFACT)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NullRodCantActivateEffect copy() {
|
||||
return new NullRodCantActivateEffect(this);
|
||||
}
|
||||
|
||||
}
|
|
@ -33,19 +33,17 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.abilities.effects.common.SacrificeSourceUnlessPaysEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -79,38 +77,25 @@ public class Peacekeeper extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class PeacekeeperCantAttackEffect extends ReplacementEffectImpl {
|
||||
class PeacekeeperCantAttackEffect extends RestrictionEffect {
|
||||
|
||||
private static final String effectText = "Creatures can't attack";
|
||||
|
||||
PeacekeeperCantAttackEffect ( ) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = effectText;
|
||||
public PeacekeeperCantAttackEffect() {
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "Creatures can't attack";
|
||||
}
|
||||
|
||||
PeacekeeperCantAttackEffect (final PeacekeeperCantAttackEffect effect ) {
|
||||
public PeacekeeperCantAttackEffect(final PeacekeeperCantAttackEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
throw new UnsupportedOperationException("Not supported.");
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return permanent.getCardType().contains(CardType.CREATURE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Player atackingPlayer = game.getPlayer(event.getPlayerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (sourcePermanent != null && atackingPlayer != null) {
|
||||
game.informPlayer(atackingPlayer, new StringBuilder(sourcePermanent.getName()).append(" prevents you from attacking with this creature.").toString());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARE_ATTACKER;
|
||||
public boolean canAttack(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.constants.Zone;
|
|||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -73,7 +73,7 @@ public class AbyssalPersecutor extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class AbyssalPersecutorCannotWinEffect extends ReplacementEffectImpl {
|
||||
class AbyssalPersecutorCannotWinEffect extends ContinuousRuleModifiyingEffectImpl {
|
||||
|
||||
AbyssalPersecutorCannotWinEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
|
@ -93,16 +93,6 @@ class AbyssalPersecutorCannotWinEffect extends ReplacementEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbyssalPersecutorCannotWinEffect copy() {
|
||||
return new AbyssalPersecutorCannotWinEffect(this);
|
||||
|
|
|
@ -80,7 +80,7 @@ public class OmnathLocusOfMana extends CardImpl {
|
|||
|
||||
class OmnathReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
private static final List<ManaType> manaTypes = new ArrayList<ManaType>();
|
||||
private static final List<ManaType> manaTypes = new ArrayList<>();
|
||||
static {
|
||||
manaTypes.add(ManaType.BLACK);
|
||||
manaTypes.add(ManaType.BLUE);
|
||||
|
|
|
@ -35,14 +35,17 @@ import mage.ObjectColor;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.AlternativeCostImpl;
|
||||
import mage.abilities.costs.mana.ColoredManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.SkipNextUntapTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
/**
|
||||
|
@ -158,11 +161,13 @@ class PermafrostTrapEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
for (UUID target : this.targetPointer.getTargets(game, source)) {
|
||||
Permanent creature = game.getPermanent(target);
|
||||
for (UUID targetId : this.targetPointer.getTargets(game, source)) {
|
||||
Permanent creature = game.getPermanent(targetId);
|
||||
if (creature != null) {
|
||||
creature.tap(game);
|
||||
game.addEffect(new PermafrostEffect2(creature.getId()), source);
|
||||
SkipNextUntapTargetEffect effect = new SkipNextUntapTargetEffect();
|
||||
effect.setTargetPointer(new FixedTarget(targetId));
|
||||
game.addEffect(effect, source);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -173,44 +178,3 @@ class PermafrostTrapEffect extends OneShotEffect {
|
|||
return new PermafrostTrapEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
class PermafrostEffect2 extends ReplacementEffectImpl {
|
||||
|
||||
protected UUID creatureId;
|
||||
|
||||
public PermafrostEffect2(UUID creatureId) {
|
||||
super(Duration.OneUse, Outcome.Detriment);
|
||||
this.creatureId = creatureId;
|
||||
}
|
||||
|
||||
public PermafrostEffect2(final PermafrostEffect2 effect) {
|
||||
super(effect);
|
||||
creatureId = effect.creatureId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermafrostEffect2 copy() {
|
||||
return new PermafrostEffect2(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
used = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (game.getTurn().getStepType() == PhaseStep.UNTAP
|
||||
&& event.getType() == GameEvent.EventType.UNTAP
|
||||
&& event.getTargetId().equals(creatureId)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -137,7 +137,7 @@ class WrexialEffect extends OneShotEffect {
|
|||
|
||||
class WrexialReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
private UUID cardid;
|
||||
private final UUID cardid;
|
||||
|
||||
public WrexialReplacementEffect(UUID cardid) {
|
||||
super(Duration.EndOfTurn, Outcome.Exile);
|
||||
|
|
|
@ -28,8 +28,6 @@
|
|||
package mage.sets.zendikar;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.*;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.ObjectColor;
|
||||
|
@ -38,11 +36,15 @@ import mage.abilities.common.AsEntersBattlefieldAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.choices.ChoiceColor;
|
||||
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.permanent.Permanent;
|
||||
|
|
|
@ -78,6 +78,11 @@ public abstract class ContinuousRuleModifiyingEffectImpl extends ContinuousEffec
|
|||
this.messageToGameLog = effect.messageToGameLog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInfoMessage(Ability source, GameEvent event, Game game) {
|
||||
if (infoMessage == null) {
|
||||
|
|
|
@ -28,25 +28,26 @@
|
|||
|
||||
package mage.abilities.effects.common.combat;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CantAttackUnlessDefenderControllsPermanent extends ReplacementEffectImpl {
|
||||
public class CantAttackUnlessDefenderControllsPermanent extends RestrictionEffect {
|
||||
|
||||
private final FilterPermanent filter;
|
||||
|
||||
public CantAttackUnlessDefenderControllsPermanent(FilterPermanent filter) {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
super(Duration.WhileOnBattlefield);
|
||||
this.filter = filter;
|
||||
staticText = new StringBuilder("{this} can't attack unless defending player controls ").append(filter.getMessage()).toString();
|
||||
}
|
||||
|
@ -56,28 +57,37 @@ public class CantAttackUnlessDefenderControllsPermanent extends ReplacementEffec
|
|||
this.filter = effect.filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
return permanent.getId().equals(source.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttack(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttack(UUID defenderId, Ability source, Game game) {
|
||||
UUID defendingPlayerId = null;
|
||||
Player player = game.getPlayer(defenderId);
|
||||
if (player == null) {
|
||||
Permanent permanent = game.getPermanent(defenderId);
|
||||
if (permanent != null) {
|
||||
defendingPlayerId = permanent.getControllerId();
|
||||
}
|
||||
} else {
|
||||
defendingPlayerId = defenderId;
|
||||
}
|
||||
if (defendingPlayerId != null && game.getBattlefield().countAll(filter, defendingPlayerId, game) == 0) {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CantAttackUnlessDefenderControllsPermanent copy() {
|
||||
return new CantAttackUnlessDefenderControllsPermanent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
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() == GameEvent.EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) {
|
||||
if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -27,23 +27,20 @@
|
|||
*/
|
||||
package mage.abilities.effects.common.combat;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.RestrictionEffect;
|
||||
import mage.constants.Duration;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
||||
public class CantBlockAttackActivateAttachedEffect extends ReplacementEffectImpl {
|
||||
public class CantBlockAttackActivateAttachedEffect extends RestrictionEffect {
|
||||
|
||||
public CantBlockAttackActivateAttachedEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
super(Duration.WhileOnBattlefield);
|
||||
staticText = "Enchanted creature can't attack or block, and its activated abilities can't be activated";
|
||||
}
|
||||
|
||||
|
@ -52,30 +49,34 @@ public class CantBlockAttackActivateAttachedEffect extends ReplacementEffectImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public CantBlockAttackActivateAttachedEffect copy() {
|
||||
return new CantBlockAttackActivateAttachedEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
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() == GameEvent.EventType.DECLARE_ATTACKER || event.getType() == GameEvent.EventType.DECLARE_BLOCKER || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||
public boolean applies(Permanent permanent, Ability source, Game game) {
|
||||
Permanent enchantment = game.getPermanent(source.getSourceId());
|
||||
if (enchantment != null && enchantment.getAttachedTo() != null) {
|
||||
if (event.getSourceId().equals(enchantment.getAttachedTo())) {
|
||||
if (permanent.getId().equals(enchantment.getAttachedTo())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttack(Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlock(Permanent attacker, Permanent blocker, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canUseActivatedAbilities(Permanent permanent, Ability source, Game game) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CantBlockAttackActivateAttachedEffect copy() {
|
||||
return new CantBlockAttackActivateAttachedEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,18 +28,15 @@
|
|||
|
||||
package mage.abilities.effects.common.continious;
|
||||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.watchers.common.CastSpellLastTurnWatcher;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue