Merge origin/master

This commit is contained in:
LevelX2 2018-07-16 17:43:34 +02:00
commit fa2c008359
5 changed files with 44 additions and 40 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.d;
import java.util.UUID;
@ -34,7 +33,15 @@ public final class DreadWanderer extends CardImpl {
// {2}{B}: Return Dread Wanderer from your graveyard to the battlefield.
// Activate this ability only any time you could cast a sorcery and only if you have one or fewer cards in hand.
ConditionalActivatedAbility ability = new ConditionalActivatedAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), new ManaCostsImpl("{2}{B}"), HeckbentCondition.instance);
ConditionalActivatedAbility ability = new ConditionalActivatedAbility(
Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToBattlefieldEffect(),
new ManaCostsImpl("{2}{B}"),
HeckbentCondition.instance,
"{2}{B}: Return {this} from your graveyard to the battlefield. "
+ "Activate this ability only any time you could cast a sorcery "
+ "and only if you have one or fewer cards in hand."
);
ability.setTiming(TimingRule.SORCERY);
addAbility(ability);
}

View file

@ -1,27 +1,24 @@
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.effects.common.SendOptionUsedEventEffect;
import mage.abilities.keyword.EmbalmAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
@ -41,13 +38,11 @@ public final class HeartPiercerManticore extends CardImpl {
this.power = new MageInt(4);
this.toughness = new MageInt(3);
// When Heart-Piercer Manticore enters the battlefield, you may sacrifice another creature.
Ability firstAbility = new EntersBattlefieldTriggeredAbility(new HeartPiercerManticoreSacrificeEffect(), true);
this.addAbility(firstAbility);
// When you do, Heart-Piercer Manticore deals damage equal to that creature's power to any target.
Ability secondAbility = new HeartPiercerManticoreSacrificeTriggeredAbility(firstAbility.getOriginalId());
secondAbility.addTarget(new TargetAnyTarget());
this.addAbility(secondAbility);
// When Heart-Piercer Manticore enters the battlefield, you may sacrifice another creature. When you do, Heart-Piercer Manticore deals damage equal to that creature's power to any target.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new HeartPiercerManticoreSacrificeEffect(), true
));
// Embalm {5}{R}
this.addAbility(new EmbalmAbility(new ManaCostsImpl("{5}{R}"), this));
@ -67,7 +62,8 @@ class HeartPiercerManticoreSacrificeEffect extends OneShotEffect {
public HeartPiercerManticoreSacrificeEffect() {
super(Outcome.Damage);
this.staticText = "you may sacrifice another creature";
this.staticText = "sacrifice another creature. When you do, "
+ "{this} deals damage equal to that creature's power to any target";
}
public HeartPiercerManticoreSacrificeEffect(final HeartPiercerManticoreSacrificeEffect effect) {
@ -87,8 +83,11 @@ class HeartPiercerManticoreSacrificeEffect extends OneShotEffect {
if (controller.choose(outcome, target, source.getSourceId(), game)) {
Permanent toSacrifice = game.getPermanent(target.getFirstTarget());
if (toSacrifice != null) {
toSacrifice.sacrifice(source.getSourceId(), game);
return new SendOptionUsedEventEffect(toSacrifice.getPower().getValue()).apply(game, source);
DelayedTriggeredAbility trigger = new HeartPiercerManticoreReflexiveTriggeredAbility(toSacrifice.getPower().getValue());
if (toSacrifice.sacrifice(source.getSourceId(), game)) {
game.addDelayedTriggeredAbility(trigger, source);
return new SendOptionUsedEventEffect().apply(game, source);
}
}
}
return true;
@ -97,44 +96,36 @@ class HeartPiercerManticoreSacrificeEffect extends OneShotEffect {
}
}
class HeartPiercerManticoreSacrificeTriggeredAbility extends TriggeredAbilityImpl {
class HeartPiercerManticoreReflexiveTriggeredAbility extends DelayedTriggeredAbility {
private final UUID relatedTriggerdAbilityOriginalId;
public HeartPiercerManticoreSacrificeTriggeredAbility(UUID relatedTriggerdAbilityOriginalId) {
super(Zone.BATTLEFIELD, new InfoEffect("{this} deals damage equal to that creature's power to any target"));
this.relatedTriggerdAbilityOriginalId = relatedTriggerdAbilityOriginalId;
public HeartPiercerManticoreReflexiveTriggeredAbility(int damage) {
super(new DamageTargetEffect(damage), Duration.OneUse, true);
this.addTarget(new TargetAnyTarget());
}
public HeartPiercerManticoreSacrificeTriggeredAbility(final HeartPiercerManticoreSacrificeTriggeredAbility ability) {
public HeartPiercerManticoreReflexiveTriggeredAbility(final HeartPiercerManticoreReflexiveTriggeredAbility ability) {
super(ability);
this.relatedTriggerdAbilityOriginalId = ability.relatedTriggerdAbilityOriginalId;
}
@Override
public HeartPiercerManticoreSacrificeTriggeredAbility copy() {
return new HeartPiercerManticoreSacrificeTriggeredAbility(this);
public HeartPiercerManticoreReflexiveTriggeredAbility copy() {
return new HeartPiercerManticoreReflexiveTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.OPTION_USED;
return event.getType() == GameEvent.EventType.OPTION_USED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getPlayerId().equals(this.getControllerId())
&& event.getTargetId().equals(relatedTriggerdAbilityOriginalId)
&& event.getSourceId().equals(getSourceId())) {
getEffects().clear();
getEffects().add(new DamageTargetEffect(event.getAmount()));
return true;
}
return false;
return event.getPlayerId().equals(this.getControllerId())
&& event.getSourceId().equals(this.getSourceId());
}
@Override
public String getRule() {
return "When you do, {this} deals damage equal to that creature's power to any target.";
return "When you sacrifice a creature to {this}'s ability, "
+ "{this} deals damage equal to that creature's power to any target";
}
}

View file

@ -16,6 +16,7 @@ import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.StaticFilters;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.other.OwnerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
@ -76,7 +77,7 @@ class VirtussManeuverEffect extends OneShotEffect {
if (player == null) {
continue;
}
FilterCard filter = new FilterCard("card in your graveyard");
FilterCard filter = new FilterCreatureCard("creature card in your graveyard");
filter.add(new OwnerIdPredicate(player.getId()));
TargetCardInGraveyard target = new TargetCardInGraveyard(filter);
getBackMap.put(player.getId(), null);

View file

@ -14,6 +14,7 @@ import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
@ -56,8 +57,11 @@ public final class VivienReid extends CardImpl {
// +1: Look at the top four cards of your library. You may reveal a creature or land card from among them and put it into your hand. Put the rest on the bottom of your library in any order.
this.addAbility(new LoyaltyAbility(
new LookLibraryAndPickControllerEffect(
new StaticValue(4), false, new StaticValue(1), filter, false
), 1
new StaticValue(4), false, new StaticValue(1), filter,
Zone.LIBRARY, false, true, false, Zone.HAND, true, false, false)
.setBackInRandomOrder(true)
.setText("Look at the top four cards of your library. You may reveal a creature or land card from among them"
+ " and put it into your hand. Put the rest on the bottom of your library in a random order."), 1
));
// -3: Destroy target artifact, enchantment, or creature with flying.

View file

@ -61,6 +61,7 @@ public class LookLibraryAndPickControllerEffect extends LookLibraryControllerEff
private boolean putOnTopSelected;
private boolean anyOrder;
//TODO: These constructors are a mess
public LookLibraryAndPickControllerEffect(DynamicValue numberOfCards,
boolean mayShuffleAfter, DynamicValue numberToPick,
FilterCard pickFilter, boolean putOnTop) {