diff --git a/Mage.Sets/src/mage/sets/alarareborn/SkyclawThrash.java b/Mage.Sets/src/mage/sets/alarareborn/SkyclawThrash.java index f8b4020ec29..1bfe1efdb11 100644 --- a/Mage.Sets/src/mage/sets/alarareborn/SkyclawThrash.java +++ b/Mage.Sets/src/mage/sets/alarareborn/SkyclawThrash.java @@ -29,9 +29,22 @@ package mage.sets.alarareborn; import java.util.UUID; import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.AttacksTriggeredAbility; +import mage.abilities.effects.ContinuousEffect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.abilities.keyword.FlyingAbility; import mage.cards.CardImpl; import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; import mage.constants.Rarity; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.players.Player; +import mage.target.targetpointer.FixedTarget; /** * @@ -45,12 +58,11 @@ public class SkyclawThrash extends CardImpl { this.subtype.add("Viashino"); this.subtype.add("Warrior"); - - this.power = new MageInt(4); this.toughness = new MageInt(4); // Whenever Skyclaw Thrash attacks, flip a coin. If you win the flip, Skyclaw Thrash gets +1/+1 and gains flying until end of turn. + this.addAbility(new AttacksTriggeredAbility(new SkyclawThrashEffect(), false)); } public SkyclawThrash(final SkyclawThrash card) { @@ -62,3 +74,38 @@ public class SkyclawThrash extends CardImpl { return new SkyclawThrash(this); } } + +class SkyclawThrashEffect extends OneShotEffect { + + public SkyclawThrashEffect() { + super(Outcome.Benefit); + this.staticText = "flip a coin. If you win the flip, {this} gets +1/+1 and gains flying until end of turn"; + } + + public SkyclawThrashEffect(final SkyclawThrashEffect effect) { + super(effect); + } + + @Override + public SkyclawThrashEffect copy() { + return new SkyclawThrashEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player controller = game.getPlayer(source.getControllerId()); + if (controller != null) { + Permanent sourcePermanent = game.getPermanent(source.getSourceId()); + if (controller.flipCoin(game) && sourcePermanent != null) { + ContinuousEffect effect = new BoostTargetEffect(1, 1, Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(sourcePermanent, game)); + game.addEffect(effect, source); + effect = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn); + effect.setTargetPointer(new FixedTarget(sourcePermanent, game)); + game.addEffect(effect, source); + } + return true; + } + return false; + } +} diff --git a/Mage.Sets/src/mage/sets/morningtide/ReinsOfTheVinesteed.java b/Mage.Sets/src/mage/sets/morningtide/ReinsOfTheVinesteed.java index 7700423271c..28f8d0aed7a 100644 --- a/Mage.Sets/src/mage/sets/morningtide/ReinsOfTheVinesteed.java +++ b/Mage.Sets/src/mage/sets/morningtide/ReinsOfTheVinesteed.java @@ -123,12 +123,15 @@ class ReinsOfTheVinesteedEffect extends OneShotEffect { sb.delete(sb.length() - 2, sb.length()); FILTER.setMessage(sb.toString()); TargetPermanent target = new TargetPermanent(FILTER); + target.setNotTarget(true); if (controller != null && controller.choose(Outcome.PutCardInPlay, target, source.getSourceId(), game)) { Permanent targetPermanent = game.getPermanent(target.getFirstTarget()); - game.getState().setValue("attachTo:" + aura.getId(), targetPermanent); - aura.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), controller.getId()); - return targetPermanent.addAttachment(aura.getId(), game); + if (!targetPermanent.cantBeEnchantedBy(aura, game)) { + game.getState().setValue("attachTo:" + aura.getId(), targetPermanent); + aura.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), controller.getId()); + return targetPermanent.addAttachment(aura.getId(), game); + } } } return false;