* Skyclaw Thrash - Added missing ability.

This commit is contained in:
LevelX2 2016-03-07 23:41:02 +01:00
parent 6e4a4285b8
commit 1b3c72cc00

View file

@ -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;
}
}