mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge origin/master
This commit is contained in:
commit
ed472a9b81
18 changed files with 401 additions and 141 deletions
|
@ -201,9 +201,12 @@ public class FeedbackPanel extends javax.swing.JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Issue 256: Chat+Feedback panel: request focus prevents players from chatting
|
// Issue 256: Chat+Feedback panel: request focus prevents players from chatting
|
||||||
|
// Issue #1054: XMage steals window focus whenever the screen updates
|
||||||
private void requestFocusIfPossible() {
|
private void requestFocusIfPossible() {
|
||||||
boolean requestFocusAllowed = true;
|
boolean requestFocusAllowed = true;
|
||||||
if (connectedChatPanel != null && connectedChatPanel.getTxtMessageInputComponent() != null) {
|
if (MageFrame.getInstance().getFocusOwner() == null) {
|
||||||
|
requestFocusAllowed = false;
|
||||||
|
} else if (connectedChatPanel != null && connectedChatPanel.getTxtMessageInputComponent() != null) {
|
||||||
if (connectedChatPanel.getTxtMessageInputComponent().hasFocus()) {
|
if (connectedChatPanel.getTxtMessageInputComponent().hasFocus()) {
|
||||||
requestFocusAllowed = false;
|
requestFocusAllowed = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ package mage.sets.magicorigins;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
import mage.abilities.common.DiesCreatureTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
|
import mage.abilities.effects.common.ExileAndReturnTransformedSourceEffect;
|
||||||
import mage.abilities.keyword.LifelinkAbility;
|
import mage.abilities.keyword.LifelinkAbility;
|
||||||
import mage.abilities.keyword.TransformAbility;
|
import mage.abilities.keyword.TransformAbility;
|
||||||
|
@ -42,6 +43,7 @@ import mage.filter.predicate.Predicates;
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||||
import mage.filter.predicate.permanent.TokenPredicate;
|
import mage.filter.predicate.permanent.TokenPredicate;
|
||||||
|
import mage.game.permanent.token.ZombieToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -74,7 +76,8 @@ public class LilianaHereticalHealer extends CardImpl {
|
||||||
this.addAbility(LifelinkAbility.getInstance());
|
this.addAbility(LifelinkAbility.getInstance());
|
||||||
|
|
||||||
// Whenever another nontoken creature you control dies, exile Liliana Heretical Healer, then return her to the battlefield transformed under her owner's control. If you do, put a 2/2 black Zombie creature token onto the battlefield.
|
// Whenever another nontoken creature you control dies, exile Liliana Heretical Healer, then return her to the battlefield transformed under her owner's control. If you do, put a 2/2 black Zombie creature token onto the battlefield.
|
||||||
this.addAbility(new DiesCreatureTriggeredAbility(new ExileAndReturnTransformedSourceEffect(ExileAndReturnTransformedSourceEffect.Gender.FEMAL), false, filter));
|
this.addAbility(new DiesCreatureTriggeredAbility(new ExileAndReturnTransformedSourceEffect(ExileAndReturnTransformedSourceEffect.Gender.FEMAL,
|
||||||
|
new CreateTokenEffect(new ZombieToken(expansionSetCode))), false, filter));
|
||||||
}
|
}
|
||||||
|
|
||||||
public LilianaHereticalHealer(final LilianaHereticalHealer card) {
|
public LilianaHereticalHealer(final LilianaHereticalHealer card) {
|
||||||
|
|
|
@ -43,7 +43,6 @@ import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.StackObject;
|
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
|
@ -96,8 +95,7 @@ class WillbreakerTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public boolean checkTrigger(GameEvent event, Game game) {
|
public boolean checkTrigger(GameEvent event, Game game) {
|
||||||
if (getControllerId().equals(event.getPlayerId())) {
|
if (getControllerId().equals(event.getPlayerId())) {
|
||||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||||
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)
|
if (permanent != null && permanent.getCardType().contains(CardType.CREATURE)) {
|
||||||
&& StackObject.class.isInstance(game.getObject(event.getSourceId()))) {
|
|
||||||
Player controller = game.getPlayer(getControllerId());
|
Player controller = game.getPlayer(getControllerId());
|
||||||
if (controller != null && controller.hasOpponent(permanent.getControllerId(), game)) {
|
if (controller != null && controller.hasOpponent(permanent.getControllerId(), game)) {
|
||||||
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
|
getEffects().get(0).setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||||
|
|
|
@ -28,16 +28,16 @@
|
||||||
package mage.sets.newphyrexia;
|
package mage.sets.newphyrexia;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.ColoredManaSymbol;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
import mage.abilities.costs.common.TapSourceCost;
|
||||||
import mage.abilities.costs.mana.PhyrexianManaCost;
|
import mage.abilities.costs.mana.PhyrexianManaCost;
|
||||||
import mage.abilities.effects.common.TapTargetEffect;
|
import mage.abilities.effects.common.TapTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.ColoredManaSymbol;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,6 +54,7 @@ public class BlindingSouleater extends CardImpl {
|
||||||
this.power = new MageInt(1);
|
this.power = new MageInt(1);
|
||||||
this.toughness = new MageInt(3);
|
this.toughness = new MageInt(3);
|
||||||
|
|
||||||
|
// {WP},{T}: Tap target creature. ( can be paid with either or 2 life.)
|
||||||
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||||
new TapTargetEffect(),
|
new TapTargetEffect(),
|
||||||
new PhyrexianManaCost(ColoredManaSymbol.W));
|
new PhyrexianManaCost(ColoredManaSymbol.W));
|
||||||
|
|
|
@ -29,10 +29,12 @@ package mage.sets.returntoravnica;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||||
import mage.abilities.common.ZoneChangeTriggeredAbility;
|
import mage.abilities.common.ZoneChangeTriggeredAbility;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.ReturnFromExileForSourceEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -44,10 +46,10 @@ import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
import mage.game.ExileZone;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.common.TargetCardInGraveyard;
|
import mage.target.common.TargetCardInGraveyard;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
@ -67,7 +69,6 @@ public class AngelOfSerenity extends CardImpl {
|
||||||
this.power = new MageInt(5);
|
this.power = new MageInt(5);
|
||||||
this.toughness = new MageInt(6);
|
this.toughness = new MageInt(6);
|
||||||
|
|
||||||
|
|
||||||
// Flying
|
// Flying
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
@ -75,7 +76,7 @@ public class AngelOfSerenity extends CardImpl {
|
||||||
this.addAbility(new AngelOfSerenityTriggeredAbility());
|
this.addAbility(new AngelOfSerenityTriggeredAbility());
|
||||||
|
|
||||||
// When Angel of Serenity leaves the battlefield, return the exiled cards to their owners' hands.
|
// When Angel of Serenity leaves the battlefield, return the exiled cards to their owners' hands.
|
||||||
this.addAbility(new LeavesBattlefieldTriggeredAbility(new AngelOfSerenityLeaveEffect(), false ));
|
this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnFromExileForSourceEffect(Zone.HAND, false, true), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public AngelOfSerenity(final AngelOfSerenity card) {
|
public AngelOfSerenity(final AngelOfSerenity card) {
|
||||||
|
@ -104,7 +105,7 @@ class AngelOfSerenityTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||||
getTargets().clear();
|
getTargets().clear();
|
||||||
FilterCreaturePermanent filter = new FilterCreaturePermanent("up to three other target creatures");
|
FilterCreaturePermanent filter = new FilterCreaturePermanent("up to three other target creatures");
|
||||||
filter.add(new AnotherPredicate());
|
filter.add(new AnotherPredicate());
|
||||||
TargetCreaturePermanent target1 = new TargetCreaturePermanent(0,3, filter, false);
|
TargetCreaturePermanent target1 = new TargetCreaturePermanent(0, 3, filter, false);
|
||||||
game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target1, this, game);
|
game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target1, this, game);
|
||||||
if (target1.getTargets().size() > 0) {
|
if (target1.getTargets().size() > 0) {
|
||||||
getTargets().add(target1);
|
getTargets().add(target1);
|
||||||
|
@ -112,8 +113,8 @@ class AngelOfSerenityTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||||
}
|
}
|
||||||
int leftTargets = 3 - target1.getTargets().size();
|
int leftTargets = 3 - target1.getTargets().size();
|
||||||
if (leftTargets > 0) {
|
if (leftTargets > 0) {
|
||||||
FilterCard filter2 = new FilterCreatureCard("up to " + leftTargets + " target creature card" + (leftTargets > 1?"s":"") +" from graveyards");
|
FilterCard filter2 = new FilterCreatureCard("up to " + leftTargets + " target creature card" + (leftTargets > 1 ? "s" : "") + " from graveyards");
|
||||||
TargetCardInGraveyard target2 = new TargetCardInGraveyard(0,leftTargets, filter2);
|
TargetCardInGraveyard target2 = new TargetCardInGraveyard(0, leftTargets, filter2);
|
||||||
game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target2, this, game);
|
game.getPlayer(getControllerId()).chooseTarget(Outcome.Exile, target2, this, game);
|
||||||
if (target2.getTargets().size() > 0) {
|
if (target2.getTargets().size() > 0) {
|
||||||
getTargets().add(target2);
|
getTargets().add(target2);
|
||||||
|
@ -150,21 +151,24 @@ class AngelOfSerenityEnterEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
boolean result = true;
|
boolean result = true;
|
||||||
if (source.getTargets().size() > 0) {
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
MageObject sourceObject = game.getObject(source.getSourceId());
|
||||||
|
if (controller != null && sourceObject != null && source.getTargets().size() > 0) {
|
||||||
|
UUID exileZoneId = CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
|
||||||
for (Target target : source.getTargets()) {
|
for (Target target : source.getTargets()) {
|
||||||
if (target instanceof TargetCreaturePermanent) {
|
if (target instanceof TargetCreaturePermanent) {
|
||||||
for (UUID permanentId : target.getTargets()) {
|
for (UUID permanentId : target.getTargets()) {
|
||||||
Permanent permanent = game.getPermanent(permanentId);
|
Permanent permanent = game.getPermanent(permanentId);
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
result |= permanent.moveToExile(CardUtil.getCardExileZoneId(game, source), "Angel of Serenity", source.getSourceId(), game);
|
result |= controller.moveCardToExileWithInfo(permanent, exileZoneId, sourceObject.getIdName(), source.getSourceId(), game, Zone.BATTLEFIELD, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (target instanceof TargetCardInGraveyard){
|
} else if (target instanceof TargetCardInGraveyard) {
|
||||||
for (UUID cardId : target.getTargets()) {
|
for (UUID cardId : target.getTargets()) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
result |= card.moveToExile(CardUtil.getCardExileZoneId(game, source), "Angel of Serenity", source.getSourceId(), game);
|
result |= controller.moveCardToExileWithInfo(card, exileZoneId, sourceObject.getIdName(), source.getSourceId(), game, Zone.GRAVEYARD, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -173,34 +177,3 @@ class AngelOfSerenityEnterEffect extends OneShotEffect {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AngelOfSerenityLeaveEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public AngelOfSerenityLeaveEffect() {
|
|
||||||
super(Outcome.ReturnToHand);
|
|
||||||
this.staticText = "return the exiled cards to their owners' hands";
|
|
||||||
}
|
|
||||||
|
|
||||||
public AngelOfSerenityLeaveEffect(final AngelOfSerenityLeaveEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AngelOfSerenityLeaveEffect copy() {
|
|
||||||
return new AngelOfSerenityLeaveEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
ExileZone exZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
|
|
||||||
if (exZone != null) {
|
|
||||||
for (Card card : exZone.getCards(game)) {
|
|
||||||
if (card != null) {
|
|
||||||
card.moveToZone(Zone.HAND, source.getSourceId(), game, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -34,7 +34,6 @@ import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.mageobject.MonocoloredPredicate;
|
import mage.filter.predicate.mageobject.MonocoloredPredicate;
|
||||||
import mage.target.Target;
|
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,7 +52,6 @@ public class UltimatePrice extends CardImpl {
|
||||||
super(ownerId, 82, "Ultimate Price", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
super(ownerId, 82, "Ultimate Price", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{B}");
|
||||||
this.expansionSetCode = "RTR";
|
this.expansionSetCode = "RTR";
|
||||||
|
|
||||||
|
|
||||||
// Destroy target monocolored creature.
|
// Destroy target monocolored creature.
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
||||||
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
this.getSpellAbility().addEffect(new DestroyTargetEffect());
|
||||||
|
|
|
@ -36,7 +36,6 @@ import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
|
||||||
import mage.abilities.costs.common.TapSourceCost;
|
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.ReturnFromExileEffect;
|
import mage.abilities.effects.common.ReturnFromExileEffect;
|
||||||
|
@ -62,7 +61,6 @@ public class MistmeadowWitch extends CardImpl {
|
||||||
|
|
||||||
// {2}{W}{U}: Exile target creature. Return that card to the battlefield under its owner's control at the beginning of the next end step.
|
// {2}{W}{U}: Exile target creature. Return that card to the battlefield under its owner's control at the beginning of the next end step.
|
||||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MistmeadowWitchEffect(), new ManaCostsImpl("{2}{W}{U}"));
|
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MistmeadowWitchEffect(), new ManaCostsImpl("{2}{W}{U}"));
|
||||||
ability.addCost(new TapSourceCost());
|
|
||||||
ability.addTarget(new TargetCreaturePermanent());
|
ability.addTarget(new TargetCreaturePermanent());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.mage.test.cards.abilities.keywords;
|
package org.mage.test.cards.abilities.keywords;
|
||||||
|
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
|
@ -40,26 +39,25 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
public class DashTest extends CardTestPlayerBase {
|
public class DashTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 702.108. Dash
|
* 702.108. Dash 702.108a Dash represents three abilities: two static
|
||||||
* 702.108a Dash represents three abilities: two static abilities that function while the card with dash is
|
* abilities that function while the card with dash is on the stack, one of
|
||||||
* on the stack, one of which may create a delayed triggered ability, and a static ability that
|
* which may create a delayed triggered ability, and a static ability that
|
||||||
* functions while the object with dash is on the battlefield. “Dash [cost]” means “You may cast
|
* functions while the object with dash is on the battlefield. “Dash [cost]”
|
||||||
* this card by paying [cost] rather that its mana cost,” “If this spell’s dash cost was paid, return the
|
* means “You may cast this card by paying [cost] rather that its mana
|
||||||
* permanent this spell becomes to its owner’s hand at the beginning of the next end step,” and “As
|
* cost,” “If this spell’s dash cost was paid, return the permanent this
|
||||||
* long as this permanent’s dash cost was paid, it has haste.” Paying a card’s dash cost follows the
|
* spell becomes to its owner’s hand at the beginning of the next end step,”
|
||||||
* rules for paying alternative costs in rules 601.2b and 601.2e–g.
|
* and “As long as this permanent’s dash cost was paid, it has haste.”
|
||||||
|
* Paying a card’s dash cost follows the rules for paying alternative costs
|
||||||
|
* in rules 601.2b and 601.2e–g.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Screamreach Brawler
|
* Screamreach Brawler Creature — Orc Berserker 2/3, 2R (3) Dash {1}{R} (You
|
||||||
* Creature — Orc Berserker 2/3, 2R (3)
|
* may cast this spell for its dash cost. If you do, it gains haste, and
|
||||||
* Dash {1}{R} (You may cast this spell for its dash cost. If you do, it
|
* it's returned from the battlefield to its owner's hand at the beginning
|
||||||
* gains haste, and it's returned from the battlefield to its owner's hand
|
* of the next end step.)
|
||||||
* at the beginning of the next end step.)
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDash() {
|
public void testDash() {
|
||||||
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||||
|
@ -96,4 +94,30 @@ public class DashTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Also dash returns creatures to your hand at end of turn even if they died
|
||||||
|
* that turn.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testDashedCreatureDiesInCombat() {
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 2);
|
||||||
|
addCard(Zone.HAND, playerA, "Screamreach Brawler"); // 2/3
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Geist of the Moors", 1); // 3/1
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Screamreach Brawler");
|
||||||
|
setChoice(playerA, "Yes");
|
||||||
|
attack(1, playerA, "Screamreach Brawler");
|
||||||
|
block(1, playerB, "Geist of the Moors", "Screamreach Brawler");
|
||||||
|
|
||||||
|
setStopAt(2, PhaseStep.UNTAP);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
assertPermanentCount(playerA, "Screamreach Brawler", 0);
|
||||||
|
assertHandCount(playerA, "Screamreach Brawler", 0);
|
||||||
|
assertGraveyardCount(playerA, "Screamreach Brawler", 1);
|
||||||
|
assertGraveyardCount(playerB, "Geist of the Moors", 1);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,4 +211,31 @@ public class RenownTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ability doesn't trigger when renowned. ("Whenever an opponent casts a
|
||||||
|
* noncreature spell, if ~ is renowned, ~ deals 2 damage to that player.")
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testScabClanBerserker() {
|
||||||
|
// Renown 1
|
||||||
|
// Whenever an opponent casts a noncreature spell, if Scab-Clan Berserker is renowned, Scab-Clan Berserker deals 2 damage to that player.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Scab-Clan Berserker"); // 2/2 {1}{R}{R}
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Mountain", 1);
|
||||||
|
addCard(Zone.HAND, playerB, "Lightning Bolt");
|
||||||
|
|
||||||
|
attack(3, playerA, "Scab-Clan Berserker"); // 1 damage
|
||||||
|
castSpell(3, PhaseStep.POSTCOMBAT_MAIN, playerB, "Lightning Bolt", playerA);
|
||||||
|
|
||||||
|
setStopAt(3, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
Permanent berserker = getPermanent("Scab-Clan Berserker", playerA);
|
||||||
|
Assert.assertEquals("has has renown", true, berserker.isRenown());
|
||||||
|
assertPowerToughness(playerA, "Scab-Clan Berserker", 3, 3);
|
||||||
|
|
||||||
|
assertLife(playerA, 17); // Lightning Bolt
|
||||||
|
assertLife(playerB, 16); // 2 from attack 2 from triggered ability
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,6 +87,9 @@ public class TransformTest extends CardTestPlayerBase {
|
||||||
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
|
assertPermanentCount(playerA, "Liliana, Heretical Healer", 0);
|
||||||
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
|
assertPermanentCount(playerA, "Liliana, Defiant Necromancer", 1);
|
||||||
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3);
|
assertCounterCount("Liliana, Defiant Necromancer", CounterType.LOYALTY, 3);
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Zombie", 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,71 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* 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 org.mage.test.cards.triggers;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class BecomesTheTargetTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Willbreaker is not working when an ability is targeting the opponet's
|
||||||
|
* creature. Only spells.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testWillbreakerAbility() {
|
||||||
|
// Whenever a creature an opponent controls becomes the target of a spell or ability you control, gain control of that creature for as long as you control Willbreaker.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Willbreaker", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Blinding Souleater", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Plains", 1);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Silvercoat Lion", 1);
|
||||||
|
|
||||||
|
activateAbility(2, PhaseStep.PRECOMBAT_MAIN, playerB, "{WP},{T}: Tap target creature", "Silvercoat Lion");
|
||||||
|
|
||||||
|
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertLife(playerA, 20);
|
||||||
|
assertLife(playerB, 20);
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Silvercoat Lion", 0);
|
||||||
|
assertTapped("Silvercoat Lion", true);
|
||||||
|
|
||||||
|
assertPermanentCount(playerB, "Silvercoat Lion", 1);
|
||||||
|
assertPermanentCount(playerB, "Willbreaker", 1);
|
||||||
|
assertPermanentCount(playerB, "Blinding Souleater", 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* 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 org.mage.test.cards.triggers;
|
||||||
|
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class EnterLeaveBattlefieldExileTargetTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAngelOfSerenityExile() {
|
||||||
|
// Flying
|
||||||
|
// When Angel of Serenity enters the battlefield, you may exile up to three other target creatures from the battlefield and/or creature cards from graveyards.
|
||||||
|
// When Angel of Serenity leaves the battlefield, return the exiled cards to their owners' hands.
|
||||||
|
addCard(Zone.HAND, playerA, "Angel of Serenity");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 7);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox", 1);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Angel of Serenity");
|
||||||
|
addTarget(playerA, "Silvercoat Lion^Pillarfield Ox");
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Angel of Serenity", 1);
|
||||||
|
assertExileCount("Silvercoat Lion", 1);
|
||||||
|
assertExileCount("Pillarfield Ox", 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When Angel of Serenity entered the battlefield on my opponent's main
|
||||||
|
* phase it exiled 3 of my creatures (as it should), I cast Ultimate Price
|
||||||
|
* (destroy monocolored creature) on my next main phase and destroyed the
|
||||||
|
* Angel of Serenity. The log said the exiled cards were returned to my hand
|
||||||
|
* but they remained in exile indefinitely.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testAngelOfSerenityExileReturn() {
|
||||||
|
// Flying
|
||||||
|
// When Angel of Serenity enters the battlefield, you may exile up to three other target creatures from the battlefield and/or creature cards from graveyards.
|
||||||
|
// When Angel of Serenity leaves the battlefield, return the exiled cards to their owners' hands.
|
||||||
|
addCard(Zone.HAND, playerA, "Angel of Serenity");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Plains", 7);
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Swamp", 2);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Silvercoat Lion", 1);
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Pillarfield Ox", 1);
|
||||||
|
addCard(Zone.HAND, playerB, "Ultimate Price", 1);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Angel of Serenity");
|
||||||
|
addTarget(playerA, "Silvercoat Lion^Pillarfield Ox");
|
||||||
|
|
||||||
|
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Ultimate Price", "Angel of Serenity");
|
||||||
|
|
||||||
|
setStopAt(2, PhaseStep.BEGIN_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertGraveyardCount(playerB, "Ultimate Price", 1);
|
||||||
|
assertGraveyardCount(playerA, "Angel of Serenity", 1);
|
||||||
|
assertHandCount(playerB, "Silvercoat Lion", 1);
|
||||||
|
assertHandCount(playerB, "Pillarfield Ox", 1);
|
||||||
|
assertExileCount(playerB, 0);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -37,7 +37,7 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
* @author LeveX2
|
* @author LeveX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class JournexToNowhereTest extends CardTestPlayerBase {
|
public class JourneyToNowhereTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Journey to Nowhere Enchantment {1}{W}
|
Journey to Nowhere Enchantment {1}{W}
|
|
@ -7,6 +7,8 @@ package mage.abilities.effects.common;
|
||||||
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.ContinuousEffect;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.keyword.TransformAbility;
|
import mage.abilities.keyword.TransformAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
@ -19,19 +21,33 @@ import mage.players.Player;
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
|
public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
|
||||||
|
|
||||||
public static enum Gender { MALE, FEMAL };
|
public static enum Gender {
|
||||||
|
|
||||||
|
MALE, FEMAL
|
||||||
|
};
|
||||||
|
|
||||||
|
protected Effect additionalEffect;
|
||||||
|
|
||||||
public ExileAndReturnTransformedSourceEffect(Gender gender) {
|
public ExileAndReturnTransformedSourceEffect(Gender gender) {
|
||||||
|
this(gender, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param gender
|
||||||
|
* @param additionalEffect that effect is applies as source is exiled
|
||||||
|
*/
|
||||||
|
public ExileAndReturnTransformedSourceEffect(Gender gender, Effect additionalEffect) {
|
||||||
super(Outcome.Benefit);
|
super(Outcome.Benefit);
|
||||||
this.staticText = "exile {this}, then return " + (gender.equals(Gender.MALE) ? "him":"her")
|
this.additionalEffect = additionalEffect;
|
||||||
+ " to the battlefield transformed under" + (gender.equals(Gender.MALE) ? "his":"her")+ " owner's control";
|
this.staticText = "exile {this}, then return " + (gender.equals(Gender.MALE) ? "him" : "her")
|
||||||
|
+ " to the battlefield transformed under" + (gender.equals(Gender.MALE) ? "his" : "her") + " owner's control";
|
||||||
}
|
}
|
||||||
|
|
||||||
public ExileAndReturnTransformedSourceEffect(final ExileAndReturnTransformedSourceEffect effect) {
|
public ExileAndReturnTransformedSourceEffect(final ExileAndReturnTransformedSourceEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
|
this.additionalEffect = effect.additionalEffect;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -48,6 +64,13 @@ public class ExileAndReturnTransformedSourceEffect extends OneShotEffect {
|
||||||
if (controller.moveCards(card, Zone.BATTLEFIELD, Zone.EXILED, source, game)) {
|
if (controller.moveCards(card, Zone.BATTLEFIELD, Zone.EXILED, source, game)) {
|
||||||
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
|
game.getState().setValue(TransformAbility.VALUE_KEY_ENTER_TRANSFORMED + source.getSourceId(), Boolean.TRUE);
|
||||||
controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
|
controller.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
|
||||||
|
if (additionalEffect != null) {
|
||||||
|
if (additionalEffect instanceof ContinuousEffect) {
|
||||||
|
game.addEffect((ContinuousEffect) additionalEffect, source);
|
||||||
|
} else {
|
||||||
|
additionalEffect.apply(game, source);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1,35 +1,32 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
@ -41,6 +38,7 @@ import static mage.constants.Zone.GRAVEYARD;
|
||||||
import static mage.constants.Zone.HAND;
|
import static mage.constants.Zone.HAND;
|
||||||
import mage.game.ExileZone;
|
import mage.game.ExileZone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.PermanentToken;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.util.CardUtil;
|
import mage.util.CardUtil;
|
||||||
|
|
||||||
|
@ -70,7 +68,8 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
||||||
*
|
*
|
||||||
* @param zone
|
* @param zone
|
||||||
* @param tapped
|
* @param tapped
|
||||||
* @param previousZone if this is used from a dies leave battlefield or destroyed trigger, the exile zone is based on previous zone of the object
|
* @param previousZone if this is used from a dies leave battlefield or
|
||||||
|
* destroyed trigger, the exile zone is based on previous zone of the object
|
||||||
*/
|
*/
|
||||||
public ReturnFromExileForSourceEffect(Zone zone, boolean tapped, boolean previousZone) {
|
public ReturnFromExileForSourceEffect(Zone zone, boolean tapped, boolean previousZone) {
|
||||||
super(Outcome.PutCardInPlay);
|
super(Outcome.PutCardInPlay);
|
||||||
|
@ -95,23 +94,24 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
MageObject sourceObject = source.getSourceObject(game);
|
||||||
int zoneChangeCounter = source.getSourceObjectZoneChangeCounter() - (previousZone ? 1:0);
|
if (sourceObject != null && controller != null) {
|
||||||
UUID exileId = CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter);
|
int zoneChangeCounter = source.getSourceObjectZoneChangeCounter();
|
||||||
ExileZone exile = game.getExile().getExileZone(exileId);
|
if (zoneChangeCounter > 0 && previousZone && !(sourceObject instanceof PermanentToken)) {
|
||||||
|
zoneChangeCounter--;
|
||||||
|
}
|
||||||
|
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter));
|
||||||
if (exile != null) { // null is valid if source left battlefield before enters the battlefield effect resolved
|
if (exile != null) { // null is valid if source left battlefield before enters the battlefield effect resolved
|
||||||
LinkedList<UUID> cards = new LinkedList<>(exile);
|
if (returnToZone.equals(Zone.BATTLEFIELD)) {
|
||||||
for (UUID cardId: cards) {
|
for (Card card : exile.getCards(game)) {
|
||||||
Card card = game.getCard(cardId);
|
Player owner = game.getPlayer(card.getOwnerId());
|
||||||
if (card == null) {
|
if (owner != null) {
|
||||||
return false;
|
owner.putOntoBattlefieldWithInfo(card, game, Zone.EXILED, source.getSourceId());
|
||||||
}
|
}
|
||||||
if (!game.isSimulation()) {
|
|
||||||
game.informPlayers(controller.getLogName() + " moves " + card.getLogName() + " from exile to " + returnToZone.toString().toLowerCase());
|
|
||||||
}
|
}
|
||||||
card.moveToZone(returnToZone, source.getSourceId(), game, tapped);
|
} else {
|
||||||
|
controller.moveCards(exile, Zone.EXILED, returnToZone, source, game);
|
||||||
}
|
}
|
||||||
exile.clear();
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ public class ReturnFromExileForSourceEffect extends OneShotEffect {
|
||||||
private void setText() {
|
private void setText() {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("return the exiled cards ");
|
sb.append("return the exiled cards ");
|
||||||
switch(returnToZone) {
|
switch (returnToZone) {
|
||||||
case BATTLEFIELD:
|
case BATTLEFIELD:
|
||||||
sb.append("to the battlefield under its owner's control");
|
sb.append("to the battlefield under its owner's control");
|
||||||
if (tapped) {
|
if (tapped) {
|
||||||
|
|
|
@ -31,6 +31,7 @@ import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.DelayedTriggeredAbility;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.StaticAbility;
|
import mage.abilities.StaticAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
|
@ -44,7 +45,7 @@ import mage.abilities.costs.Costs;
|
||||||
import mage.abilities.costs.CostsImpl;
|
import mage.abilities.costs.CostsImpl;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
import mage.abilities.effects.common.ReturnToHandTargetEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
@ -76,10 +77,7 @@ public class DashAbility extends StaticAbility implements AlternativeSourceCosts
|
||||||
Ability ability = new EntersBattlefieldAbility(
|
Ability ability = new EntersBattlefieldAbility(
|
||||||
new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.Custom, false),
|
new GainAbilitySourceEffect(HasteAbility.getInstance(), Duration.Custom, false),
|
||||||
DashedCondition.getInstance(), false, "", "");
|
DashedCondition.getInstance(), false, "", "");
|
||||||
Effect effect = new ReturnToHandTargetEffect();
|
ability.addEffect(new DashAddDelayedTriggeredAbilityEffect());
|
||||||
effect.setText("return the dashed creature from the battlefield to its owner's hand");
|
|
||||||
effect.setTargetPointer(new FixedTarget(card.getId()));
|
|
||||||
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect), false));
|
|
||||||
addSubAbility(ability);
|
addSubAbility(ability);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -134,7 +132,7 @@ public class DashAbility extends StaticAbility implements AlternativeSourceCosts
|
||||||
this.resetDash();
|
this.resetDash();
|
||||||
for (AlternativeCost2 dashCost : alternativeSourceCosts) {
|
for (AlternativeCost2 dashCost : alternativeSourceCosts) {
|
||||||
if (dashCost.canPay(ability, sourceId, controllerId, game)
|
if (dashCost.canPay(ability, sourceId, controllerId, game)
|
||||||
&& player.chooseUse(Outcome.Benefit, new StringBuilder(KEYWORD).append(" the creature for ").append(dashCost.getText(true)).append(" ?").toString(), ability, game)) {
|
&& player.chooseUse(Outcome.Benefit, KEYWORD + " the creature for " + dashCost.getText(true) + " ?", ability, game)) {
|
||||||
activateDash(dashCost, game);
|
activateDash(dashCost, game);
|
||||||
ability.getManaCostsToPay().clear();
|
ability.getManaCostsToPay().clear();
|
||||||
ability.getCosts().clear();
|
ability.getCosts().clear();
|
||||||
|
@ -209,3 +207,35 @@ public class DashAbility extends StaticAbility implements AlternativeSourceCosts
|
||||||
return alterCosts;
|
return alterCosts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DashAddDelayedTriggeredAbilityEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public DashAddDelayedTriggeredAbilityEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "return the dashed creature from the battlefield to its owner's hand";
|
||||||
|
}
|
||||||
|
|
||||||
|
public DashAddDelayedTriggeredAbilityEffect(final DashAddDelayedTriggeredAbilityEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DashAddDelayedTriggeredAbilityEffect copy() {
|
||||||
|
return new DashAddDelayedTriggeredAbilityEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Effect effect = new ReturnToHandTargetEffect();
|
||||||
|
effect.setText("return the dashed creature from the battlefield to its owner's hand");
|
||||||
|
effect.setTargetPointer(new FixedTarget(source.getSourceId()));
|
||||||
|
// init target pointer now because the dashed creature will only be returned from current zone
|
||||||
|
effect.getTargetPointer().init(game, source);
|
||||||
|
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(effect);
|
||||||
|
delayedAbility.setSourceId(source.getSourceId());
|
||||||
|
delayedAbility.setControllerId(source.getControllerId());
|
||||||
|
delayedAbility.setSourceObject(source.getSourceObject(game), game);
|
||||||
|
game.addDelayedTriggeredAbility(delayedAbility);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2914,6 +2914,12 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
result |= moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, fromZone);
|
result |= moveCardToHandWithInfo(card, source == null ? null : source.getSourceId(), game, fromZone);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
case BATTLEFIELD:
|
||||||
|
result = false;
|
||||||
|
for (Card card : cards) {
|
||||||
|
result |= putOntoBattlefieldWithInfo(card, game, fromZone, source == null ? null : source.getSourceId());
|
||||||
|
}
|
||||||
|
return result;
|
||||||
default:
|
default:
|
||||||
throw new UnsupportedOperationException("to Zone not supported yet");
|
throw new UnsupportedOperationException("to Zone not supported yet");
|
||||||
}
|
}
|
||||||
|
|
|
@ -146,6 +146,9 @@ git log 757b9ea99ec1f0ce46bb533f9f86f3473d122a60..HEAD --diff-filter=A --name-st
|
||||||
since 1.4.2.v0
|
since 1.4.2.v0
|
||||||
git log cd0cba6ec7d8799bb85247b7b4f5d545e170b093..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
|
git log cd0cba6ec7d8799bb85247b7b4f5d545e170b093..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
|
||||||
|
|
||||||
|
since 1.4.2.v1
|
||||||
|
git log 0b26aaff6ec033a538179bf607b1c7a7736aedb2..HEAD --diff-filter=A --name-status | sed -ne "s/^A[^u]Mage.Sets\/src\/mage\/sets\///p" | sort > added_cards.txt
|
||||||
|
|
||||||
3. Copy added_cards.txt to trunk\Utils folder
|
3. Copy added_cards.txt to trunk\Utils folder
|
||||||
4. Run script:
|
4. Run script:
|
||||||
> perl extract_in_wiki_format.perl
|
> perl extract_in_wiki_format.perl
|
||||||
|
|
Loading…
Reference in a new issue