Merge origin/master

This commit is contained in:
Styxo 2016-04-06 20:23:15 +02:00
commit 7ff31fb12e
92 changed files with 2894 additions and 775 deletions

View file

@ -32,6 +32,7 @@ import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.Duration;
@ -90,6 +91,10 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
UUID sourceId = event.getSourceId();
UUID controllerId = event.getPlayerId();
if (game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null) {
card = card.getSecondCardFace();
}
// Aura cards that go to battlefield face down (Manifest) don't have to select targets
if (card.isFaceDown(game)) {
return false;
@ -167,6 +172,7 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
}
Player targetPlayer = game.getPlayer(targetId);
if (targetCard != null || targetPermanent != null || targetPlayer != null) {
card = game.getCard(event.getTargetId());
card.removeFromZone(game, fromZone, sourceId);
card.updateZoneChangeCounter(game);
PermanentCard permanent = new PermanentCard(card, (controllingPlayer == null ? card.getOwnerId() : controllingPlayer.getId()), game);
@ -200,7 +206,12 @@ public class AuraReplacementEffect extends ReplacementEffectImpl {
if (((ZoneChangeEvent) event).getToZone().equals(Zone.BATTLEFIELD)
&& !(((ZoneChangeEvent) event).getFromZone().equals(Zone.STACK))) {
Card card = game.getCard(event.getTargetId());
if (card != null && card.getCardType().contains(CardType.ENCHANTMENT) && card.hasSubtype("Aura")) {
if (card != null && (card.getCardType().contains(CardType.ENCHANTMENT) && card.hasSubtype("Aura")
|| // in case of transformable enchantments
(game.getState().getValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + card.getId()) != null
&& card.getSecondCardFace() != null
&& card.getSecondCardFace().getCardType().contains(CardType.ENCHANTMENT)
&& card.getSecondCardFace().hasSubtype("Aura")))) {
return true;
}
}

View file

@ -90,6 +90,10 @@ public class DoIfCostPaid extends OneShotEffect {
return game.getPlayer(source.getControllerId());
}
public Cost getCost() {
return cost;
}
@Override
public String getText(Mode mode) {
if (!staticText.isEmpty()) {

View file

@ -31,6 +31,7 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.Outcome;
import mage.constants.Zone;
@ -78,20 +79,30 @@ public class ReturnToBattlefieldUnderOwnerControlTargetEffect extends OneShotEff
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Card card = null;
Cards cardsToMove = new CardsImpl();
if (fromExileZone) {
UUID exilZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
if (exilZoneId != null) {
ExileZone exileZone = game.getExile().getExileZone(exilZoneId);
if (exileZone != null && getTargetPointer().getFirst(game, source) != null) {
card = exileZone.get(getTargetPointer().getFirst(game, source), game);
if (exileZone != null) {
for (UUID cardId : getTargetPointer().getTargets(game, source)) {
Card card = exileZone.get(cardId, game);
if (card != null) {
cardsToMove.add(card);
}
}
}
}
} else {
card = game.getCard(getTargetPointer().getFirst(game, source));
for (UUID cardId : getTargetPointer().getTargets(game, source)) {
Card card = game.getCard(cardId);
if (card != null) {
cardsToMove.add(card);
}
}
}
if (card != null) {
controller.moveCards(new CardsImpl(card).getCards(game),
if (!cardsToMove.isEmpty()) {
controller.moveCards(cardsToMove.getCards(game),
Zone.BATTLEFIELD, source, game, tapped, false, true, null);
return true;
}