diff --git a/Mage.Sets/src/mage/cards/a/Abeyance.java b/Mage.Sets/src/mage/cards/a/Abeyance.java index 3e35499f1ce..f467490ab49 100644 --- a/Mage.Sets/src/mage/cards/a/Abeyance.java +++ b/Mage.Sets/src/mage/cards/a/Abeyance.java @@ -61,11 +61,6 @@ class AbeyanceEffect extends ContinuousRuleModifyingEffectImpl { return new AbeyanceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -76,6 +71,12 @@ class AbeyanceEffect extends ContinuousRuleModifyingEffectImpl { return null; } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CAST_SPELL + || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { if (source.getFirstTarget() != null diff --git a/Mage.Sets/src/mage/cards/a/AetherStorm.java b/Mage.Sets/src/mage/cards/a/AetherStorm.java index 4dc9a501106..bcadf719de2 100644 --- a/Mage.Sets/src/mage/cards/a/AetherStorm.java +++ b/Mage.Sets/src/mage/cards/a/AetherStorm.java @@ -57,11 +57,6 @@ class AetherStormReplacementEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public AetherStormReplacementEffect copy() { return new AetherStormReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/a/AggressiveMining.java b/Mage.Sets/src/mage/cards/a/AggressiveMining.java index 3da112d53bf..f4ffe419c9d 100644 --- a/Mage.Sets/src/mage/cards/a/AggressiveMining.java +++ b/Mage.Sets/src/mage/cards/a/AggressiveMining.java @@ -64,11 +64,6 @@ class AggressiveMiningEffect extends ContinuousRuleModifyingEffectImpl { public AggressiveMiningEffect copy() { return new AggressiveMiningEffect(this); } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } @Override public boolean checksEventType(GameEvent event, Game game) { diff --git a/Mage.Sets/src/mage/cards/a/AngelicArbiter.java b/Mage.Sets/src/mage/cards/a/AngelicArbiter.java index f903d4c8e5c..6517f6c4df6 100644 --- a/Mage.Sets/src/mage/cards/a/AngelicArbiter.java +++ b/Mage.Sets/src/mage/cards/a/AngelicArbiter.java @@ -98,11 +98,6 @@ class AngelicArbiterEffect2 extends ContinuousRuleModifyingEffectImpl { return new AngelicArbiterEffect2(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/a/AshesOfTheAbhorrent.java b/Mage.Sets/src/mage/cards/a/AshesOfTheAbhorrent.java index 5b37e2b0bd0..01ca1445e75 100644 --- a/Mage.Sets/src/mage/cards/a/AshesOfTheAbhorrent.java +++ b/Mage.Sets/src/mage/cards/a/AshesOfTheAbhorrent.java @@ -59,11 +59,6 @@ class AshesOfTheAbhorrentEffect extends ContinuousRuleModifyingEffectImpl { return new AshesOfTheAbhorrentEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL diff --git a/Mage.Sets/src/mage/cards/a/AshiokDreamRender.java b/Mage.Sets/src/mage/cards/a/AshiokDreamRender.java index da888faf9e9..efdd92108df 100644 --- a/Mage.Sets/src/mage/cards/a/AshiokDreamRender.java +++ b/Mage.Sets/src/mage/cards/a/AshiokDreamRender.java @@ -66,11 +66,6 @@ class AshiokDreamRenderEffect extends ContinuousRuleModifyingEffectImpl { return new AshiokDreamRenderEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/a/AshioksErasure.java b/Mage.Sets/src/mage/cards/a/AshioksErasure.java index db295cb0fe1..a1ff9f4dc41 100644 --- a/Mage.Sets/src/mage/cards/a/AshioksErasure.java +++ b/Mage.Sets/src/mage/cards/a/AshioksErasure.java @@ -146,11 +146,6 @@ class AshioksErasureReplacementEffect extends ContinuousRuleModifyingEffectImpl return false; } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public AshioksErasureReplacementEffect copy() { return new AshioksErasureReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/a/AssaultSuit.java b/Mage.Sets/src/mage/cards/a/AssaultSuit.java index 32dc67888c5..d180d8c7191 100644 --- a/Mage.Sets/src/mage/cards/a/AssaultSuit.java +++ b/Mage.Sets/src/mage/cards/a/AssaultSuit.java @@ -1,7 +1,6 @@ package mage.cards.a; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; @@ -25,14 +24,15 @@ import mage.game.permanent.Permanent; import mage.players.Player; import mage.target.targetpointer.FixedTarget; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class AssaultSuit extends CardImpl { public AssaultSuit(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}"); + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); this.subtype.add(SubType.EQUIPMENT); // Equipped creature gets +2/+2, has haste, can't attack you or a planeswalker you control, and can't be sacrificed. @@ -65,7 +65,7 @@ public final class AssaultSuit extends CardImpl { } } - class AssaultSuitCantBeSacrificed extends ContinuousRuleModifyingEffectImpl { +class AssaultSuitCantBeSacrificed extends ContinuousRuleModifyingEffectImpl { public AssaultSuitCantBeSacrificed() { super(Duration.WhileOnBattlefield, Outcome.Detriment, true, false); @@ -81,25 +81,20 @@ public final class AssaultSuit extends CardImpl { return new AssaultSuitCantBeSacrificed(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { return "This creature can't be sacrificed."; } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.SACRIFICE_PERMANENT) { - Permanent equipment = game.getPermanent(source.getSourceId()); - if (equipment != null) { - return equipment.isAttachedTo(event.getTargetId()); - } - } - return false; + Permanent equipment = game.getPermanent(source.getSourceId()); + return equipment != null && equipment.isAttachedTo(event.getTargetId()); } } diff --git a/Mage.Sets/src/mage/cards/a/AureliasFury.java b/Mage.Sets/src/mage/cards/a/AureliasFury.java index bd493c2e983..5851dce5996 100644 --- a/Mage.Sets/src/mage/cards/a/AureliasFury.java +++ b/Mage.Sets/src/mage/cards/a/AureliasFury.java @@ -133,11 +133,6 @@ class AureliasFuryCantCastEffect extends ContinuousRuleModifyingEffectImpl { return new AureliasFuryCantCastEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/a/AzorTheLawbringer.java b/Mage.Sets/src/mage/cards/a/AzorTheLawbringer.java index bc24da77fc8..243fd1d5148 100644 --- a/Mage.Sets/src/mage/cards/a/AzorTheLawbringer.java +++ b/Mage.Sets/src/mage/cards/a/AzorTheLawbringer.java @@ -106,11 +106,6 @@ class AzorTheLawbringerCantCastEffect extends ContinuousRuleModifyingEffectImpl return new AzorTheLawbringerCantCastEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -120,6 +115,11 @@ class AzorTheLawbringerCantCastEffect extends ContinuousRuleModifyingEffectImpl 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) { UUID opponentId = getTargetPointer().getFirst(game, source); diff --git a/Mage.Sets/src/mage/cards/b/Banefire.java b/Mage.Sets/src/mage/cards/b/Banefire.java index e79b0d260b9..5a1a3f57856 100644 --- a/Mage.Sets/src/mage/cards/b/Banefire.java +++ b/Mage.Sets/src/mage/cards/b/Banefire.java @@ -124,14 +124,12 @@ class BanefireCantCounterEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.COUNTER; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() != GameEvent.EventType.COUNTER) { return false; } - Card card = game.getCard(source.getSourceId()); if (card == null) { return false; } diff --git a/Mage.Sets/src/mage/cards/b/BartelRuneaxe.java b/Mage.Sets/src/mage/cards/b/BartelRuneaxe.java index f99b9415112..05af9222790 100644 --- a/Mage.Sets/src/mage/cards/b/BartelRuneaxe.java +++ b/Mage.Sets/src/mage/cards/b/BartelRuneaxe.java @@ -65,11 +65,6 @@ class BartelRuneaxeEffect extends ContinuousRuleModifyingEffectImpl { return event.getType() == GameEvent.EventType.TARGET; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/b/BasandraBattleSeraph.java b/Mage.Sets/src/mage/cards/b/BasandraBattleSeraph.java index 26e1ff0f94d..44eb59b16af 100644 --- a/Mage.Sets/src/mage/cards/b/BasandraBattleSeraph.java +++ b/Mage.Sets/src/mage/cards/b/BasandraBattleSeraph.java @@ -72,11 +72,6 @@ class BasandraBattleSeraphEffect extends ContinuousRuleModifyingEffectImpl { return new BasandraBattleSeraphEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/b/Berserk.java b/Mage.Sets/src/mage/cards/b/Berserk.java index bec5e5c48fc..bb68008af78 100644 --- a/Mage.Sets/src/mage/cards/b/Berserk.java +++ b/Mage.Sets/src/mage/cards/b/Berserk.java @@ -72,20 +72,20 @@ class BerserkReplacementEffect extends ContinuousRuleModifyingEffectImpl { 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())) { CombatDamageStepStartedWatcher watcher = game.getState().getWatcher(CombatDamageStepStartedWatcher.class); return watcher == null || watcher.conditionMet(); } return false; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public BerserkReplacementEffect copy() { return new BerserkReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/b/BlindingBeam.java b/Mage.Sets/src/mage/cards/b/BlindingBeam.java index f54373c94aa..e71d3871c8f 100644 --- a/Mage.Sets/src/mage/cards/b/BlindingBeam.java +++ b/Mage.Sets/src/mage/cards/b/BlindingBeam.java @@ -108,11 +108,6 @@ class BlindingBeamEffect2 extends ContinuousRuleModifyingEffectImpl { return new BlindingBeamEffect2(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public boolean isInactive(Ability source, Game game) { // the PRE step part is directly after the UNTAP events for permanents diff --git a/Mage.Sets/src/mage/cards/b/BloodFrenzy.java b/Mage.Sets/src/mage/cards/b/BloodFrenzy.java index 79841bdb040..b924d12984a 100644 --- a/Mage.Sets/src/mage/cards/b/BloodFrenzy.java +++ b/Mage.Sets/src/mage/cards/b/BloodFrenzy.java @@ -79,9 +79,4 @@ class BloodFrenzyCastRestriction extends ContinuousRuleModifyingEffectImpl { } return false; } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } } diff --git a/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java b/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java index 1bdb9609a0f..5a8e25285b0 100644 --- a/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java +++ b/Mage.Sets/src/mage/cards/b/BoseijuWhoSheltersAll.java @@ -105,11 +105,6 @@ class BoseijuWhoSheltersAllCantCounterEffect extends ContinuousRuleModifyingEffe return new BoseijuWhoSheltersAllCantCounterEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject sourceObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/b/BoundDetermined.java b/Mage.Sets/src/mage/cards/b/BoundDetermined.java index 36e0bc360ab..4dd698b2f82 100644 --- a/Mage.Sets/src/mage/cards/b/BoundDetermined.java +++ b/Mage.Sets/src/mage/cards/b/BoundDetermined.java @@ -119,11 +119,6 @@ class DeterminedEffect extends ContinuousRuleModifyingEffectImpl { return new DeterminedEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject sourceObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/b/BrandOfIllOmen.java b/Mage.Sets/src/mage/cards/b/BrandOfIllOmen.java index e208f80a055..2c00bfbcf22 100644 --- a/Mage.Sets/src/mage/cards/b/BrandOfIllOmen.java +++ b/Mage.Sets/src/mage/cards/b/BrandOfIllOmen.java @@ -66,11 +66,6 @@ class BrandOfIllOmenEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public BrandOfIllOmenEffect copy() { return new BrandOfIllOmenEffect(this); diff --git a/Mage.Sets/src/mage/cards/b/BriselaVoiceOfNightmares.java b/Mage.Sets/src/mage/cards/b/BriselaVoiceOfNightmares.java index 8a3a672a9ce..8a9ba49f3c8 100644 --- a/Mage.Sets/src/mage/cards/b/BriselaVoiceOfNightmares.java +++ b/Mage.Sets/src/mage/cards/b/BriselaVoiceOfNightmares.java @@ -71,11 +71,6 @@ class BriselaVoiceOfNightmaresCantCastEffect extends ContinuousRuleModifyingEffe return new BriselaVoiceOfNightmaresCantCastEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/c/CavernOfSouls.java b/Mage.Sets/src/mage/cards/c/CavernOfSouls.java index f5ab69ab977..3b0663ce566 100644 --- a/Mage.Sets/src/mage/cards/c/CavernOfSouls.java +++ b/Mage.Sets/src/mage/cards/c/CavernOfSouls.java @@ -177,11 +177,6 @@ class CavernOfSoulsCantCounterEffect extends ContinuousRuleModifyingEffectImpl { return new CavernOfSoulsCantCounterEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject sourceObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/c/CircuDimirLobotomist.java b/Mage.Sets/src/mage/cards/c/CircuDimirLobotomist.java index 7f625814ec4..f14dd3a10c3 100644 --- a/Mage.Sets/src/mage/cards/c/CircuDimirLobotomist.java +++ b/Mage.Sets/src/mage/cards/c/CircuDimirLobotomist.java @@ -120,10 +120,14 @@ class CircuDimirLobotomistRuleModifyingEffect extends ContinuousRuleModifyingEff return "You can't cast this spell because a card with the same name is exiled by " + CardUtil.getSourceName(game, source) + '.'; } + @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 - || !game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { + if (!game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { return false; } MageObject object = game.getObject(event.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/c/CityInABottle.java b/Mage.Sets/src/mage/cards/c/CityInABottle.java index db902f71f0a..5d45040b659 100644 --- a/Mage.Sets/src/mage/cards/c/CityInABottle.java +++ b/Mage.Sets/src/mage/cards/c/CityInABottle.java @@ -216,11 +216,6 @@ class CityInABottleCantPlayEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public CityInABottleCantPlayEffect copy() { return new CityInABottleCantPlayEffect(this); diff --git a/Mage.Sets/src/mage/cards/c/CloudsteelKirin.java b/Mage.Sets/src/mage/cards/c/CloudsteelKirin.java index 63b8ed6f133..dde6497a1c9 100644 --- a/Mage.Sets/src/mage/cards/c/CloudsteelKirin.java +++ b/Mage.Sets/src/mage/cards/c/CloudsteelKirin.java @@ -71,8 +71,9 @@ class CloudsteelKirinEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.WINS + || event.getType() == GameEvent.EventType.LOSES; } @Override diff --git a/Mage.Sets/src/mage/cards/c/ConjurersBan.java b/Mage.Sets/src/mage/cards/c/ConjurersBan.java index 474af05d512..6e09f380966 100644 --- a/Mage.Sets/src/mage/cards/c/ConjurersBan.java +++ b/Mage.Sets/src/mage/cards/c/ConjurersBan.java @@ -53,24 +53,22 @@ class ConjurersBanEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public ConjurersBanEffect copy() { return new ConjurersBanEffect(this); } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CAST_SPELL + || event.getType() == GameEvent.EventType.PLAY_LAND; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.CAST_SPELL || event.getType() == GameEvent.EventType.PLAY_LAND) { - MageObject object = game.getObject(event.getSourceId()); - String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); - return CardUtil.haveSameNames(object, cardName, game); - } - return false; + MageObject object = game.getObject(event.getSourceId()); + String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); + return CardUtil.haveSameNames(object, cardName, game); } @Override diff --git a/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java b/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java index bae13527317..151c57f97e8 100644 --- a/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java +++ b/Mage.Sets/src/mage/cards/c/ConquerorsFlail.java @@ -101,11 +101,6 @@ class ConquerorsFlailEffect extends ContinuousRuleModifyingEffectImpl { return new ConquerorsFlailEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/c/CorneredMarket.java b/Mage.Sets/src/mage/cards/c/CorneredMarket.java index c8dbc0e399f..b5978eea56a 100644 --- a/Mage.Sets/src/mage/cards/c/CorneredMarket.java +++ b/Mage.Sets/src/mage/cards/c/CorneredMarket.java @@ -104,11 +104,6 @@ class CorneredMarketReplacementEffect extends ContinuousRuleModifyingEffectImpl return false; } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public CorneredMarketReplacementEffect copy() { return new CorneredMarketReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/c/CouncilOfTheAbsolute.java b/Mage.Sets/src/mage/cards/c/CouncilOfTheAbsolute.java index f5090da749a..069f9cbb85f 100644 --- a/Mage.Sets/src/mage/cards/c/CouncilOfTheAbsolute.java +++ b/Mage.Sets/src/mage/cards/c/CouncilOfTheAbsolute.java @@ -64,11 +64,6 @@ class CouncilOfTheAbsoluteReplacementEffect extends ContinuousRuleModifyingEffec super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public CouncilOfTheAbsoluteReplacementEffect copy() { return new CouncilOfTheAbsoluteReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/c/CurseOfExhaustion.java b/Mage.Sets/src/mage/cards/c/CurseOfExhaustion.java index 6049a0d29b1..ff5dc6dd78d 100644 --- a/Mage.Sets/src/mage/cards/c/CurseOfExhaustion.java +++ b/Mage.Sets/src/mage/cards/c/CurseOfExhaustion.java @@ -19,13 +19,12 @@ import mage.watchers.common.CastSpellLastTurnWatcher; import java.util.UUID; /** - * * @author BetaSteward */ public final class CurseOfExhaustion extends CardImpl { public CurseOfExhaustion(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}{W}"); this.subtype.add(SubType.AURA, SubType.CURSE); @@ -66,22 +65,18 @@ class CurseOfExhaustionEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; + 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 enchantment = game.getPermanent(source.getSourceId()); - if (enchantment != null && enchantment.getAttachedTo() != null) { - Player player = game.getPlayer(enchantment.getAttachedTo()); - if (player != null && event.getPlayerId().equals(player.getId())) { - CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class); - if (watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) > 0) { - return true; - } - } + Permanent enchantment = game.getPermanent(source.getSourceId()); + if (enchantment != null && enchantment.getAttachedTo() != null) { + Player player = game.getPlayer(enchantment.getAttachedTo()); + if (player != null && event.getPlayerId().equals(player.getId())) { + CastSpellLastTurnWatcher watcher = game.getState().getWatcher(CastSpellLastTurnWatcher.class); + return watcher != null && watcher.getAmountOfSpellsPlayerCastOnCurrentTurn(event.getPlayerId()) > 0; } } return false; diff --git a/Mage.Sets/src/mage/cards/d/DampingEngine.java b/Mage.Sets/src/mage/cards/d/DampingEngine.java index 2c734cd9719..390008e1067 100644 --- a/Mage.Sets/src/mage/cards/d/DampingEngine.java +++ b/Mage.Sets/src/mage/cards/d/DampingEngine.java @@ -105,11 +105,6 @@ class DampingEngineEffect extends ContinuousRuleModifyingEffectImpl { return new DampingEngineEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = source.getSourceObject(game); diff --git a/Mage.Sets/src/mage/cards/d/DeafeningSilence.java b/Mage.Sets/src/mage/cards/d/DeafeningSilence.java index 7f7980d78d9..551df36cac9 100644 --- a/Mage.Sets/src/mage/cards/d/DeafeningSilence.java +++ b/Mage.Sets/src/mage/cards/d/DeafeningSilence.java @@ -61,11 +61,6 @@ class DeafeningSilenceEffect extends ContinuousRuleModifyingEffectImpl { return new DeafeningSilenceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/d/DelightedHalfling.java b/Mage.Sets/src/mage/cards/d/DelightedHalfling.java index fed158e1308..b0ff88fcd81 100644 --- a/Mage.Sets/src/mage/cards/d/DelightedHalfling.java +++ b/Mage.Sets/src/mage/cards/d/DelightedHalfling.java @@ -148,11 +148,6 @@ class DelightedHalflingCantCounterEffect extends ContinuousRuleModifyingEffectIm return new DelightedHalflingCantCounterEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject sourceObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/d/DiscipleOfCaelusNin.java b/Mage.Sets/src/mage/cards/d/DiscipleOfCaelusNin.java index 56ce63f957a..25f1103f465 100644 --- a/Mage.Sets/src/mage/cards/d/DiscipleOfCaelusNin.java +++ b/Mage.Sets/src/mage/cards/d/DiscipleOfCaelusNin.java @@ -115,11 +115,6 @@ class DiscipleOfCaelusNinSecondEffect extends ContinuousRuleModifyingEffectImpl return event.getType() == GameEvent.EventType.PHASE_IN; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { return true; diff --git a/Mage.Sets/src/mage/cards/d/DisplayOfDominance.java b/Mage.Sets/src/mage/cards/d/DisplayOfDominance.java index 5f2f80d1509..8a2f565f58c 100644 --- a/Mage.Sets/src/mage/cards/d/DisplayOfDominance.java +++ b/Mage.Sets/src/mage/cards/d/DisplayOfDominance.java @@ -80,11 +80,6 @@ class DisplayOfDominanceEffect extends ContinuousRuleModifyingEffectImpl { return new DisplayOfDominanceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.TARGET; diff --git a/Mage.Sets/src/mage/cards/d/DosanTheFallingLeaf.java b/Mage.Sets/src/mage/cards/d/DosanTheFallingLeaf.java index cb41dfe19be..eb4301f0d4d 100644 --- a/Mage.Sets/src/mage/cards/d/DosanTheFallingLeaf.java +++ b/Mage.Sets/src/mage/cards/d/DosanTheFallingLeaf.java @@ -53,13 +53,13 @@ class DosanTheFallingLeafEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return event.getType() == GameEvent.EventType.CAST_SPELL && !game.isActivePlayer(event.getPlayerId()); + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CAST_SPELL; } @Override - public boolean apply(Game game, Ability source) { - return true; + public boolean applies(GameEvent event, Ability source, Game game) { + return !game.isActivePlayer(event.getPlayerId()); } @Override diff --git a/Mage.Sets/src/mage/cards/d/DovinBaan.java b/Mage.Sets/src/mage/cards/d/DovinBaan.java index a9316043013..397bec0fa17 100644 --- a/Mage.Sets/src/mage/cards/d/DovinBaan.java +++ b/Mage.Sets/src/mage/cards/d/DovinBaan.java @@ -80,11 +80,6 @@ class DovinBaanCantActivateAbilitiesEffect extends ContinuousRuleModifyingEffect return new DovinBaanCantActivateAbilitiesEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage.Sets/src/mage/cards/d/DragonlordDromoka.java b/Mage.Sets/src/mage/cards/d/DragonlordDromoka.java index fe9a0f2c8a8..7693af410b1 100644 --- a/Mage.Sets/src/mage/cards/d/DragonlordDromoka.java +++ b/Mage.Sets/src/mage/cards/d/DragonlordDromoka.java @@ -66,11 +66,6 @@ class DragonlordDromokaEffect extends ContinuousRuleModifyingEffectImpl { return new DragonlordDromokaEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/d/DreadWight.java b/Mage.Sets/src/mage/cards/d/DreadWight.java index 143c354d4af..295f670bc26 100644 --- a/Mage.Sets/src/mage/cards/d/DreadWight.java +++ b/Mage.Sets/src/mage/cards/d/DreadWight.java @@ -182,11 +182,6 @@ class DreadWightDoNotUntapEffect extends ContinuousRuleModifyingEffectImpl { return new DreadWightDoNotUntapEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Permanent permanentToUntap = game.getPermanent((event.getTargetId())); diff --git a/Mage.Sets/src/mage/cards/e/ExclusionRitual.java b/Mage.Sets/src/mage/cards/e/ExclusionRitual.java index a2f4d721833..17bf0c5d6cf 100644 --- a/Mage.Sets/src/mage/cards/e/ExclusionRitual.java +++ b/Mage.Sets/src/mage/cards/e/ExclusionRitual.java @@ -112,11 +112,6 @@ class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl return false; } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public ExclusionRitualReplacementEffect copy() { return new ExclusionRitualReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/e/ExperimentalFrenzy.java b/Mage.Sets/src/mage/cards/e/ExperimentalFrenzy.java index feb44754499..bfe6f2c1586 100644 --- a/Mage.Sets/src/mage/cards/e/ExperimentalFrenzy.java +++ b/Mage.Sets/src/mage/cards/e/ExperimentalFrenzy.java @@ -66,11 +66,6 @@ class ExperimentalFrenzyRestrictionEffect extends ContinuousRuleModifyingEffectI return new ExperimentalFrenzyRestrictionEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.PLAY_LAND diff --git a/Mage.Sets/src/mage/cards/f/FaithsFetters.java b/Mage.Sets/src/mage/cards/f/FaithsFetters.java index 9c9123c5fc2..d0b672ef39e 100644 --- a/Mage.Sets/src/mage/cards/f/FaithsFetters.java +++ b/Mage.Sets/src/mage/cards/f/FaithsFetters.java @@ -73,11 +73,6 @@ class FaithsFettersEffect extends ContinuousRuleModifyingEffectImpl { return new FaithsFettersEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage.Sets/src/mage/cards/f/FiendslayerPaladin.java b/Mage.Sets/src/mage/cards/f/FiendslayerPaladin.java index 4927cf4b108..031e1798c43 100644 --- a/Mage.Sets/src/mage/cards/f/FiendslayerPaladin.java +++ b/Mage.Sets/src/mage/cards/f/FiendslayerPaladin.java @@ -72,11 +72,6 @@ class FiendslayerPaladinEffect extends ContinuousRuleModifyingEffectImpl { return new FiendslayerPaladinEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/f/Flamebreak.java b/Mage.Sets/src/mage/cards/f/Flamebreak.java index 41b11a6c132..566b661a8fd 100644 --- a/Mage.Sets/src/mage/cards/f/Flamebreak.java +++ b/Mage.Sets/src/mage/cards/f/Flamebreak.java @@ -1,7 +1,6 @@ package mage.cards.f; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.dynamicvalue.common.StaticValue; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; @@ -20,8 +19,9 @@ import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.watchers.common.DamagedByWatcher; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class Flamebreak extends CardImpl { @@ -33,7 +33,7 @@ public final class Flamebreak extends CardImpl { } public Flamebreak(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{R}{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{R}{R}{R}"); // Flamebreak deals 3 damage to each creature without flying and each player. Creatures dealt damage this way can't be regenerated this turn. @@ -69,19 +69,14 @@ class FlamebreakCantRegenerateEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; + 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() == GameEvent.EventType.REGENERATE) { - DamagedByWatcher watcher = game.getState().getWatcher(DamagedByWatcher.class, source.getSourceId()); - if (watcher != null) { - return watcher.wasDamaged(event.getTargetId(), game); - } - } - return false; + DamagedByWatcher watcher = game.getState().getWatcher(DamagedByWatcher.class, source.getSourceId()); + return watcher != null && watcher.wasDamaged(event.getTargetId(), game); } } diff --git a/Mage.Sets/src/mage/cards/f/FlamescrollCelebrant.java b/Mage.Sets/src/mage/cards/f/FlamescrollCelebrant.java index 79f3acd7c13..040e3bafd19 100644 --- a/Mage.Sets/src/mage/cards/f/FlamescrollCelebrant.java +++ b/Mage.Sets/src/mage/cards/f/FlamescrollCelebrant.java @@ -127,11 +127,6 @@ class RevelInSilenceEffect extends ContinuousRuleModifyingEffectImpl { return new RevelInSilenceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Player activePlayer = game.getPlayer(game.getActivePlayerId()); diff --git a/Mage.Sets/src/mage/cards/f/FormOfTheSquirrel.java b/Mage.Sets/src/mage/cards/f/FormOfTheSquirrel.java index dd561e5c0fb..57d2468289e 100644 --- a/Mage.Sets/src/mage/cards/f/FormOfTheSquirrel.java +++ b/Mage.Sets/src/mage/cards/f/FormOfTheSquirrel.java @@ -111,12 +111,12 @@ class FormOfTheSquirrelCantCastEffect extends ContinuousRuleModifyingEffectImpl } @Override - public boolean apply(Game game, Ability source) { - return true; + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CAST_SPELL; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - return event.getType() == GameEvent.EventType.CAST_SPELL && event.getPlayerId().equals(source.getControllerId()); + return event.getPlayerId().equals(source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/g/GaddockTeeg.java b/Mage.Sets/src/mage/cards/g/GaddockTeeg.java index 7b929a45fd6..c84d4251505 100644 --- a/Mage.Sets/src/mage/cards/g/GaddockTeeg.java +++ b/Mage.Sets/src/mage/cards/g/GaddockTeeg.java @@ -55,11 +55,6 @@ class GaddockTeegReplacementEffect4 extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public GaddockTeegReplacementEffect4 copy() { return new GaddockTeegReplacementEffect4(this); @@ -92,11 +87,6 @@ class GaddockTeegReplacementEffectX extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public GaddockTeegReplacementEffectX copy() { return new GaddockTeegReplacementEffectX(this); diff --git a/Mage.Sets/src/mage/cards/g/GaeasHerald.java b/Mage.Sets/src/mage/cards/g/GaeasHerald.java index ce0cc8c22c1..8b1e7958743 100644 --- a/Mage.Sets/src/mage/cards/g/GaeasHerald.java +++ b/Mage.Sets/src/mage/cards/g/GaeasHerald.java @@ -62,11 +62,6 @@ class CantCounterEffect extends ContinuousRuleModifyingEffectImpl { return new CantCounterEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.COUNTER; diff --git a/Mage.Sets/src/mage/cards/g/GoblinRockSled.java b/Mage.Sets/src/mage/cards/g/GoblinRockSled.java index 67909d45b1d..9ad75e89964 100644 --- a/Mage.Sets/src/mage/cards/g/GoblinRockSled.java +++ b/Mage.Sets/src/mage/cards/g/GoblinRockSled.java @@ -79,11 +79,6 @@ class DontUntapIfAttackedLastTurnSourceEffect extends ContinuousRuleModifyingEff return new DontUntapIfAttackedLastTurnSourceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.UNTAP; diff --git a/Mage.Sets/src/mage/cards/g/Godsend.java b/Mage.Sets/src/mage/cards/g/Godsend.java index ce8ec73e5da..c068fed8257 100644 --- a/Mage.Sets/src/mage/cards/g/Godsend.java +++ b/Mage.Sets/src/mage/cards/g/Godsend.java @@ -188,9 +188,14 @@ class GodsendRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl { 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 && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { + if (game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) { MageObject object = game.getObject(event.getSourceId()); if (object != null) { ExileZone exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source)); diff --git a/Mage.Sets/src/mage/cards/g/GridMonitor.java b/Mage.Sets/src/mage/cards/g/GridMonitor.java index 05701914e3a..dfafadc1aba 100644 --- a/Mage.Sets/src/mage/cards/g/GridMonitor.java +++ b/Mage.Sets/src/mage/cards/g/GridMonitor.java @@ -60,13 +60,13 @@ class GridMonitorEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; + 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.getControllerId())) { + if (event.getPlayerId().equals(source.getControllerId())) { MageObject object = game.getObject(event.getSourceId()); if (object != null && object.isCreature(game)) { return true; diff --git a/Mage.Sets/src/mage/cards/g/GuardianBeast.java b/Mage.Sets/src/mage/cards/g/GuardianBeast.java index 2a4c999bf83..1b4f2d0927c 100644 --- a/Mage.Sets/src/mage/cards/g/GuardianBeast.java +++ b/Mage.Sets/src/mage/cards/g/GuardianBeast.java @@ -87,11 +87,6 @@ class GuardianBeastConditionalEffect extends ContinuousRuleModifyingEffectImpl { return true; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { Permanent permanent = source.getSourcePermanentIfItStillExists(game); diff --git a/Mage.Sets/src/mage/cards/h/HaakonStromgaldScourge.java b/Mage.Sets/src/mage/cards/h/HaakonStromgaldScourge.java index 43acbb5f874..fbe88336e61 100644 --- a/Mage.Sets/src/mage/cards/h/HaakonStromgaldScourge.java +++ b/Mage.Sets/src/mage/cards/h/HaakonStromgaldScourge.java @@ -103,11 +103,6 @@ class HaakonStromgaldScourgePlayEffect2 extends ContinuousRuleModifyingEffectImp public HaakonStromgaldScourgePlayEffect2 copy() { return new HaakonStromgaldScourgePlayEffect2(this); } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } @Override public boolean checksEventType(GameEvent event, Game game) { diff --git a/Mage.Sets/src/mage/cards/h/HandToHand.java b/Mage.Sets/src/mage/cards/h/HandToHand.java index 19e74642552..3833fadfef6 100644 --- a/Mage.Sets/src/mage/cards/h/HandToHand.java +++ b/Mage.Sets/src/mage/cards/h/HandToHand.java @@ -53,11 +53,6 @@ class HandToHandEffect extends ContinuousRuleModifyingEffectImpl { return new HandToHandEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -67,6 +62,12 @@ class HandToHandEffect extends ContinuousRuleModifyingEffectImpl { return null; } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.CAST_SPELL + || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { if (game.getTurnPhaseType() == TurnPhase.COMBAT) { diff --git a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java index 98d16dab170..5d6d73ae2cb 100644 --- a/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java +++ b/Mage.Sets/src/mage/cards/h/HopeOfGhirapur.java @@ -82,11 +82,6 @@ class HopeOfGhirapurCantCastEffect extends ContinuousRuleModifyingEffectImpl { return new HopeOfGhirapurCantCastEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = source.getSourceObject(game); diff --git a/Mage.Sets/src/mage/cards/i/Incinerate.java b/Mage.Sets/src/mage/cards/i/Incinerate.java index bda6e4f80d5..1f935b1d327 100644 --- a/Mage.Sets/src/mage/cards/i/Incinerate.java +++ b/Mage.Sets/src/mage/cards/i/Incinerate.java @@ -58,11 +58,6 @@ class IncinerateEffect extends ContinuousRuleModifyingEffectImpl { return new IncinerateEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.REGENERATE; diff --git a/Mage.Sets/src/mage/cards/i/Insist.java b/Mage.Sets/src/mage/cards/i/Insist.java index d94448bc4cf..7e408f87b58 100644 --- a/Mage.Sets/src/mage/cards/i/Insist.java +++ b/Mage.Sets/src/mage/cards/i/Insist.java @@ -69,11 +69,6 @@ class InsistEffect extends ContinuousRuleModifyingEffectImpl { } } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject sourceObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/i/InvasionPlans.java b/Mage.Sets/src/mage/cards/i/InvasionPlans.java index a849b31e86a..e6312cb5410 100644 --- a/Mage.Sets/src/mage/cards/i/InvasionPlans.java +++ b/Mage.Sets/src/mage/cards/i/InvasionPlans.java @@ -55,11 +55,6 @@ class InvasionPlansEffect extends ContinuousRuleModifyingEffectImpl { return new InvasionPlansEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DECLARING_BLOCKERS; diff --git a/Mage.Sets/src/mage/cards/i/IxalansBinding.java b/Mage.Sets/src/mage/cards/i/IxalansBinding.java index cc036f3601a..b4e16cbf8de 100644 --- a/Mage.Sets/src/mage/cards/i/IxalansBinding.java +++ b/Mage.Sets/src/mage/cards/i/IxalansBinding.java @@ -92,11 +92,6 @@ class IxalansBindingReplacementEffect extends ContinuousRuleModifyingEffectImpl return false; } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public IxalansBindingReplacementEffect copy() { return new IxalansBindingReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/j/JayaBallardTaskMage.java b/Mage.Sets/src/mage/cards/j/JayaBallardTaskMage.java index f76e0364491..9b492d456ef 100644 --- a/Mage.Sets/src/mage/cards/j/JayaBallardTaskMage.java +++ b/Mage.Sets/src/mage/cards/j/JayaBallardTaskMage.java @@ -1,7 +1,6 @@ package mage.cards.j; -import java.util.UUID; import mage.MageInt; import mage.ObjectColor; import mage.abilities.Ability; @@ -25,20 +24,21 @@ import mage.target.TargetPermanent; import mage.target.common.TargetAnyTarget; import mage.watchers.common.DamagedByWatcher; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class JayaBallardTaskMage extends CardImpl { private static final FilterPermanent filter = new FilterPermanent("blue permanent"); - + static { filter.add(new ColorPredicate(ObjectColor.BLUE)); } - + public JayaBallardTaskMage(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}{R}"); this.supertype.add(SuperType.LEGENDARY); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.SPELLSHAPER); @@ -50,23 +50,23 @@ public final class JayaBallardTaskMage extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl<>("{R}")); ability.addTarget(new TargetPermanent(filter)); ability.addCost(new TapSourceCost()); - ability.addCost(new DiscardCardCost()); + ability.addCost(new DiscardCardCost()); this.addAbility(ability); - + // {1}{R}, {tap}, Discard a card: Jaya Ballard, Task Mage deals 3 damage to any target. A creature dealt damage this way can't be regenerated this turn. ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), new ManaCostsImpl<>("{1}{R}")); ability.addTarget(new TargetAnyTarget()); ability.addCost(new TapSourceCost()); - ability.addCost(new DiscardCardCost()); + ability.addCost(new DiscardCardCost()); ability.addEffect(new CantRegenerateEffect()); this.addAbility(ability, new DamagedByWatcher(false)); - + // {5}{R}{R}, {tap}, Discard a card: Jaya Ballard deals 6 damage to each creature and each player. ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageEverythingEffect(6), new ManaCostsImpl<>("{5}{R}{R}")); ability.addCost(new TapSourceCost()); - ability.addCost(new DiscardCardCost()); + ability.addCost(new DiscardCardCost()); this.addAbility(ability); - + } private JayaBallardTaskMage(final JayaBallardTaskMage card) { @@ -96,19 +96,13 @@ class CantRegenerateEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; + 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() == GameEvent.EventType.REGENERATE) { - DamagedByWatcher watcher = game.getState().getWatcher(DamagedByWatcher.class, source.getSourceId()); - if (watcher != null) { - return watcher.wasDamaged(event.getTargetId(), game); - } - } - return false; + DamagedByWatcher watcher = game.getState().getWatcher(DamagedByWatcher.class, source.getSourceId()); + return watcher != null && watcher.wasDamaged(event.getTargetId(), game); } - } diff --git a/Mage.Sets/src/mage/cards/k/KarplusanStrider.java b/Mage.Sets/src/mage/cards/k/KarplusanStrider.java index 57a5c7bc73c..b4548e168be 100644 --- a/Mage.Sets/src/mage/cards/k/KarplusanStrider.java +++ b/Mage.Sets/src/mage/cards/k/KarplusanStrider.java @@ -60,11 +60,6 @@ class KarplusanStriderEffect extends ContinuousRuleModifyingEffectImpl { return new KarplusanStriderEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/k/KatabaticWinds.java b/Mage.Sets/src/mage/cards/k/KatabaticWinds.java index 7aa58eeeab7..ac9e97bb0b1 100644 --- a/Mage.Sets/src/mage/cards/k/KatabaticWinds.java +++ b/Mage.Sets/src/mage/cards/k/KatabaticWinds.java @@ -104,11 +104,6 @@ class KatabaticWindsRuleModifyingEffect extends ContinuousRuleModifyingEffectImp return new KatabaticWindsRuleModifyingEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage.Sets/src/mage/cards/k/KeenEaredSentry.java b/Mage.Sets/src/mage/cards/k/KeenEaredSentry.java index bb150d24609..a2025f4ff5b 100644 --- a/Mage.Sets/src/mage/cards/k/KeenEaredSentry.java +++ b/Mage.Sets/src/mage/cards/k/KeenEaredSentry.java @@ -83,11 +83,6 @@ class KeenEaredSentryEffect extends ContinuousRuleModifyingEffectImpl { return game.getOpponents(source.getControllerId()).contains(event.getTargetId()) && KeenEaredSentryWatcher.checkPlayer(event.getTargetId(), game); } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } } class KeenEaredSentryWatcher extends Watcher { diff --git a/Mage.Sets/src/mage/cards/k/KillSwitch.java b/Mage.Sets/src/mage/cards/k/KillSwitch.java index 34d31e5c511..4bd37431529 100644 --- a/Mage.Sets/src/mage/cards/k/KillSwitch.java +++ b/Mage.Sets/src/mage/cards/k/KillSwitch.java @@ -97,11 +97,6 @@ class KillSwitchUntapEffect extends ContinuousRuleModifyingEffectImpl { return new KillSwitchUntapEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.UNTAP; diff --git a/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java b/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java index a872ffee356..eb87b5c920a 100644 --- a/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java +++ b/Mage.Sets/src/mage/cards/l/LeovoldEmissaryOfTrest.java @@ -69,11 +69,6 @@ class LeovoldEmissaryOfTrestEffect extends ContinuousRuleModifyingEffectImpl { return event.getType() == GameEvent.EventType.DRAW_CARD; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { CardsAmountDrawnThisTurnWatcher watcher = game.getState().getWatcher(CardsAmountDrawnThisTurnWatcher.class); diff --git a/Mage.Sets/src/mage/cards/l/LeylineOfLifeforce.java b/Mage.Sets/src/mage/cards/l/LeylineOfLifeforce.java index 7a1d1a1d6ff..394fdc95a9d 100644 --- a/Mage.Sets/src/mage/cards/l/LeylineOfLifeforce.java +++ b/Mage.Sets/src/mage/cards/l/LeylineOfLifeforce.java @@ -59,11 +59,6 @@ class LeylineOfLifeforceEffect extends ContinuousRuleModifyingEffectImpl { return new LeylineOfLifeforceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.COUNTER; diff --git a/Mage.Sets/src/mage/cards/l/LichsMastery.java b/Mage.Sets/src/mage/cards/l/LichsMastery.java index 53dd428688e..18aaa2a26e3 100644 --- a/Mage.Sets/src/mage/cards/l/LichsMastery.java +++ b/Mage.Sets/src/mage/cards/l/LichsMastery.java @@ -89,13 +89,13 @@ class LichsMasteryCantLoseEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.LOSES; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - return event.getType() == GameEvent.EventType.LOSES && event.getPlayerId().equals(source.getControllerId()); + return event.getPlayerId().equals(source.getControllerId()); } } diff --git a/Mage.Sets/src/mage/cards/l/LierDiscipleOfTheDrowned.java b/Mage.Sets/src/mage/cards/l/LierDiscipleOfTheDrowned.java index 31df8e4d977..0d2d604c70e 100644 --- a/Mage.Sets/src/mage/cards/l/LierDiscipleOfTheDrowned.java +++ b/Mage.Sets/src/mage/cards/l/LierDiscipleOfTheDrowned.java @@ -64,11 +64,6 @@ class LierDiscipleOfTheDrownedCounteredEffect extends ContinuousRuleModifyingEff return new LierDiscipleOfTheDrownedCounteredEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.COUNTER; diff --git a/Mage.Sets/src/mage/cards/l/LimitedResources.java b/Mage.Sets/src/mage/cards/l/LimitedResources.java index 021d130b24b..d4b00ce2a55 100644 --- a/Mage.Sets/src/mage/cards/l/LimitedResources.java +++ b/Mage.Sets/src/mage/cards/l/LimitedResources.java @@ -106,11 +106,6 @@ class CantPlayLandEffect extends ContinuousRuleModifyingEffectImpl { return new CantPlayLandEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.PLAY_LAND; diff --git a/Mage.Sets/src/mage/cards/l/LivingBreakthrough.java b/Mage.Sets/src/mage/cards/l/LivingBreakthrough.java index 5d411f78c99..861156384e3 100644 --- a/Mage.Sets/src/mage/cards/l/LivingBreakthrough.java +++ b/Mage.Sets/src/mage/cards/l/LivingBreakthrough.java @@ -100,9 +100,4 @@ class LivingBreakthroughEffect extends ContinuousRuleModifyingEffectImpl { Spell spell = game.getStack().getSpell(event.getTargetId()); return spell != null && spell.getManaValue() == this.manaValue; } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } } diff --git a/Mage.Sets/src/mage/cards/l/LlawanCephalidEmpress.java b/Mage.Sets/src/mage/cards/l/LlawanCephalidEmpress.java index a2cf6982fce..523e9185695 100644 --- a/Mage.Sets/src/mage/cards/l/LlawanCephalidEmpress.java +++ b/Mage.Sets/src/mage/cards/l/LlawanCephalidEmpress.java @@ -84,11 +84,6 @@ class LlawanCephalidRuleModifyingEffect extends ContinuousRuleModifyingEffectImp return new LlawanCephalidRuleModifyingEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/l/LostInThought.java b/Mage.Sets/src/mage/cards/l/LostInThought.java index cc744edb9fa..1ea81040989 100644 --- a/Mage.Sets/src/mage/cards/l/LostInThought.java +++ b/Mage.Sets/src/mage/cards/l/LostInThought.java @@ -117,11 +117,6 @@ class LostInThoughtCantActivateAbilitiesEffect extends ContinuousRuleModifyingEf return new LostInThoughtCantActivateAbilitiesEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage.Sets/src/mage/cards/l/LureOfPrey.java b/Mage.Sets/src/mage/cards/l/LureOfPrey.java index 90cf1b4144c..61de86d7be7 100644 --- a/Mage.Sets/src/mage/cards/l/LureOfPrey.java +++ b/Mage.Sets/src/mage/cards/l/LureOfPrey.java @@ -82,11 +82,6 @@ class LureOfPreyRestrictionEffect extends ContinuousRuleModifyingEffectImpl { return false; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public LureOfPreyRestrictionEffect copy() { return new LureOfPreyRestrictionEffect(this); diff --git a/Mage.Sets/src/mage/cards/m/ManaMaze.java b/Mage.Sets/src/mage/cards/m/ManaMaze.java index 5e5b1145fbe..3bbe9415393 100644 --- a/Mage.Sets/src/mage/cards/m/ManaMaze.java +++ b/Mage.Sets/src/mage/cards/m/ManaMaze.java @@ -71,11 +71,6 @@ class ManaMazeEffect extends ContinuousRuleModifyingEffectImpl { return false; } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public ManaMazeEffect copy() { return new ManaMazeEffect(this); diff --git a/Mage.Sets/src/mage/cards/m/MandateOfPeace.java b/Mage.Sets/src/mage/cards/m/MandateOfPeace.java index 973f73f3de6..bb234bf6228 100644 --- a/Mage.Sets/src/mage/cards/m/MandateOfPeace.java +++ b/Mage.Sets/src/mage/cards/m/MandateOfPeace.java @@ -65,11 +65,6 @@ class MandateOfPeaceOpponentsCantCastSpellsEffect extends ContinuousRuleModifyin return new MandateOfPeaceOpponentsCantCastSpellsEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/m/MaralenOfTheMornsong.java b/Mage.Sets/src/mage/cards/m/MaralenOfTheMornsong.java index eb0c341ac1a..6ede71a79c4 100644 --- a/Mage.Sets/src/mage/cards/m/MaralenOfTheMornsong.java +++ b/Mage.Sets/src/mage/cards/m/MaralenOfTheMornsong.java @@ -60,11 +60,6 @@ class MaralenOfTheMornsongEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public MaralenOfTheMornsongEffect copy() { return new MaralenOfTheMornsongEffect(this); diff --git a/Mage.Sets/src/mage/cards/m/MarisiBreakerOfTheCoil.java b/Mage.Sets/src/mage/cards/m/MarisiBreakerOfTheCoil.java index a1b006a56ac..a1efe3883a1 100644 --- a/Mage.Sets/src/mage/cards/m/MarisiBreakerOfTheCoil.java +++ b/Mage.Sets/src/mage/cards/m/MarisiBreakerOfTheCoil.java @@ -67,11 +67,6 @@ class MarisiBreakerOfTheCoilSpellEffect extends ContinuousRuleModifyingEffectImp return new MarisiBreakerOfTheCoilSpellEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/m/MasterWarcraft.java b/Mage.Sets/src/mage/cards/m/MasterWarcraft.java index 8e1af2b218f..303eb9ed934 100644 --- a/Mage.Sets/src/mage/cards/m/MasterWarcraft.java +++ b/Mage.Sets/src/mage/cards/m/MasterWarcraft.java @@ -85,11 +85,6 @@ class MasterWarcraftChooseAttackersEffect extends ContinuousRuleModifyingEffectI return new MasterWarcraftChooseAttackersEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DECLARING_ATTACKERS; diff --git a/Mage.Sets/src/mage/cards/m/MeddlingMage.java b/Mage.Sets/src/mage/cards/m/MeddlingMage.java index 5980927439f..51d1fc9ef5d 100644 --- a/Mage.Sets/src/mage/cards/m/MeddlingMage.java +++ b/Mage.Sets/src/mage/cards/m/MeddlingMage.java @@ -58,11 +58,6 @@ class MeddlingMageReplacementEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public MeddlingMageReplacementEffect copy() { return new MeddlingMageReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/m/MegatronTyrant.java b/Mage.Sets/src/mage/cards/m/MegatronTyrant.java index 58a7d8c4c9e..9349b01c200 100644 --- a/Mage.Sets/src/mage/cards/m/MegatronTyrant.java +++ b/Mage.Sets/src/mage/cards/m/MegatronTyrant.java @@ -83,11 +83,6 @@ class MegatronTyrantCantCastSpellsEffect extends ContinuousRuleModifyingEffectIm return new MegatronTyrantCantCastSpellsEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/m/MindlockOrb.java b/Mage.Sets/src/mage/cards/m/MindlockOrb.java index 1523e6e44b9..043593aeb5f 100644 --- a/Mage.Sets/src/mage/cards/m/MindlockOrb.java +++ b/Mage.Sets/src/mage/cards/m/MindlockOrb.java @@ -52,13 +52,13 @@ class MindlockRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - throw new UnsupportedOperationException("Not supported."); + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == EventType.SEARCH_LIBRARY; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - return event.getType() == GameEvent.EventType.SEARCH_LIBRARY; + return true; } @Override diff --git a/Mage.Sets/src/mage/cards/m/MoltenDisaster.java b/Mage.Sets/src/mage/cards/m/MoltenDisaster.java index 27cadee434b..0ac4cd77c07 100644 --- a/Mage.Sets/src/mage/cards/m/MoltenDisaster.java +++ b/Mage.Sets/src/mage/cards/m/MoltenDisaster.java @@ -91,11 +91,6 @@ class MoltenDisasterSplitSecondEffect extends ContinuousRuleModifyingEffectImpl return false; } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public MoltenDisasterSplitSecondEffect copy() { return new MoltenDisasterSplitSecondEffect(this); diff --git a/Mage.Sets/src/mage/cards/m/Moonhold.java b/Mage.Sets/src/mage/cards/m/Moonhold.java index 10ee314921d..aa760e97591 100644 --- a/Mage.Sets/src/mage/cards/m/Moonhold.java +++ b/Mage.Sets/src/mage/cards/m/Moonhold.java @@ -70,11 +70,6 @@ class MoonholdEffect extends ContinuousRuleModifyingEffectImpl { return new MoonholdEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -113,11 +108,6 @@ class MoonholdEffect2 extends ContinuousRuleModifyingEffectImpl { return new MoonholdEffect2(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/n/Nevermore.java b/Mage.Sets/src/mage/cards/n/Nevermore.java index 6ef54dfe2b9..a43c9036d69 100644 --- a/Mage.Sets/src/mage/cards/n/Nevermore.java +++ b/Mage.Sets/src/mage/cards/n/Nevermore.java @@ -14,7 +14,6 @@ import mage.constants.Outcome; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.util.CardUtil; import java.util.UUID; @@ -57,24 +56,21 @@ class NevermoreEffect2 extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public NevermoreEffect2 copy() { return new NevermoreEffect2(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) { - MageObject object = game.getObject(event.getSourceId()); - String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); - return CardUtil.haveSameNames(object, cardName, game); - } - return false; + MageObject object = game.getObject(event.getSourceId()); + String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); + return CardUtil.haveSameNames(object, cardName, game); } } diff --git a/Mage.Sets/src/mage/cards/n/NullChamber.java b/Mage.Sets/src/mage/cards/n/NullChamber.java index 2382a35820c..4d0203ed04e 100644 --- a/Mage.Sets/src/mage/cards/n/NullChamber.java +++ b/Mage.Sets/src/mage/cards/n/NullChamber.java @@ -111,11 +111,6 @@ class NullChamberReplacementEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public NullChamberReplacementEffect copy() { return new NullChamberReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/o/OmenMachine.java b/Mage.Sets/src/mage/cards/o/OmenMachine.java index 01c165ebf88..517fb194f50 100644 --- a/Mage.Sets/src/mage/cards/o/OmenMachine.java +++ b/Mage.Sets/src/mage/cards/o/OmenMachine.java @@ -57,11 +57,6 @@ class OmenMachineEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public OmenMachineEffect copy() { return new OmenMachineEffect(this); diff --git a/Mage.Sets/src/mage/cards/o/Oubliette.java b/Mage.Sets/src/mage/cards/o/Oubliette.java index 3de70b1b995..a518b0d1449 100644 --- a/Mage.Sets/src/mage/cards/o/Oubliette.java +++ b/Mage.Sets/src/mage/cards/o/Oubliette.java @@ -102,11 +102,6 @@ class OubliettePhasePreventEffect extends ContinuousRuleModifyingEffectImpl { return event.getType() == GameEvent.EventType.PHASE_IN; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { return source.getSourcePermanentIfItStillExists(game) != null diff --git a/Mage.Sets/src/mage/cards/o/OutOfTime.java b/Mage.Sets/src/mage/cards/o/OutOfTime.java index 34dc4540538..4f88e185451 100644 --- a/Mage.Sets/src/mage/cards/o/OutOfTime.java +++ b/Mage.Sets/src/mage/cards/o/OutOfTime.java @@ -184,11 +184,6 @@ class OutOfTimeReplacementEffect extends ContinuousRuleModifyingEffectImpl { return event.getType() == GameEvent.EventType.PHASE_IN; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { Set creatureIds = (Set) game.getState().getValue("phasedOutCreatures" diff --git a/Mage.Sets/src/mage/cards/o/Overmaster.java b/Mage.Sets/src/mage/cards/o/Overmaster.java index f631e5230d9..1a6f33fdc89 100644 --- a/Mage.Sets/src/mage/cards/o/Overmaster.java +++ b/Mage.Sets/src/mage/cards/o/Overmaster.java @@ -71,11 +71,6 @@ class OvermasterEffect extends ContinuousRuleModifyingEffectImpl { } } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject sourceObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/o/OverwhelmingSplendor.java b/Mage.Sets/src/mage/cards/o/OverwhelmingSplendor.java index f34f7f6bf4a..a6a42957e84 100644 --- a/Mage.Sets/src/mage/cards/o/OverwhelmingSplendor.java +++ b/Mage.Sets/src/mage/cards/o/OverwhelmingSplendor.java @@ -134,11 +134,6 @@ class OverwhelmingSplendorCantActivateEffect extends ContinuousRuleModifyingEffe return new OverwhelmingSplendorCantActivateEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -149,11 +144,12 @@ class OverwhelmingSplendorCantActivateEffect extends ContinuousRuleModifyingEffe } @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() != GameEvent.EventType.ACTIVATE_ABILITY) { - return false; - } + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; + } + @Override + public boolean applies(GameEvent event, Ability source, Game game) { Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (enchantment == null || !event.getPlayerId().equals(enchantment.getAttachedTo())) { return false; diff --git a/Mage.Sets/src/mage/cards/p/PardicMiner.java b/Mage.Sets/src/mage/cards/p/PardicMiner.java index 1b44db6bce8..673e8949ab3 100644 --- a/Mage.Sets/src/mage/cards/p/PardicMiner.java +++ b/Mage.Sets/src/mage/cards/p/PardicMiner.java @@ -1,7 +1,6 @@ package mage.cards.p; -import java.util.UUID; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -10,23 +9,20 @@ import mage.abilities.costs.common.SacrificeSourceCost; import mage.abilities.effects.ContinuousRuleModifyingEffectImpl; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.SubType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; +import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.target.TargetPlayer; +import java.util.UUID; + /** - * * @author cbt33 */ public final class PardicMiner extends CardImpl { public PardicMiner(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{R}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); this.subtype.add(SubType.DWARF); this.power = new MageInt(1); @@ -64,11 +60,6 @@ class PardicMinerEffect extends ContinuousRuleModifyingEffectImpl { return new PardicMinerEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -79,11 +70,12 @@ class PardicMinerEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.PLAY_LAND && event.getPlayerId().equals(source.getFirstTarget())) { - return true; - } - return false; + 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.getPlayerId().equals(source.getFirstTarget()); + } } diff --git a/Mage.Sets/src/mage/cards/p/PeaceTalks.java b/Mage.Sets/src/mage/cards/p/PeaceTalks.java index 49aff84201c..ef4bf0b82d6 100644 --- a/Mage.Sets/src/mage/cards/p/PeaceTalks.java +++ b/Mage.Sets/src/mage/cards/p/PeaceTalks.java @@ -151,11 +151,6 @@ class PeaceTalksPlayersAndPermanentsCantBeTargetsOfSpellsOrActivatedAbilities ex return false; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public PeaceTalksPlayersAndPermanentsCantBeTargetsOfSpellsOrActivatedAbilities copy() { return new PeaceTalksPlayersAndPermanentsCantBeTargetsOfSpellsOrActivatedAbilities(this); diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianCensor.java b/Mage.Sets/src/mage/cards/p/PhyrexianCensor.java index 6ab491c7231..1e1751f2be8 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianCensor.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianCensor.java @@ -79,11 +79,6 @@ class PhyrexianCensorEffect extends ContinuousRuleModifyingEffectImpl { return new PhyrexianCensorEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/p/PhyrexianRevoker.java b/Mage.Sets/src/mage/cards/p/PhyrexianRevoker.java index ac80d07cd3d..9965bac5cb2 100644 --- a/Mage.Sets/src/mage/cards/p/PhyrexianRevoker.java +++ b/Mage.Sets/src/mage/cards/p/PhyrexianRevoker.java @@ -1,6 +1,5 @@ package mage.cards.p; -import java.util.Optional; import mage.MageInt; import mage.MageObject; import mage.abilities.Ability; @@ -15,6 +14,8 @@ import mage.game.Game; import mage.game.events.GameEvent; import mage.game.events.GameEvent.EventType; import mage.util.CardUtil; + +import java.util.Optional; import java.util.UUID; /** @@ -57,11 +58,6 @@ class PhyrexianRevokerEffect2 extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public PhyrexianRevokerEffect2 copy() { return new PhyrexianRevokerEffect2(this); @@ -76,18 +72,21 @@ class PhyrexianRevokerEffect2 extends ContinuousRuleModifyingEffectImpl { return null; } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == EventType.ACTIVATE_ABILITY; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) { - MageObject object = game.getObject(event.getSourceId()); // Can happen for special ability???? - if (object != null) { - Optional optAbility = object.getAbilities().get(event.getTargetId()); - if (optAbility.isPresent() && AbilityType.SPECIAL_ACTION == optAbility.get().getAbilityType()) { - return false; - } - String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); - return CardUtil.haveSameNames(object, cardName, game); + MageObject object = game.getObject(event.getSourceId()); // Can happen for special ability???? + if (object != null) { + Optional optAbility = object.getAbilities().get(event.getTargetId()); + if (optAbility.isPresent() && AbilityType.SPECIAL_ACTION == optAbility.get().getAbilityType()) { + return false; } + String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); + return CardUtil.haveSameNames(object, cardName, game); } return false; } diff --git a/Mage.Sets/src/mage/cards/p/PithingNeedle.java b/Mage.Sets/src/mage/cards/p/PithingNeedle.java index b1964ba990d..946c37c5dde 100644 --- a/Mage.Sets/src/mage/cards/p/PithingNeedle.java +++ b/Mage.Sets/src/mage/cards/p/PithingNeedle.java @@ -61,11 +61,6 @@ class PithingNeedleEffect extends ContinuousRuleModifyingEffectImpl { return new PithingNeedleEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage.Sets/src/mage/cards/p/PlatinumAngel.java b/Mage.Sets/src/mage/cards/p/PlatinumAngel.java index fad0547024b..5686f4f0391 100644 --- a/Mage.Sets/src/mage/cards/p/PlatinumAngel.java +++ b/Mage.Sets/src/mage/cards/p/PlatinumAngel.java @@ -39,37 +39,38 @@ public final class PlatinumAngel extends CardImpl { public PlatinumAngel copy() { return new PlatinumAngel(this); } +} - static class PlatinumAngelEffect extends ContinuousRuleModifyingEffectImpl { +class PlatinumAngelEffect extends ContinuousRuleModifyingEffectImpl { - public PlatinumAngelEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit, false, false); - staticText = "You can't lose the game and your opponents can't win the game"; - } - - private PlatinumAngelEffect(final PlatinumAngelEffect effect) { - super(effect); - } - - @Override - public PlatinumAngelEffect copy() { - return new PlatinumAngelEffect(this); - } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - switch (event.getType()) { - case WINS: - return game.getOpponents(source.getControllerId()).contains(event.getPlayerId()); - case LOSES: - return source.isControlledBy(event.getPlayerId()); - } - return false; + public PlatinumAngelEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit, false, false); + staticText = "You can't lose the game and your opponents can't win the game"; + } + + private PlatinumAngelEffect(final PlatinumAngelEffect effect) { + super(effect); + } + + @Override + public PlatinumAngelEffect copy() { + return new PlatinumAngelEffect(this); + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.WINS + || event.getType() == GameEvent.EventType.LOSES; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + switch (event.getType()) { + case WINS: + return game.getOpponents(source.getControllerId()).contains(event.getPlayerId()); + case LOSES: + return source.isControlledBy(event.getPlayerId()); } + return false; } } diff --git a/Mage.Sets/src/mage/cards/r/RakdosLordOfRiots.java b/Mage.Sets/src/mage/cards/r/RakdosLordOfRiots.java index 1a2b65b7446..594fcf58303 100644 --- a/Mage.Sets/src/mage/cards/r/RakdosLordOfRiots.java +++ b/Mage.Sets/src/mage/cards/r/RakdosLordOfRiots.java @@ -65,11 +65,6 @@ class RakdosLordOfRiotsCantCastEffect extends ContinuousRuleModifyingEffectImpl super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public RakdosLordOfRiotsCantCastEffect copy() { return new RakdosLordOfRiotsCantCastEffect(this); diff --git a/Mage.Sets/src/mage/cards/r/RangerCaptainOfEos.java b/Mage.Sets/src/mage/cards/r/RangerCaptainOfEos.java index 5e17f7dec7c..25d88f94b05 100644 --- a/Mage.Sets/src/mage/cards/r/RangerCaptainOfEos.java +++ b/Mage.Sets/src/mage/cards/r/RangerCaptainOfEos.java @@ -78,11 +78,6 @@ class RangerCaptainOfEosEffect extends ContinuousRuleModifyingEffectImpl { return new RangerCaptainOfEosEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/r/ReflectorMage.java b/Mage.Sets/src/mage/cards/r/ReflectorMage.java index 0d95e2fef06..a98ed69d556 100644 --- a/Mage.Sets/src/mage/cards/r/ReflectorMage.java +++ b/Mage.Sets/src/mage/cards/r/ReflectorMage.java @@ -124,11 +124,6 @@ class ExclusionRitualReplacementEffect extends ContinuousRuleModifyingEffectImpl return false; } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public ExclusionRitualReplacementEffect copy() { return new ExclusionRitualReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/r/RenderSilent.java b/Mage.Sets/src/mage/cards/r/RenderSilent.java index 3674bcb59e1..2f2bc0e5c33 100644 --- a/Mage.Sets/src/mage/cards/r/RenderSilent.java +++ b/Mage.Sets/src/mage/cards/r/RenderSilent.java @@ -91,11 +91,6 @@ class RenderSilentEffect extends ContinuousRuleModifyingEffectImpl { return new RenderSilentEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/r/RootSliver.java b/Mage.Sets/src/mage/cards/r/RootSliver.java index 7af0d8f4e56..cf9e1806603 100644 --- a/Mage.Sets/src/mage/cards/r/RootSliver.java +++ b/Mage.Sets/src/mage/cards/r/RootSliver.java @@ -65,11 +65,6 @@ class RootSliverEffect extends ContinuousRuleModifyingEffectImpl { return new RootSliverEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.COUNTER; diff --git a/Mage.Sets/src/mage/cards/r/Runesword.java b/Mage.Sets/src/mage/cards/r/Runesword.java index 2c19848284e..51c6dfce7c8 100644 --- a/Mage.Sets/src/mage/cards/r/Runesword.java +++ b/Mage.Sets/src/mage/cards/r/Runesword.java @@ -123,11 +123,6 @@ class RuneswordCantBeRegeneratedEffect extends ContinuousRuleModifyingEffectImpl targetCreatureId = getTargetPointer().getFirst(game, source); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.REGENERATE; diff --git a/Mage.Sets/src/mage/cards/s/SanctumPrelate.java b/Mage.Sets/src/mage/cards/s/SanctumPrelate.java index 2d6779ac475..28e99a2e661 100644 --- a/Mage.Sets/src/mage/cards/s/SanctumPrelate.java +++ b/Mage.Sets/src/mage/cards/s/SanctumPrelate.java @@ -92,11 +92,6 @@ class SanctumPrelateReplacementEffect extends ContinuousRuleModifyingEffectImpl super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public SanctumPrelateReplacementEffect copy() { return new SanctumPrelateReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/s/SavageSummoning.java b/Mage.Sets/src/mage/cards/s/SavageSummoning.java index e71b265212d..e10ba2dd44b 100644 --- a/Mage.Sets/src/mage/cards/s/SavageSummoning.java +++ b/Mage.Sets/src/mage/cards/s/SavageSummoning.java @@ -23,7 +23,6 @@ import mage.watchers.Watcher; import java.util.*; /** - * * @author LevelX2 */ public final class SavageSummoning extends CardImpl { @@ -157,7 +156,7 @@ class SavageSummoningWatcher extends Watcher { String creatureCardKey = card.getId().toString() + '_' + (card.getZoneChangeCounter(game)); // add one because card is now gone to battlefield as creature String cardKey = cardId.toString() + '_' + zoneChangeCounter; - Set savageSpells = cardsCastWithSavageSummoning.get(creatureCardKey); + Set savageSpells = cardsCastWithSavageSummoning.get(creatureCardKey); return savageSpells != null && savageSpells.contains(cardKey); } @@ -202,11 +201,6 @@ class SavageSummoningCantCounterEffect extends ContinuousRuleModifyingEffectImpl return new SavageSummoningCantCounterEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject sourceObject = game.getObject(source); @@ -216,13 +210,16 @@ class SavageSummoningCantCounterEffect extends ContinuousRuleModifyingEffectImpl return null; } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.COUNTER; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.COUNTER) { - Spell spell = game.getStack().getSpell(event.getTargetId()); - if (spell != null && watcher.isSpellCastWithThisSavageSummoning(spell.getId(), source.getSourceId(), zoneChangeCounter)) { - return true; - } + Spell spell = game.getStack().getSpell(event.getTargetId()); + if (spell != null && watcher.isSpellCastWithThisSavageSummoning(spell.getId(), source.getSourceId(), zoneChangeCounter)) { + return true; } return false; } diff --git a/Mage.Sets/src/mage/cards/s/SchemingFence.java b/Mage.Sets/src/mage/cards/s/SchemingFence.java index dfae2a6ec38..4e911fe9701 100644 --- a/Mage.Sets/src/mage/cards/s/SchemingFence.java +++ b/Mage.Sets/src/mage/cards/s/SchemingFence.java @@ -118,11 +118,6 @@ class SchemingFenceDisableEffect extends ContinuousRuleModifyingEffectImpl { return new SchemingFenceDisableEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage.Sets/src/mage/cards/s/SenTriplets.java b/Mage.Sets/src/mage/cards/s/SenTriplets.java index c4f5af23d0e..f1933082f22 100644 --- a/Mage.Sets/src/mage/cards/s/SenTriplets.java +++ b/Mage.Sets/src/mage/cards/s/SenTriplets.java @@ -71,11 +71,6 @@ class SenTripletsRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl { return new SenTripletsRuleModifyingEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); diff --git a/Mage.Sets/src/mage/cards/s/SerraAvenger.java b/Mage.Sets/src/mage/cards/s/SerraAvenger.java index a3bf9f4a201..11f43b1f3a1 100644 --- a/Mage.Sets/src/mage/cards/s/SerraAvenger.java +++ b/Mage.Sets/src/mage/cards/s/SerraAvenger.java @@ -65,19 +65,19 @@ class CantCastSerraAvengerEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public CantCastSerraAvengerEffect copy() { return new CantCastSerraAvengerEffect(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 && event.getSourceId().equals(source.getSourceId())) { + if (event.getSourceId().equals(source.getSourceId())) { Player controller = game.getPlayer(source.getControllerId()); // it can be cast on other players turn 1 - 3 if some effect let allow you to do this if (controller != null && controller.getTurns() <= 3 && game.isActivePlayer(source.getControllerId())) { diff --git a/Mage.Sets/src/mage/cards/s/SerraBestiary.java b/Mage.Sets/src/mage/cards/s/SerraBestiary.java index 96082bd5866..7f5da2c191a 100644 --- a/Mage.Sets/src/mage/cards/s/SerraBestiary.java +++ b/Mage.Sets/src/mage/cards/s/SerraBestiary.java @@ -80,11 +80,6 @@ class SerraBestiaryRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl return new SerraBestiaryRuleModifyingEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage.Sets/src/mage/cards/s/ShadowOfDoubt.java b/Mage.Sets/src/mage/cards/s/ShadowOfDoubt.java index 813e87295bc..320ae899ba6 100644 --- a/Mage.Sets/src/mage/cards/s/ShadowOfDoubt.java +++ b/Mage.Sets/src/mage/cards/s/ShadowOfDoubt.java @@ -57,12 +57,12 @@ class LibrariesCantBeSearchedEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.SEARCH_LIBRARY; } @Override public boolean applies(GameEvent event, Ability source, Game game) { - return event.getType() == GameEvent.EventType.SEARCH_LIBRARY; + return true; } } diff --git a/Mage.Sets/src/mage/cards/s/ShannaSisaysLegacy.java b/Mage.Sets/src/mage/cards/s/ShannaSisaysLegacy.java index ef193b1a918..b078322d3c9 100644 --- a/Mage.Sets/src/mage/cards/s/ShannaSisaysLegacy.java +++ b/Mage.Sets/src/mage/cards/s/ShannaSisaysLegacy.java @@ -77,11 +77,6 @@ class ShannaSisaysLegacyEffect extends ContinuousRuleModifyingEffectImpl { return new ShannaSisaysLegacyEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/s/Silence.java b/Mage.Sets/src/mage/cards/s/Silence.java index 4956e4f5826..29244c46891 100644 --- a/Mage.Sets/src/mage/cards/s/Silence.java +++ b/Mage.Sets/src/mage/cards/s/Silence.java @@ -53,11 +53,6 @@ class SilenceEffect extends ContinuousRuleModifyingEffectImpl { return new SilenceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/s/SingleCombat.java b/Mage.Sets/src/mage/cards/s/SingleCombat.java index dcc4447385f..d11ba4c4e78 100644 --- a/Mage.Sets/src/mage/cards/s/SingleCombat.java +++ b/Mage.Sets/src/mage/cards/s/SingleCombat.java @@ -109,11 +109,6 @@ class SingleCombatRestrictionEffect extends ContinuousRuleModifyingEffectImpl { return new SingleCombatRestrictionEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/s/Solfatara.java b/Mage.Sets/src/mage/cards/s/Solfatara.java index e37963c57ea..067e5aee695 100644 --- a/Mage.Sets/src/mage/cards/s/Solfatara.java +++ b/Mage.Sets/src/mage/cards/s/Solfatara.java @@ -61,11 +61,6 @@ class SolfataraEffect extends ContinuousRuleModifyingEffectImpl { return new SolfataraEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -76,11 +71,12 @@ class SolfataraEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.PLAY_LAND && event.getPlayerId().equals(source.getFirstTarget())) { - return true; - } - return false; + 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.getPlayerId().equals(source.getFirstTarget()); + } } diff --git a/Mage.Sets/src/mage/cards/s/SorcerousSpyglass.java b/Mage.Sets/src/mage/cards/s/SorcerousSpyglass.java index 1484a802989..0ffa5a539f4 100644 --- a/Mage.Sets/src/mage/cards/s/SorcerousSpyglass.java +++ b/Mage.Sets/src/mage/cards/s/SorcerousSpyglass.java @@ -56,11 +56,6 @@ class SorcerousSpyglassActivationEffect extends ContinuousRuleModifyingEffectImp return new SorcerousSpyglassActivationEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage.Sets/src/mage/cards/s/SphinxsDecree.java b/Mage.Sets/src/mage/cards/s/SphinxsDecree.java index 90ac455d72d..de6adac7454 100644 --- a/Mage.Sets/src/mage/cards/s/SphinxsDecree.java +++ b/Mage.Sets/src/mage/cards/s/SphinxsDecree.java @@ -86,11 +86,6 @@ class SphinxsDecreeCantCastEffect extends ContinuousRuleModifyingEffectImpl { return new SphinxsDecreeCantCastEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -100,6 +95,11 @@ class SphinxsDecreeCantCastEffect extends ContinuousRuleModifyingEffectImpl { 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) { UUID opponentId = getTargetPointer().getFirst(game, source); diff --git a/Mage.Sets/src/mage/cards/s/SpiritOfTheLabyrinth.java b/Mage.Sets/src/mage/cards/s/SpiritOfTheLabyrinth.java index 7ac7116cd35..3c67b66fed3 100644 --- a/Mage.Sets/src/mage/cards/s/SpiritOfTheLabyrinth.java +++ b/Mage.Sets/src/mage/cards/s/SpiritOfTheLabyrinth.java @@ -90,11 +90,6 @@ class SpiritOfTheLabyrinthEffect extends ContinuousRuleModifyingEffectImpl { return new SpiritOfTheLabyrinthEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DRAW_CARD; diff --git a/Mage.Sets/src/mage/cards/s/Stabilizer.java b/Mage.Sets/src/mage/cards/s/Stabilizer.java index 7865900e80b..861d41d61e8 100644 --- a/Mage.Sets/src/mage/cards/s/Stabilizer.java +++ b/Mage.Sets/src/mage/cards/s/Stabilizer.java @@ -53,11 +53,6 @@ class StabilizerEffect extends ContinuousRuleModifyingEffectImpl { return new StabilizerEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -67,11 +62,13 @@ class StabilizerEffect extends ContinuousRuleModifyingEffectImpl { return "You can't cycle cards (" + mageObject.getIdName() + ")."; } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() != GameEvent.EventType.ACTIVATE_ABILITY) { - return false; - } Ability ability = game.getAbility(event.getTargetId(), event.getSourceId()).orElse(null); return ability instanceof CyclingAbility; } diff --git a/Mage.Sets/src/mage/cards/s/Stranglehold.java b/Mage.Sets/src/mage/cards/s/Stranglehold.java index befeb0c85fa..f80e2a16d0a 100644 --- a/Mage.Sets/src/mage/cards/s/Stranglehold.java +++ b/Mage.Sets/src/mage/cards/s/Stranglehold.java @@ -60,11 +60,6 @@ class OpponentsCantSearchLibarariesEffect extends ContinuousRuleModifyingEffectI return new OpponentsCantSearchLibarariesEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/t/TangleKelp.java b/Mage.Sets/src/mage/cards/t/TangleKelp.java index 68532b20d80..bb57da022ce 100644 --- a/Mage.Sets/src/mage/cards/t/TangleKelp.java +++ b/Mage.Sets/src/mage/cards/t/TangleKelp.java @@ -72,11 +72,6 @@ class DontUntapIfAttackedLastTurnEnchantedEffect extends ContinuousRuleModifying super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public DontUntapIfAttackedLastTurnEnchantedEffect copy() { return new DontUntapIfAttackedLastTurnEnchantedEffect(this); diff --git a/Mage.Sets/src/mage/cards/t/TeferiMageOfZhalfir.java b/Mage.Sets/src/mage/cards/t/TeferiMageOfZhalfir.java index 604f2522aba..76f4cfba2f2 100644 --- a/Mage.Sets/src/mage/cards/t/TeferiMageOfZhalfir.java +++ b/Mage.Sets/src/mage/cards/t/TeferiMageOfZhalfir.java @@ -144,11 +144,6 @@ class TeferiMageOfZhalfirReplacementEffect extends ContinuousRuleModifyingEffect return false; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public TeferiMageOfZhalfirReplacementEffect copy() { return new TeferiMageOfZhalfirReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/t/TeferiTimeRaveler.java b/Mage.Sets/src/mage/cards/t/TeferiTimeRaveler.java index 7cc102bb822..e6496140593 100644 --- a/Mage.Sets/src/mage/cards/t/TeferiTimeRaveler.java +++ b/Mage.Sets/src/mage/cards/t/TeferiTimeRaveler.java @@ -104,11 +104,6 @@ class TeferiTimeRavelerReplacementEffect extends ContinuousRuleModifyingEffectIm return false; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public TeferiTimeRavelerReplacementEffect copy() { return new TeferiTimeRavelerReplacementEffect(this); diff --git a/Mage.Sets/src/mage/cards/t/TeferiTimelessVoyager.java b/Mage.Sets/src/mage/cards/t/TeferiTimelessVoyager.java index 450fa48ad17..b1bfa19eafe 100644 --- a/Mage.Sets/src/mage/cards/t/TeferiTimelessVoyager.java +++ b/Mage.Sets/src/mage/cards/t/TeferiTimelessVoyager.java @@ -127,11 +127,6 @@ class TeferiTimelessVoyagerPhaseEffect extends ContinuousRuleModifyingEffectImpl return event.getType() == GameEvent.EventType.PHASE_IN; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { return this.mor.refersTo(event.getTargetId(), game); diff --git a/Mage.Sets/src/mage/cards/t/TerritorialDispute.java b/Mage.Sets/src/mage/cards/t/TerritorialDispute.java index 9ab7e3ebcb2..088859697c9 100644 --- a/Mage.Sets/src/mage/cards/t/TerritorialDispute.java +++ b/Mage.Sets/src/mage/cards/t/TerritorialDispute.java @@ -64,11 +64,6 @@ class TerritorialDisputeEffect extends ContinuousRuleModifyingEffectImpl { public TerritorialDisputeEffect copy() { return new TerritorialDisputeEffect(this); } - - @Override - public boolean apply(Game game, Ability source) { - return true; - } @Override public boolean checksEventType(GameEvent event, Game game) { diff --git a/Mage.Sets/src/mage/cards/t/TetsuoUmezawa.java b/Mage.Sets/src/mage/cards/t/TetsuoUmezawa.java index 80be09b292c..39c8c711a70 100644 --- a/Mage.Sets/src/mage/cards/t/TetsuoUmezawa.java +++ b/Mage.Sets/src/mage/cards/t/TetsuoUmezawa.java @@ -86,11 +86,6 @@ class TetsuoUmezawaEffect extends ContinuousRuleModifyingEffectImpl { return event.getType() == GameEvent.EventType.TARGET; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/t/TheBookOfExaltedDeeds.java b/Mage.Sets/src/mage/cards/t/TheBookOfExaltedDeeds.java index 788d629df0c..dba00425e69 100644 --- a/Mage.Sets/src/mage/cards/t/TheBookOfExaltedDeeds.java +++ b/Mage.Sets/src/mage/cards/t/TheBookOfExaltedDeeds.java @@ -92,8 +92,9 @@ class TheBookOfExaltedDeedsEffect extends ContinuousRuleModifyingEffectImpl { } @Override - public boolean apply(Game game, Ability source) { - return true; + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.WINS + || event.getType() == GameEvent.EventType.LOSES; } @Override diff --git a/Mage.Sets/src/mage/cards/t/TheCheeseStandsAlone.java b/Mage.Sets/src/mage/cards/t/TheCheeseStandsAlone.java index 1ffe60bdb28..f19c245855d 100644 --- a/Mage.Sets/src/mage/cards/t/TheCheeseStandsAlone.java +++ b/Mage.Sets/src/mage/cards/t/TheCheeseStandsAlone.java @@ -61,7 +61,8 @@ class CheeseStandsAloneContinuousEffect extends ContinuousRuleModifyingEffectImp } @Override - public boolean apply(Game game, Ability source) { + public boolean checksEventType(GameEvent event, Game game) { + // TODO: workaround to check win conditional on any event, but must be state base action instead return true; } diff --git a/Mage.Sets/src/mage/cards/t/TheImmortalSun.java b/Mage.Sets/src/mage/cards/t/TheImmortalSun.java index 5932fb7d45a..036005d6b04 100644 --- a/Mage.Sets/src/mage/cards/t/TheImmortalSun.java +++ b/Mage.Sets/src/mage/cards/t/TheImmortalSun.java @@ -70,11 +70,6 @@ class TheImmortalSunCantActivateEffect extends ContinuousRuleModifyingEffectImpl return new TheImmortalSunCantActivateEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -84,17 +79,20 @@ class TheImmortalSunCantActivateEffect extends ContinuousRuleModifyingEffectImpl return null; } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) { - Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); - if (permanent == null) { - return false; - } - if (permanent.isPlaneswalker(game)) { - Optional ability = game.getAbility(event.getTargetId(), event.getSourceId()); - return ability.isPresent() && (ability.get() instanceof LoyaltyAbility); - } + Permanent permanent = game.getPermanentOrLKIBattlefield(event.getSourceId()); + if (permanent == null) { + return false; + } + if (permanent.isPlaneswalker(game)) { + Optional ability = game.getAbility(event.getTargetId(), event.getSourceId()); + return ability.isPresent() && (ability.get() instanceof LoyaltyAbility); } return false; } diff --git a/Mage.Sets/src/mage/cards/t/ThePhasingOfZhalfir.java b/Mage.Sets/src/mage/cards/t/ThePhasingOfZhalfir.java index bba81b5c8a1..45c81111255 100644 --- a/Mage.Sets/src/mage/cards/t/ThePhasingOfZhalfir.java +++ b/Mage.Sets/src/mage/cards/t/ThePhasingOfZhalfir.java @@ -89,11 +89,6 @@ class ThePhasingOfZhalfirPhaseEffect extends ContinuousRuleModifyingEffectImpl { return event.getType() == GameEvent.EventType.PHASE_IN; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean applies(GameEvent event, Ability source, Game game) { return event.getTargetId().equals(this.getTargetPointer().getFirst(game, source)); diff --git a/Mage.Sets/src/mage/cards/t/ThrunBreakerOfSilence.java b/Mage.Sets/src/mage/cards/t/ThrunBreakerOfSilence.java index 38555a26c7d..612df87a086 100644 --- a/Mage.Sets/src/mage/cards/t/ThrunBreakerOfSilence.java +++ b/Mage.Sets/src/mage/cards/t/ThrunBreakerOfSilence.java @@ -77,11 +77,6 @@ class ThrunBreakerOfSilenceEffect extends ContinuousRuleModifyingEffectImpl { return new ThrunBreakerOfSilenceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Permanent sourcePermanent = game.getPermanent(source.getSourceId()); diff --git a/Mage.Sets/src/mage/cards/t/TidalBarracuda.java b/Mage.Sets/src/mage/cards/t/TidalBarracuda.java index f14f6fd12d6..97ebc722f3f 100644 --- a/Mage.Sets/src/mage/cards/t/TidalBarracuda.java +++ b/Mage.Sets/src/mage/cards/t/TidalBarracuda.java @@ -66,11 +66,6 @@ class TidalBarracudaEffect extends ContinuousRuleModifyingEffectImpl { return new TidalBarracudaEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/t/TomikDistinguishedAdvokist.java b/Mage.Sets/src/mage/cards/t/TomikDistinguishedAdvokist.java index fc43772397b..d8d0b82991e 100644 --- a/Mage.Sets/src/mage/cards/t/TomikDistinguishedAdvokist.java +++ b/Mage.Sets/src/mage/cards/t/TomikDistinguishedAdvokist.java @@ -98,11 +98,6 @@ class TomikDistinguishedAdvokistRestrictionEffect extends ContinuousRuleModifyin return new TomikDistinguishedAdvokistRestrictionEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.PLAY_LAND; diff --git a/Mage.Sets/src/mage/cards/t/TurfWound.java b/Mage.Sets/src/mage/cards/t/TurfWound.java index 5750e3722ac..a06bfb729d0 100644 --- a/Mage.Sets/src/mage/cards/t/TurfWound.java +++ b/Mage.Sets/src/mage/cards/t/TurfWound.java @@ -58,11 +58,6 @@ class TurfWoundEffect extends ContinuousRuleModifyingEffectImpl { return new TurfWoundEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -72,9 +67,14 @@ class TurfWoundEffect extends ContinuousRuleModifyingEffectImpl { 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; diff --git a/Mage.Sets/src/mage/cards/v/VeilstoneAmulet.java b/Mage.Sets/src/mage/cards/v/VeilstoneAmulet.java index ac1a21578cc..598b91c86ac 100644 --- a/Mage.Sets/src/mage/cards/v/VeilstoneAmulet.java +++ b/Mage.Sets/src/mage/cards/v/VeilstoneAmulet.java @@ -56,11 +56,6 @@ class VeilstoneAmuletEffect extends ContinuousRuleModifyingEffectImpl { return new VeilstoneAmuletEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.TARGET; diff --git a/Mage.Sets/src/mage/cards/v/VexingShusher.java b/Mage.Sets/src/mage/cards/v/VexingShusher.java index 4aa0c5825e1..ad916aca08f 100644 --- a/Mage.Sets/src/mage/cards/v/VexingShusher.java +++ b/Mage.Sets/src/mage/cards/v/VexingShusher.java @@ -69,11 +69,6 @@ class VexingShusherCantCounterTargetEffect extends ContinuousRuleModifyingEffect return new VexingShusherCantCounterTargetEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject sourceObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/v/VoidWinnower.java b/Mage.Sets/src/mage/cards/v/VoidWinnower.java index f20caec720a..42970bde8e9 100644 --- a/Mage.Sets/src/mage/cards/v/VoidWinnower.java +++ b/Mage.Sets/src/mage/cards/v/VoidWinnower.java @@ -61,11 +61,6 @@ class VoidWinnowerCantCastEffect extends ContinuousRuleModifyingEffectImpl { return new VoidWinnowerCantCastEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/v/VoidstoneGargoyle.java b/Mage.Sets/src/mage/cards/v/VoidstoneGargoyle.java index 753a33899fb..6d82e5a5049 100644 --- a/Mage.Sets/src/mage/cards/v/VoidstoneGargoyle.java +++ b/Mage.Sets/src/mage/cards/v/VoidstoneGargoyle.java @@ -13,7 +13,6 @@ import mage.cards.CardSetInfo; import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; import mage.util.CardUtil; import java.util.UUID; @@ -61,11 +60,6 @@ class VoidstoneGargoyleReplacementEffect1 extends ContinuousRuleModifyingEffectI super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public VoidstoneGargoyleReplacementEffect1 copy() { return new VoidstoneGargoyleReplacementEffect1(this); @@ -80,14 +74,16 @@ class VoidstoneGargoyleReplacementEffect1 extends ContinuousRuleModifyingEffectI 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) { - MageObject object = game.getObject(event.getSourceId()); - String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); - return CardUtil.haveSameNames(object, cardName, game); - } - return false; + MageObject object = game.getObject(event.getSourceId()); + String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); + return CardUtil.haveSameNames(object, cardName, game); } } @@ -103,11 +99,6 @@ class VoidstoneGargoyleRuleModifyingEffect2 extends ContinuousRuleModifyingEffec super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public VoidstoneGargoyleRuleModifyingEffect2 copy() { return new VoidstoneGargoyleRuleModifyingEffect2(this); @@ -123,13 +114,14 @@ class VoidstoneGargoyleRuleModifyingEffect2 extends ContinuousRuleModifyingEffec } @Override - public boolean applies(GameEvent event, Ability source, Game game) { - if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) { - MageObject object = game.getObject(event.getSourceId()); - String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); - return CardUtil.haveSameNames(object, cardName, game); - } - return false; + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; } + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + MageObject object = game.getObject(event.getSourceId()); + String cardName = (String) game.getState().getValue(source.getSourceId().toString() + ChooseACardNameEffect.INFO_KEY); + return CardUtil.haveSameNames(object, cardName, game); + } } diff --git a/Mage.Sets/src/mage/cards/v/VolrathsCurse.java b/Mage.Sets/src/mage/cards/v/VolrathsCurse.java index 6e3ce68eada..35b7b3049f1 100644 --- a/Mage.Sets/src/mage/cards/v/VolrathsCurse.java +++ b/Mage.Sets/src/mage/cards/v/VolrathsCurse.java @@ -120,11 +120,6 @@ class VolrathsCurseCantActivateAbilitiesEffect extends ContinuousRuleModifyingEf return new VolrathsCurseCantActivateAbilitiesEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage.Sets/src/mage/cards/w/WardOfBones.java b/Mage.Sets/src/mage/cards/w/WardOfBones.java index 982dd234aad..738e59ecf04 100644 --- a/Mage.Sets/src/mage/cards/w/WardOfBones.java +++ b/Mage.Sets/src/mage/cards/w/WardOfBones.java @@ -64,11 +64,6 @@ class WardOfBonesEffect extends ContinuousRuleModifyingEffectImpl { return new WardOfBonesEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage.Sets/src/mage/cards/w/WardscaleDragon.java b/Mage.Sets/src/mage/cards/w/WardscaleDragon.java index ff965f0ca6d..b41d887a7ea 100644 --- a/Mage.Sets/src/mage/cards/w/WardscaleDragon.java +++ b/Mage.Sets/src/mage/cards/w/WardscaleDragon.java @@ -64,11 +64,6 @@ class WardscaleDragonRuleEffect extends ContinuousRuleModifyingEffectImpl { return new WardscaleDragonRuleEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/w/WormsOfTheEarth.java b/Mage.Sets/src/mage/cards/w/WormsOfTheEarth.java index 2646e0d23f6..ce2713e34ac 100644 --- a/Mage.Sets/src/mage/cards/w/WormsOfTheEarth.java +++ b/Mage.Sets/src/mage/cards/w/WormsOfTheEarth.java @@ -65,11 +65,6 @@ class WormsOfTheEarthPlayEffect extends ContinuousRuleModifyingEffectImpl { return new WormsOfTheEarthPlayEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.PLAY_LAND; diff --git a/Mage.Sets/src/mage/cards/x/XanatharGuildKingpin.java b/Mage.Sets/src/mage/cards/x/XanatharGuildKingpin.java index c62c5ece0d3..e8d822eb5c1 100644 --- a/Mage.Sets/src/mage/cards/x/XanatharGuildKingpin.java +++ b/Mage.Sets/src/mage/cards/x/XanatharGuildKingpin.java @@ -80,11 +80,6 @@ class XanatharGuildKingpinRuleModifyingEffect extends ContinuousRuleModifyingEff return new XanatharGuildKingpinRuleModifyingEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source)); diff --git a/Mage.Sets/src/mage/cards/x/XantidSwarm.java b/Mage.Sets/src/mage/cards/x/XantidSwarm.java index 7dda88c653f..26971ba4bee 100644 --- a/Mage.Sets/src/mage/cards/x/XantidSwarm.java +++ b/Mage.Sets/src/mage/cards/x/XantidSwarm.java @@ -99,11 +99,6 @@ class XantidSwarmReplacementEffect extends ContinuousRuleModifyingEffectImpl { return new XantidSwarmReplacementEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage.Sets/src/mage/cards/y/YasharnImplacableEarth.java b/Mage.Sets/src/mage/cards/y/YasharnImplacableEarth.java index 0bdfdd2576f..14db564898c 100644 --- a/Mage.Sets/src/mage/cards/y/YasharnImplacableEarth.java +++ b/Mage.Sets/src/mage/cards/y/YasharnImplacableEarth.java @@ -128,11 +128,6 @@ class YasharnImplacableEarthEffect extends ContinuousRuleModifyingEffectImpl { return new YasharnImplacableEarthEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousRuleModifyingEffect.java b/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousRuleModifyingEffect.java index 00f553952b9..83d74dcd3c0 100644 --- a/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousRuleModifyingEffect.java +++ b/Mage/src/main/java/mage/abilities/decorator/ConditionalContinuousRuleModifyingEffect.java @@ -66,11 +66,6 @@ public class ConditionalContinuousRuleModifyingEffect extends ContinuousRuleModi return effect.isDiscarded() || (otherwiseEffect != null && otherwiseEffect.isDiscarded()); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public boolean checksEventType(GameEvent event, Game game) { if (effect.checksEventType(event, game)) { diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousRuleModifyingEffect.java b/Mage/src/main/java/mage/abilities/effects/ContinuousRuleModifyingEffect.java index 5dd27c2f644..7442cf947b4 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousRuleModifyingEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousRuleModifyingEffect.java @@ -1,5 +1,3 @@ - - package mage.abilities.effects; import mage.abilities.Ability; diff --git a/Mage/src/main/java/mage/abilities/effects/ContinuousRuleModifyingEffectImpl.java b/Mage/src/main/java/mage/abilities/effects/ContinuousRuleModifyingEffectImpl.java index 8be834d8a30..3e07c9be11f 100644 --- a/Mage/src/main/java/mage/abilities/effects/ContinuousRuleModifyingEffectImpl.java +++ b/Mage/src/main/java/mage/abilities/effects/ContinuousRuleModifyingEffectImpl.java @@ -59,24 +59,11 @@ public abstract class ContinuousRuleModifyingEffectImpl extends ContinuousEffect this.messageToGameLog = effect.messageToGameLog; } - /** - * An early check for the event types this effect applies to. This check was - * added to speed up event handling. Once all existing - * ContinuousRuleModifiyingEffects have implemented this method, the method - * should be changed to abstract here or removed. - * - * @param event - * @param game - * @return - */ @Override - public boolean checksEventType(GameEvent event, Game game) { - return true; - } - - @Override - public boolean apply(Game game, Ability source) { - return true; + final public boolean apply(Game game, Ability source) { + // not used in rule modifying effects because it allows or disallows related event only without data + // modification or choose dialogs (see applies method) + throw new IllegalStateException("Wrong code usage. Rules modifying effects don't use apply methods"); } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantActivateAbilitiesAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantActivateAbilitiesAttachedEffect.java index b6f4d6f113c..129b2f2cff3 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantActivateAbilitiesAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantActivateAbilitiesAttachedEffect.java @@ -29,11 +29,6 @@ public class CantActivateAbilitiesAttachedEffect extends ContinuousRuleModifying return new CantActivateAbilitiesAttachedEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java index 485d0ef92f1..f050ad42afa 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredControlledEffect.java @@ -45,11 +45,6 @@ public class CantBeCounteredControlledEffect extends ContinuousRuleModifyingEffe return new CantBeCounteredControlledEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.COUNTER; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredSourceEffect.java index edcf056da3d..4d9f3514c6f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeCounteredSourceEffect.java @@ -32,11 +32,6 @@ public class CantBeCounteredSourceEffect extends ContinuousRuleModifyingEffectIm return new CantBeCounteredSourceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { StackObject stackObject = game.getStack().getStackObject(event.getTargetId()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java index e2e9a5f8860..f75377d228a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedSourceEffect.java @@ -31,11 +31,6 @@ public class CantBeRegeneratedSourceEffect extends ContinuousRuleModifyingEffect return new CantBeRegeneratedSourceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.REGENERATE; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java index cbd61f26cd2..16c303ee20b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeRegeneratedTargetEffect.java @@ -27,11 +27,6 @@ public class CantBeRegeneratedTargetEffect extends ContinuousRuleModifyingEffect return new CantBeRegeneratedTargetEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.REGENERATE; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java index cdbdef87ce9..9f671dfa22f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAllEffect.java @@ -49,11 +49,6 @@ public class CantBeTargetedAllEffect extends ContinuousRuleModifyingEffectImpl { return new CantBeTargetedAllEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.TARGET; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java index 7893f2de689..f2ea7b39a40 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedAttachedEffect.java @@ -44,11 +44,6 @@ public class CantBeTargetedAttachedEffect extends ContinuousRuleModifyingEffectI return new CantBeTargetedAttachedEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.TARGET; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedCardsGraveyardsEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedCardsGraveyardsEffect.java index d1f9720f65f..b81439d3f2b 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedCardsGraveyardsEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedCardsGraveyardsEffect.java @@ -30,11 +30,6 @@ public class CantBeTargetedCardsGraveyardsEffect extends ContinuousRuleModifying return new CantBeTargetedCardsGraveyardsEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.TARGET; @@ -46,7 +41,7 @@ public class CantBeTargetedCardsGraveyardsEffect extends ContinuousRuleModifying 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) { + if (zone == Zone.GRAVEYARD) { return true; } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java index 3f76d6976f1..7a6069d6b73 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedSourceEffect.java @@ -36,11 +36,6 @@ public class CantBeTargetedSourceEffect extends ContinuousRuleModifyingEffectImp return new CantBeTargetedSourceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.TARGET; diff --git a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java index 6077fae25c3..4ce8e4b36ca 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/CantBeTargetedTargetEffect.java @@ -39,11 +39,6 @@ public class CantBeTargetedTargetEffect extends ContinuousRuleModifyingEffectImp return new CantBeTargetedTargetEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.TARGET; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java index 94f1bb65aae..7612d72c83e 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepSourceEffect.java @@ -28,11 +28,6 @@ public class DontUntapInControllersNextUntapStepSourceEffect extends ContinuousR return new DontUntapInControllersNextUntapStepSourceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -44,7 +39,8 @@ public class DontUntapInControllersNextUntapStepSourceEffect extends ContinuousR @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UNTAP_STEP || event.getType() == GameEvent.EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP_STEP + || event.getType() == GameEvent.EventType.UNTAP; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java index 92ce682a732..e0ca981deb8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersNextUntapStepTargetEffect.java @@ -71,11 +71,6 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR return new DontUntapInControllersNextUntapStepTargetEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -88,7 +83,8 @@ public class DontUntapInControllersNextUntapStepTargetEffect extends ContinuousR @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UNTAP_STEP || event.getType() == GameEvent.EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP_STEP + || event.getType() == GameEvent.EventType.UNTAP; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepAllEffect.java index 3b109db119e..95754f096ff 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepAllEffect.java @@ -41,11 +41,6 @@ public class DontUntapInControllersUntapStepAllEffect extends ContinuousRuleModi return new DontUntapInControllersUntapStepAllEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.UNTAP; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java index 6623974ca01..eb67d9d755d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepEnchantedEffect.java @@ -27,11 +27,6 @@ public class DontUntapInControllersUntapStepEnchantedEffect extends ContinuousRu super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public DontUntapInControllersUntapStepEnchantedEffect copy() { return new DontUntapInControllersUntapStepEnchantedEffect(this); diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepSourceEffect.java index c235ef7b1f6..62b0f9b1b03 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepSourceEffect.java @@ -34,11 +34,6 @@ public class DontUntapInControllersUntapStepSourceEffect extends ContinuousRuleM return new DontUntapInControllersUntapStepSourceEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.UNTAP; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java index 01c0b7adc9f..e9c369720fa 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInControllersUntapStepTargetEffect.java @@ -38,11 +38,6 @@ public class DontUntapInControllersUntapStepTargetEffect extends ContinuousRuleM return new DontUntapInControllersUntapStepTargetEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.UNTAP; diff --git a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInPlayersNextUntapStepAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInPlayersNextUntapStepAllEffect.java index 8dd2566db8a..d24fe72ab5d 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DontUntapInPlayersNextUntapStepAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DontUntapInPlayersNextUntapStepAllEffect.java @@ -46,11 +46,6 @@ public class DontUntapInPlayersNextUntapStepAllEffect extends ContinuousRuleModi return new DontUntapInPlayersNextUntapStepAllEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); @@ -63,7 +58,8 @@ public class DontUntapInPlayersNextUntapStepAllEffect extends ContinuousRuleModi @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.UNTAP_STEP || event.getType() == GameEvent.EventType.UNTAP; + return event.getType() == GameEvent.EventType.UNTAP_STEP + || event.getType() == GameEvent.EventType.UNTAP; } @Override diff --git a/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java b/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java index 95b1f92a50f..00ac482a536 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/EpicEffect.java @@ -75,11 +75,6 @@ class EpicReplacementEffect extends ContinuousRuleModifyingEffectImpl { super(effect); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public EpicReplacementEffect copy() { return new EpicReplacementEffect(this); diff --git a/Mage/src/main/java/mage/abilities/effects/common/SkipUntapStepEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SkipUntapStepEffect.java index 9f8c312391d..444860dbff7 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SkipUntapStepEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SkipUntapStepEffect.java @@ -58,11 +58,15 @@ public class SkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl { return new SkipUntapStepEffect(this); } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.UNTAP_STEP; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { Player controller = game.getPlayer(source.getControllerId()); - return event.getType() == GameEvent.EventType.UNTAP_STEP - && controller != null + return controller != null && game.getState().getPlayersInRange(controller.getId(), game).contains(event.getPlayerId()); } } diff --git a/Mage/src/main/java/mage/abilities/effects/common/combat/ChooseBlockersEffect.java b/Mage/src/main/java/mage/abilities/effects/common/combat/ChooseBlockersEffect.java index 07d1dfee53b..93e8d175159 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/combat/ChooseBlockersEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/combat/ChooseBlockersEffect.java @@ -28,11 +28,6 @@ public class ChooseBlockersEffect extends ContinuousRuleModifyingEffectImpl { return new ChooseBlockersEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.DECLARING_BLOCKERS; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantCastMoreThanOneSpellEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantCastMoreThanOneSpellEffect.java index 95432a435f2..44a35bfcc68 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/CantCastMoreThanOneSpellEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CantCastMoreThanOneSpellEffect.java @@ -33,11 +33,6 @@ public class CantCastMoreThanOneSpellEffect extends ContinuousRuleModifyingEffec return new CantCastMoreThanOneSpellEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/DamageCantBePreventedEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/DamageCantBePreventedEffect.java index 65c06b00ed7..9f894641458 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/DamageCantBePreventedEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/DamageCantBePreventedEffect.java @@ -23,11 +23,6 @@ public class DamageCantBePreventedEffect extends ContinuousRuleModifyingEffectIm return new DamageCantBePreventedEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.PREVENT_DAMAGE; diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantCastOrActivateOpponentsYourTurnEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantCastOrActivateOpponentsYourTurnEffect.java index b1f6dfc6114..efc604e6cf8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantCastOrActivateOpponentsYourTurnEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantCastOrActivateOpponentsYourTurnEffect.java @@ -30,11 +30,6 @@ public class CantCastOrActivateOpponentsYourTurnEffect extends ContinuousRuleMod return new CantCastOrActivateOpponentsYourTurnEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { Player activePlayer = game.getPlayer(game.getActivePlayerId()); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantRegenerateTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantRegenerateTargetEffect.java index 44a048110a5..cdc1711fc93 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantRegenerateTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CantRegenerateTargetEffect.java @@ -32,11 +32,6 @@ public class CantRegenerateTargetEffect extends ContinuousRuleModifyingEffectImp return new CantRegenerateTargetEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.REGENERATE; diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyIfYouHaveCastAnotherSpellEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyIfYouHaveCastAnotherSpellEffect.java index 7c27be2442d..9a0289dbfe5 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyIfYouHaveCastAnotherSpellEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CastOnlyIfYouHaveCastAnotherSpellEffect.java @@ -39,11 +39,6 @@ public class CastOnlyIfYouHaveCastAnotherSpellEffect extends ContinuousRuleModif return false; } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public CastOnlyIfYouHaveCastAnotherSpellEffect copy() { return new CastOnlyIfYouHaveCastAnotherSpellEffect(this); diff --git a/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java b/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java index e2232b11e33..75af466f270 100644 --- a/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/AftermathAbility.java @@ -104,11 +104,6 @@ class AftermathCantCastFromHand extends ContinuousRuleModifyingEffectImpl { return new AftermathCantCastFromHand(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.CAST_SPELL; diff --git a/Mage/src/main/java/mage/abilities/keyword/SplitSecondAbility.java b/Mage/src/main/java/mage/abilities/keyword/SplitSecondAbility.java index de3a7c95e63..7a2e7829029 100644 --- a/Mage/src/main/java/mage/abilities/keyword/SplitSecondAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/SplitSecondAbility.java @@ -59,7 +59,8 @@ class SplitSecondEffect extends ContinuousRuleModifyingEffectImpl { @Override public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.CAST_SPELL || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; + return event.getType() == GameEvent.EventType.CAST_SPELL + || event.getType() == GameEvent.EventType.ACTIVATE_ABILITY; } @Override @@ -76,11 +77,6 @@ class SplitSecondEffect extends ContinuousRuleModifyingEffectImpl { return false; } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public SplitSecondEffect copy() { return new SplitSecondEffect(this); diff --git a/Mage/src/main/java/mage/game/command/emblems/GideonOfTheTrialsEmblem.java b/Mage/src/main/java/mage/game/command/emblems/GideonOfTheTrialsEmblem.java index d79270a9771..bc9107acd9e 100644 --- a/Mage/src/main/java/mage/game/command/emblems/GideonOfTheTrialsEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/GideonOfTheTrialsEmblem.java @@ -51,8 +51,9 @@ class GideonOfTheTrialsCantLoseEffect extends ContinuousRuleModifyingEffectImpl } @Override - public boolean apply(Game game, Ability source) { - return true; + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.WINS + || event.getType() == GameEvent.EventType.LOSES; } @Override diff --git a/Mage/src/main/java/mage/game/command/emblems/NarsetTranscendentEmblem.java b/Mage/src/main/java/mage/game/command/emblems/NarsetTranscendentEmblem.java index 171fd083d24..f66f3cef996 100644 --- a/Mage/src/main/java/mage/game/command/emblems/NarsetTranscendentEmblem.java +++ b/Mage/src/main/java/mage/game/command/emblems/NarsetTranscendentEmblem.java @@ -52,11 +52,6 @@ class NarsetTranscendentCantCastEffect extends ContinuousRuleModifyingEffectImpl return new NarsetTranscendentCantCastEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return true; - } - @Override public String getInfoMessage(Ability source, GameEvent event, Game game) { MageObject mageObject = game.getObject(source); diff --git a/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java b/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java index 05c53bca4e2..f57e12b7a3b 100644 --- a/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/EdgeOfMalacolPlane.java @@ -84,11 +84,6 @@ class EdgeOfMalacolEffect extends ContinuousRuleModifyingEffectImpl { return new EdgeOfMalacolEffect(this); } - @Override - public boolean apply(Game game, Ability source) { - return false; - } - @Override public boolean checksEventType(GameEvent event, Game game) { return event.getType() == GameEvent.EventType.UNTAP; diff --git a/Mage/src/main/java/mage/game/command/planes/TheEonFogPlane.java b/Mage/src/main/java/mage/game/command/planes/TheEonFogPlane.java index bc3cd1a4475..bda9c9d3181 100644 --- a/Mage/src/main/java/mage/game/command/planes/TheEonFogPlane.java +++ b/Mage/src/main/java/mage/game/command/planes/TheEonFogPlane.java @@ -62,16 +62,14 @@ public class TheEonFogPlane extends Plane { class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl { - boolean allPlayers = false; + final boolean allPlayers; public TheEonFogSkipUntapStepEffect() { - super(Duration.WhileOnBattlefield, Outcome.Neutral, false, false); - this.allPlayers = false; - staticText = "Players skip their untap steps"; + this(Duration.WhileOnBattlefield, false); } - public TheEonFogSkipUntapStepEffect(Duration d, boolean allPlayers) { - super(d, Outcome.Neutral, false, false); + public TheEonFogSkipUntapStepEffect(Duration duration, boolean allPlayers) { + super(duration, Outcome.Neutral, false, false); this.allPlayers = allPlayers; staticText = "Players skip their untap steps"; } @@ -86,6 +84,11 @@ class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl { return new TheEonFogSkipUntapStepEffect(this); } + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.UNTAP_STEP; + } + @Override public boolean applies(GameEvent event, Ability source, Game game) { Plane cPlane = game.getState().getCurrentPlane(); @@ -95,6 +98,6 @@ class TheEonFogSkipUntapStepEffect extends ContinuousRuleModifyingEffectImpl { if (!cPlane.getPlaneType().equals(Planes.PLANE_THE_EON_FOG)) { return false; } - return event.getType() == GameEvent.EventType.UNTAP_STEP; + return true; } }