updated various activated abilities

This commit is contained in:
Evan Kranzler 2017-09-12 12:14:01 -04:00
parent 786a62befa
commit a26c5a509f
10 changed files with 163 additions and 181 deletions

View file

@ -25,28 +25,24 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.ActivatedAbilityImpl;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.costs.mana.ColoredManaCost;
import mage.abilities.condition.common.SourceAttackingCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
@ -55,19 +51,37 @@ import mage.target.common.TargetCreaturePermanent;
*/
public class AncientHellkite extends CardImpl {
private final UUID originalId;
public AncientHellkite(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{R}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}{R}");
this.subtype.add(SubType.DRAGON);
this.power = new MageInt(6);
this.toughness = new MageInt(6);
this.addAbility(FlyingAbility.getInstance());
this.addAbility(new AncientHellkiteAbility());
Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{R}"), SourceAttackingCondition.instance);
ability.addTarget(new TargetCreaturePermanent(new FilterCreaturePermanent("creature defending player controls")));
originalId = ability.getOriginalId();
this.addAbility(ability);
}
public AncientHellkite(final AncientHellkite card) {
super(card);
this.originalId = card.originalId;
}
@Override
public void adjustTargets(Ability ability, Game game) {
if (ability.getOriginalId().equals(originalId)) {
ability.getTargets().clear();
FilterCreaturePermanent filter = new FilterCreaturePermanent("creature defending player controls");
UUID defenderId = game.getCombat().getDefenderId(ability.getSourceId());
filter.add(new ControllerIdPredicate(defenderId));
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
ability.addTarget(target);
}
}
@Override
@ -76,71 +90,3 @@ public class AncientHellkite extends CardImpl {
}
}
class AncientHellkiteAbility extends ActivatedAbilityImpl {
private static final FilterCreaturePermanent filterTemplate = new FilterCreaturePermanent("creature defending player controls");
public AncientHellkiteAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(1));
addCost(new AncientHellkiteCost());
addManaCost(new ColoredManaCost(ColoredManaSymbol.R));
addTarget(new TargetCreaturePermanent(filterTemplate));
}
public AncientHellkiteAbility(final AncientHellkiteAbility ability) {
super(ability);
}
@Override
public AncientHellkiteAbility copy() {
return new AncientHellkiteAbility(this);
}
@Override
public boolean activate(Game game, boolean noMana) {
UUID defenderId = game.getCombat().getDefenderId(sourceId);
if (defenderId != null) {
FilterCreaturePermanent filter = filterTemplate.copy();
filter.add(new ControllerIdPredicate(defenderId));
this.getTargets().clear();
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
this.addTarget(target);
return super.activate(game, noMana);
}
return false;
}
}
class AncientHellkiteCost extends CostImpl {
public AncientHellkiteCost() {
this.text = "Activate this ability only if Ancient Hellkite is attacking";
}
public AncientHellkiteCost(final AncientHellkiteCost cost) {
super(cost);
}
@Override
public AncientHellkiteCost copy() {
return new AncientHellkiteCost(this);
}
@Override
public boolean canPay(Ability ability, UUID sourceId, UUID controllerId, Game game) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.isAttacking()) {
return true;
}
return false;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
this.paid = true;
return paid;
}
}

View file

@ -29,13 +29,13 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
@ -43,6 +43,7 @@ import mage.abilities.keyword.FirstStrikeAbility;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.Game;
@ -55,7 +56,7 @@ import mage.players.Player;
public class BrutalDeceiver extends CardImpl {
public BrutalDeceiver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(2);
@ -65,9 +66,7 @@ public class BrutalDeceiver extends CardImpl {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryControllerEffect(), new GenericManaCost(1)));
// {2}: Reveal the top card of your library. If it's a land card, {this} gets +1/+0 and gains first strike until end of turn.
Ability ability = new BrutalDeceiverAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{2}"));
ability.addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn));
this.addAbility(ability);
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new BrutalDeceiverEffect(), new ManaCostsImpl("{2}")));
}
public BrutalDeceiver(final BrutalDeceiver card) {
@ -80,38 +79,39 @@ public class BrutalDeceiver extends CardImpl {
}
}
class BrutalDeceiverAbility extends LimitedTimesPerTurnActivatedAbility {
class BrutalDeceiverEffect extends OneShotEffect {
public BrutalDeceiverAbility(Zone zone, Effect effect, Cost cost) {
super(zone, effect, cost);
public BrutalDeceiverEffect() {
super(Outcome.BoostCreature);
this.staticText = "Reveal the top card of your library. If it's a land card, {this} gets +1/+0 and gains first strike until end of turn";
}
public BrutalDeceiverAbility(BrutalDeceiverAbility ability) {
super(ability);
public BrutalDeceiverEffect(final BrutalDeceiverEffect effect) {
super(effect);
}
@Override
public BrutalDeceiverAbility copy() {
return new BrutalDeceiverAbility(this);
public BrutalDeceiverEffect copy() {
return new BrutalDeceiverEffect(this);
}
@Override
public boolean checkIfClause(Game game) {
Player player = game.getPlayer(this.getControllerId());
if (player != null) {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
Cards cards = new CardsImpl();
Card card = player.getLibrary().getFromTop(game);
cards.add(card);
player.revealCards("Brutal Deceiver", cards, game);
if (card != null && card.isLand()) {
return true;
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
cards.add(card);
controller.revealCards(sourceObject.getIdName(), cards, game);
if (card.isLand()) {
game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source);
game.addEffect(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), source);
}
}
return true;
}
return false;
}
@Override
public String getRule() {
return "{2}: Reveal the top card of your library. If it's a land card, {this} gets +1/+0 and gains first strike until end of turn. Activate this ability only once each turn.";
}
}

View file

@ -56,7 +56,7 @@ import mage.players.Player;
public class CallousDeceiver extends CardImpl {
public CallousDeceiver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(1);

View file

@ -29,16 +29,18 @@ package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.DealsDamageToACreatureTriggeredAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.*;
import mage.constants.CardType;
import mage.constants.SubType;
@ -55,7 +57,7 @@ import mage.players.Player;
public class CruelDeceiver extends CardImpl {
public CruelDeceiver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(2);
@ -82,7 +84,7 @@ class CruelDeceiverEffect extends OneShotEffect {
public CruelDeceiverEffect() {
super(Outcome.AddAbility);
this.staticText = "Reveal the top card of your library. If it's a land card, {this} gets +2/+2 and gains trample until end of turn";
this.staticText = "Reveal the top card of your library. If it's a land card, Cruel Deceiver gains \"Whenever Cruel Deceiver deals damage to a creature, destroy that creature\" until end of turn";
}
public CruelDeceiverEffect(final CruelDeceiverEffect effect) {
@ -96,15 +98,18 @@ class CruelDeceiverEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
Cards cards = new CardsImpl();
Card card = player.getLibrary().getFromTop(game);
cards.add(card);
player.revealCards("Cruel Deceiver", cards, game);
if (card != null && card.isLand()) {
game.addEffect(new BoostSourceEffect(2,2,Duration.EndOfTurn), source);
game.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(),Duration.EndOfTurn), source);
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
cards.add(card);
controller.revealCards(sourceObject.getIdName(), cards, game);
if (card.isLand()) {
game.addEffect(new BoostSourceEffect(1, 0, Duration.EndOfTurn), source);
game.addEffect(new GainAbilitySourceEffect(new DealsDamageToACreatureTriggeredAbility(new DestroyTargetEffect(true), false, false, true), Duration.EndOfTurn), source);
}
}
return true;
}

View file

@ -29,21 +29,29 @@ package mage.cards.f;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.FeralDeceiverAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -52,19 +60,17 @@ import mage.constants.Zone;
public class FeralDeceiver extends CardImpl {
public FeralDeceiver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{G}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// {1}: Look at the top card of your library.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryControllerEffect(), new GenericManaCost(1)));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryControllerEffect(), new GenericManaCost(1)));
// {2}: Reveal the top card of your library. If it's a land card, {this} gets +2/+2 and gains trample until end of turn.
Ability ability = new FeralDeceiverAbility(Zone.BATTLEFIELD, new BoostSourceEffect(2,2,Duration.EndOfTurn), new ManaCostsImpl("{2}"));
ability.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(),Duration.EndOfTurn));
this.addAbility(ability);
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new FeralDeceiverEffect(), new ManaCostsImpl("{2}")));
}
public FeralDeceiver(final FeralDeceiver card) {
@ -77,3 +83,39 @@ public class FeralDeceiver extends CardImpl {
}
}
class FeralDeceiverEffect extends OneShotEffect {
public FeralDeceiverEffect() {
super(Outcome.BoostCreature);
this.staticText = "Reveal the top card of your library. If it's a land card, {this} gets +2/+2 and gains trample until end of turn";
}
public FeralDeceiverEffect(final FeralDeceiverEffect effect) {
super(effect);
}
@Override
public FeralDeceiverEffect copy() {
return new FeralDeceiverEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
Cards cards = new CardsImpl();
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
cards.add(card);
controller.revealCards(sourceObject.getIdName(), cards, game);
if (card.isLand()) {
game.addEffect(new BoostSourceEffect(2, 2, Duration.EndOfTurn), source);
game.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn), source);
}
}
return true;
}
return false;
}
}

View file

@ -29,20 +29,28 @@ package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.FeralDeceiverAbility;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.LookLibraryControllerEffect;
import mage.abilities.effects.common.UntapSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -51,19 +59,17 @@ import mage.constants.Zone;
public class HarshDeceiver extends CardImpl {
public HarshDeceiver(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// {1}: Look at the top card of your library.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryControllerEffect(), new GenericManaCost(1)));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new LookLibraryControllerEffect(), new GenericManaCost(1)));
// {2}: Reveal the top card of your library. If it's a land card, untap {this} and it gets +1/+1 until end of turn.
Ability ability = new FeralDeceiverAbility(Zone.BATTLEFIELD, new UntapSourceEffect(), new ManaCostsImpl("{2}"));
ability.addEffect(new BoostSourceEffect(1,1,Duration.EndOfTurn));
this.addAbility(ability);
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD, new HarshDeceiverEffect(), new ManaCostsImpl("{2}")));
}
public HarshDeceiver(final HarshDeceiver card) {
@ -75,3 +81,40 @@ public class HarshDeceiver extends CardImpl {
return new HarshDeceiver(this);
}
}
class HarshDeceiverEffect extends OneShotEffect {
public HarshDeceiverEffect() {
super(Outcome.BoostCreature);
this.staticText = "Reveal the top card of your library. If it's a land card, untap {this} and it gets +1/+1 until end of turn";
}
public HarshDeceiverEffect(final HarshDeceiverEffect effect) {
super(effect);
}
@Override
public HarshDeceiverEffect copy() {
return new HarshDeceiverEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (controller != null && sourceObject != null) {
Cards cards = new CardsImpl();
Card card = controller.getLibrary().getFromTop(game);
if (card != null) {
cards.add(card);
controller.revealCards(sourceObject.getIdName(), cards, game);
if (card.isLand()) {
new UntapSourceEffect().apply(game, source);
game.addEffect(new BoostSourceEffect(1, 1, Duration.EndOfTurn), source);
}
}
return true;
}
return false;
}
}