This commit is contained in:
ludwig.hirth 2013-03-26 13:46:11 +01:00
commit 51cee91089
47 changed files with 925 additions and 64 deletions

View file

@ -1244,7 +1244,7 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
}
@Override
public int chooseEffect(List<ReplacementEffect> rEffects, Game game) {
public int chooseEffect(List<String> rEffects, Game game) {
log.debug("chooseEffect");
//TODO: implement this
return 0;

View file

@ -374,7 +374,7 @@ public class SimulatedPlayerMCTS extends MCTSPlayer {
}
@Override
public int chooseEffect(List<ReplacementEffect> rEffects, Game game) {
public int chooseEffect(List<String> rEffects, Game game) {
if (this.isHuman())
return rnd.nextInt(rEffects.size());
return super.chooseEffect(rEffects, game);

View file

@ -155,12 +155,12 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
}
@Override
public int chooseEffect(List<ReplacementEffect> rEffects, Game game) {
public int chooseEffect(List<String> rEffects, Game game) {
updateGameStatePriority("chooseEffect", game);
replacementEffectChoice.getChoices().clear();
int count = 1;
for (ReplacementEffect effect: rEffects) {
replacementEffectChoice.getChoices().add(count + ". " + effect.getText(null));
for (String effectText: rEffects) {
replacementEffectChoice.getChoices().add(count + ". " + effectText);
count++;
}
if (replacementEffectChoice.getChoices().size() == 1)
@ -173,7 +173,7 @@ public class HumanPlayer extends PlayerImpl<HumanPlayer> {
replacementEffectChoice.setChoice(response.getString());
count = 1;
for (int i = 0; i < rEffects.size(); i++) {
if (replacementEffectChoice.getChoice().equals(count + ". " + rEffects.get(i).getText(null)))
if (replacementEffectChoice.getChoice().equals(count + ". " + rEffects.get(i)))
return i;
count++;
}

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.antiquities;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class HurkylsRecall extends mage.sets.fifthedition.HurkylsRecall {
public HurkylsRecall(UUID ownerId) {
super(ownerId);
this.cardNumber = 54;
this.expansionSetCode = "ATQ";
}
public HurkylsRecall(final HurkylsRecall card) {
super(card);
}
@Override
public HurkylsRecall copy() {
return new HurkylsRecall(this);
}
}

View file

@ -79,7 +79,7 @@ public class GenjuOfTheCedars extends CardImpl<GenjuOfTheCedars> {
this.addAbility(ability2);
// When enchanted Forest is put into a graveyard, you may return Genju of the Cedars from your graveyard to your hand.
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Forest", true);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Forest", true, false);
this.addAbility(ability3);
}

View file

@ -80,7 +80,7 @@ public class GenjuOfTheFalls extends CardImpl<GenjuOfTheFalls> {
this.addAbility(ability2);
// When enchanted Island is put into a graveyard, you may return Genju of the Falls from your graveyard to your hand. TargetPermanent auraTarget = new TargetLandPermanent(filter);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Island", true);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Island", true, false);
this.addAbility(ability3);
}

View file

@ -84,7 +84,7 @@ public class GenjuOfTheFens extends CardImpl<GenjuOfTheFens> {
this.addAbility(ability2);
// When enchanted Swamp is put into a graveyard, you may return Genju of the Fens from your graveyard to your hand.
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Swamp", true);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Swamp", true, false);
this.addAbility(ability3);
}

View file

@ -82,7 +82,7 @@ public class GenjuOfTheFields extends CardImpl<GenjuOfTheFields> {
this.addAbility(ability2);
// When enchanted Plains is put into a graveyard, you may return Genju of the Fields from your graveyard to your hand.
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Plains", true);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Plains", true, false);
this.addAbility(ability3);
}

View file

@ -80,7 +80,7 @@ public class GenjuOfTheRealm extends CardImpl<GenjuOfTheRealm> {
this.addAbility(ability2);
// When enchanted land is put into a graveyard, you may return Genju of the Realm from your graveyard to your hand.
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted land", true);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted land", true, false);
this.addAbility(ability3);
}

View file

@ -79,7 +79,7 @@ public class GenjuOfTheSpires extends CardImpl<GenjuOfTheSpires> {
this.addAbility(ability2);
// When enchanted Mountain is put into a graveyard, you may return Genju of the Spires from your graveyard to your hand.
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Mountain", true);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandSourceEffect(), "enchanted Mountain", true, false);
this.addAbility(ability3);
}

View file

@ -31,6 +31,7 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.cards.CardImpl;
@ -49,7 +50,7 @@ public class GodsEyeGateToTheReikai extends CardImpl<GodsEyeGateToTheReikai> {
// {tap}: Add {1} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// When Gods' Eye, Gate to the Reikai is put into a graveyard from the battlefield, put a 1/1 colorless Spirit creature token onto the battlefield.
this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new SpiritToken(), 1), false));
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new CreateTokenEffect(new SpiritToken(), 1), false));
}
public GodsEyeGateToTheReikai(final GodsEyeGateToTheReikai card) {

View file

@ -0,0 +1,130 @@
/*
* 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.coldsnap;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.RevealTargetFromHandCost;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
/**
*
* @author LevelX2
*/
public class MartyrOfSands extends CardImpl<MartyrOfSands> {
private static final FilterCard filter = new FilterCard("X white cards from your hand");
static {
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
public MartyrOfSands(UUID ownerId) {
super(ownerId, 15, "Martyr of Sands", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{W}");
this.expansionSetCode = "CSP";
this.subtype.add("Human");
this.subtype.add("Cleric");
this.color.setWhite(true);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
// {1}, Reveal X white cards from your hand, Sacrifice Martyr of Sands: You gain three times X life.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MartyrOfSandsEffect(), new ManaCostsImpl("{1}"));
ability.addCost(new RevealTargetFromHandCost(new TargetCardInHand(0,Integer.MAX_VALUE, filter)));
ability.addCost(new SacrificeSourceCost());
this.addAbility(ability);
}
public MartyrOfSands(final MartyrOfSands card) {
super(card);
}
@Override
public MartyrOfSands copy() {
return new MartyrOfSands(this);
}
}
class MartyrOfSandsEffect extends OneShotEffect<MartyrOfSandsEffect> {
public MartyrOfSandsEffect() {
super(Outcome.GainLife);
this.staticText = "You gain three times X life";
}
public MartyrOfSandsEffect(final MartyrOfSandsEffect effect) {
super(effect);
}
@Override
public MartyrOfSandsEffect copy() {
return new MartyrOfSandsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
RevealTargetFromHandCost revealCost = null;
for (Cost cost : source.getCosts()) {
if (cost instanceof RevealTargetFromHandCost) {
revealCost = (RevealTargetFromHandCost) cost;
}
}
Player controller = game.getPlayer(source.getControllerId());
Card sourceCard = game.getCard(source.getSourceId());
if (controller != null && sourceCard != null && revealCost != null) {
int live = revealCost.getNumberRevealedCards() * 3;
if (live > 0) {
controller.gainLife(live, game);
}
game.informPlayers(new StringBuilder(sourceCard.getName())
.append(": ").append(controller.getName()).append(" revealed ")
.append(revealCost.getNumberRevealedCards()).append(revealCost.getNumberRevealedCards() == 1 ?"white card":"white cards")
.append(" and gained ").append(live).append(" live").toString());
return true;
}
return false;
}
}

View file

@ -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 mage.sets.fifthedition;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
/**
*
* @author LevelX2
*/
public class HurkylsRecall extends CardImpl<HurkylsRecall> {
public HurkylsRecall(UUID ownerId) {
super(ownerId, 93, "Hurkyl's Recall", Rarity.RARE, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "5ED";
this.color.setBlue(true);
// Return all artifacts target player owns to his or her hand.
this.getSpellAbility().addEffect(new HurkylsRecallReturnToHandEffect());
this.getSpellAbility().addTarget(new TargetPlayer(true));
}
public HurkylsRecall(final HurkylsRecall card) {
super(card);
}
@Override
public HurkylsRecall copy() {
return new HurkylsRecall(this);
}
}
class HurkylsRecallReturnToHandEffect extends OneShotEffect<HurkylsRecallReturnToHandEffect> {
public HurkylsRecallReturnToHandEffect() {
super(Outcome.ReturnToHand);
staticText = "Return all artifacts target player owns to his or her hand";
}
public HurkylsRecallReturnToHandEffect(final HurkylsRecallReturnToHandEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
if (targetPointer.getFirst(game, source) != null) {
FilterArtifactPermanent filter = new FilterArtifactPermanent();
filter.add(new ControllerIdPredicate(targetPointer.getFirst(game, source)));
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
permanent.moveToZone(Zone.HAND, source.getSourceId(), game, true);
}
return true;
}
return false;
}
@Override
public HurkylsRecallReturnToHandEffect copy() {
return new HurkylsRecallReturnToHandEffect(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.fourthedition;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class HurkylsRecall extends mage.sets.fifthedition.HurkylsRecall {
public HurkylsRecall(UUID ownerId) {
super(ownerId);
this.cardNumber = 77;
this.expansionSetCode = "4ED";
}
public HurkylsRecall(final HurkylsRecall card) {
super(card);
}
@Override
public HurkylsRecall copy() {
return new HurkylsRecall(this);
}
}

View file

@ -32,6 +32,7 @@ import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
import mage.abilities.effects.common.DrawCardControllerEffect;
import mage.cards.CardImpl;
@ -45,7 +46,7 @@ public class HatchingPlans extends CardImpl<HatchingPlans> {
super(ownerId, 27, "Hatching Plans", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{1}{U}");
this.expansionSetCode = "GPT";
this.color.setBlue(true);
this.addAbility(new DiesTriggeredAbility(new DrawCardControllerEffect(3)));
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new DrawCardControllerEffect(3)));
}
public HatchingPlans (final HatchingPlans card) {

View file

@ -78,7 +78,7 @@ public class EssenceOfTheWild extends CardImpl<EssenceOfTheWild> {
class EssenceOfTheWildEffect extends ReplacementEffectImpl<EssenceOfTheWildEffect> {
public EssenceOfTheWildEffect() {
super(Duration.WhileOnBattlefield, Outcome.Copy);
super(Duration.WhileOnBattlefield, Outcome.Copy, false);
staticText = "Creatures you control enter the battlefield as a copy of {this}";
}

View file

@ -71,7 +71,8 @@ public class EvilTwin extends CardImpl<EvilTwin> {
this.addAbility(new SimpleStaticAbility(
Zone.BATTLEFIELD,
new EntersBattlefieldEffect(new CopyPermanentEffect(new EvilTwinApplyToPermanent()),
"You may have {this} enter the battlefield as a copy of any creature on the battlefield except it gains \"{U}{B}, {T}: Destroy target creature with the same name as this creature\"")));
"You may have {this} enter the battlefield as a copy of any creature on the battlefield except it gains \"{U}{B}, {T}: Destroy target creature with the same name as this creature\"",
true)));
}
public EvilTwin(final EvilTwin card) {

View file

@ -0,0 +1,140 @@
/*
* 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.lorwyn;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.DamageCreatureEvent;
import mage.game.events.DamagePlaneswalkerEvent;
import mage.game.events.DamagePlayerEvent;
import mage.game.events.GameEvent;
import static mage.game.events.GameEvent.EventType.DAMAGE_PLANESWALKER;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class DoranTheSiegeTower extends CardImpl<DoranTheSiegeTower> {
public DoranTheSiegeTower(UUID ownerId) {
super(ownerId, 247, "Doran, the Siege Tower", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{B}{G}{W}");
this.expansionSetCode = "LRW";
this.supertype.add("Legendary");
this.subtype.add("Treefolk");
this.subtype.add("Shaman");
this.color.setGreen(true);
this.color.setBlack(true);
this.color.setWhite(true);
this.power = new MageInt(0);
this.toughness = new MageInt(5);
// Each creature assigns combat damage equal to its toughness rather than its power.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DoranTheSiegeTowerEffect()));
}
public DoranTheSiegeTower(final DoranTheSiegeTower card) {
super(card);
}
@Override
public DoranTheSiegeTower copy() {
return new DoranTheSiegeTower(this);
}
}
class DoranTheSiegeTowerEffect extends ReplacementEffectImpl<DoranTheSiegeTowerEffect> {
public DoranTheSiegeTowerEffect() {
super(Constants.Duration.WhileOnBattlefield, Outcome.Damage);
staticText = "Each creature assigns combat damage equal to its toughness rather than its power";
}
public DoranTheSiegeTowerEffect(final DoranTheSiegeTowerEffect effect) {
super(effect);
}
@Override
public DoranTheSiegeTowerEffect copy() {
return new DoranTheSiegeTowerEffect(this);
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
switch (event.getType()) {
case DAMAGE_PLAYER:
if (((DamagePlayerEvent) event).isCombatDamage() &&
(event.getAppliedEffects() == null || !event.getAppliedEffects().contains(this.getId()))) {
event.getAppliedEffects().add(this.getId());
return true;
}
break;
case DAMAGE_PLANESWALKER:
if (((DamagePlaneswalkerEvent) event).isCombatDamage() &&
(event.getAppliedEffects() == null || !event.getAppliedEffects().contains(this.getId()))) {
event.getAppliedEffects().add(this.getId());
return true;
}
break;
case DAMAGE_CREATURE:
if (((DamageCreatureEvent) event).isCombatDamage() &&
(event.getAppliedEffects() == null || !event.getAppliedEffects().contains(this.getId()))) {
event.getAppliedEffects().add(this.getId());
return true;
}
break;
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getSourceId());
if (permanent != null) {
event.setAmount(permanent.getToughness().getValue());
}
return false;
}
}

View file

@ -65,7 +65,8 @@ public class PhantasmalImage extends CardImpl<PhantasmalImage> {
this.power = new MageInt(0);
this.toughness = new MageInt(0);
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new PhantasmalImageCopyEffect(), abilityText));
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(
new PhantasmalImageCopyEffect(), abilityText, true));
this.addAbility(ability);
}

View file

@ -35,6 +35,7 @@ import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.AttachEffect;
@ -67,7 +68,7 @@ public class GlisteningOil extends CardImpl<GlisteningOil> {
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new GainAbilityAttachedEffect(InfectAbility.getInstance(), Constants.AttachmentType.AURA)));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GlisteningOilEffect(), Constants.TargetController.YOU, false));
this.addAbility(new DiesTriggeredAbility(new ReturnToHandSourceEffect()));
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
}
public GlisteningOil(final GlisteningOil card) {

View file

@ -62,7 +62,11 @@ public class PhyrexianMetamorph extends CardImpl<PhyrexianMetamorph> {
this.color.setBlue(true);
this.power = new MageInt(0);
this.toughness = new MageInt(0);
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new PhyrexianMetamorphEffect(), "You may have {this} enter the battlefield as a copy of any artifact or creature on the battlefield, except it's an artifact in addition to its other types"));
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(
new PhyrexianMetamorphEffect(),
"You may have {this} enter the battlefield as a copy of any artifact or creature on the battlefield, except it's an artifact in addition to its other types",
true));
this.addAbility(ability);
}

View file

@ -67,7 +67,7 @@ public class TorporOrb extends CardImpl<TorporOrb> {
class TorporOrbEffect extends ReplacementEffectImpl<TorporOrbEffect> {
TorporOrbEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
super(Duration.WhileOnBattlefield, Outcome.Detriment, false);
staticText = "Creatures entering the battlefield don't cause abilities to trigger";
}

View file

@ -60,7 +60,7 @@ public class ViridianHarvest extends CardImpl<ViridianHarvest> {
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
this.addAbility(new DiesAttachedTriggeredAbility(new GainLifeEffect(6), "enchanted artifact"));
this.addAbility(new DiesAttachedTriggeredAbility(new GainLifeEffect(6), "enchanted artifact", false, false));
}
public ViridianHarvest(final ViridianHarvest card) {

View file

@ -28,9 +28,9 @@
package mage.sets.planechase2012;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -61,10 +61,10 @@ public class SakashimasStudent extends CardImpl<SakashimasStudent> {
// Ninjutsu {1}{U}
this.addAbility(new NinjutsuAbility(new ManaCostsImpl("{1}{U}")));
// You may have Sakashima's Student enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types.
this.addAbility(new SimpleStaticAbility(
Constants.Zone.BATTLEFIELD,
new EntersBattlefieldEffect(new CopyPermanentEffect(new SakashimasStudentApplyToPermanent()),
"You may have {this} enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types")));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,new EntersBattlefieldEffect(
new CopyPermanentEffect(new SakashimasStudentApplyToPermanent()),
"You may have {this} enter the battlefield as a copy of any creature on the battlefield, except it's still a Ninja in addition to its other creature types",
true)));
}

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.revisededition;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class HurkylsRecall extends mage.sets.fifthedition.HurkylsRecall {
public HurkylsRecall(UUID ownerId) {
super(ownerId);
this.cardNumber = 60;
this.expansionSetCode = "3ED";
}
public HurkylsRecall(final HurkylsRecall card) {
super(card);
}
@Override
public HurkylsRecall copy() {
return new HurkylsRecall(this);
}
}

View file

@ -0,0 +1,115 @@
/*
* 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.shadowmoor;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.game.Game;
import mage.players.Player;
/**
*
* @author LevelX2
*/
public class AuguryAdept extends CardImpl<AuguryAdept> {
public AuguryAdept(UUID ownerId) {
super(ownerId, 137, "Augury Adept", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W/U}{W/U}");
this.expansionSetCode = "SHM";
this.subtype.add("Kithkin");
this.subtype.add("Wizard");
this.color.setBlue(true);
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
// Whenever Augury Adept deals combat damage to a player, reveal the top card of your library and put that card into your hand. You gain life equal to its converted mana cost.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new AuguryAdeptEffect(), false));
}
public AuguryAdept(final AuguryAdept card) {
super(card);
}
@Override
public AuguryAdept copy() {
return new AuguryAdept(this);
}
}
class AuguryAdeptEffect extends OneShotEffect<AuguryAdeptEffect> {
public AuguryAdeptEffect() {
super(Outcome.GainLife);
this.staticText = "reveal the top card of your library and put that card into your hand. You gain life equal to its converted mana cost";
}
public AuguryAdeptEffect(final AuguryAdeptEffect effect) {
super(effect);
}
@Override
public AuguryAdeptEffect copy() {
return new AuguryAdeptEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Card sourceCard = game.getCard(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (player == null || sourceCard == null) {
return false;
}
Cards cards = new CardsImpl();
Card card = player.getLibrary().removeFromTop(game);
if (card != null) {
card.moveToZone(Constants.Zone.HAND, source.getSourceId(), game, true);
int cmc = card.getManaCost().convertedManaCost();
if (cmc > 0) {
player.gainLife(cmc, game);
}
cards.add(card);
player.revealCards(sourceCard.getName(), cards, game);
game.informPlayers(sourceCard.getName() + ": "+ player.getName() + " revealed " +card.getName() + " and gained " + cmc + " live");
}
return true;
}
}

View file

@ -28,6 +28,7 @@
package mage.sets.shardsofalara;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
@ -47,7 +48,6 @@ import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author Loki
@ -58,10 +58,17 @@ public class SigilOfDistinction extends CardImpl<SigilOfDistinction> {
super(ownerId, 219, "Sigil of Distinction", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{X}");
this.expansionSetCode = "ALA";
this.subtype.add("Equipment");
// Sigil of Distinction enters the battlefield with X charge counters on it.
this.addAbility(new EntersBattlefieldAbility(new SigilOfDistinctionEffect(), "{this} enters the battlefield with X charge counters on it"));
this.addAbility(new EquipAbility(Outcome.AddAbility, new RemoveCountersSourceCost(CounterType.CHARGE.createInstance())));
// Equipped creature gets +1/+1 for each charge counter on Sigil of Distinction.
BoostEquippedEffect effect = new BoostEquippedEffect(new CountersCount(CounterType.CHARGE), new CountersCount(CounterType.CHARGE));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
// EquipRemove a charge counter from Sigil of Distinction.
this.addAbility(new EquipAbility(Outcome.AddAbility, new RemoveCountersSourceCost(CounterType.CHARGE.createInstance())));
}
public SigilOfDistinction(final SigilOfDistinction card) {
@ -103,4 +110,4 @@ class SigilOfDistinctionEffect extends OneShotEffect<SigilOfDistinctionEffect> {
public SigilOfDistinctionEffect copy() {
return new SigilOfDistinctionEffect(this);
}
}
}

View file

@ -53,7 +53,10 @@ public class Clone extends CardImpl<Clone> {
this.power = new MageInt(0);
this.toughness = new MageInt(0);
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new CopyPermanentEffect(), "You may have {this} enter the battlefield as a copy of any creature on the battlefield"));
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(
new CopyPermanentEffect(),
"You may have {this} enter the battlefield as a copy of any creature on the battlefield",
true));
this.addAbility(ability);
}

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.tenth;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public class HurkylsRecall extends mage.sets.fifthedition.HurkylsRecall {
public HurkylsRecall(UUID ownerId) {
super(ownerId);
this.cardNumber = 88;
this.expansionSetCode = "10E";
}
public HurkylsRecall(final HurkylsRecall card) {
super(card);
}
@Override
public HurkylsRecall copy() {
return new HurkylsRecall(this);
}
}

View file

@ -56,7 +56,10 @@ public class SculptingSteel extends CardImpl<SculptingSteel> {
this.expansionSetCode = "10E";
// You may have Sculpting Steel enter the battlefield as a copy of any artifact on the battlefield.
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(new CopyPermanentEffect(filter), "You may have {this} enter the battlefield as a copy of any artifact on the battlefield"));
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new EntersBattlefieldEffect(
new CopyPermanentEffect(filter),
"You may have {this} enter the battlefield as a copy of any artifact on the battlefield",
true));
this.addAbility(ability);
}

View file

@ -0,0 +1,74 @@
/*
* 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.timespiral;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.mana.WhiteManaAbility;
import mage.cards.CardImpl;
import mage.filter.common.FilterBasicLandCard;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.target.common.TargetCardInLibrary;
/**
*
* @author LevelX2
*/
public class FlagstonesOfTrokair extends CardImpl<FlagstonesOfTrokair> {
private static final FilterBasicLandCard filter = new FilterBasicLandCard();
static {
filter.add(new SubtypePredicate("Plains"));
}
public FlagstonesOfTrokair(UUID ownerId) {
super(ownerId, 272, "Flagstones of Trokair", Rarity.RARE, new CardType[]{CardType.LAND}, "");
this.expansionSetCode = "TSP";
this.supertype.add("Legendary");
// {tap}: Add {W} to your mana pool.
this.addAbility(new WhiteManaAbility());
// When Flagstones of Trokair is put into a graveyard from the battlefield, you may search your library for a Plains card and put it onto the battlefield tapped. If you do, shuffle your library.
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(filter), true, true), true));
}
public FlagstonesOfTrokair(final FlagstonesOfTrokair card) {
super(card);
}
@Override
public FlagstonesOfTrokair copy() {
return new FlagstonesOfTrokair(this);
}
}

View file

@ -56,7 +56,10 @@ public class Vesuva extends CardImpl<Vesuva> {
this.expansionSetCode = "TSP";
// You may have Vesuva enter the battlefield tapped as a copy of any land on the battlefield.
EntersBattlefieldEffect effect = new EntersBattlefieldEffect(new TapSourceEffect(true), "You may have {this} enter the battlefield tapped as a copy of any land on the battlefield");
EntersBattlefieldEffect effect = new EntersBattlefieldEffect(
new TapSourceEffect(true),
"You may have {this} enter the battlefield tapped as a copy of any land on the battlefield",
true);
effect.addEffect(new CopyPermanentEffect(filter));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
}

View file

@ -34,6 +34,7 @@ import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.common.PutIntoGraveFromBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.abilities.effects.common.AttachEffect;
@ -66,7 +67,7 @@ public class Cessation extends CardImpl<Cessation> {
this.addAbility(ability);
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new CessationEffect()));
//When Cessation is put into a graveyard from the battlefield, return Cessation to its owner's hand.
this.addAbility(new DiesTriggeredAbility(new ReturnToHandSourceEffect()));
this.addAbility(new PutIntoGraveFromBattlefieldTriggeredAbility(new ReturnToHandSourceEffect()));
}
public Cessation(final Cessation card) {

View file

@ -70,7 +70,7 @@ public class CorruptedZendikon extends CardImpl<CorruptedZendikon> {
Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new OozeToken(), "Enchanted land is a 3/3 black Ooze creature. It's still a land.", Constants.Duration.Custom));
this.addAbility(ability2);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land");
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false);
this.addAbility(ability3);
}

View file

@ -71,7 +71,7 @@ public class CrusherZendikon extends CardImpl<CrusherZendikon> {
Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new BeastToken(), "Enchanted land is a 4/2 red Beast creature with trample. It's still a land.", Constants.Duration.Custom));
this.addAbility(ability2);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land");
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false);
this.addAbility(ability3);
}

View file

@ -71,7 +71,7 @@ public class GuardianZendikon extends CardImpl<GuardianZendikon> {
Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new WallToken(), "Enchanted land is a 2/6 white wall creature with defender. It's still a land", Constants.Duration.Custom));
this.addAbility(ability2);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land");
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false);
this.addAbility(ability3);
}

View file

@ -28,9 +28,9 @@
package mage.sets.worldwake;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.Constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -40,6 +40,7 @@ import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
/**
*
@ -52,6 +53,7 @@ public class JwariShapeshifter extends CardImpl<JwariShapeshifter> {
static {
filter.add(new SubtypePredicate("Ally"));
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new AnotherPredicate()); // needed because during enters_the_battlefield event the creature is already targetable although it shouldn't
}
public JwariShapeshifter(UUID ownerId) {
@ -65,7 +67,10 @@ public class JwariShapeshifter extends CardImpl<JwariShapeshifter> {
this.toughness = new MageInt(0);
// You may have Jwari Shapeshifter enter the battlefield as a copy of any Ally creature on the battlefield.
Ability ability = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new EntersBattlefieldEffect(new CopyPermanentEffect(filter), "You may have {this} enter the battlefield as a copy of any Ally creature on the battlefield"));
Ability ability = new SimpleStaticAbility(
Zone.BATTLEFIELD,
new EntersBattlefieldEffect(new CopyPermanentEffect(filter), null,
"You may have {this} enter the battlefield as a copy of any Ally creature on the battlefield", true, true));
this.addAbility(ability);
}

View file

@ -70,7 +70,7 @@ public class VastwoodZendikon extends CardImpl<VastwoodZendikon> {
Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new VastwoodElementalToken(), "Enchanted land is a 6/4 green Elemental creature. It's still a land", Constants.Duration.Custom));
this.addAbility(ability2);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land");
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false);
this.addAbility(ability3);
}

View file

@ -71,7 +71,7 @@ public class WindZendikon extends CardImpl<WindZendikon> {
Ability ability2 = new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BecomesCreatureAttachedEffect(new ElementalToken(), "Enchanted land is a 2/2 blue Elemental creature with flying. It's still a land", Constants.Duration.Custom));
this.addAbility(ability2);
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land");
Ability ability3 = new DiesAttachedTriggeredAbility(new ReturnToHandAttachedEffect(), "enchanted land", false, false);
this.addAbility(ability3);
}

View file

@ -109,8 +109,7 @@ class ChooseColorEffect extends OneShotEffect<ChooseColorEffect> {
ChoiceColor colorChoice = new ChoiceColor();
if (player.choose(Constants.Outcome.Benefit, colorChoice, game)) {
game.informPlayers(perm.getName() + ": " + player.getName() + " has chosen " + colorChoice.getChoice());
game.getState().setValue(perm.getId() + "_color", colorChoice.getColor());
game.addEffect(new GainProtectionFromChosenColorEffect(), source);
game.addEffect(new GainProtectionFromChosenColorEffect(colorChoice.getColor()), source);
}
}
return false;
@ -131,15 +130,18 @@ class GainProtectionFromChosenColorEffect extends GainAbilityControlledEffect {
filter1.add(new SubtypePredicate("Ally"));
}
private FilterCard filter2;
private ObjectColor chosenColor;
public GainProtectionFromChosenColorEffect() {
public GainProtectionFromChosenColorEffect(ObjectColor chosenColor) {
super(new ProtectionAbility(new FilterCard()), Duration.EndOfTurn, filter1);
filter2 = (FilterCard) ((ProtectionAbility) getFirstAbility()).getFilter();
this.chosenColor = chosenColor;
}
public GainProtectionFromChosenColorEffect(final GainProtectionFromChosenColorEffect effect) {
super(effect);
this.filter2 = effect.filter2.copy();
this.chosenColor = effect.chosenColor;
}
@Override
@ -149,7 +151,6 @@ class GainProtectionFromChosenColorEffect extends GainAbilityControlledEffect {
@Override
public boolean apply(Game game, Ability source) {
ObjectColor chosenColor = (ObjectColor) game.getState().getValue(source.getSourceId() + "_color");
filter2.add(new ColorPredicate(chosenColor));
filter2.setMessage(chosenColor.getDescription());
setAbility(new ProtectionAbility(new FilterCard(filter2)));

View file

@ -1,6 +1,6 @@
package mage.abilities.common;
import mage.Constants;
import mage.Constants.Zone;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.Effect;
import mage.game.Game;
@ -13,21 +13,29 @@ import mage.game.permanent.Permanent;
* @author Loki
*/
public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl<DiesAttachedTriggeredAbility> {
private String attachedDescription;
private boolean diesRuleText;
public DiesAttachedTriggeredAbility(Effect effect, String attachedDescription) {
this(effect, attachedDescription, false);
}
public DiesAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional) {
super(Constants.Zone.BATTLEFIELD, effect, optional);
this(effect, attachedDescription, optional, true);
}
public DiesAttachedTriggeredAbility(Effect effect, String attachedDescription, boolean optional, boolean diesRuleText) {
super(Zone.BATTLEFIELD, effect, optional);
this.attachedDescription = attachedDescription;
this.diesRuleText = diesRuleText;
}
public DiesAttachedTriggeredAbility(final DiesAttachedTriggeredAbility ability) {
super(ability);
this.attachedDescription = ability.attachedDescription;
this.diesRuleText = ability.diesRuleText;
}
@Override
@ -38,7 +46,7 @@ public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl<DiesAttac
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE && ((ZoneChangeEvent)event).isDiesEvent()) {
Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Constants.Zone.BATTLEFIELD);
Permanent p = (Permanent) game.getLastKnownInformation(event.getTargetId(), Zone.BATTLEFIELD);
if (p.getAttachments().contains(this.getSourceId())) {
for (Effect effect : getEffects()) {
effect.setValue("attachedTo", p);
@ -51,6 +59,13 @@ public class DiesAttachedTriggeredAbility extends TriggeredAbilityImpl<DiesAttac
@Override
public String getRule() {
return "When " + attachedDescription + " dies, " + super.getRule();
StringBuilder sb = new StringBuilder("When ").append(attachedDescription);
if (diesRuleText) {
sb.append(" dies, ");
} else {
sb.append(" is put into graveyard, ");
}
sb.append(super.getRule());
return sb.toString();
}
}

View file

@ -30,8 +30,9 @@
package mage.abilities.costs.common;
import java.util.UUID;
import mage.Constants;
import mage.Constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.costs.CostImpl;
import mage.cards.Card;
@ -44,6 +45,7 @@ import mage.target.common.TargetCardInHand;
public class RevealTargetFromHandCost extends CostImpl<RevealTargetFromHandCost> {
public int convertedManaCosts = 0;
protected int numberCardsRevealed = 0;
public RevealTargetFromHandCost(TargetCardInHand target) {
this.addTarget(target);
@ -52,23 +54,28 @@ public class RevealTargetFromHandCost extends CostImpl<RevealTargetFromHandCost>
public RevealTargetFromHandCost(RevealTargetFromHandCost cost) {
super(cost);
this.convertedManaCosts = cost.convertedManaCosts;
this.numberCardsRevealed = cost.numberCardsRevealed;
}
@Override
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana) {
if (targets.choose(Constants.Outcome.Benefit, controllerId, sourceId, game)) {
if (targets.choose(Outcome.Benefit, controllerId, sourceId, game)) {
convertedManaCosts = 0;
numberCardsRevealed = 0;
Player player = game.getPlayer(controllerId);
Cards cards = new CardsImpl();
for (UUID targetId: targets.get(0).getTargets()) {
Card card = player.getHand().get(targetId, game);
if (card == null)
return false;
convertedManaCosts = card.getManaCost().convertedManaCost();
cards.add(card);
player.revealCards("Revealed card", cards, game); // this is not a boolean
convertedManaCosts += card.getManaCost().convertedManaCost();
numberCardsRevealed++;
cards.add(card);
paid = true;
return paid;
}
player.revealCards("Revealed card", cards, game); // this is not a boolean
return paid;
}
paid = false;
return paid;
@ -78,6 +85,10 @@ public class RevealTargetFromHandCost extends CostImpl<RevealTargetFromHandCost>
return convertedManaCosts;
}
public int getNumberRevealedCards() {
return numberCardsRevealed;
}
@Override
public boolean canPay(UUID sourceId, UUID controllerId, Game game) {
return targets.canChoose(controllerId, game);
@ -87,4 +98,4 @@ public class RevealTargetFromHandCost extends CostImpl<RevealTargetFromHandCost>
public RevealTargetFromHandCost copy() {
return new RevealTargetFromHandCost(this);
}
}
}

View file

@ -34,6 +34,7 @@ import mage.Constants.AsThoughEffectType;
import mage.Constants.Duration;
import mage.Constants.Layer;
import mage.Constants.SubLayer;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.StaticAbility;
import mage.game.Game;
@ -376,7 +377,7 @@ public class ContinuousEffects implements Serializable {
else {
//20100716 - 616.1c
Player player = game.getPlayer(event.getPlayerId());
index = player.chooseEffect(rEffects, game);
index = player.chooseEffect(getReplacementEffectsTexts(rEffects, game), game);
}
ReplacementEffect rEffect = rEffects.get(index);
caught = rEffect.replaceEvent(event, this.getAbility(rEffect.getId()), game);
@ -541,6 +542,20 @@ public class ContinuousEffects implements Serializable {
return effects;
}
public List<String> getReplacementEffectsTexts(List<ReplacementEffect> rEffects, Game game) {
List<String> texts = new ArrayList<String>();
for (ReplacementEffect effect: rEffects) {
Ability ability = replacementEffects.getAbility(effect.getId());
MageObject object = game.getObject(ability.getSourceId());
if (object != null) {
texts.add(ability.getRule(object.getName()));
} else {
texts.add(effect.getText(null));
}
}
return texts;
}
}
class TimestampSorter implements Comparator<ContinuousEffect> {
@Override

View file

@ -29,6 +29,7 @@
package mage.abilities.effects;
import mage.Constants.Duration;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.condition.Condition;
@ -36,6 +37,7 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.stack.Spell;
import mage.players.Player;
/**
*
@ -46,6 +48,7 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl<EntersBattlef
protected Effects baseEffects = new Effects();
protected String text;
protected Condition condition;
protected boolean optional;
public static final String SOURCE_CAST_SPELL_ABILITY = "sourceCastSpellAbility";
@ -54,16 +57,23 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl<EntersBattlef
}
public EntersBattlefieldEffect(Effect baseEffect, String text) {
super(Duration.OneUse, baseEffect.getOutcome());
this.baseEffects.add(baseEffect);
this.text = text;
this(baseEffect, null, text, true, false);
}
public EntersBattlefieldEffect(Effect baseEffect, String text, boolean optional) {
this(baseEffect, null, text, true, optional);
}
public EntersBattlefieldEffect(Effect baseEffect, Condition condition, String text) {
super(Duration.OneUse, baseEffect.getOutcome());
this(baseEffect, condition, text, true, false);
}
public EntersBattlefieldEffect(Effect baseEffect, Condition condition, String text, boolean selfScope, boolean optional) {
super(Duration.OneUse, baseEffect.getOutcome(), selfScope);
this.baseEffects.add(baseEffect);
this.text = text;
this.condition = condition;
this.optional = optional;
}
public EntersBattlefieldEffect(EntersBattlefieldEffect effect) {
@ -71,6 +81,7 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl<EntersBattlef
this.baseEffects = effect.baseEffects.copy();
this.text = effect.text;
this.condition = effect.condition;
this.optional = effect.optional;
}
public void addEffect(Effect effect) {
@ -96,6 +107,16 @@ public class EntersBattlefieldEffect extends ReplacementEffectImpl<EntersBattlef
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
if (optional) {
Player controller = game.getPlayer(source.getControllerId());
MageObject object = game.getObject(source.getSourceId());
if (controller == null || object == null) {
return false;
}
if (!controller.chooseUse(outcome, new StringBuilder("Use effect of ").append(object.getName()).append("?").toString(), game)) {
return false;
}
}
Spell spell = game.getStack().getSpell(event.getSourceId());
for (Effect effect: baseEffects) {
if (source.activate(game, false)) {

View file

@ -38,6 +38,7 @@ import mage.abilities.costs.Cost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.game.Game;
import mage.game.events.EntersTheBattlefieldEvent;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
@ -73,7 +74,7 @@ public class EchoAbility extends TriggeredAbilityImpl<EchoAbility> {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
ZoneChangeEvent zEvent = (ZoneChangeEvent)event;
EntersTheBattlefieldEvent zEvent = (EntersTheBattlefieldEvent)event;
if(zEvent.getFromZone() == null && this.echoPaid) {
this.echoPaid = false;
}

View file

@ -607,7 +607,7 @@ public abstract class PermanentImpl<T extends PermanentImpl<T>> extends CardImpl
*/
private int damage(int damageAmount, UUID sourceId, Game game, boolean preventable, boolean combat, boolean markDamage, ArrayList<UUID> appliedEffects) {
int damageDone = 0;
if (damageAmount > 0 && canDamage(game.getObject(sourceId), game)) {
if (canDamage(game.getObject(sourceId), game)) {
if (cardType.contains(CardType.PLANESWALKER)) {
damageDone = damagePlaneswalker(damageAmount, sourceId, game, preventable, combat, markDamage, appliedEffects);
} else {

View file

@ -231,7 +231,7 @@ public interface Player extends MageItem, Copyable<Player> {
// set the value for X spells and abilities
int announceXMana(int min, int max, String message, Game game, Ability ability);
int chooseEffect(List<ReplacementEffect> rEffects, Game game);
int chooseEffect(List<String> rEffects, Game game);
TriggeredAbility chooseTriggeredAbility(List<TriggeredAbility> abilities, Game game);
Mode chooseMode(Modes modes, Ability source, Game game);
void selectAttackers(Game game, UUID attackingPlayerId);