Added Spelltithe Enforcer, Gauntlet of Might and Shivan Wumpus.

This commit is contained in:
LevelX2 2015-01-26 18:20:02 +01:00
parent 684e76e9bf
commit 6fe58db97d
9 changed files with 545 additions and 4 deletions

View file

@ -0,0 +1,174 @@
/*
* 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.guildpact;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.PostResolveEffect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.FilterPermanent;
import mage.filter.FilterSpell;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class SpelltitheEnforcer extends CardImpl {
public SpelltitheEnforcer(UUID ownerId) {
super(ownerId, 18, "Spelltithe Enforcer", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{W}{W}");
this.expansionSetCode = "GPT";
this.subtype.add("Elephant");
this.subtype.add("Wizard");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever an opponent casts a spell, that player sacrifices a permanent unless he or she pays {1}.
this.addAbility(new SpellCastOpponentTriggeredAbility(
Zone.BATTLEFIELD,
new DoUnlessTargetPaysEffect(new SacrificeEffect(new FilterPermanent(), 1, "that player"), new GenericManaCost(1),
"Pay {1}? (otherwise sacrifice a permanent)"),
new FilterSpell(),
false,
SetTargetPointer.PLAYER
));
}
public SpelltitheEnforcer(final SpelltitheEnforcer card) {
super(card);
}
@Override
public SpelltitheEnforcer copy() {
return new SpelltitheEnforcer(this);
}
}
class DoUnlessTargetPaysEffect extends OneShotEffect {
protected Effects executingEffects = new Effects();
private final Cost cost;
private String chooseUseText;
public DoUnlessTargetPaysEffect(Effect effect, Cost cost) {
this(effect, cost, null);
}
public DoUnlessTargetPaysEffect(Effect effect, Cost cost, String chooseUseText) {
super(Outcome.Benefit);
this.executingEffects.add(effect);
this.cost = cost;
this.chooseUseText = chooseUseText;
}
public DoUnlessTargetPaysEffect(final DoUnlessTargetPaysEffect effect) {
super(effect);
this.executingEffects = effect.executingEffects.copy();
this.cost = effect.cost.copy();
this.chooseUseText = effect.chooseUseText;
}
public void addEffect(Effect effect) {
executingEffects.add(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null && targetPlayer != null) {
String message;
if (chooseUseText == null) {
String effectText = executingEffects.getText(source.getModes().getMode());
message = "Pay " + cost.getText() + " to prevent (" + effectText.substring(0, effectText.length() -1) + ")?";
} else {
message = chooseUseText;
}
message = CardUtil.replaceSourceName(message, sourceObject.getLogName());
boolean result = true;
boolean doEffect = true;
// check if target player is willing to pay
if (cost.canPay(source, source.getSourceId(), targetPlayer.getId(), game) && targetPlayer.chooseUse(Outcome.Detriment, message, game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getSourceId(), targetPlayer.getId(), false)) {
game.informPlayers(targetPlayer.getName() + " pays the cost to prevent the effect");
doEffect = false;
}
}
// do the effects player did not pay
if (doEffect) {
for(Effect effect: executingEffects) {
effect.setTargetPointer(this.targetPointer);
if (effect instanceof OneShotEffect) {
if (!(effect instanceof PostResolveEffect)) {
result &= effect.apply(game, source);
}
}
else {
game.addEffect((ContinuousEffect) effect, source);
}
}
}
return result;
}
return false;
}
@Override
public String getText(Mode mode) {
if (!staticText.isEmpty()) {
return staticText;
}
String effectsText = executingEffects.getText(mode);
return effectsText.substring(0, effectsText.length() -1) + " unless he or she pays " + cost.getText();
}
@Override
public DoUnlessTargetPaysEffect copy() {
return new DoUnlessTargetPaysEffect(this);
}
}

View file

@ -0,0 +1,86 @@
/*
* 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.limitedalpha;
import java.util.UUID;
import mage.Mana;
import mage.ObjectColor;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.TapForManaAllTriggeredManaAbility;
import mage.abilities.effects.common.AddManaToManaPoolTargetControllerEffect;
import mage.abilities.effects.common.ManaEffect;
import mage.abilities.effects.common.continious.BoostAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.SetTargetPointer;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
/**
*
* @author LevelX2
*/
public class GauntletOfMight extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Red creatures");
private static final FilterLandPermanent filterMountain = new FilterLandPermanent("a Mountain is tapped");
static {
filter.add(new ColorPredicate(ObjectColor.RED));
filterMountain.add(new SubtypePredicate("Mountain"));
}
public GauntletOfMight(UUID ownerId) {
super(ownerId, 244, "Gauntlet of Might", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{4}");
this.expansionSetCode = "LEA";
// Red creatures get +1/+1.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, false)));
// Whenever a Mountain is tapped for mana, its controller adds {R} to his or her mana pool.
ManaEffect effect = new AddManaToManaPoolTargetControllerEffect(new Mana(ColoredManaSymbol.R), "his or her");
effect.setText("its controller adds {R} to his or her mana pool");
this.addAbility(new TapForManaAllTriggeredManaAbility(
effect, filterMountain, SetTargetPointer.PLAYER));
}
public GauntletOfMight(final GauntletOfMight card) {
super(card);
}
@Override
public GauntletOfMight copy() {
return new GauntletOfMight(this);
}
}

View file

@ -0,0 +1,52 @@
/*
* 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.limitedbeta;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class GauntletOfMight extends mage.sets.limitedalpha.GauntletOfMight {
public GauntletOfMight(UUID ownerId) {
super(ownerId);
this.cardNumber = 246;
this.expansionSetCode = "LEB";
}
public GauntletOfMight(final GauntletOfMight card) {
super(card);
}
@Override
public GauntletOfMight copy() {
return new GauntletOfMight(this);
}
}

View file

@ -0,0 +1,178 @@
/*
* 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.planarchaos;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.PostResolveEffect;
import mage.abilities.effects.common.PutOnLibrarySourceEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.filter.common.FilterControlledLandPermanent;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetControlledPermanent;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class ShivanWumpus extends CardImpl {
public ShivanWumpus(UUID ownerId) {
super(ownerId, 121, "Shivan Wumpus", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{R}");
this.expansionSetCode = "PLC";
this.subtype.add("Beast");
this.power = new MageInt(6);
this.toughness = new MageInt(6);
// Trample
this.addAbility(TrampleAbility.getInstance());
// When Shivan Wumpus enters the battlefield, any player may sacrifice a land. If a player does, put Shivan Wumpus on top of its owner's library.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new DoIfAnyPlayerPaysEffect(
new PutOnLibrarySourceEffect(true),
new SacrificeTargetCost(new TargetControlledPermanent(new FilterControlledLandPermanent("a land"))),
"Sacrifice a land to return {this} to top of its owners library?"),
false
));
}
public ShivanWumpus(final ShivanWumpus card) {
super(card);
}
@Override
public ShivanWumpus copy() {
return new ShivanWumpus(this);
}
}
class DoIfAnyPlayerPaysEffect extends OneShotEffect {
protected Effects executingEffects = new Effects();
private final Cost cost;
private String chooseUseText;
public DoIfAnyPlayerPaysEffect(Effect effect, Cost cost) {
this(effect, cost, null);
}
public DoIfAnyPlayerPaysEffect(Effect effect, Cost cost, String chooseUseText) {
super(Outcome.Benefit);
this.executingEffects.add(effect);
this.cost = cost;
this.chooseUseText = chooseUseText;
}
public DoIfAnyPlayerPaysEffect(final DoIfAnyPlayerPaysEffect effect) {
super(effect);
this.executingEffects = effect.executingEffects.copy();
this.cost = effect.cost.copy();
this.chooseUseText = effect.chooseUseText;
}
public void addEffect(Effect effect) {
executingEffects.add(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = game.getObject(source.getSourceId());
if (controller != null && sourceObject != null) {
String message;
if (chooseUseText == null) {
String effectText = executingEffects.getText(source.getModes().getMode());
message = "Pay " + cost.getText() + " to prevent (" + effectText.substring(0, effectText.length() -1) + ")?";
} else {
message = chooseUseText;
}
message = CardUtil.replaceSourceName(message, sourceObject.getLogName());
boolean result = true;
boolean doEffect = false;
// check if any player is willing to pay
for (UUID playerId: controller.getInRange()) {
Player player = game.getPlayer(playerId);
if (player != null && cost.canPay(source, source.getSourceId(), player.getId(), game) && player.chooseUse(Outcome.Detriment, message, game)) {
cost.clearPaid();
if (cost.pay(source, game, source.getSourceId(), player.getId(), false)) {
game.informPlayers(sourceObject.getLogName() + ": " + player.getName() + " pays the cost");
doEffect = true;
break;
}
}
}
// do the effects if nobody paid
if (doEffect) {
for(Effect effect: executingEffects) {
effect.setTargetPointer(this.targetPointer);
if (effect instanceof OneShotEffect) {
if (!(effect instanceof PostResolveEffect)) {
result &= effect.apply(game, source);
}
}
else {
game.addEffect((ContinuousEffect) effect, source);
}
}
}
return result;
}
return false;
}
@Override
public String getText(Mode mode) {
if (!staticText.isEmpty()) {
return staticText;
}
// any player may sacrifice a land. If a player does, put Shivan Wumpus on top of its owner's library.
String effectsText = executingEffects.getText(mode);
return "any player may " + cost.getText() + ". If a player does, " + effectsText.substring(0, effectsText.length() -1) ;
}
@Override
public DoIfAnyPlayerPaysEffect copy() {
return new DoIfAnyPlayerPaysEffect(this);
}
}

View file

@ -35,7 +35,6 @@ import mage.abilities.effects.common.SacrificeTargetEffect;
import mage.cards.CardImpl;
import mage.target.common.TargetCreaturePermanent;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Zone;
import mage.game.Game;
import mage.abilities.Ability;
import mage.game.permanent.Permanent;

View file

@ -0,0 +1,52 @@
/*
* 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.unlimitededition;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class GauntletOfMight extends mage.sets.limitedalpha.GauntletOfMight {
public GauntletOfMight(UUID ownerId) {
super(ownerId);
this.cardNumber = 245;
this.expansionSetCode = "2ED";
}
public GauntletOfMight(final GauntletOfMight card) {
super(card);
}
@Override
public GauntletOfMight copy() {
return new GauntletOfMight(this);
}
}

View file

@ -97,7 +97,7 @@ public class PutOnLibrarySourceEffect extends OneShotEffect {
sb.append(staticText);
} else {
// Put Champion of Stray Souls on top of your library from your graveyard
sb.append("Put {this} on ");
sb.append("put {this} on ");
sb.append(onTop ? "top" : "the bottom").append(" of it's owner's library");
}
return sb.toString();

View file

@ -98,7 +98,7 @@ public class SacrificeEffect extends OneShotEffect{
}
for ( int idx = 0; idx < target.getTargets().size(); idx++) {
Permanent permanent = game.getPermanent((UUID)target.getTargets().get(idx));
Permanent permanent = game.getPermanent(target.getTargets().get(idx));
if ( permanent != null ) {
abilityApplied |= permanent.sacrifice(source.getSourceId(), game);