This commit is contained in:
jeffwadsworth 2019-11-24 19:45:01 -06:00
parent 75b82018e1
commit 8b8d21d4ad

View file

@ -18,7 +18,10 @@ import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import static mage.constants.Layer.TypeChangingEffects_4;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
@ -98,25 +101,29 @@ class TezzeretCruelMachinistEffect extends OneShotEffect {
return false;
}
Cards cardsToMove = new CardsImpl();
for (UUID cardId : target.getTargets()) {
Card card = game.getCard(cardId);
if (card == null) {
continue;
}
cardsToMove.add(card);
ContinuousEffect effect = new TezzeretCruelMachinistCardTypeEffect();
effect.setTargetPointer(new FixedTarget(
ContinuousEffect effectCardType = new TezzeretCruelMachinistCardTypeEffect();
effectCardType.setTargetPointer(new FixedTarget(
card.getId(),
card.getZoneChangeCounter(game) + 1
));
game.addEffect(effect, source);
effect = new TezzeretCruelMachinistPowerToughnessEffect();
effect.setTargetPointer(new FixedTarget(
game.addEffect(effectCardType, source);
ContinuousEffect effectPowerToughness = new TezzeretCruelMachinistPowerToughnessEffect();
effectPowerToughness.setTargetPointer(new FixedTarget(
card.getId(),
card.getZoneChangeCounter(game) + 1
));
game.addEffect(effect, source);
game.addEffect(effectPowerToughness, source);
}
return player.moveCards(cardsToMove.getCards(game), Zone.BATTLEFIELD, source, game, false, true, true, null);
}
}
@ -137,13 +144,24 @@ class TezzeretCruelMachinistCardTypeEffect extends AddCardTypeTargetEffect {
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null || !permanent.isFaceDown(game)) {
this.discard();
return false;
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
for (UUID targetId : targetPointer.getTargets(game, source)) {
Permanent target = game.getPermanent(targetId);
if (target != null
&& target.isFaceDown(game)) {
switch (layer) {
case TypeChangingEffects_4:
target.getSuperType().clear();
target.getCardType().clear();
target.getSubtype(game).clear();
target.addCardType(CardType.ARTIFACT);
target.addCardType(CardType.CREATURE);
break;
}
return true;
}
}
return super.apply(game, source);
return false;
}
}
@ -164,11 +182,16 @@ class TezzeretCruelMachinistPowerToughnessEffect extends SetPowerToughnessTarget
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent == null || !permanent.isFaceDown(game)) {
this.discard();
return false;
for (UUID targetId : this.getTargetPointer().getTargets(game, source)) {
Permanent target = game.getPermanent(targetId);
if (target != null
&& target.isFaceDown(game)) {
target.getPower().setValue(5);
target.getToughness().setValue(5);
break;
}
return true;
}
return super.apply(game, source);
return false;
}
}