[BOK] 11 cards and some small fixes/improvements

This commit is contained in:
LevelX2 2012-09-14 08:14:09 +02:00
parent 9f8849a3e0
commit 681be2a70c
16 changed files with 1702 additions and 357 deletions

View file

@ -1,64 +1,65 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.keyword.SoulshiftAbility;
import mage.cards.CardImpl;
/**
*
* @author North
*/
public class ForkedBranchGarami extends CardImpl<ForkedBranchGarami> {
public ForkedBranchGarami(UUID ownerId) {
super(ownerId, 125, "Forked-Branch Garami", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.expansionSetCode = "BOK";
this.subtype.add("Spirit");
this.color.setGreen(true);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
this.addAbility(new SoulshiftAbility(4));
this.addAbility(new SoulshiftAbility(4));
}
public ForkedBranchGarami(final ForkedBranchGarami card) {
super(card);
}
@Override
public ForkedBranchGarami copy() {
return new ForkedBranchGarami(this);
}
}
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.keyword.SoulshiftAbility;
import mage.cards.CardImpl;
/**
*
* @author North
*/
public class ForkedBranchGarami extends CardImpl<ForkedBranchGarami> {
public ForkedBranchGarami(UUID ownerId) {
super(ownerId, 125, "Forked-Branch Garami", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
this.expansionSetCode = "BOK";
this.subtype.add("Spirit");
this.color.setGreen(true);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// Soulshift 4, soulshift 4 (When this creature dies, you may return up to two target Spirit cards with converted mana cost 4 or less from your graveyard to your hand.)
this.addAbility(new SoulshiftAbility(4));
this.addAbility(new SoulshiftAbility(4));
}
public ForkedBranchGarami(final ForkedBranchGarami card) {
super(card);
}
@Override
public ForkedBranchGarami copy() {
return new ForkedBranchGarami(this);
}
}

View file

@ -0,0 +1,125 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.SpellAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.CostModificationEffectImpl;
import mage.abilities.keyword.BushidoAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.players.Player;
import mage.util.CardUtil;
/**
* @author LevelX2
*/
public class KentaroTheSmilingCat extends CardImpl<KentaroTheSmilingCat> {
public KentaroTheSmilingCat(UUID ownerId) {
super(ownerId, 13, "Kentaro, the Smiling Cat", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{1}{W}");
this.expansionSetCode = "BOK";
this.supertype.add("Legendary");
this.subtype.add("Human");
this.subtype.add("Samurai");
this.color.setWhite(true);
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// Bushido 1 (When this blocks or becomes blocked, it gets +1/+1 until end of turn.)
this.addAbility(new BushidoAbility(1));
// You may pay {X} rather than pay the mana cost for Samurai spells you cast, where X is that spell's converted mana cost.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new KentaroTheSmilingCatCostReductionEffect()));
}
public KentaroTheSmilingCat(final KentaroTheSmilingCat card) {
super(card);
}
@Override
public KentaroTheSmilingCat copy() {
return new KentaroTheSmilingCat(this);
}
private class KentaroTheSmilingCatCostReductionEffect extends CostModificationEffectImpl<KentaroTheSmilingCatCostReductionEffect> {
private static final String effectText = "You may pay {X} rather than pay the mana cost for Samurai spells you cast, where X is that spell's converted mana cost";
KentaroTheSmilingCatCostReductionEffect() {
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Benefit);
staticText = effectText;
}
KentaroTheSmilingCatCostReductionEffect(KentaroTheSmilingCatCostReductionEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source, Ability abilityToModify) {
return true;
}
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify instanceof SpellAbility) {
SpellAbility spell = (SpellAbility) abilityToModify;
if (spell.getControllerId().equals(source.getControllerId())) {
Card sourceCard = game.getCard(spell.getSourceId());
if (sourceCard != null && sourceCard.getSubtype().contains("Samurai")) {
String manaCostsString = "{" + sourceCard.getManaCost().convertedManaCost() + "}";
Player player = game.getPlayer(spell.getControllerId());
if (player != null && player.chooseUse(Constants.Outcome.Benefit, "Pay converted mana cost rather than pay the mana cost for Samurai creature?", game)) {
spell.getManaCostsToPay().clear();
spell.getManaCostsToPay().load(manaCostsString);
return true;
}
}
}
}
return false;
}
@Override
public KentaroTheSmilingCatCostReductionEffect copy() {
return new KentaroTheSmilingCatCostReductionEffect(this);
}
}
}

View file

@ -0,0 +1,77 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.SacrificeSourceCost;
import mage.abilities.effects.common.continious.GainProtectionFromColorTargetEffect;
import mage.abilities.keyword.SoulshiftAbility;
import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author LevelX2
*/
public class MoonlitStrider extends CardImpl<MoonlitStrider> {
public MoonlitStrider(UUID ownerId) {
super(ownerId, 16, "Moonlit Strider", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{3}{W}");
this.expansionSetCode = "BOK";
this.subtype.add("Spirit");
this.color.setWhite(true);
this.power = new MageInt(1);
this.toughness = new MageInt(4);
// Sacrifice Moonlit Strider: Target creature you control gains protection from the color of your choice until end of turn.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new GainProtectionFromColorTargetEffect(Constants.Duration.EndOfTurn), new SacrificeSourceCost());
ability.addChoice(new ChoiceColor());
ability.addTarget(new TargetControlledCreaturePermanent());
this.addAbility(ability);
// Soulshift 3 (When this creature dies, you may return target Spirit card with converted mana cost 3 or less from your graveyard to your hand.)
this.addAbility(new SoulshiftAbility(3));
}
public MoonlitStrider(final MoonlitStrider card) {
super(card);
}
@Override
public MoonlitStrider copy() {
return new MoonlitStrider(this);
}
}

View file

@ -0,0 +1,104 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
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.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author LevelX2
*/
public class OrbOfDreams extends CardImpl<OrbOfDreams> {
public OrbOfDreams(UUID ownerId) {
super(ownerId, 156, "Orb of Dreams", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "BOK";
// Permanents enter the battlefield tapped.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new OrbOfDreamsEffect()));
}
public OrbOfDreams(final OrbOfDreams card) {
super(card);
}
@Override
public OrbOfDreams copy() {
return new OrbOfDreams(this);
}
private class OrbOfDreamsEffect extends ReplacementEffectImpl<OrbOfDreamsEffect> {
OrbOfDreamsEffect() {
super(Constants.Duration.WhileOnBattlefield, Constants.Outcome.Tap);
staticText = "Permanents enter the battlefield tapped";
}
OrbOfDreamsEffect(final OrbOfDreamsEffect effect) {
super(effect);
}
@Override
public OrbOfDreamsEffect copy() {
return new OrbOfDreamsEffect(this);
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent != null) {
permanent.setTapped(true);
}
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == GameEvent.EventType.ENTERS_THE_BATTLEFIELD) {
return true;
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
}
}

View file

@ -0,0 +1,152 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.CreatureEntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continious.BoostEquippedEffect;
import mage.abilities.keyword.EquipAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class RoninWarclub extends CardImpl<RoninWarclub> {
public RoninWarclub(UUID ownerId) {
super(ownerId, 158, "Ronin Warclub", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "BOK";
this.subtype.add("Equipment");
// Equipped creature gets +2/+1.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new BoostEquippedEffect(2, 1)));
// Whenever a creature enters the battlefield under your control, attach Ronin Warclub to that creature.
Ability ability = new RoninWarclubTriggeredAbility();
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// Equip {5} ({5}: Attach to target creature you control. Equip only as a sorcery.)
this.addAbility(new EquipAbility(Constants.Outcome.BoostCreature, new GenericManaCost(5)));
}
public RoninWarclub(final RoninWarclub card) {
super(card);
}
@Override
public RoninWarclub copy() {
return new RoninWarclub(this);
}
private class RoninWarclubTriggeredAbility extends TriggeredAbilityImpl<RoninWarclubTriggeredAbility> {
public RoninWarclubTriggeredAbility() {
super(Constants.Zone.BATTLEFIELD, new RoninWarclubAttachEffect(), false);
}
public RoninWarclubTriggeredAbility(RoninWarclubTriggeredAbility ability) {
super(ability);
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getType() == GameEvent.EventType.ZONE_CHANGE) {
Permanent permanent = game.getPermanent(event.getTargetId());
if (((ZoneChangeEvent) event).getToZone() == Constants.Zone.BATTLEFIELD
&& permanent.getCardType().contains(CardType.CREATURE)
&& (permanent.getControllerId().equals(this.controllerId))) {
if (!this.getTargets().isEmpty()) {
// remove previous target
if (this.getTargets().get(0).getTargets().size() > 0) {
this.getTargets().clear();
this.addTarget(new TargetCreaturePermanent());
}
Target target = this.getTargets().get(0);
if (target instanceof TargetCreaturePermanent) {
target.add(event.getTargetId(), game);
}
}
return true;
}
}
return false;
}
@Override
public RoninWarclubTriggeredAbility copy() {
return new RoninWarclubTriggeredAbility(this);
}
}
private class RoninWarclubAttachEffect extends OneShotEffect<RoninWarclubAttachEffect> {
public RoninWarclubAttachEffect() {
super(Constants.Outcome.BoostCreature);
this.staticText = "Whenever a creature enters the battlefield under your control, attach {this} to that creature";
}
public RoninWarclubAttachEffect(final RoninWarclubAttachEffect effect) {
super(effect);
}
@Override
public RoninWarclubAttachEffect copy() {
return new RoninWarclubAttachEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
boolean result;
result = permanent.addAttachment(source.getSourceId(), game);
return result;
}
return false;
}
}
}

View file

@ -0,0 +1,163 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
/**
*
* @author LevelX2
*/
public class Scour extends CardImpl<Scour> {
private static final FilterPermanent filter = new FilterPermanent("enchantment");
static {
filter.add(new CardTypePredicate(CardType.ENCHANTMENT));
}
public Scour(UUID ownerId) {
super(ownerId, 20, "Scour", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{W}{W}");
this.expansionSetCode = "BOK";
this.color.setWhite(true);
// Exile target enchantment.
this.getSpellAbility().addEffect(new ScourExileTargetEffect());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
// Search its controller's graveyard, hand, and library for all cards with the same name as that enchantment and exile them. Then that player shuffles his or her library.
}
public Scour(final Scour card) {
super(card);
}
@Override
public Scour copy() {
return new Scour(this);
}
private class ScourExileTargetEffect extends OneShotEffect<ScourExileTargetEffect> {
private String exileZone = null;
private UUID exileId = null;
public ScourExileTargetEffect() {
super(Constants.Outcome.Exile);
this.staticText = "Exile target enchantment. Search its controller's graveyard, hand, and library for all cards with the same name as that enchantment and exile them. Then that player shuffles his or her library";
}
public ScourExileTargetEffect(final ScourExileTargetEffect effect) {
super(effect);
this.exileZone = effect.exileZone;
this.exileId = effect.exileId;
}
@Override
public ScourExileTargetEffect copy() {
return new ScourExileTargetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
boolean result;
Permanent permanent = game.getPermanent(targetPointer.getFirst(game, source));
if (exileId == null) {
exileId = getId();
}
if (permanent != null) {
Player targetPlayer = game.getPlayer(permanent.getOwnerId());
Player you = game.getPlayer(source.getControllerId());
Card chosenCard = permanent;
result = permanent.moveToExile(exileId, exileZone, source.getSourceId(), game);
if (targetPlayer != null && you != null) {
//cards in Library
Cards cardsInLibrary = new CardsImpl(Constants.Zone.LIBRARY);
cardsInLibrary.addAll(targetPlayer.getLibrary().getCards(game));
you.lookAtCards("Scour search of Library", cardsInLibrary, game);
// cards in Graveyard
Cards cardsInGraveyard = new CardsImpl(Constants.Zone.GRAVEYARD);
cardsInGraveyard.addAll(targetPlayer.getGraveyard());
// cards in Hand
Cards cardsInHand = new CardsImpl(Constants.Zone.HAND);
cardsInHand.addAll(targetPlayer.getHand());
you.lookAtCards("Scour search of Hand", cardsInHand, game);
// exile same named cards from zones
for (Card checkCard : cardsInLibrary.getCards(game)) {
if (checkCard.getName().equals(chosenCard.getName())) {
checkCard.moveToExile(id, "Library", id, game);
}
}
for (Card checkCard : cardsInGraveyard.getCards(game)) {
if (checkCard.getName().equals(chosenCard.getName())) {
checkCard.moveToExile(id, "Graveyard", id, game);
}
}
for (Card checkCard : cardsInHand.getCards(game)) {
if (checkCard.getName().equals(chosenCard.getName())) {
checkCard.moveToExile(id, "Hand", id, game);
}
}
targetPlayer.shuffleLibrary(game);
}
return result;
}
return false;
}
}
}

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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.DiscardTargetCost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCardInHand;
/**
*
* @author LevelX2
*/
public class SlumberingTora extends CardImpl<SlumberingTora> {
private static final FilterCard filter = new FilterCard("Spirit or Arcane card");
static {
filter.add(Predicates.or(new SubtypePredicate("Spirit"),new SubtypePredicate("Arcane")));
}
public SlumberingTora(UUID ownerId) {
super(ownerId, 161, "Slumbering Tora", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{3}");
this.expansionSetCode = "BOK";
// {2}, Discard a Spirit or Arcane card: Slumbering Tora becomes an X/X Cat artifact creature until end of turn,
// where X is the discarded card's converted mana cost.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new SlumberingToraEffect(), new ManaCostsImpl("{2}"));
ability.addCost(new DiscardTargetCost(new TargetCardInHand(filter)));
this.addAbility(ability);
}
public SlumberingTora(final SlumberingTora card) {
super(card);
}
@Override
public SlumberingTora copy() {
return new SlumberingTora(this);
}
private class SlumberingToraEffect extends ContinuousEffectImpl<SlumberingToraEffect> {
public SlumberingToraEffect() {
super(Constants.Duration.EndOfTurn, Constants.Outcome.BecomeCreature);
setText();
}
public SlumberingToraEffect(final SlumberingToraEffect effect) {
super(effect);
}
@Override
public SlumberingToraEffect copy() {
return new SlumberingToraEffect(this);
}
@Override
public boolean apply(Constants.Layer layer, Constants.SubLayer sublayer, Ability source, Game game) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == Constants.SubLayer.NA) {
permanent.getCardType().add(CardType.CREATURE);
permanent.getSubtype().add("Cat");
}
break;
case PTChangingEffects_7:
if (sublayer == Constants.SubLayer.SetPT_7b) {
int convManaCosts = 0;
for (Cost cost: source.getCosts()) {
if (cost instanceof DiscardTargetCost && ((DiscardTargetCost)cost).getCards().size() > 0) {
convManaCosts = ((DiscardTargetCost)cost).getCards().get(0).getManaCost().convertedManaCost();
break;
}
}
permanent.getPower().setValue(convManaCosts);
permanent.getToughness().setValue(convManaCosts);
}
}
return true;
}
return false;
}
@Override
public boolean apply(Game game, Ability source) {
return false;
}
private void setText() {
staticText = "{this} becomes an X/X Cat artifact creature until end of turn, where X is the discarded card's converted mana cost";
}
@Override
public boolean hasLayer(Constants.Layer layer) {
return layer == Constants.Layer.PTChangingEffects_7 || layer == Constants.Layer.TypeChangingEffects_4;
}
}
}

View file

@ -0,0 +1,143 @@
/*
* 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.betrayersofkamigawa;
import java.util.List;
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.Card;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
/**
*
* @author LevelX2
*/
public class StreamOfConsciousness extends CardImpl<StreamOfConsciousness> {
public StreamOfConsciousness(UUID ownerId) {
super(ownerId, 53, "Stream of Consciousness", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "BOK";
this.subtype.add("Arcane");
this.color.setBlue(true);
// Target player shuffles up to four target cards from his or her graveyard into his or her library.
this.getSpellAbility().addEffect(new StreamOfConsciousnessEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new StreamOfConsciousnessTarget());
}
public StreamOfConsciousness(final StreamOfConsciousness card) {
super(card);
}
@Override
public StreamOfConsciousness copy() {
return new StreamOfConsciousness(this);
}
}
class StreamOfConsciousnessEffect extends OneShotEffect<StreamOfConsciousnessEffect> {
public StreamOfConsciousnessEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to four target cards from his or her graveyard into his or her library";
}
public StreamOfConsciousnessEffect(final StreamOfConsciousnessEffect effect) {
super(effect);
}
@Override
public StreamOfConsciousnessEffect copy() {
return new StreamOfConsciousnessEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
List<UUID> targets = source.getTargets().get(1).getTargets();
boolean shuffle = false;
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
if (player.getGraveyard().contains(card.getId())) {
player.getGraveyard().remove(card);
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
shuffle = true;
}
}
}
if (shuffle) {
player.getLibrary().shuffle();
}
return true;
}
return false;
}
}
class StreamOfConsciousnessTarget extends TargetCard<StreamOfConsciousnessTarget> {
public StreamOfConsciousnessTarget() {
super(0, 4, Zone.GRAVEYARD, new FilterCard("cards from target player's graveyard"));
}
public StreamOfConsciousnessTarget(final StreamOfConsciousnessTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card, game);
}
}
return false;
}
@Override
public StreamOfConsciousnessTarget copy() {
return new StreamOfConsciousnessTarget(this);
}
}

View file

@ -0,0 +1,112 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.filter.FilterPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPermanent;
/**
*
* @author LevelX2
*/
public class TerashisGrasp extends CardImpl<TerashisGrasp> {
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
static {
filter.add(Predicates.or(
new CardTypePredicate(CardType.ARTIFACT),
new CardTypePredicate(CardType.ENCHANTMENT)));
}
public TerashisGrasp (UUID ownerId) {
super(ownerId, 26, "Terashi's Grasp", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{2}{W}");
this.expansionSetCode = "BOK";
this.subtype.add("Arcane");
this.color.setWhite(true);
// Destroy target artifact or enchantment.
this.getSpellAbility().addTarget(new TargetPermanent(filter));
this.getSpellAbility().addEffect(new DestroyTargetEffect());
// You gain life equal to its converted mana cost.
this.getSpellAbility().addEffect(new TerashisGraspEffect());
}
public TerashisGrasp (final TerashisGrasp card) {
super(card);
}
@Override
public TerashisGrasp copy() {
return new TerashisGrasp(this);
}
private class TerashisGraspEffect extends OneShotEffect<TerashisGraspEffect> {
public TerashisGraspEffect() {
super(Constants.Outcome.DestroyPermanent);
staticText = "You gain life equal to its converted mana cost";
}
public TerashisGraspEffect(TerashisGraspEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
MageObject card = game.getLastKnownInformation(source.getFirstTarget(), Constants.Zone.BATTLEFIELD);
if (card != null) {
int cost = card.getManaCost().get(0).convertedManaCost();
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
player.gainLife(cost, game);
}
}
return true;
}
@Override
public TerashisGraspEffect copy() {
return new TerashisGraspEffect(this);
}
}
}

View file

@ -0,0 +1,90 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.effects.common.IndestructibleAllEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.cards.CardImpl;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.CounterPredicate;
import mage.target.TargetPermanent;
/**
* @author LevelX2
*/
public class ThatWhichWasTaken extends CardImpl<ThatWhichWasTaken> {
private static final FilterPermanent filter = new FilterPermanent("permanent other than That Which Was Taken");
private static final FilterPermanent filterIndestructible = new FilterPermanent("Each permanent with a divinity counter on it");
static {
filter.add(new AnotherPredicate());
filterIndestructible.add(new CounterPredicate(CounterType.DIVINITY));
}
public ThatWhichWasTaken(UUID ownerId) {
super(ownerId, 162, "That Which Was Taken", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{5}");
this.expansionSetCode = "BOK";
this.supertype.add("Legendary");
// {4}, {T}: Put a divinity counter on target permanent other than That Which Was Taken.
Ability ability = new SimpleActivatedAbility(Constants.Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.DIVINITY.createInstance()), new GenericManaCost(4));
ability.addCost(new TapSourceCost());
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
// Each permanent with a divinity counter on it is indestructible.
this.addAbility(new SimpleStaticAbility(Constants.Zone.BATTLEFIELD, new IndestructibleAllEffect(filterIndestructible)));
}
public ThatWhichWasTaken(final ThatWhichWasTaken card) {
super(card);
}
@Override
public ThatWhichWasTaken copy() {
return new ThatWhichWasTaken(this);
}
}

View file

@ -0,0 +1,120 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
/**
*
* @author LevelX2
*/
public class ToilsOfNightAndDay extends CardImpl<ToilsOfNightAndDay> {
public ToilsOfNightAndDay(UUID ownerId) {
super(ownerId, 57, "Toils of Night and Day", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{U}");
this.expansionSetCode = "BOK";
this.subtype.add("Arcane");
this.color.setBlue(true);
// You may tap or untap target permanent, then you may tap or untap another target permanent.
this.getSpellAbility().addEffect(new ToilsOfNightAndDayEffect());
this.getSpellAbility().addTarget(new TargetPermanent());
this.getSpellAbility().addTarget(new TargetPermanent());
}
public ToilsOfNightAndDay(final ToilsOfNightAndDay card) {
super(card);
}
@Override
public ToilsOfNightAndDay copy() {
return new ToilsOfNightAndDay(this);
}
private class ToilsOfNightAndDayEffect extends OneShotEffect<ToilsOfNightAndDayEffect> {
public ToilsOfNightAndDayEffect() {
super(Outcome.Tap);
this.staticText = "You may tap or untap target permanent, then you may tap or untap another target permanent";
}
public ToilsOfNightAndDayEffect(final ToilsOfNightAndDayEffect effect) {
super(effect);
}
@Override
public ToilsOfNightAndDayEffect copy() {
return new ToilsOfNightAndDayEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
boolean result = false;
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
Permanent permanent = game.getPermanent(source.getFirstTarget());
if (permanent != null) {
if (permanent.isTapped()) {
if (player.chooseUse(Constants.Outcome.Untap, "Untap that permanent?", game)) {
result |= permanent.untap(game);
}
} else {
if (player.chooseUse(Constants.Outcome.Tap, "Tap that permanent?", game)) {
result |= permanent.tap(game);
}
}
}
permanent = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (permanent != null) {
if (permanent.isTapped()) {
if (player.chooseUse(Constants.Outcome.Untap, "Untap that permanent?", game)) {
result |= permanent.untap(game);
}
} else {
if (player.chooseUse(Constants.Outcome.Tap, "Tap that permanent?", game)) {
result |= permanent.tap(game);
}
}
}
}
return result;
}
}
}

View file

@ -0,0 +1,101 @@
/*
* 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.betrayersofkamigawa;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.common.continious.BoostTargetEffect;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class UncheckedGrowth extends CardImpl<UncheckedGrowth> {
public UncheckedGrowth(UUID ownerId) {
super(ownerId, 148, "Unchecked Growth", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{G}");
this.expansionSetCode = "BOK";
this.subtype.add("Arcane");
this.color.setGreen(true);
// Target creature gets +4/+4 until end of turn.
this.getSpellAbility().addEffect(new BoostTargetEffect(4, 4, Constants.Duration.EndOfTurn));
// If it's a Spirit, it gains trample until end of turn.
this.getSpellAbility().addEffect(new UncheckedGrowthTrampleEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public UncheckedGrowth(final UncheckedGrowth card) {
super(card);
}
@Override
public UncheckedGrowth copy() {
return new UncheckedGrowth(this);
}
private class UncheckedGrowthTrampleEffect extends ContinuousEffectImpl<UncheckedGrowthTrampleEffect> {
public UncheckedGrowthTrampleEffect() {
super(Constants.Duration.EndOfTurn, Constants.Layer.AbilityAddingRemovingEffects_6, Constants.SubLayer.NA, Constants.Outcome.AddAbility);
staticText = "If it's a Spirit, it gains trample until end of turn";
}
public UncheckedGrowthTrampleEffect(final UncheckedGrowthTrampleEffect effect) {
super(effect);
}
@Override
public UncheckedGrowthTrampleEffect copy() {
return new UncheckedGrowthTrampleEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int affectedTargets = 0;
for (UUID permanentId : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(permanentId);
if (permanent != null && permanent.getSubtype().contains("Spirit")) {
permanent.addAbility(TrampleAbility.getInstance(), game);
affectedTargets++;
}
}
return affectedTargets > 0;
}
}
}

View file

@ -1,52 +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.iceage;
import java.util.UUID;
/**
*
* @author North
*/
public class Justice extends mage.sets.fifthedition.Justice {
public Justice(UUID ownerId) {
super(ownerId);
this.cardNumber = 366;
this.expansionSetCode = "ICE";
}
public Justice(final Justice card) {
super(card);
}
@Override
public Justice copy() {
return new Justice(this);
}
}
/*
* 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.iceage;
import java.util.UUID;
/**
*
* @author North
*/
public class Justice extends mage.sets.fifthedition.Justice {
public Justice(UUID ownerId) {
super(ownerId);
this.cardNumber = 256;
this.expansionSetCode = "ICE";
}
public Justice(final Justice card) {
super(card);
}
@Override
public Justice copy() {
return new Justice(this);
}
}

View file

@ -1,146 +1,146 @@
/*
* 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.innistrad;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.TimingRule;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
/**
*
* @author North
*/
public class MemorysJourney extends CardImpl<MemorysJourney> {
public MemorysJourney(UUID ownerId) {
super(ownerId, 66, "Memory's Journey", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "ISD";
this.color.setBlue(true);
// Target player shuffles up to three target cards from his or her graveyard into his or her library.
this.getSpellAbility().addEffect(new MemorysJourneyEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new MemorysJourneyTarget());
// Flashback {G}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{G}"), TimingRule.INSTANT));
}
public MemorysJourney(final MemorysJourney card) {
super(card);
}
@Override
public MemorysJourney copy() {
return new MemorysJourney(this);
}
}
class MemorysJourneyEffect extends OneShotEffect<MemorysJourneyEffect> {
public MemorysJourneyEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to three target cards from his or her graveyard into his or her library";
}
public MemorysJourneyEffect(final MemorysJourneyEffect effect) {
super(effect);
}
@Override
public MemorysJourneyEffect copy() {
return new MemorysJourneyEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
List<UUID> targets = source.getTargets().get(1).getTargets();
boolean shuffle = false;
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
if (player.getGraveyard().contains(card.getId())) {
player.getGraveyard().remove(card);
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
shuffle = true;
}
}
}
if (shuffle) {
player.getLibrary().shuffle();
}
return true;
}
return false;
}
}
class MemorysJourneyTarget extends TargetCard<MemorysJourneyTarget> {
public MemorysJourneyTarget() {
super(0, 3, Zone.GRAVEYARD, new FilterCreatureCard());
}
public MemorysJourneyTarget(final MemorysJourneyTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card, game);
}
}
return false;
}
@Override
public MemorysJourneyTarget copy() {
return new MemorysJourneyTarget(this);
}
}
/*
* 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.innistrad;
import java.util.List;
import java.util.UUID;
import mage.Constants.CardType;
import mage.Constants.Outcome;
import mage.Constants.Rarity;
import mage.Constants.TimingRule;
import mage.Constants.Zone;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.TargetPlayer;
/**
*
* @author North
*/
public class MemorysJourney extends CardImpl<MemorysJourney> {
public MemorysJourney(UUID ownerId) {
super(ownerId, 66, "Memory's Journey", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}");
this.expansionSetCode = "ISD";
this.color.setBlue(true);
// Target player shuffles up to three target cards from his or her graveyard into his or her library.
this.getSpellAbility().addEffect(new MemorysJourneyEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
this.getSpellAbility().addTarget(new MemorysJourneyTarget());
// Flashback {G}
this.addAbility(new FlashbackAbility(new ManaCostsImpl("{G}"), TimingRule.INSTANT));
}
public MemorysJourney(final MemorysJourney card) {
super(card);
}
@Override
public MemorysJourney copy() {
return new MemorysJourney(this);
}
}
class MemorysJourneyEffect extends OneShotEffect<MemorysJourneyEffect> {
public MemorysJourneyEffect() {
super(Outcome.Neutral);
this.staticText = "Target player shuffles up to three target cards from his or her graveyard into his or her library";
}
public MemorysJourneyEffect(final MemorysJourneyEffect effect) {
super(effect);
}
@Override
public MemorysJourneyEffect copy() {
return new MemorysJourneyEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
List<UUID> targets = source.getTargets().get(1).getTargets();
boolean shuffle = false;
for (UUID targetId : targets) {
Card card = game.getCard(targetId);
if (card != null) {
if (player.getGraveyard().contains(card.getId())) {
player.getGraveyard().remove(card);
card.moveToZone(Zone.LIBRARY, source.getId(), game, true);
shuffle = true;
}
}
}
if (shuffle) {
player.getLibrary().shuffle();
}
return true;
}
return false;
}
}
class MemorysJourneyTarget extends TargetCard<MemorysJourneyTarget> {
public MemorysJourneyTarget() {
super(0, 3, Zone.GRAVEYARD, new FilterCard());
}
public MemorysJourneyTarget(final MemorysJourneyTarget target) {
super(target);
}
@Override
public boolean canTarget(UUID id, Ability source, Game game) {
Card card = game.getCard(id);
if (card != null && game.getState().getZone(card.getId()) == Zone.GRAVEYARD) {
UUID firstTarget = source.getFirstTarget();
if (firstTarget != null && game.getPlayer(firstTarget).getGraveyard().contains(id)) {
return filter.match(card, game);
}
}
return false;
}
@Override
public MemorysJourneyTarget copy() {
return new MemorysJourneyTarget(this);
}
}

View file

@ -28,6 +28,8 @@
package mage.abilities.costs.common;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.Constants.Outcome;
import mage.abilities.Ability;
@ -42,6 +44,8 @@ import mage.target.common.TargetCardInHand;
* @author BetaSteward_at_googlemail.com
*/
public class DiscardTargetCost extends CostImpl<DiscardTargetCost> {
List<Card> cards = new ArrayList<Card>();
public DiscardTargetCost(TargetCardInHand target) {
this.addTarget(target);
@ -50,6 +54,9 @@ public class DiscardTargetCost extends CostImpl<DiscardTargetCost> {
public DiscardTargetCost(DiscardTargetCost cost) {
super(cost);
for (Card card: cost.cards) {
this.cards.add(card.copy());
}
}
@Override
@ -58,8 +65,10 @@ public class DiscardTargetCost extends CostImpl<DiscardTargetCost> {
Player player = game.getPlayer(controllerId);
for (UUID targetId: targets.get(0).getTargets()) {
Card card = player.getHand().get(targetId, game);
if (card == null)
if (card == null) {
return false;
}
this.cards.add(card.copy());
paid |= player.discard(card, null, game);
}
}
@ -76,4 +85,7 @@ public class DiscardTargetCost extends CostImpl<DiscardTargetCost> {
return new DiscardTargetCost(this);
}
public List<Card> getCards() {
return cards;
}
}

View file

@ -1,94 +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.abilities.effects.common;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class IndestructibleAllEffect extends ReplacementEffectImpl<IndestructibleAllEffect> {
private FilterPermanent filter;
/**
* duration = WhileOnBattlefield
*
* @param filter
*/
public IndestructibleAllEffect(FilterPermanent filter) {
this(filter, Duration.WhileOnBattlefield);
}
public IndestructibleAllEffect(FilterPermanent filter, Duration duration) {
super(duration, Outcome.Benefit);
this.filter = filter;
this.staticText = filter.getMessage() + " are indestructible";
if (duration.equals(Duration.EndOfTurn)) {
this.staticText += " this turn";
}
}
public IndestructibleAllEffect(IndestructibleAllEffect effect) {
super(effect);
this.filter = effect.filter;
}
@Override
public IndestructibleAllEffect copy() {
return new IndestructibleAllEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DESTROY_PERMANENT)) {
Permanent permanent = game.getPermanent(event.getTargetId());
return permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game);
}
return false;
}
}
/*
* 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.common;
import mage.Constants.Duration;
import mage.Constants.Outcome;
import mage.abilities.Ability;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.filter.FilterPermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
/**
*
* @author North
*/
public class IndestructibleAllEffect extends ReplacementEffectImpl<IndestructibleAllEffect> {
private FilterPermanent filter;
/**
* duration = WhileOnBattlefield
*
* @param filter
*/
public IndestructibleAllEffect(FilterPermanent filter) {
this(filter, Duration.WhileOnBattlefield);
}
public IndestructibleAllEffect(FilterPermanent filter, Duration duration) {
super(duration, Outcome.Benefit);
this.filter = filter;
if (filter.getMessage().startsWith("Each")) {
this.staticText = filter.getMessage() + " is indestructible";
}
else {
this.staticText = filter.getMessage() + " are indestructible";
}
if (duration.equals(Duration.EndOfTurn)) {
this.staticText += " this turn";
}
}
public IndestructibleAllEffect(IndestructibleAllEffect effect) {
super(effect);
this.filter = effect.filter;
}
@Override
public IndestructibleAllEffect copy() {
return new IndestructibleAllEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType().equals(GameEvent.EventType.DESTROY_PERMANENT)) {
Permanent permanent = game.getPermanent(event.getTargetId());
return permanent != null && filter.match(permanent, source.getSourceId(), source.getControllerId(), game);
}
return false;
}
}