Added Release the Ants. Created package for post resolve effects and started moving post resolve effects there.

This commit is contained in:
LevelX2 2014-08-26 17:45:13 +02:00
parent 9d4b88a388
commit 37efad7d2c
18 changed files with 164 additions and 57 deletions

View file

@ -149,6 +149,7 @@ public class Main {
server = new MageTransporterServer(serverLocator, new MageServerImpl(adminPassword, testMode), MageServer.class.getName(), new MageServerInvocationHandler());
server.start();
logger.info("Started MAGE server - listening on " + connection.toString());
if (testMode) {
logger.info("MAGE server running in test mode");
}

View file

@ -35,7 +35,7 @@ import mage.constants.Rarity;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;

View file

@ -30,7 +30,7 @@ package mage.sets.avacynrestored;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.abilities.effects.common.turn.AddExtraTurnControllerEffect;
import mage.abilities.keyword.MiracleAbility;
import mage.cards.CardImpl;

View file

@ -30,7 +30,7 @@ package mage.sets.fifthedition;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;

View file

@ -29,7 +29,7 @@ package mage.sets.invasion;
import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;

View file

@ -29,7 +29,7 @@ package mage.sets.journeyintonyx;
import java.util.UUID;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.abilities.effects.common.ReturnToHandTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;

View file

@ -28,7 +28,7 @@
package mage.sets.journeyintonyx;
import java.util.UUID;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.abilities.effects.common.turn.ControlTargetPlayerNextTurnEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;

View file

@ -34,7 +34,7 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.players.Player;

View file

@ -33,7 +33,7 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.FilterCard;

View file

@ -34,7 +34,7 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.abilities.effects.common.continious.MaximumHandSizeControllerEffect;
import mage.abilities.effects.common.continious.MaximumHandSizeControllerEffect.HandSizeModification;
import mage.cards.Card;

View file

@ -0,0 +1,64 @@
/*
* 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 mage.sets.morningtide;
import java.util.UUID;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.postresolve.ClashWinReturnToHandSpellEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.target.common.TargetCreatureOrPlayer;
/**
*
* @author LevelX2
*/
public class ReleaseTheAnts extends CardImpl {
public ReleaseTheAnts(UUID ownerId) {
super(ownerId, 98, "Release the Ants", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{R}");
this.expansionSetCode = "MOR";
this.color.setRed(true);
// Release the Ants deals 1 damage to target creature or player. Clash with an opponent. If you win, return Release the Ants to its owner's hand.
this.getSpellAbility().addEffect(new DamageTargetEffect(1));
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
this.getSpellAbility().addEffect(ClashWinReturnToHandSpellEffect.getInstance());
}
public ReleaseTheAnts(final ReleaseTheAnts card) {
super(card);
}
@Override
public ReleaseTheAnts copy() {
return new ReleaseTheAnts(this);
}
}

View file

@ -32,14 +32,13 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.MageSingleton;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.PostResolveEffect;
import mage.abilities.effects.common.ClashEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.postresolve.ClashWinReturnToHandSpellEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
@ -60,9 +59,8 @@ public class TitansRevenge extends CardImpl {
// Titan's Revenge deals X damage to target creature or player. Clash with an opponent. If you win, return Titan's Revenge to its owner's hand.
this.getSpellAbility().addEffect(new DamageTargetEffect(new ManacostVariableValue()));
this.getSpellAbility().addEffect(TitansRevengeReturnToHandSpellEffect.getInstance());
this.getSpellAbility().addTarget(new TargetCreatureOrPlayer());
this.getSpellAbility().addEffect(ClashWinReturnToHandSpellEffect.getInstance());
}
public TitansRevenge(final TitansRevenge card) {
@ -74,42 +72,3 @@ public class TitansRevenge extends CardImpl {
return new TitansRevenge(this);
}
}
class TitansRevengeReturnToHandSpellEffect extends PostResolveEffect implements MageSingleton {
private static final TitansRevengeReturnToHandSpellEffect fINSTANCE = new TitansRevengeReturnToHandSpellEffect();
private Object readResolve() throws ObjectStreamException {
return fINSTANCE;
}
private TitansRevengeReturnToHandSpellEffect() {
staticText = "Clash with an opponent. If you win, return {this} to its owner's hand";
}
public static TitansRevengeReturnToHandSpellEffect getInstance() {
return fINSTANCE;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public TitansRevengeReturnToHandSpellEffect copy() {
return fINSTANCE;
}
@Override
public boolean isActive(Ability source, Game game) {
return ClashEffect.getInstance().apply(game, source);
}
@Override
public void postResolve(Card card, Ability source, UUID controllerId, Game game) {
Player controller = game.getPlayer(controllerId);
if (controller != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.STACK);
}
}
}

View file

@ -30,7 +30,7 @@ package mage.sets.returntoravnica;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCardInYourGraveyard;

View file

@ -31,7 +31,7 @@ import mage.abilities.Ability;
import mage.abilities.costs.common.DiscardXTargetCost;
import mage.abilities.dynamicvalue.common.GetXValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.abilities.effects.common.ReturnFromGraveyardToHandTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;

View file

@ -30,7 +30,7 @@ package mage.sets.urzassaga;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.abilities.effects.common.discard.DiscardHandAllEffect;
import mage.cards.Card;
import mage.cards.CardImpl;

View file

@ -33,7 +33,7 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.postresolve.ExileSpellEffect;
import mage.abilities.effects.common.UntapLandsEffect;
import mage.cards.CardImpl;
import mage.game.Game;

View file

@ -0,0 +1,83 @@
/*
* 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 mage.abilities.effects.postresolve;
import java.io.ObjectStreamException;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.MageSingleton;
import mage.abilities.effects.PostResolveEffect;
import mage.abilities.effects.common.ClashEffect;
import mage.cards.Card;
import mage.constants.Zone;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class ClashWinReturnToHandSpellEffect extends PostResolveEffect implements MageSingleton {
private static final ClashWinReturnToHandSpellEffect fINSTANCE = new ClashWinReturnToHandSpellEffect();
private Object readResolve() throws ObjectStreamException {
return fINSTANCE;
}
private ClashWinReturnToHandSpellEffect() {
staticText = "Clash with an opponent. If you win, return {this} to its owner's hand";
}
public static ClashWinReturnToHandSpellEffect getInstance() {
return fINSTANCE;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public ClashWinReturnToHandSpellEffect copy() {
return fINSTANCE;
}
@Override
public boolean isActive(Ability source, Game game) {
return ClashEffect.getInstance().apply(game, source);
}
@Override
public void postResolve(Card card, Ability source, UUID controllerId, Game game) {
Player controller = game.getPlayer(controllerId);
if (controller != null) {
controller.moveCardToHandWithInfo(card, source.getSourceId(), game, Zone.STACK);
}
}
}

View file

@ -26,7 +26,7 @@
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.effects.common;
package mage.abilities.effects.postresolve;
import mage.abilities.Ability;
import mage.abilities.MageSingleton;