mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
* Replaced some more wrong card movement handling.
This commit is contained in:
parent
11be86c208
commit
a05726cdee
5 changed files with 50 additions and 51 deletions
|
@ -35,8 +35,6 @@ import mage.abilities.Ability;
|
|||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureEffect;
|
||||
import mage.abilities.effects.common.continuous.BecomesFaceDownCreatureEffect.FaceDownType;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.keyword.MorphAbility;
|
||||
import mage.cards.Card;
|
||||
|
@ -104,19 +102,18 @@ class ShorecrasherElementalEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent shorecrasherElemental = game.getPermanent(source.getSourceId());
|
||||
MageObject sourceObject = source.getSourceObject(game);
|
||||
if (shorecrasherElemental != null
|
||||
&& sourceObject != null
|
||||
if (controller != null && shorecrasherElemental != null && sourceObject != null
|
||||
&& new MageObjectReference(sourceObject, game).refersTo(shorecrasherElemental, game)) {
|
||||
if (shorecrasherElemental.moveToExile(source.getSourceId(), sourceObject.getName(), source.getSourceId(), game)) {
|
||||
if (controller.moveCards(shorecrasherElemental, Zone.EXILED, source, game)) {
|
||||
Card card = game.getExile().getCard(source.getSourceId(), game);
|
||||
if (card != null) {
|
||||
game.addEffect(new BecomesFaceDownCreatureEffect(Duration.Custom, FaceDownType.MEGAMORPHED), source);
|
||||
return card.putOntoBattlefield(game, Zone.EXILED, source.getSourceId(), card.getOwnerId(), false, true);
|
||||
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game, false, true, true, null);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
*/
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.LoyaltyAbility;
|
||||
|
@ -38,8 +40,8 @@ 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.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
|
@ -113,25 +115,25 @@ class SorinLordOfInnistradEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Set<Card> toBattlefield = new HashSet<>();
|
||||
for (UUID targetId : source.getTargets().get(0).getTargets()) {
|
||||
Permanent perm = game.getPermanent(targetId);
|
||||
if (perm != null) {
|
||||
perm.destroy(source.getSourceId(), game, false);
|
||||
}
|
||||
}
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null) {
|
||||
for (UUID targetId : source.getTargets().get(0).getTargets()) {
|
||||
if (game.getState().getZone(targetId) == Zone.GRAVEYARD) {
|
||||
if (Zone.GRAVEYARD == game.getState().getZone(targetId)) {
|
||||
Card card = game.getCard(targetId);
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Zone.GRAVEYARD, source.getSourceId(), player.getId());
|
||||
toBattlefield.add(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
game.applyEffects();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
return controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,11 +58,9 @@ import mage.target.targetpointer.FixedTarget;
|
|||
public class SovereignsOfLostAlara extends CardImpl {
|
||||
|
||||
public SovereignsOfLostAlara(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{W}{U}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{W}{U}");
|
||||
this.subtype.add(SubType.SPIRIT);
|
||||
|
||||
|
||||
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(5);
|
||||
|
||||
|
@ -133,25 +131,25 @@ class SovereignsOfLostAlaraEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player you = game.getPlayer(source.getControllerId());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
Permanent attackingCreature = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (you != null && attackingCreature != null) {
|
||||
if (controller != null && attackingCreature != null) {
|
||||
FilterCard filter = new FilterCard("aura that could enchant the lone attacking creature");
|
||||
filter.add(new SubtypePredicate(SubType.AURA));
|
||||
filter.add(new AuraCardCanAttachToPermanentId(attackingCreature.getId()));
|
||||
if (you.chooseUse(Outcome.Benefit, "Do you want to search your library?", source, game)) {
|
||||
if (controller.chooseUse(Outcome.Benefit, "Do you want to search your library?", source, game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
target.setNotTarget(true);
|
||||
if (you.searchLibrary(target, game)) {
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
if (target.getFirstTarget() != null) {
|
||||
Card aura = game.getCard(target.getFirstTarget());
|
||||
game.getState().setValue("attachTo:" + aura.getId(), attackingCreature);
|
||||
aura.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), you.getId());
|
||||
controller.moveCards(aura, Zone.BATTLEFIELD, source, game);
|
||||
return attackingCreature.addAttachment(aura.getId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
you.shuffleLibrary(source, game);
|
||||
controller.shuffleLibrary(source, game);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -160,4 +158,4 @@ class SovereignsOfLostAlaraEffect extends OneShotEffect {
|
|||
public SovereignsOfLostAlaraEffect copy() {
|
||||
return new SovereignsOfLostAlaraEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ package mage.cards.s;
|
|||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.AttachEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
|
@ -37,8 +38,8 @@ 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.Filter;
|
||||
import mage.game.Game;
|
||||
|
@ -47,6 +48,7 @@ import mage.players.Player;
|
|||
import mage.target.Target;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -65,7 +67,8 @@ public class SteamVines extends CardImpl {
|
|||
Ability ability = new EnchantAbility(auraTarget.getTargetName());
|
||||
this.addAbility(ability);
|
||||
|
||||
// When enchanted land becomes tapped, destroy it and Steam Vines deals 1 damage to that land's controller. That player attaches Steam Vines to a land of their choice.
|
||||
// When enchanted land becomes tapped, destroy it and Steam Vines deals 1 damage to that land's controller.
|
||||
// That player attaches Steam Vines to a land of their choice.
|
||||
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new SteamVinesEffect(), "enchanted land"));
|
||||
|
||||
}
|
||||
|
@ -98,10 +101,10 @@ class SteamVinesEffect extends OneShotEffect {
|
|||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Permanent kudzu = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
Card kudzuCard = game.getCard(source.getSourceId());
|
||||
if (kudzu != null) {
|
||||
Permanent enchantedLand = game.getPermanentOrLKIBattlefield(kudzu.getAttachedTo());
|
||||
Permanent steamVines = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||
Card steamVinesCard = game.getCard(source.getSourceId());
|
||||
if (steamVines != null) {
|
||||
Permanent enchantedLand = game.getPermanentOrLKIBattlefield(steamVines.getAttachedTo());
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (enchantedLand != null
|
||||
&& controller != null) {
|
||||
|
@ -113,20 +116,20 @@ class SteamVinesEffect extends OneShotEffect {
|
|||
if (!game.getBattlefield().getAllActivePermanents(CardType.LAND).isEmpty()) { //lands are available on the battlefield
|
||||
Target target = new TargetLandPermanent();
|
||||
target.setNotTarget(true); //not a target, it is chosen
|
||||
if (kudzuCard != null
|
||||
if (steamVinesCard != null
|
||||
&& landsController != null) {
|
||||
if (landsController.choose(Outcome.Detriment, target, source.getId(), game)) {
|
||||
if (landsController.choose(Outcome.DestroyPermanent, target, source.getId(), game)) {
|
||||
if (target.getFirstTarget() != null) {
|
||||
Permanent landChosen = game.getPermanent(target.getFirstTarget());
|
||||
if (landChosen != null) {
|
||||
for (Target targetTest : kudzuCard.getSpellAbility().getTargets()) {
|
||||
for (Target targetTest : steamVinesCard.getSpellAbility().getTargets()) {
|
||||
Filter filterTest = targetTest.getFilter();
|
||||
if (filterTest.match(landChosen, game)) {
|
||||
if (game.getBattlefield().containsPermanent(landChosen.getId())) { //verify that it is still on the battlefield
|
||||
game.getState().setValue("attachTo:" + kudzuCard.getId(), landChosen);
|
||||
Zone zone = game.getState().getZone(kudzuCard.getId());
|
||||
kudzuCard.putOntoBattlefield(game, zone, source.getSourceId(), controller.getId());
|
||||
return landChosen.addAttachment(kudzuCard.getId(), game);
|
||||
game.informPlayers(landsController.getLogName() + " attaches " + steamVines.getLogName() + " to " + landChosen.getLogName());
|
||||
Effect effect = new AttachEffect(Outcome.Neutral);
|
||||
effect.setTargetPointer(new FixedTarget(landChosen, game));
|
||||
return effect.apply(game, source);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ import mage.target.common.TargetControlledCreaturePermanent;
|
|||
public class StonehewerGiant extends CardImpl {
|
||||
|
||||
public StonehewerGiant(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}{W}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
|
||||
this.subtype.add(SubType.GIANT);
|
||||
this.subtype.add(SubType.WARRIOR);
|
||||
|
||||
|
@ -102,28 +102,27 @@ class StonehewerGiantEffect 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());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FilterCard filter = new FilterCard("Equipment");
|
||||
filter.add(new SubtypePredicate(SubType.EQUIPMENT));
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
if (player.searchLibrary(target, game)) {
|
||||
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (controller.searchLibrary(target, game)) {
|
||||
Card card = controller.getLibrary().getCard(target.getFirstTarget(), game);
|
||||
if (card != null) {
|
||||
card.putOntoBattlefield(game, Zone.LIBRARY, source.getSourceId(), source.getControllerId());
|
||||
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
|
||||
Permanent equipment = game.getPermanent(card.getId());
|
||||
|
||||
Target targetCreature = new TargetControlledCreaturePermanent();
|
||||
if (equipment != null && player.choose(Outcome.BoostCreature, targetCreature, source.getSourceId(), game)) {
|
||||
if (equipment != null && controller.choose(Outcome.BoostCreature, targetCreature, source.getSourceId(), game)) {
|
||||
Permanent permanent = game.getPermanent(targetCreature.getFirstTarget());
|
||||
permanent.addAttachment(equipment.getId(), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
player.shuffleLibrary(source, game);
|
||||
controller.shuffleLibrary(source, game);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue