mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
more fixes
This commit is contained in:
parent
ef38ff10e9
commit
8c2a347f4d
6 changed files with 159 additions and 167 deletions
|
@ -1,25 +1,12 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.asthought.PlayFromNotOwnHandZoneAllEffect;
|
||||
import mage.abilities.keyword.CyclingAbility;
|
||||
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.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.WatcherScope;
|
||||
import mage.constants.Zone;
|
||||
import mage.cards.*;
|
||||
import mage.constants.*;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.AbilityPredicate;
|
||||
|
@ -31,8 +18,12 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.watchers.Watcher;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class AbandonedSarcophagus extends CardImpl {
|
||||
|
@ -55,7 +46,7 @@ public final class AbandonedSarcophagus extends CardImpl {
|
|||
|
||||
}
|
||||
|
||||
public AbandonedSarcophagus(final AbandonedSarcophagus card) {
|
||||
private AbandonedSarcophagus(final AbandonedSarcophagus card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -67,15 +58,12 @@ public final class AbandonedSarcophagus extends CardImpl {
|
|||
|
||||
class AbandonedSarcophagusReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
boolean cardHasCycling;
|
||||
boolean cardWasCycledThisTurn;
|
||||
|
||||
public AbandonedSarcophagusReplacementEffect() {
|
||||
AbandonedSarcophagusReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Exile);
|
||||
staticText = "If a card with cycling would be put into your graveyard from anywhere and it wasn't cycled, exile it instead";
|
||||
}
|
||||
|
||||
public AbandonedSarcophagusReplacementEffect(final AbandonedSarcophagusReplacementEffect effect) {
|
||||
private AbandonedSarcophagusReplacementEffect(final AbandonedSarcophagusReplacementEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -112,34 +100,33 @@ class AbandonedSarcophagusReplacementEffect extends ReplacementEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
cardWasCycledThisTurn = false;
|
||||
cardHasCycling = false;
|
||||
if (((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD
|
||||
&& !game.isSimulation()) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
AbandonedSarcophagusWatcher watcher = (AbandonedSarcophagusWatcher) game.getState().getWatchers().get(AbandonedSarcophagusWatcher.class.getSimpleName());
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card != null
|
||||
&& controller != null
|
||||
&& watcher != null
|
||||
&& card.isOwnedBy(controller.getId())) {
|
||||
for (Ability ability : card.getAbilities()) {
|
||||
if (ability instanceof CyclingAbility) {
|
||||
cardHasCycling = true;
|
||||
}
|
||||
}
|
||||
Cards cards = watcher.getCardsCycledThisTurn(controller.getId());
|
||||
for (Card c : cards.getCards(game)) {
|
||||
if (c == card) {
|
||||
cardWasCycledThisTurn = true;
|
||||
watcher.getCardsCycledThisTurn(controller.getId()).remove(card); //remove reference to the card as it is no longer needed
|
||||
}
|
||||
}
|
||||
return (!cardWasCycledThisTurn
|
||||
&& cardHasCycling);
|
||||
boolean cardWasCycledThisTurn = false;
|
||||
boolean cardHasCycling = false;
|
||||
if (!(((ZoneChangeEvent) event).getToZone() == Zone.GRAVEYARD) || game.isSimulation()) {
|
||||
return false;
|
||||
}
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
AbandonedSarcophagusWatcher watcher = (AbandonedSarcophagusWatcher) game.getState().getWatchers().get(AbandonedSarcophagusWatcher.class.getSimpleName());
|
||||
Card card = game.getCard(event.getTargetId());
|
||||
if (card == null
|
||||
|| controller == null
|
||||
|| watcher == null
|
||||
|| !card.isOwnedBy(controller.getId())) {
|
||||
return false;
|
||||
}
|
||||
for (Ability ability : card.getAbilities()) {
|
||||
if (ability instanceof CyclingAbility) {
|
||||
cardHasCycling = true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
Cards cards = watcher.getCardsCycledThisTurn(controller.getId());
|
||||
for (Card c : cards.getCards(game)) {
|
||||
if (c == card) {
|
||||
cardWasCycledThisTurn = true;
|
||||
watcher.getCardsCycledThisTurn(controller.getId()).remove(card); //remove reference to the card as it is no longer needed
|
||||
}
|
||||
}
|
||||
return !cardWasCycledThisTurn && cardHasCycling;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,11 +134,11 @@ class AbandonedSarcophagusWatcher extends Watcher {
|
|||
|
||||
private final Map<UUID, Cards> cycledCardsThisTurn = new HashMap<>();
|
||||
|
||||
public AbandonedSarcophagusWatcher() {
|
||||
AbandonedSarcophagusWatcher() {
|
||||
super(AbandonedSarcophagusWatcher.class.getSimpleName(), WatcherScope.GAME);
|
||||
}
|
||||
|
||||
public AbandonedSarcophagusWatcher(final AbandonedSarcophagusWatcher watcher) {
|
||||
private AbandonedSarcophagusWatcher(final AbandonedSarcophagusWatcher watcher) {
|
||||
super(watcher);
|
||||
for (Entry<UUID, Cards> entry : watcher.cycledCardsThisTurn.entrySet()) {
|
||||
cycledCardsThisTurn.put(entry.getKey(), entry.getValue().copy());
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
|
||||
|
@ -17,8 +15,10 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.target.TargetPlayer;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author fireshoes
|
||||
*/
|
||||
public final class Abeyance extends CardImpl {
|
||||
|
@ -46,12 +46,13 @@ public final class Abeyance extends CardImpl {
|
|||
|
||||
class AbeyanceEffect extends ContinuousRuleModifyingEffectImpl {
|
||||
|
||||
public AbeyanceEffect() {
|
||||
AbeyanceEffect() {
|
||||
super(Duration.EndOfTurn, Outcome.Detriment);
|
||||
staticText = "Until end of turn, target player can't cast instant or sorcery spells, and that player can't activate abilities that aren't mana abilities";
|
||||
staticText = "Until end of turn, target player can't cast instant or sorcery spells, " +
|
||||
"and that player can't activate abilities that aren't mana abilities";
|
||||
}
|
||||
|
||||
public AbeyanceEffect(final AbeyanceEffect effect) {
|
||||
private AbeyanceEffect(final AbeyanceEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -69,29 +70,30 @@ class AbeyanceEffect extends ContinuousRuleModifyingEffectImpl {
|
|||
public String getInfoMessage(Ability source, GameEvent event, Game game) {
|
||||
MageObject mageObject = game.getObject(source.getSourceId());
|
||||
if (mageObject != null) {
|
||||
return "You can't cast instant or sorcery spells or activate abilities that aren't mana abilities this turn (" + mageObject.getIdName() + ").";
|
||||
return "You can't cast instant or sorcery spells or activate abilities " +
|
||||
"that aren't mana abilities this turn (" + mageObject.getIdName() + ").";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
if (source.getFirstTarget() != null && source.getFirstTarget().equals(event.getPlayerId())) {
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if(object == null){
|
||||
return false;
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.CAST_SPELL) {
|
||||
if (object.isInstant() || object.isSorcery()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||
Optional<Ability> ability = game.getAbility(event.getTargetId(), event.getSourceId());
|
||||
if (ability.isPresent() && !(ability.get() instanceof ActivatedManaAbilityImpl)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (source.getFirstTarget() != null
|
||||
&& source.getFirstTarget().equals(event.getPlayerId())) {
|
||||
return false;
|
||||
}
|
||||
MageObject object = game.getObject(event.getSourceId());
|
||||
if (object == null) {
|
||||
return false;
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.CAST_SPELL
|
||||
&& (object.isInstant() || object.isSorcery())) {
|
||||
return true;
|
||||
}
|
||||
if (event.getType() == GameEvent.EventType.ACTIVATE_ABILITY) {
|
||||
Optional<Ability> ability = game.getAbility(event.getTargetId(), event.getSourceId());
|
||||
return ability != null && ability.isPresent()
|
||||
&& !(ability.get() instanceof ActivatedManaAbilityImpl);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
|
@ -17,23 +16,23 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
|
|||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.filter.predicate.permanent.CounterPredicate;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class AbzanBattlePriest extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent();
|
||||
|
||||
static {
|
||||
filter.add(new CardTypePredicate(CardType.CREATURE));
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
filter.add(new CounterPredicate(CounterType.P1P1));
|
||||
}
|
||||
|
||||
static final String rule = "Each creature you control with a +1/+1 counter on it has lifelink";
|
||||
|
||||
public AbzanBattlePriest(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.HUMAN);
|
||||
this.subtype.add(SubType.CLERIC);
|
||||
|
||||
|
@ -42,9 +41,15 @@ public final class AbzanBattlePriest extends CardImpl {
|
|||
|
||||
// Outlast {W}
|
||||
this.addAbility(new OutlastAbility(new ManaCostsImpl<>("{W}")));
|
||||
|
||||
|
||||
// Each creature you control with a +1/+1 counter on it has lifelink.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(LifelinkAbility.getInstance(), Duration.WhileOnBattlefield, filter, rule)));
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new GainAbilityAllEffect(
|
||||
LifelinkAbility.getInstance(), Duration.WhileOnBattlefield,
|
||||
filter, "Each creature you control with a +1/+1 counter on it has lifelink"
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public AbzanBattlePriest(final AbzanBattlePriest card) {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
|
@ -22,6 +20,8 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author halljared
|
||||
*/
|
||||
|
@ -44,7 +44,7 @@ public final class AccursedWitch extends CardImpl {
|
|||
this.addAbility(new DiesTriggeredAbility(new AccursedWitchReturnTransformedEffect()));
|
||||
}
|
||||
|
||||
public AccursedWitch(final AccursedWitch card) {
|
||||
private AccursedWitch(final AccursedWitch card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -56,12 +56,12 @@ public final class AccursedWitch extends CardImpl {
|
|||
|
||||
class AccursedWitchReturnTransformedEffect extends OneShotEffect {
|
||||
|
||||
public AccursedWitchReturnTransformedEffect() {
|
||||
AccursedWitchReturnTransformedEffect() {
|
||||
super(Outcome.PutCardInPlay);
|
||||
this.staticText = "Put {this} from your graveyard onto the battlefield transformed";
|
||||
}
|
||||
|
||||
public AccursedWitchReturnTransformedEffect(final AccursedWitchReturnTransformedEffect effect) {
|
||||
private AccursedWitchReturnTransformedEffect(final AccursedWitchReturnTransformedEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -73,29 +73,27 @@ class AccursedWitchReturnTransformedEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
if (game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD) {
|
||||
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
|
||||
//note: should check for null after game.getCard
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
if (controller == null || !(game.getState().getZone(source.getSourceId()) == Zone.GRAVEYARD)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
|
||||
//note: should check for null after game.getCard
|
||||
Card card = game.getCard(source.getSourceId());
|
||||
if (card != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class AccursedWitchSpellsCostReductionEffect extends CostModificationEffectImpl {
|
||||
|
||||
public AccursedWitchSpellsCostReductionEffect() {
|
||||
AccursedWitchSpellsCostReductionEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Detriment, CostModificationType.REDUCE_COST);
|
||||
this.staticText = "Spells your opponents cast that target {this} cost {1} less to cast.";
|
||||
}
|
||||
|
||||
protected AccursedWitchSpellsCostReductionEffect(AccursedWitchSpellsCostReductionEffect effect) {
|
||||
private AccursedWitchSpellsCostReductionEffect(AccursedWitchSpellsCostReductionEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -107,17 +105,16 @@ class AccursedWitchSpellsCostReductionEffect extends CostModificationEffectImpl
|
|||
|
||||
@Override
|
||||
public boolean applies(Ability abilityToModify, Ability source, Game game) {
|
||||
if (abilityToModify instanceof SpellAbility) {
|
||||
if (game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
||||
for (UUID modeId : abilityToModify.getModes().getSelectedModes()) {
|
||||
Mode mode = abilityToModify.getModes().get(modeId);
|
||||
for (Target target : mode.getTargets()) {
|
||||
for (UUID targetUUID : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetUUID);
|
||||
if (permanent != null && permanent.getId().equals(source.getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (!(abilityToModify instanceof SpellAbility) || !game.getOpponents(source.getControllerId()).contains(abilityToModify.getControllerId())) {
|
||||
return false;
|
||||
}
|
||||
for (UUID modeId : abilityToModify.getModes().getSelectedModes()) {
|
||||
Mode mode = abilityToModify.getModes().get(modeId);
|
||||
for (Target target : mode.getTargets()) {
|
||||
for (UUID targetUUID : target.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(targetUUID);
|
||||
if (permanent != null && permanent.getId().equals(source.getSourceId())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
|
@ -25,8 +24,9 @@ import mage.players.Player;
|
|||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author L_J
|
||||
*/
|
||||
public final class AchHansRun extends CardImpl {
|
||||
|
@ -38,7 +38,7 @@ public final class AchHansRun extends CardImpl {
|
|||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new AchHansRunEffect(), TargetController.YOU, true));
|
||||
}
|
||||
|
||||
public AchHansRun(final AchHansRun card) {
|
||||
private AchHansRun(final AchHansRun card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -50,12 +50,12 @@ public final class AchHansRun extends CardImpl {
|
|||
|
||||
class AchHansRunEffect extends OneShotEffect {
|
||||
|
||||
public AchHansRunEffect() {
|
||||
AchHansRunEffect() {
|
||||
super(Outcome.PutCreatureInPlay);
|
||||
this.staticText = "you may say \"Ach! Hans, run! It’s the …\" and the name of a creature card. If you do, search your library for a card with that name, put it onto the battlefield, then shuffle your library. That creature gains haste. Exile it at the beginning of the next end step";
|
||||
}
|
||||
|
||||
public AchHansRunEffect(final AchHansRunEffect effect) {
|
||||
private AchHansRunEffect(final AchHansRunEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -67,41 +67,41 @@ class AchHansRunEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
ChoiceImpl cardChoice = new ChoiceImpl(true);
|
||||
cardChoice.setChoices(CardRepository.instance.getCreatureNames());
|
||||
cardChoice.setMessage("Choose a creature card name");
|
||||
if (controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||
String cardName = cardChoice.getChoice();
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(controller.getLogName() + ": \"Ach! Hans, run! It's the " + cardName + "!\"");
|
||||
}
|
||||
FilterCard nameFilter = new FilterCard();
|
||||
nameFilter.add(new NamePredicate(cardName));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(1, 1, nameFilter);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
Card card = controller.getLibrary().remove(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
if (card != null && controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
|
||||
Permanent creature = game.getPermanent(card.getId());
|
||||
if (creature != null) {
|
||||
// gains haste
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(creature, game));
|
||||
game.addEffect(effect, source);
|
||||
// Exile at begin of next end step
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect(null, null, Zone.BATTLEFIELD);
|
||||
exileEffect.setTargetPointer(new FixedTarget(creature, game));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
controller.shuffleLibrary(source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
ChoiceImpl cardChoice = new ChoiceImpl(true);
|
||||
cardChoice.setChoices(CardRepository.instance.getCreatureNames());
|
||||
cardChoice.setMessage("Choose a creature card name");
|
||||
if (!controller.choose(Outcome.Detriment, cardChoice, game)) {
|
||||
return false;
|
||||
}
|
||||
String cardName = cardChoice.getChoice();
|
||||
game.informPlayers(controller.getLogName() + ": \"Ach! Hans, run! It's the " + cardName + "!\"");
|
||||
FilterCard nameFilter = new FilterCard();
|
||||
nameFilter.add(new NamePredicate(cardName));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(1, 1, nameFilter);
|
||||
if (!controller.searchLibrary(target, game)) {
|
||||
return false;
|
||||
}
|
||||
Card card = controller.getLibrary().remove(target.getFirstTarget(), game);
|
||||
if (card == null || !controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
|
||||
return false;
|
||||
}
|
||||
Permanent creature = game.getPermanent(card.getId());
|
||||
if (creature == null) {
|
||||
return false;
|
||||
}
|
||||
// gains haste
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(creature, game));
|
||||
game.addEffect(effect, source);
|
||||
// Exile at begin of next end step
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect(null, null, Zone.BATTLEFIELD);
|
||||
exileEffect.setTargetPointer(new FixedTarget(creature, game));
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
controller.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -23,14 +22,15 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetAnyTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
*/
|
||||
public final class ApocalypseHydra extends CardImpl {
|
||||
|
||||
public ApocalypseHydra(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{X}{R}{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{X}{R}{G}");
|
||||
this.subtype.add(SubType.HYDRA);
|
||||
|
||||
this.power = new MageInt(0);
|
||||
|
@ -46,7 +46,7 @@ public final class ApocalypseHydra extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public ApocalypseHydra(final ApocalypseHydra card) {
|
||||
private ApocalypseHydra(final ApocalypseHydra card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ class ApocalypseHydraEffect extends OneShotEffect {
|
|||
staticText = "with X +1/+1 counters on it. If X is 5 or more, it enters the battlefield with an additional X +1/+1 counters on it";
|
||||
}
|
||||
|
||||
ApocalypseHydraEffect(final ApocalypseHydraEffect effect) {
|
||||
private ApocalypseHydraEffect(final ApocalypseHydraEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -71,20 +71,21 @@ class ApocalypseHydraEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanentEntering(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (spellAbility != null
|
||||
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||
&& permanent.getZoneChangeCounter(game) == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||
int amount = spellAbility.getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
if (amount < 5) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
|
||||
} else {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount * 2), source, game);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (spellAbility == null
|
||||
|| !spellAbility.getSourceId().equals(source.getSourceId())
|
||||
|| permanent.getZoneChangeCounter(game) != spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||
return false;
|
||||
}
|
||||
int amount = spellAbility.getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
if (amount < 5) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), source, game);
|
||||
} else {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount * 2), source, game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue