mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 11:32:00 -08:00
fix some more cards
This commit is contained in:
parent
80a456a15f
commit
ddbc339c1b
11 changed files with 98 additions and 90 deletions
|
|
@ -23,6 +23,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -93,7 +94,7 @@ class BreakOutEffect extends OneShotEffect {
|
|||
if (pickedCard.getManaValue() <= 2 &&
|
||||
controller.chooseUse(Outcome.PutCardInPlay, "Put it onto the battlefield?", source, game) &&
|
||||
controller.moveCards(pickedCard, Zone.BATTLEFIELD, source, game)) {
|
||||
Permanent permanent = game.getPermanent(pickedCard.getId());
|
||||
Permanent permanent = CardUtil.getPermanentFromCardPutToBattlefield(pickedCard, game);
|
||||
if (permanent != null) {
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
|
||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -81,7 +82,7 @@ class CantStayAwayEffect extends OneShotEffect {
|
|||
return false;
|
||||
}
|
||||
controller.moveCards(targetCard, Zone.BATTLEFIELD, source, game);
|
||||
Permanent permanent = game.getPermanent(targetCard.getId());
|
||||
Permanent permanent = CardUtil.getPermanentFromCardPutToBattlefield(targetCard, game);
|
||||
if (permanent != null) {
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(new SimpleStaticAbility(new CantStayAwayReplacementEffect()), Duration.Custom);
|
||||
effect.setTargetPointer(new FixedTarget(permanent, game));
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||
|
|
@ -22,15 +21,17 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class CorpseDance extends CardImpl {
|
||||
|
||||
public CorpseDance(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{B}");
|
||||
|
||||
// Buyback {2}
|
||||
this.addAbility(new BuybackAbility("{2}"));
|
||||
|
|
@ -68,32 +69,30 @@ class CorpseDanceEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
Card lastCreatureCard = null;
|
||||
for (Card card : controller.getGraveyard().getCards(game)) {
|
||||
if (card.isCreature(game)) {
|
||||
lastCreatureCard = card;
|
||||
}
|
||||
}
|
||||
if (lastCreatureCard != null) {
|
||||
if (controller.moveCards(lastCreatureCard, Zone.BATTLEFIELD, source, game)) {
|
||||
Permanent creature = game.getPermanent(lastCreatureCard.getId());
|
||||
if (creature != null) {
|
||||
FixedTarget blueprintTarget = new FixedTarget(creature, game);
|
||||
// Gains Haste
|
||||
ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
|
||||
hasteEffect.setTargetPointer(blueprintTarget.copy());
|
||||
game.addEffect(hasteEffect, source);
|
||||
// Exile it at end of turn
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
|
||||
exileEffect.setTargetPointer(blueprintTarget.copy());
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
Card lastCreatureCard = null;
|
||||
for (Card card : controller.getGraveyard().getCards(game)) {
|
||||
if (card.isCreature(game)) {
|
||||
lastCreatureCard = card;
|
||||
}
|
||||
}
|
||||
if (lastCreatureCard != null && controller.moveCards(lastCreatureCard, Zone.BATTLEFIELD, source, game)) {
|
||||
Permanent creature = CardUtil.getPermanentFromCardPutToBattlefield(lastCreatureCard, game);
|
||||
if (creature != null) {
|
||||
FixedTarget blueprintTarget = new FixedTarget(creature, game);
|
||||
// Gains Haste
|
||||
ContinuousEffect hasteEffect = new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn);
|
||||
hasteEffect.setTargetPointer(blueprintTarget.copy());
|
||||
game.addEffect(hasteEffect, source);
|
||||
// Exile it at end of turn
|
||||
ExileTargetEffect exileEffect = new ExileTargetEffect(null, "", Zone.BATTLEFIELD);
|
||||
exileEffect.setTargetPointer(blueprintTarget.copy());
|
||||
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(exileEffect);
|
||||
game.addDelayedTriggeredAbility(delayedAbility, source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.DiesAttachedTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
|
@ -12,17 +11,19 @@ import mage.cards.Card;
|
|||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Blinke
|
||||
*/
|
||||
public final class Deathrender extends CardImpl {
|
||||
|
|
@ -33,8 +34,10 @@ public final class Deathrender extends CardImpl {
|
|||
|
||||
// Equipped creature gets +2/+2.
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(2, 2)));
|
||||
|
||||
// Whenever equipped creature dies, you may put a creature card from your hand onto the battlefield and attach Deathrender to it.
|
||||
this.addAbility(new DiesAttachedTriggeredAbility(new DeathrenderEffect(), "equipped creature"));
|
||||
|
||||
// Equip {2}
|
||||
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(2), false));
|
||||
}
|
||||
|
|
@ -68,19 +71,20 @@ class DeathrenderEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && sourcePermanent != null) {
|
||||
TargetCardInHand target = new TargetCardInHand(0, 1, StaticFilters.FILTER_CARD_CREATURE);
|
||||
if (controller.choose(Outcome.PutCardInPlay, target, source, game)) {
|
||||
Card creatureInHand = game.getCard(target.getFirstTarget());
|
||||
if (creatureInHand != null) {
|
||||
if (controller.moveCards(creatureInHand, Zone.BATTLEFIELD, source, game)) {
|
||||
game.getPermanent(creatureInHand.getId()).addAttachment(sourcePermanent.getId(), source, game);
|
||||
}
|
||||
Permanent sourcePermanent = source.getSourcePermanentIfItStillExists(game);
|
||||
if (controller == null || sourcePermanent == null) {
|
||||
return false;
|
||||
}
|
||||
TargetCardInHand target = new TargetCardInHand(0, 1, StaticFilters.FILTER_CARD_CREATURE);
|
||||
if (controller.choose(Outcome.PutCardInPlay, target, source, game)) {
|
||||
Card creatureInHand = game.getCard(target.getFirstTarget());
|
||||
if (creatureInHand != null && controller.moveCards(creatureInHand, Zone.BATTLEFIELD, source, game)) {
|
||||
Permanent permanent = CardUtil.getPermanentFromCardPutToBattlefield(creatureInHand, game);
|
||||
if (permanent != null) {
|
||||
permanent.addAttachment(sourcePermanent.getId(), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -102,7 +103,7 @@ class FirefluxSquadEffect extends OneShotEffect {
|
|||
return player.putCardsOnBottomOfLibrary(cards, game, source, false);
|
||||
}
|
||||
player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game, true, false, true, null);
|
||||
permanent = game.getPermanent(toBattlefield.getId());
|
||||
permanent = CardUtil.getPermanentFromCardPutToBattlefield(toBattlefield, game);
|
||||
if (permanent != null) {
|
||||
cards.remove(toBattlefield);
|
||||
game.getCombat().addAttackingCreature(permanent.getId(), game);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -154,45 +155,44 @@ class FlickerformReturnEffect extends OneShotEffect {
|
|||
}
|
||||
ExileZone exileZone = game.getExile().getExileZone(exileZoneId);
|
||||
Card enchantedCard = exileZone.get(enchantedCardId, game);
|
||||
//skip if exiled card is missing
|
||||
if (enchantedCard != null) {
|
||||
Player owner = game.getPlayer(enchantedCard.getOwnerId());
|
||||
//skip if card's owner is missing
|
||||
if (owner != null) {
|
||||
owner.moveCards(enchantedCard, Zone.BATTLEFIELD, source, game);
|
||||
Permanent newPermanent = game.getPermanent(enchantedCardId);
|
||||
if (newPermanent != null) {
|
||||
Set<Card> toBattlefieldAttached = new HashSet<Card>();
|
||||
for (Card enchantment : exileZone.getCards(game)) {
|
||||
if (filterAura.match(enchantment, game)) {
|
||||
boolean canTarget = false;
|
||||
for (Target target : enchantment.getSpellAbility().getTargets()) {
|
||||
Filter filter = target.getFilter();
|
||||
if (filter.match(newPermanent, game)) {
|
||||
canTarget = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!canTarget) {
|
||||
// Aura stays exiled
|
||||
continue;
|
||||
}
|
||||
game.getState().setValue("attachTo:" + enchantment.getId(), newPermanent);
|
||||
if (enchantedCard == null) {
|
||||
return false;
|
||||
}
|
||||
Player owner = game.getPlayer(enchantedCard.getOwnerId());
|
||||
if (owner == null) {
|
||||
return false;
|
||||
}
|
||||
owner.moveCards(enchantedCard, Zone.BATTLEFIELD, source, game);
|
||||
Permanent newPermanent = CardUtil.getPermanentFromCardPutToBattlefield(enchantedCard, game);
|
||||
if (newPermanent != null) {
|
||||
Set<Card> toBattlefieldAttached = new HashSet<>();
|
||||
for (Card enchantment : exileZone.getCards(game)) {
|
||||
if (filterAura.match(enchantment, game)) {
|
||||
boolean canTarget = false;
|
||||
for (Target target : enchantment.getSpellAbility().getTargets()) {
|
||||
Filter filter = target.getFilter();
|
||||
if (filter.match(newPermanent, game)) {
|
||||
canTarget = true;
|
||||
break;
|
||||
}
|
||||
toBattlefieldAttached.add(enchantment);
|
||||
}
|
||||
if (!toBattlefieldAttached.isEmpty()) {
|
||||
controller.moveCards(toBattlefieldAttached, Zone.BATTLEFIELD, source, game);
|
||||
for (Card card : toBattlefieldAttached) {
|
||||
if (game.getState().getZone(card.getId()) == Zone.BATTLEFIELD) {
|
||||
newPermanent.addAttachment(card.getId(), source, game);
|
||||
}
|
||||
}
|
||||
if (!canTarget) {
|
||||
// Aura stays exiled
|
||||
continue;
|
||||
}
|
||||
game.getState().setValue("attachTo:" + enchantment.getId(), newPermanent);
|
||||
}
|
||||
toBattlefieldAttached.add(enchantment);
|
||||
}
|
||||
if (!toBattlefieldAttached.isEmpty()) {
|
||||
controller.moveCards(toBattlefieldAttached, Zone.BATTLEFIELD, source, game);
|
||||
for (Card card : toBattlefieldAttached) {
|
||||
if (game.getState().getZone(card.getId()) == Zone.BATTLEFIELD) {
|
||||
newPermanent.addAttachment(card.getId(), source, game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import mage.game.events.GameEvent;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInHand;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -127,7 +128,7 @@ class KaaliaOfTheVastEffect extends OneShotEffect {
|
|||
UUID defenderId = game.getCombat().getDefendingPlayerId(source.getSourceId(), game);
|
||||
if (defenderId != null) {
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, true, false, false, null);
|
||||
Permanent creature = game.getPermanent(cardId);
|
||||
Permanent creature = CardUtil.getPermanentFromCardPutToBattlefield(card, game);
|
||||
if (creature != null) {
|
||||
game.getCombat().addAttackerToCombat(card.getId(), defenderId, game);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -84,7 +85,7 @@ class MakeshiftMannequinEffect extends OneShotEffect {
|
|||
counters.addCounter(CounterType.MANNEQUIN.createInstance());
|
||||
game.setEnterWithCounters(cardId, counters);
|
||||
if (controller.moveCards(card, Zone.BATTLEFIELD, source, game)) {
|
||||
Permanent permanent = game.getPermanent(cardId);
|
||||
Permanent permanent = CardUtil.getPermanentFromCardPutToBattlefield(card, game);
|
||||
if (permanent != null) {
|
||||
ContinuousEffect gainedEffect = new MakeshiftMannequinGainAbilityEffect();
|
||||
// Bug #6885 Fixed when owner/controller leaves the game the effect still applies
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
|
|
@ -21,6 +20,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -74,7 +74,7 @@ class ShallowGraveEffect extends OneShotEffect {
|
|||
}
|
||||
if (lastCreatureCard != null) {
|
||||
if (controller.moveCards(lastCreatureCard, Zone.BATTLEFIELD, source, game)) {
|
||||
Permanent returnedCreature = game.getPermanent(lastCreatureCard.getId());
|
||||
Permanent returnedCreature = CardUtil.getPermanentFromCardPutToBattlefield(lastCreatureCard, game);
|
||||
if (returnedCreature != null) {
|
||||
FixedTarget blueprintTarget = new FixedTarget(returnedCreature, game);
|
||||
// Gains Haste
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -106,13 +107,12 @@ class SpiritSistersCallReturnToBattlefieldEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
UUID targetId = source.getFirstTarget();
|
||||
Card card = game.getCard(targetId);
|
||||
if (controller == null || card == null || game.getState().getZone(targetId) != Zone.GRAVEYARD) {
|
||||
Card card = game.getCard(source.getFirstTarget());
|
||||
if (controller == null || card == null || game.getState().getZone(card.getId()) != Zone.GRAVEYARD) {
|
||||
return false;
|
||||
}
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
Permanent permanent = game.getPermanent(targetId);
|
||||
Permanent permanent = CardUtil.getPermanentFromCardPutToBattlefield(card, game);
|
||||
if (permanent != null) {
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(
|
||||
new SimpleStaticAbility(new LeaveBattlefieldExileSourceReplacementEffect("this permanent")),
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ class TawnossCoffinReturnEffect extends OneShotEffect {
|
|||
continue;
|
||||
}
|
||||
controller.moveCards(creatureCard, Zone.BATTLEFIELD, source, game, false, false, true, null);
|
||||
Permanent newPermanent = game.getPermanent(creatureCard.getId());
|
||||
Permanent newPermanent = CardUtil.getPermanentFromCardPutToBattlefield(creatureCard, game);
|
||||
if (newPermanent == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue