mirror of
https://github.com/correl/mage.git
synced 2024-12-25 03:00:15 +00:00
Some minor rework.
This commit is contained in:
parent
cd387234cf
commit
3940cd4b95
23 changed files with 131 additions and 275 deletions
|
@ -43,6 +43,7 @@ import mage.filter.common.FilterControlledPermanent;
|
|||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
|
||||
|
@ -116,9 +117,15 @@ class FloodtideSerpentReplacementEffect extends ReplacementEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.DECLARE_ATTACKER;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARE_ATTACKER && event.getSourceId().equals(source.getSourceId());
|
||||
return event.getSourceId().equals(source.getSourceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,6 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
|
|
|
@ -127,11 +127,16 @@ class ContainmentPriestReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||
&& ((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) {
|
||||
if (((ZoneChangeEvent) event).getToZone() == Zone.BATTLEFIELD) {
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card.getCardType().contains(CardType.CREATURE)) { // TODO: Bestow Card cast as Enchantment probably not handled correctly
|
||||
CreatureCastWatcher watcher = (CreatureCastWatcher) game.getState().getWatchers().get("CreatureWasCast");
|
||||
|
|
|
@ -110,6 +110,11 @@ class MycosynthGolemEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
|
|
@ -29,15 +29,13 @@ package mage.sets.fifthedition;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.StateTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
@ -59,7 +57,8 @@ public class Dandan extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Dandan can't attack unless defending player controls an Island.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DandanEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
|
||||
|
||||
// When you control no Islands, sacrifice Dandan.
|
||||
this.addAbility(new DandanTriggeredAbility());
|
||||
}
|
||||
|
@ -74,46 +73,6 @@ public class Dandan extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class DandanEffect extends ReplacementEffectImpl {
|
||||
|
||||
public DandanEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "{this} can't attack unless defending player controls an Island";
|
||||
}
|
||||
|
||||
public DandanEffect(final DandanEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DandanEffect copy() {
|
||||
return new DandanEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) {
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
filter.add(new SubtypePredicate("Island"));
|
||||
|
||||
if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class DandanTriggeredAbility extends StateTriggeredAbility {
|
||||
|
||||
public DandanTriggeredAbility() {
|
||||
|
@ -136,6 +95,6 @@ class DandanTriggeredAbility extends StateTriggeredAbility {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "When you control no islands, sacrifice {this}.";
|
||||
return "When you control no Islands, sacrifice {this}.";
|
||||
}
|
||||
}
|
|
@ -92,15 +92,21 @@ class DictateOfTheTwinGodsEffect extends ReplacementEffectImpl {
|
|||
return new DictateOfTheTwinGodsEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
switch (event.getType()) {
|
||||
case DAMAGE_PLAYER:
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
switch(event.getType()) {
|
||||
case DAMAGE_CREATURE:
|
||||
case DAMAGE_PLAYER:
|
||||
case DAMAGE_PLANESWALKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,6 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.continious.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.Card;
|
||||
|
|
|
@ -115,8 +115,13 @@ class KruphixGodOfHorizonsEffect extends ReplacementEffectImpl {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.EMPTY_MANA_POOL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
return event.getType() == GameEvent.EventType.EMPTY_MANA_POOL && event.getPlayerId().equals(source.getControllerId());
|
||||
return event.getPlayerId().equals(source.getControllerId());
|
||||
}
|
||||
}
|
|
@ -129,6 +129,17 @@ class OppressiveRaysEffect extends ReplacementEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
switch(event.getType()) {
|
||||
case DECLARE_ATTACKER:
|
||||
case DECLARE_BLOCKER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType().equals(GameEvent.EventType.DECLARE_ATTACKER)) {
|
||||
|
|
|
@ -40,6 +40,7 @@ import mage.constants.Zone;
|
|||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
/**
|
||||
|
@ -86,9 +87,14 @@ class HardenedScalesEffect extends ReplacementEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.ADD_COUNTERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ADD_COUNTERS && event.getData().equals(CounterType.P1P1.getName())) {
|
||||
if (event.getData().equals(CounterType.P1P1.getName())) {
|
||||
Permanent target = game.getPermanent(event.getTargetId());
|
||||
if (target != null && target.getControllerId().equals(source.getControllerId())
|
||||
&& target.getCardType().contains(CardType.CREATURE)) {
|
||||
|
|
|
@ -185,6 +185,11 @@ class KheruLichLordReplacementEffect extends ReplacementEffectImpl {
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||
|
|
|
@ -143,7 +143,12 @@ class UginsNexusExileEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == EventType.ZONE_CHANGE && event.getTargetId().equals(source.getSourceId())) {
|
||||
|
|
|
@ -34,14 +34,13 @@ import mage.abilities.StateTriggeredAbility;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.permanent.ControllerControlsIslandPredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
@ -64,7 +63,7 @@ public class PirateShip extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Pirate Ship can't attack unless defending player controls an Island.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PirateShipEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
|
||||
// {tap}: Pirate Ship deals 1 damage to target creature or player.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost());
|
||||
ability.addTarget(new TargetCreatureOrPlayer());
|
||||
|
@ -83,46 +82,6 @@ public class PirateShip extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class PirateShipEffect extends ReplacementEffectImpl {
|
||||
|
||||
public PirateShipEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "{this} can't attack unless defending player controls an Island";
|
||||
}
|
||||
|
||||
public PirateShipEffect(final PirateShipEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PirateShipEffect copy() {
|
||||
return new PirateShipEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) {
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
filter.add(new SubtypePredicate("Island"));
|
||||
|
||||
if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class PirateShipTriggeredAbility extends StateTriggeredAbility {
|
||||
|
||||
public PirateShipTriggeredAbility() {
|
||||
|
|
|
@ -30,21 +30,17 @@ package mage.sets.magic2010;
|
|||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
|
||||
import mage.abilities.effects.common.continious.SetPowerToughnessSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -70,7 +66,7 @@ public class SerpentOfTheEndlessSea extends CardImpl {
|
|||
// Serpent of the Endless Sea's power and toughness are each equal to the number of Islands you control.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new SetPowerToughnessSourceEffect(new PermanentsOnBattlefieldCount(filter), Duration.EndOfGame)));
|
||||
// Serpent of the Endless Sea can't attack unless defending player controls an Island.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SerpentOfTheEndlessSeaEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
|
||||
}
|
||||
|
||||
public SerpentOfTheEndlessSea(final SerpentOfTheEndlessSea card) {
|
||||
|
@ -82,43 +78,3 @@ public class SerpentOfTheEndlessSea extends CardImpl {
|
|||
return new SerpentOfTheEndlessSea(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SerpentOfTheEndlessSeaEffect extends ReplacementEffectImpl {
|
||||
|
||||
public SerpentOfTheEndlessSeaEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "{this} can't attack unless defending player controls an Island";
|
||||
}
|
||||
|
||||
public SerpentOfTheEndlessSeaEffect(final SerpentOfTheEndlessSeaEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SerpentOfTheEndlessSeaEffect copy() {
|
||||
return new SerpentOfTheEndlessSeaEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) {
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
filter.add(new SubtypePredicate("Island"));
|
||||
|
||||
if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
import mage.abilities.effects.ContinuousRuleModifiyingEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
|
|
|
@ -108,6 +108,11 @@ class ChiefEngineerEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
|
|
@ -130,13 +130,16 @@ class DoublingSeasonCounterEffect extends ReplacementEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ADD_COUNTERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ADD_COUNTERS) {
|
||||
Permanent target = game.getPermanent(event.getTargetId());
|
||||
if (target != null && target.getControllerId().equals(source.getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
Permanent target = game.getPermanent(event.getTargetId());
|
||||
if (target != null && target.getControllerId().equals(source.getControllerId())) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -86,17 +86,25 @@ class PyromancersSwathReplacementEffect extends ReplacementEffectImpl {
|
|||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
switch(event.getType()) {
|
||||
case DAMAGE_CREATURE:
|
||||
case DAMAGE_PLAYER:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)
|
||||
|| event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object != null && object instanceof Spell) {
|
||||
if (((Spell) object).getControllerId().equals(source.getControllerId())
|
||||
&& (object.getCardType().contains(CardType.INSTANT)
|
||||
|| object.getCardType().contains(CardType.SORCERY))){
|
||||
return true;
|
||||
}
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object != null && object instanceof Spell) {
|
||||
if (((Spell) object).getControllerId().equals(source.getControllerId())
|
||||
&& (object.getCardType().contains(CardType.INSTANT)
|
||||
|| object.getCardType().contains(CardType.SORCERY))){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -42,7 +42,6 @@ import mage.constants.Duration;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
@ -52,13 +51,7 @@ import mage.target.common.TargetLandPermanent;
|
|||
* @author cbt33, LevelX2 (Walk the Aeons), KholdFuzion (Dandan)
|
||||
*/
|
||||
public class Dreamwinder extends CardImpl {
|
||||
|
||||
private static final FilterLandPermanent filter = new FilterLandPermanent("an Island");
|
||||
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Island"));
|
||||
}
|
||||
|
||||
|
||||
public Dreamwinder(UUID ownerId) {
|
||||
super(ownerId, 83, "Dreamwinder", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
this.expansionSetCode = "ODY";
|
||||
|
@ -69,12 +62,12 @@ public class Dreamwinder extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Dreamwinder can't attack unless defending player controls an Island.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(filter)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
|
||||
// {U}, Sacrifice an Island: Target land becomes an Island until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesBasicLandTargetEffect(Duration.EndOfTurn, "Island"), new ManaCostsImpl("{U}"));
|
||||
Target target = new TargetLandPermanent();
|
||||
ability.addTarget(target);
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, filter, true)));
|
||||
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(1, 1, new FilterLandPermanent("Island","an Island"), true)));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,26 +29,20 @@ package mage.sets.tempest;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
public class SeaMonster extends CardImpl {
|
||||
|
||||
|
||||
public SeaMonster(UUID ownerId) {
|
||||
super(ownerId, 85, "Sea Monster", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{U}{U}");
|
||||
this.expansionSetCode = "TMP";
|
||||
|
@ -59,7 +53,7 @@ import mage.game.events.GameEvent;
|
|||
this.toughness = new MageInt(6);
|
||||
|
||||
// Sea Monster can't attack unless defending player controls an Island.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SeaMonsterEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
|
||||
}
|
||||
|
||||
public SeaMonster(final SeaMonster card) {
|
||||
|
@ -71,43 +65,3 @@ import mage.game.events.GameEvent;
|
|||
return new SeaMonster(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SeaMonsterEffect extends ReplacementEffectImpl {
|
||||
|
||||
public SeaMonsterEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "{this} can't attack unless defending player controls an Island";
|
||||
}
|
||||
|
||||
public SeaMonsterEffect(final SeaMonsterEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SeaMonsterEffect copy() {
|
||||
return new SeaMonsterEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) {
|
||||
FilterPermanent filter = new FilterPermanent();
|
||||
filter.add(new SubtypePredicate("Island"));
|
||||
|
||||
if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -33,7 +33,7 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.BecomesMonstrousSourceTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.combat.CantAttackUnlessDefenderControllsPermanent;
|
||||
import mage.abilities.keyword.MonstrosityAbility;
|
||||
import mage.abilities.mana.BlueManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -44,10 +44,8 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
@ -68,7 +66,7 @@ public class SealockMonster extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// Sealock Monster can't attack unless defending player controls an Island.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new SealockMonsterCantAttackEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(new FilterLandPermanent("Island","an Island"))));
|
||||
// {5}{U}{U}: Monstrosity 3.</i>
|
||||
this.addAbility(new MonstrosityAbility("{5}{U}{U}",3));
|
||||
// When Sealock Monster becomes monstrous, target land becomes an island in addition to its other types.
|
||||
|
@ -89,48 +87,6 @@ public class SealockMonster extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class SealockMonsterCantAttackEffect extends ReplacementEffectImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent();;
|
||||
static {
|
||||
filter.add(new SubtypePredicate("Island"));
|
||||
}
|
||||
|
||||
public SealockMonsterCantAttackEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment);
|
||||
staticText = "{this} can't attack unless defending player controls an Island";
|
||||
}
|
||||
|
||||
public SealockMonsterCantAttackEffect(final SealockMonsterCantAttackEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SealockMonsterCantAttackEffect copy() {
|
||||
return new SealockMonsterCantAttackEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.DECLARE_ATTACKER && source.getSourceId().equals(event.getSourceId())) {
|
||||
if (game.getBattlefield().countAll(filter, event.getTargetId(), game) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class SealockMonsterBecomesIslandTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
private static Ability islandAbility = new BlueManaAbility();
|
||||
|
|
|
@ -161,11 +161,15 @@ class WhipOfErebosReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.ZONE_CHANGE
|
||||
&& event.getTargetId().equals(source.getFirstTarget())
|
||||
if (event.getTargetId().equals(source.getFirstTarget())
|
||||
&& ((ZoneChangeEvent) event).getFromZone().equals(Zone.BATTLEFIELD)
|
||||
&& !((ZoneChangeEvent) event).getToZone().equals(Zone.EXILED)) {
|
||||
return true;
|
||||
|
|
|
@ -31,6 +31,7 @@ package mage.filter.common;
|
|||
import mage.constants.CardType;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -47,6 +48,12 @@ public class FilterLandPermanent extends FilterPermanent {
|
|||
this.add(new CardTypePredicate(CardType.LAND));
|
||||
}
|
||||
|
||||
public FilterLandPermanent(String subtype, String name) {
|
||||
super(name);
|
||||
this.add(new CardTypePredicate(CardType.LAND));
|
||||
this.add(new SubtypePredicate(subtype));
|
||||
}
|
||||
|
||||
public FilterLandPermanent(final FilterLandPermanent filter) {
|
||||
super(filter);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue