This commit is contained in:
BetaSteward 2010-11-19 04:02:10 +00:00
parent 90fa953478
commit 3b9b92ed0b
9 changed files with 36 additions and 16 deletions

View file

@ -49,7 +49,7 @@ public class SolemnOffering extends CardImpl<SolemnOffering> {
static {
filter.getCardType().add(CardType.ARTIFACT);
filter.getCardType().add(CardType.ENCHANTMENT);
filter.setScopeColor(ComparisonScope.Any);
filter.setScopeCardType(ComparisonScope.Any);
}
public SolemnOffering(UUID ownerId) {

View file

@ -32,6 +32,7 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.TargetController;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
@ -74,6 +75,14 @@ public class Corrupt extends CardImpl<Corrupt> {
class CorruptEffect extends OneShotEffect<CorruptEffect> {
private static FilterLandPermanent filter = new FilterLandPermanent("Swamps");
static {
filter.getSubtype().add("Swamp");
filter.setScopeSubtype(ComparisonScope.Any);
filter.setTargetController(TargetController.YOU);
}
public CorruptEffect() {
super(Outcome.Damage);
}
@ -84,10 +93,6 @@ class CorruptEffect extends OneShotEffect<CorruptEffect> {
@Override
public boolean apply(Game game, Ability source) {
FilterLandPermanent filter = new FilterLandPermanent("Swamps");
filter.getSubtype().add("Swamp");
filter.setScopeSubtype(ComparisonScope.Any);
filter.getControllerId().add(source.getControllerId());
int amount = game.getBattlefield().count(filter, source.getControllerId(), game);
if (amount > 0) {
int damageDealt = amount;

View file

@ -127,7 +127,7 @@ class MystifyingMazeEffect extends OneShotEffect<MystifyingMazeEffect> {
class MystifyingMazeDelayedTriggeredAbility extends DelayedTriggeredAbility<MystifyingMazeDelayedTriggeredAbility> {
public MystifyingMazeDelayedTriggeredAbility(UUID exileId) {
super(new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD));
super(new ReturnFromExileEffect(exileId, Zone.BATTLEFIELD, true));
}
public MystifyingMazeDelayedTriggeredAbility(final MystifyingMazeDelayedTriggeredAbility ability) {

View file

@ -48,7 +48,7 @@ public class Naturalize extends CardImpl<Naturalize> {
static {
filter.getCardType().add(CardType.ARTIFACT);
filter.getCardType().add(CardType.ENCHANTMENT);
filter.setScopeColor(ComparisonScope.Any);
filter.setScopeCardType(ComparisonScope.Any);
}
public Naturalize(UUID ownerId){

View file

@ -33,7 +33,6 @@ import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.game.Game;
import mage.game.permanent.token.Token;
import mage.players.Player;
/**
*

View file

@ -36,7 +36,6 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.game.ExileZone;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -46,17 +45,24 @@ public class ReturnFromExileEffect extends OneShotEffect<ReturnFromExileEffect>
private UUID exileId;
private Zone zone;
private boolean tapped;
public ReturnFromExileEffect(UUID exileId, Zone zone) {
this(exileId, zone, false);
}
public ReturnFromExileEffect(UUID exileId, Zone zone, boolean tapped) {
super(Outcome.PutCardInPlay);
this.exileId = exileId;
this.zone = zone;
this.tapped = tapped;
}
public ReturnFromExileEffect(final ReturnFromExileEffect effect) {
super(effect);
this.exileId = effect.exileId;
this.zone = effect.zone;
this.tapped = effect.tapped;
}
@Override
@ -70,7 +76,7 @@ public class ReturnFromExileEffect extends OneShotEffect<ReturnFromExileEffect>
if (exile != null) {
for (UUID cardId: exile) {
Card card = game.getCard(cardId);
card.moveToZone(zone, game, false);
card.moveToZone(zone, game, tapped);
}
exile.clear();
return true;
@ -85,6 +91,8 @@ public class ReturnFromExileEffect extends OneShotEffect<ReturnFromExileEffect>
switch(zone) {
case BATTLEFIELD:
sb.append("to the battlefield under its owner's control");
if (tapped)
sb.append(" tapped");
break;
case HAND:
sb.append("to their owner's hand");

View file

@ -182,10 +182,9 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
this.expansionSetCode = expansionSetCode;
}
@Override
public boolean moveToZone(Zone toZone, Game game, boolean flag) {
public boolean moveToZone(Zone toZone, UUID controllerId, Game game, boolean flag) {
Zone fromZone = zone;
ZoneChangeEvent event = new ZoneChangeEvent(this.getId(), ownerId, fromZone, toZone);
ZoneChangeEvent event = new ZoneChangeEvent(this.getId(), controllerId, fromZone, toZone);
if (!game.replaceEvent(event)) {
switch (event.getToZone()) {
case GRAVEYARD:
@ -208,15 +207,22 @@ public abstract class CardImpl<T extends CardImpl<T>> extends MageObjectImpl<T>
game.getBattlefield().addPermanent(permanent);
permanent.entersBattlefield(game);
game.applyEffects();
if (flag)
permanent.setTapped(true);
break;
}
zone = event.getToZone();
game.fireEvent(new ZoneChangeEvent(this.getId(), ownerId, fromZone, event.getToZone()));
game.fireEvent(event);
return zone == toZone;
}
return false;
}
@Override
public boolean moveToZone(Zone toZone, Game game, boolean flag) {
return moveToZone(toZone, ownerId, game, flag);
}
@Override
public boolean moveToExile(UUID exileId, String name, Game game) {
Zone fromZone = zone;

View file

@ -37,6 +37,7 @@ import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.keyword.LevelAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.LevelerCard;
import mage.game.Game;
import mage.game.events.ZoneChangeEvent;
@ -116,8 +117,8 @@ public class PermanentCard extends PermanentImpl<PermanentCard> {
ZoneChangeEvent event = new ZoneChangeEvent(this.getId(), this.getControllerId(), Zone.BATTLEFIELD, zone);
if (!game.replaceEvent(event)) {
if (game.getPlayer(controllerId).removeFromBattlefield(this, game)) {
Card card = game.getCard(objectId);
return card.moveToZone(event.getToZone(), game, flag);
CardImpl card = (CardImpl) game.getCard(objectId);
return card.moveToZone(event.getToZone(), controllerId, game, flag);
}
}
return false;

View file

@ -344,6 +344,7 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
this.removeFromCombat(game);
this.controlledFromStartOfTurn = false;
this.controllerId = controllerId;
this.abilities.setControllerId(controllerId);
return true;
}
}