Reimplemented Torpor Orb with RuleModifiying effect

This commit is contained in:
magenoxx 2014-08-18 19:43:01 +04:00
parent ffa987755b
commit cae473b6ca

View file

@ -27,20 +27,18 @@
*/ */
package mage.sets.newphyrexia; package mage.sets.newphyrexia;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl; import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.*;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import java.util.UUID;
/** /**
* *
* @author BetaSteward * @author BetaSteward
@ -65,9 +63,10 @@ public class TorporOrb extends CardImpl {
} }
} }
class TorporOrbEffect extends ReplacementEffectImpl { class TorporOrbEffect extends ContinuousRuleModifiyingEffectImpl {
TorporOrbEffect() { TorporOrbEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment, false); super(Duration.WhileOnBattlefield, Outcome.Detriment, false, true);
staticText = "Creatures entering the battlefield don't cause abilities to trigger"; staticText = "Creatures entering the battlefield don't cause abilities to trigger";
} }
@ -75,19 +74,17 @@ class TorporOrbEffect extends ReplacementEffectImpl {
super(effect); super(effect);
} }
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override @Override
public boolean applies(GameEvent event, Ability source, Game game) { public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) { if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
Ability ability = (Ability) getValue("targetAbility");
if (ability != null && ability instanceof TriggeredAbility) {
Permanent p = game.getPermanent(event.getTargetId()); Permanent p = game.getPermanent(event.getTargetId());
if (p != null && p.getCardType().contains(CardType.CREATURE)) { if (p != null && p.getCardType().contains(CardType.CREATURE)) {
return true; return true;
} }
} }
}
return false; return false;
} }