Additional fixes and improves for PR #6641

This commit is contained in:
Oleg Agafonov 2020-06-16 12:31:26 +04:00
parent bb391e92bb
commit 98feb0dd95
4 changed files with 43 additions and 52 deletions

View file

@ -12,42 +12,41 @@ import mage.abilities.effects.common.ExileTop3MayPlayUntilEndOfTurnEffect;
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneTargetEffect;
import mage.abilities.effects.common.discard.DiscardHandControllerEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.cards.*;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.Target;
import mage.target.common.TargetAnyTarget;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetCardInYourGraveyard;
import mage.target.targetpointer.FixedTargets;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
/**
*
* @author htrajan
*/
public final class ChandraHeartOfFire extends CardImpl {
public ChandraHeartOfFire(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{3}{R}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.CHANDRA);
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5));
// +1: Discard your hand, then exile the top three cards of your library. Until end of turn, you may play cards exiled this way.
Ability ability = new LoyaltyAbility(new DiscardHandControllerEffect(), 1);
ability.addEffect(new ExileTop3MayPlayUntilEndOfTurnEffect() {{
setText(", then " + getText(null));
}});
ability.addEffect(new ExileTop3MayPlayUntilEndOfTurnEffect().concatBy(", then"));
this.addAbility(ability);
// +1: Chandra, Heart of Fire deals 2 damage to any target.
@ -73,7 +72,7 @@ public final class ChandraHeartOfFire extends CardImpl {
class ChandraHeartOfFireUltimateEffect extends OneShotEffect {
private static final FilterCard filter = new FilterCard();
private static final FilterCard filter = new FilterCard("red instant or sorcery");
static {
filter.add(new ColorPredicate(ObjectColor.RED));
@ -100,22 +99,22 @@ class ChandraHeartOfFireUltimateEffect extends OneShotEffect {
if (controller != null) {
Set<Card> exiledCards = new HashSet<>();
filter.setMessage("red instant or sorcery in your graveyard");
TargetCard target = new TargetCard(0, Integer.MAX_VALUE, Zone.GRAVEYARD, filter);
if (controller.choose(Outcome.Exile, controller.getGraveyard(), target, game)) {
List<UUID> targets = target.getTargets();
controller.moveCards(new CardsImpl(targets), Zone.EXILED, source, game);
exiledCards.addAll(targets.stream().map(game::getCard).collect(Collectors.toList()));
// from graveyard
Target target = new TargetCardInYourGraveyard(0, Integer.MAX_VALUE, filter, true).withChooseHint("from graveyard");
if (target.canChoose(source.getSourceId(), controller.getId(), game)
&& target.choose(Outcome.AIDontUseIt, controller.getId(), source.getSourceId(), game)) {
Set<Card> cards = new CardsImpl(target.getTargets()).getCards(game);
controller.moveCards(cards, Zone.EXILED, source, game);
exiledCards.addAll(cards);
}
filter.setMessage("red instant or sorcery in your library");
Cards cardsInLibrary = new CardsImpl();
cardsInLibrary.addAll(controller.getLibrary().getCards(game));
target = new TargetCardInLibrary(0, Integer.MAX_VALUE, filter);
if (controller.choose(Outcome.Exile, cardsInLibrary, target, game)) {
List<UUID> targets = target.getTargets();
controller.moveCards(new CardsImpl(targets), Zone.EXILED, source, game);
exiledCards.addAll(targets.stream().map(game::getCard).collect(Collectors.toList()));
// from library
target = new TargetCardInLibrary(0, Integer.MAX_VALUE, filter).withChooseHint("from library");
if (target.canChoose(source.getSourceId(), controller.getId(), game)
&& target.choose(Outcome.AIDontUseIt, controller.getId(), source.getSourceId(), game)) {
Set<Card> cards = new CardsImpl(target.getTargets()).getCards(game);
controller.moveCards(cards, Zone.EXILED, source, game);
exiledCards.addAll(cards);
}
controller.shuffleLibrary(source, game);

View file

@ -2,7 +2,6 @@ package mage.cards.c;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
@ -17,17 +16,17 @@ import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import java.util.Objects;
import java.util.UUID;
/**
*
* @author htrajan
*/
public final class ChandrasPyreling extends CardImpl {
public ChandrasPyreling(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}");
this.subtype.add(SubType.ELEMENTAL);
this.subtype.add(SubType.LIZARD);
this.power = new MageInt(1);
@ -49,16 +48,13 @@ public final class ChandrasPyreling extends CardImpl {
class ChandrasPyrelingAbility extends TriggeredAbilityImpl {
private static final Effect effect = new BoostSourceEffect(1, 0, Duration.EndOfTurn);
ChandrasPyrelingAbility() {
super(Zone.BATTLEFIELD, effect);
super(Zone.BATTLEFIELD, new BoostSourceEffect(1, 0, Duration.EndOfTurn));
addEffect(new GainAbilitySourceEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn));
}
private ChandrasPyrelingAbility(ChandrasPyrelingAbility ability) {
private ChandrasPyrelingAbility(final ChandrasPyrelingAbility ability) {
super(ability);
addEffect(new GainAbilitySourceEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn));
}
@Override
@ -76,7 +72,7 @@ class ChandrasPyrelingAbility extends TriggeredAbilityImpl {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
return !damageEvent.isCombatDamage()
&& game.getOpponents(controllerId).contains(event.getTargetId())
&& game.getControllerId(event.getSourceId()).equals(controllerId);
&& Objects.equals(controllerId, game.getControllerId(event.getSourceId()));
}
@Override

View file

@ -1,5 +1,5 @@
/*
*
*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
@ -25,12 +25,11 @@
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*
*
*/
package mage.cards.k;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -40,21 +39,19 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.replacement.DealtDamageToCreatureBySourceDies;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.constants.*;
import mage.target.common.TargetAnyTarget;
import mage.watchers.common.DamagedByWatcher;
import java.util.UUID;
/**
* @author LevelX
*/
public final class KumanoMasterYamabushi extends CardImpl {
public KumanoMasterYamabushi(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{R}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}{R}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.SHAMAN);
@ -62,13 +59,13 @@ public final class KumanoMasterYamabushi extends CardImpl {
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// {{1}{R}: Kumano, Master Yamabushi deals 1 damage to any target.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}") );
// {1}{R}: Kumano, Master Yamabushi deals 1 damage to any target.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new ManaCostsImpl("{1}{R}"));
ability.addTarget(new TargetAnyTarget());
this.addAbility(ability);
// If a creature dealt damage by Kumano this turn would die, exile it instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DealtDamageToCreatureBySourceDies(this, Duration.WhileOnBattlefield)), new DamagedByWatcher(false));
}
public KumanoMasterYamabushi(final KumanoMasterYamabushi card) {

View file

@ -1,7 +1,5 @@
package mage.cards.o;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -12,22 +10,22 @@ import mage.abilities.mana.WhiteManaAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class OrzhovKeyrune extends CardImpl {
public OrzhovKeyrune(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {{T}: Add {W} or {B}.
// {T}: Add {W} or {B}.
this.addAbility(new WhiteManaAbility());
this.addAbility(new BlackManaAbility());
@ -56,6 +54,7 @@ public final class OrzhovKeyrune extends CardImpl {
toughness = new MageInt(4);
this.addAbility(LifelinkAbility.getInstance());
}
public OrzhovKeyruneToken(final OrzhovKeyruneToken token) {
super(token);
}