* Ravnica: City of Guilds - Added 5 cards.

This commit is contained in:
LevelX2 2017-05-06 15:43:01 +02:00
parent ee129e2251
commit 833237e09b
8 changed files with 622 additions and 9 deletions

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.cards.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.PutCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.GenericManaCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.CountersSourceCount;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.abilities.effects.common.counter.RemoveCounterSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import mage.counters.Counter;
/**
*
* @author LevelX2
*/
public class BloodletterQuill extends CardImpl {
public BloodletterQuill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
Counter bloodCounter = new Counter("blood");
// {2}, {T}, Put a blood counter on Bloodletter Quill: Draw a card, then lose 1 life for each blood counter on Bloodletter Quill.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new GenericManaCost(2));
ability.addEffect(new LoseLifeSourceControllerEffect(new CountersSourceCount(bloodCounter.getName()))
.setText(", then lose 1 life for each blood counter on {this}"));
ability.addCost(new TapSourceCost());
ability.addCost(new PutCountersSourceCost(bloodCounter));
this.addAbility(ability);
// {U}{B}: Remove a blood counter from Bloodletter Quill.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new RemoveCounterSourceEffect(bloodCounter), new ManaCostsImpl("{U}{B}")));
}
public BloodletterQuill(final BloodletterQuill card) {
super(card);
}
@Override
public BloodletterQuill copy() {
return new BloodletterQuill(this);
}
}

View file

@ -0,0 +1,179 @@
/*
* 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.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.filter.FilterPlayer;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.ExileZone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.util.CardUtil;
/**
*
* @author LevelX2
*/
public class CircuDimirLobotomist extends CardImpl {
private static final FilterSpell filterBlue = new FilterSpell("a blue spell");
private static final FilterSpell filterBlack = new FilterSpell("a black spell");
static {
filterBlue.add(new ColorPredicate(ObjectColor.BLUE));
filterBlack.add(new ColorPredicate(ObjectColor.BLACK));
}
public CircuDimirLobotomist(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{B}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// 10/1/2005 The first two abilities target libraries, not players.
// Target Library not supported yet - used as workaround target player
// Whenever you cast a blue spell, exile the top card of target library.
Ability ability = new SpellCastControllerTriggeredAbility(new CircuDimirLobotomistEffect(), filterBlue, false);
ability.addTarget(new TargetPlayer(1, 1, true, new FilterPlayer("target library")));
this.addAbility(ability);
// Whenever you cast a black spell, exile the top card of target library.
ability = new SpellCastControllerTriggeredAbility(new CircuDimirLobotomistEffect(), filterBlack, false);
ability.addTarget(new TargetPlayer(1, 1, true, new FilterPlayer("target library")));
this.addAbility(ability);
// Your opponents can't cast nonland cards with the same name as a card exiled with Circu, Dimir Lobotomist.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CircuDimirLobotomistRuleModifyingEffect()));
}
public CircuDimirLobotomist(final CircuDimirLobotomist card) {
super(card);
}
@Override
public CircuDimirLobotomist copy() {
return new CircuDimirLobotomist(this);
}
}
class CircuDimirLobotomistEffect extends OneShotEffect {
public CircuDimirLobotomistEffect() {
super(Outcome.Detriment);
this.staticText = "exile the top card of target library";
}
public CircuDimirLobotomistEffect(final CircuDimirLobotomistEffect effect) {
super(effect);
}
@Override
public CircuDimirLobotomistEffect copy() {
return new CircuDimirLobotomistEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player playerTargetLibrary = game.getPlayer(getTargetPointer().getFirst(game, source));
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && playerTargetLibrary != null && sourcePermanent != null) {
UUID exileId = CardUtil.getCardExileZoneId(game, source);
controller.moveCardToExileWithInfo(playerTargetLibrary.getLibrary().getFromTop(game), exileId,
sourcePermanent.getIdName() + " (" + sourcePermanent.getZoneChangeCounter(game) + ')', source.getSourceId(), game, Zone.BATTLEFIELD, true);
return true;
}
return false;
}
}
class CircuDimirLobotomistRuleModifyingEffect extends ContinuousRuleModifyingEffectImpl {
public CircuDimirLobotomistRuleModifyingEffect() {
super(Duration.WhileOnBattlefield, Outcome.Detriment);
staticText = "Your opponents can't cast nonland cards with the same name as a card exiled with {this}";
}
public CircuDimirLobotomistRuleModifyingEffect(final CircuDimirLobotomistRuleModifyingEffect effect) {
super(effect);
}
@Override
public CircuDimirLobotomistRuleModifyingEffect copy() {
return new CircuDimirLobotomistRuleModifyingEffect(this);
}
@Override
public String getInfoMessage(Ability source, GameEvent event, Game game) {
MageObject mageObject = game.getObject(source.getSourceId());
if (mageObject != null) {
return "You can't cast this spell because a card with the same name is exiled by " + mageObject.getLogName() + '.';
}
return null;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (event.getType() == EventType.CAST_SPELL && game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
MageObject object = game.getObject(event.getSourceId());
if (object != null) {
ExileZone exileZone = game.getExile().getExileZone(CardUtil.getCardExileZoneId(game, source));
if ((exileZone != null)) {
for (Card card : exileZone.getCards(game)) {
if ((card.getName().equals(object.getName()))) {
return true;
}
}
}
}
}
return false;
}
}

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.cards.f;
import java.util.UUID;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.condition.common.ManaWasSpentCondition;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.UntapTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
import mage.constants.Duration;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.DamagedEvent;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author LevelX2
*/
public class FlashConscription extends CardImpl {
public FlashConscription(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{5}{R}");
// Untap target creature and gain control of it until end of turn. That creature gains haste until end of turn. If {W} was spent to cast Flash Conscription, the creature gains "Whenever this creature deals combat damage, you gain that much life" until end of turn.
this.getSpellAbility().addEffect(new UntapTargetEffect());
this.getSpellAbility().addEffect(new GainControlTargetEffect(Duration.EndOfTurn));
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(HasteAbility.getInstance(), Duration.EndOfTurn));
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
new GainAbilityTargetEffect(new FlashConscriptionTriggeredAbility(), Duration.EndOfTurn),
new ManaWasSpentCondition(ColoredManaSymbol.W), "If {W} was spent to cast {this}, the creature gains \"Whenever this creature deals combat damage, you gain that much life\" until end of turn"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}
public FlashConscription(final FlashConscription card) {
super(card);
}
@Override
public FlashConscription copy() {
return new FlashConscription(this);
}
}
class FlashConscriptionTriggeredAbility extends TriggeredAbilityImpl {
public FlashConscriptionTriggeredAbility() {
super(Zone.BATTLEFIELD, null);
}
public FlashConscriptionTriggeredAbility(final FlashConscriptionTriggeredAbility ability) {
super(ability);
}
@Override
public FlashConscriptionTriggeredAbility copy() {
return new FlashConscriptionTriggeredAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGED_CREATURE
|| event.getType() == EventType.DAMAGED_PLAYER
|| event.getType() == EventType.DAMAGED_PLANESWALKER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedEvent damageEvent = (DamagedEvent) event;
if (damageEvent.isCombatDamage()) {
if (event.getSourceId().equals(this.sourceId)) {
this.getEffects().clear();
this.getEffects().add(new GainLifeEffect(damageEvent.getAmount()));
return true;
}
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} deals combat damage, you gain that much life.";
}
}

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.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.PreventionEffect;
import mage.abilities.effects.ReplacementEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
/**
*
* @author LevelX2
*/
public class GhostsOfTheInnocent extends CardImpl {
public GhostsOfTheInnocent(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{W}{W}");
this.subtype.add("Spirit");
this.power = new MageInt(4);
this.toughness = new MageInt(5);
// If a source would deal damage to a creature or player, it deals half that damage, rounded down, to that creature or player instead.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GhostsOfTheInnocentPreventDamageEffect()));
}
public GhostsOfTheInnocent(final GhostsOfTheInnocent card) {
super(card);
}
@Override
public GhostsOfTheInnocent copy() {
return new GhostsOfTheInnocent(this);
}
}
class GhostsOfTheInnocentPreventDamageEffect extends ReplacementEffectImpl implements PreventionEffect {
public GhostsOfTheInnocentPreventDamageEffect() {
super(Duration.WhileOnBattlefield, Outcome.Damage);
staticText = "If a source would deal damage to a creature or player, it deals half that damage, rounded down, to that creature or player instead";
}
public GhostsOfTheInnocentPreventDamageEffect(final GhostsOfTheInnocentPreventDamageEffect effect) {
super(effect);
}
@Override
public GhostsOfTheInnocentPreventDamageEffect copy() {
return new GhostsOfTheInnocentPreventDamageEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == EventType.DAMAGE_CREATURE
|| event.getType() == EventType.DAMAGE_PLAYER;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
return true;
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
int amount = (int) Math.ceil(event.getAmount() / 2.0);
GameEvent preventEvent = new GameEvent(GameEvent.EventType.PREVENT_DAMAGE, event.getTargetId(), source.getSourceId(), source.getControllerId(), amount, false);
if (!game.replaceEvent(preventEvent)) {
event.setAmount(event.getAmount() - amount);
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.PREVENTED_DAMAGE, event.getTargetId(), source.getSourceId(), source.getControllerId(), amount));
}
return false;
}
}

View file

@ -27,6 +27,7 @@
*/
package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
@ -46,8 +47,6 @@ import mage.filter.predicate.mageobject.AbilityPredicate;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author Loki
@ -65,17 +64,19 @@ public class TiborAndLumia extends CardImpl {
}
public TiborAndLumia(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{R}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{R}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(3);
this.toughness = new MageInt(3);
// Whenever you cast a blue spell, target creature gains flying until end of turn.
Ability firstAbility = new SpellCastControllerTriggeredAbility(new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn), filterBlue, false);
firstAbility.addTarget(new TargetCreaturePermanent());
this.addAbility(firstAbility);
// Whenever you cast a red spell, Tibor and Lumia deals 1 damage to each creature without flying.
this.addAbility(new SpellCastControllerTriggeredAbility(new DamageAllEffect(1, filter), filterRed, false));
}

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.cards.t;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetControlledPermanent;
/**
*
* @author LevelX2
*/
public class TwistedJustice extends CardImpl {
public TwistedJustice(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{U}{B}");
// Target player sacrifices a creature. You draw cards equal to that creature's power.
this.getSpellAbility().addEffect(new TwistedJusticeEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public TwistedJustice(final TwistedJustice card) {
super(card);
}
@Override
public TwistedJustice copy() {
return new TwistedJustice(this);
}
}
class TwistedJusticeEffect extends OneShotEffect {
TwistedJusticeEffect() {
super(Outcome.Sacrifice);
staticText = "Target player sacrifices a creature. You draw cards equal to that creature's power";
}
TwistedJusticeEffect(TwistedJusticeEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getTargets().getFirstTarget());
Player controller = game.getPlayer(source.getControllerId());
FilterControlledPermanent filter = new FilterControlledPermanent("creature");
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new ControllerPredicate(TargetController.YOU));
TargetControlledPermanent target = new TargetControlledPermanent(1, 1, filter, true);
//A spell or ability could have removed the only legal target this player
//had, if thats the case this ability should fizzle.
if (target.canChoose(player.getId(), game)) {
player.choose(Outcome.Sacrifice, target, source.getSourceId(), game);
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent != null) {
permanent.sacrifice(source.getSourceId(), game);
controller.drawCards(permanent.getPower().getValue(), game);
}
return true;
}
return false;
}
@Override
public TwistedJusticeEffect copy() {
return new TwistedJusticeEffect(this);
}
}

View file

@ -65,6 +65,7 @@ public class RavnicaCityOfGuilds extends ExpansionSet {
cards.add(new SetCardInfo("Blockbuster", 115, Rarity.UNCOMMON, mage.cards.b.Blockbuster.class));
cards.add(new SetCardInfo("Blood Funnel", 77, Rarity.RARE, mage.cards.b.BloodFunnel.class));
cards.add(new SetCardInfo("Bloodbond March", 192, Rarity.RARE, mage.cards.b.BloodbondMarch.class));
cards.add(new SetCardInfo("Bloodletter Quill", 254, Rarity.RARE, mage.cards.b.BloodletterQuill.class));
cards.add(new SetCardInfo("Boros Fury-Shield", 5, Rarity.COMMON, mage.cards.b.BorosFuryShield.class));
cards.add(new SetCardInfo("Boros Garrison", 275, Rarity.COMMON, mage.cards.b.BorosGarrison.class));
cards.add(new SetCardInfo("Boros Guildmage", 242, Rarity.UNCOMMON, mage.cards.b.BorosGuildmage.class));
@ -84,6 +85,7 @@ public class RavnicaCityOfGuilds extends ExpansionSet {
cards.add(new SetCardInfo("Char", 117, Rarity.RARE, mage.cards.c.Char.class));
cards.add(new SetCardInfo("Chord of Calling", 156, Rarity.RARE, mage.cards.c.ChordOfCalling.class));
cards.add(new SetCardInfo("Chorus of the Conclave", 195, Rarity.RARE, mage.cards.c.ChorusOfTheConclave.class));
cards.add(new SetCardInfo("Circu, Dimir Lobotomist", 196, Rarity.RARE, mage.cards.c.CircuDimirLobotomist.class));
cards.add(new SetCardInfo("Civic Wayfinder", 157, Rarity.COMMON, mage.cards.c.CivicWayfinder.class));
cards.add(new SetCardInfo("Cleansing Beam", 118, Rarity.UNCOMMON, mage.cards.c.CleansingBeam.class));
cards.add(new SetCardInfo("Clinging Darkness", 80, Rarity.COMMON, mage.cards.c.ClingingDarkness.class));
@ -140,6 +142,7 @@ public class RavnicaCityOfGuilds extends ExpansionSet {
cards.add(new SetCardInfo("Fists of Ironwood", 164, Rarity.COMMON, mage.cards.f.FistsOfIronwood.class));
cards.add(new SetCardInfo("Flame Fusillade", 123, Rarity.RARE, mage.cards.f.FlameFusillade.class));
cards.add(new SetCardInfo("Flame-Kin Zealot", 206, Rarity.UNCOMMON, mage.cards.f.FlameKinZealot.class));
cards.add(new SetCardInfo("Flash Conscription", 124, Rarity.UNCOMMON, mage.cards.f.FlashConscription.class));
cards.add(new SetCardInfo("Flickerform", 18, Rarity.RARE, mage.cards.f.Flickerform.class));
cards.add(new SetCardInfo("Flight of Fancy", 49, Rarity.COMMON, mage.cards.f.FlightOfFancy.class));
cards.add(new SetCardInfo("Flow of Ideas", 50, Rarity.UNCOMMON, mage.cards.f.FlowOfIdeas.class));
@ -152,6 +155,7 @@ public class RavnicaCityOfGuilds extends ExpansionSet {
cards.add(new SetCardInfo("Galvanic Arc", 126, Rarity.COMMON, mage.cards.g.GalvanicArc.class));
cards.add(new SetCardInfo("Gate Hound", 19, Rarity.COMMON, mage.cards.g.GateHound.class));
cards.add(new SetCardInfo("Gather Courage", 165, Rarity.COMMON, mage.cards.g.GatherCourage.class));
cards.add(new SetCardInfo("Ghosts of the Innocent", 20, Rarity.RARE, mage.cards.g.GhostsOfTheInnocent.class));
cards.add(new SetCardInfo("Glare of Subdual", 207, Rarity.RARE, mage.cards.g.GlareOfSubdual.class));
cards.add(new SetCardInfo("Glass Golem", 261, Rarity.UNCOMMON, mage.cards.g.GlassGolem.class));
cards.add(new SetCardInfo("Gleancrawler", 247, Rarity.RARE, mage.cards.g.Gleancrawler.class));
@ -315,6 +319,7 @@ public class RavnicaCityOfGuilds extends ExpansionSet {
cards.add(new SetCardInfo("Transluminant", 186, Rarity.COMMON, mage.cards.t.Transluminant.class));
cards.add(new SetCardInfo("Tunnel Vision", 72, Rarity.RARE, mage.cards.t.TunnelVision.class));
cards.add(new SetCardInfo("Twilight Drover", 33, Rarity.RARE, mage.cards.t.TwilightDrover.class));
cards.add(new SetCardInfo("Twisted Justice", 237, Rarity.UNCOMMON, mage.cards.t.TwistedJustice.class));
cards.add(new SetCardInfo("Undercity Shade", 110, Rarity.UNCOMMON, mage.cards.u.UndercityShade.class));
cards.add(new SetCardInfo("Ursapine", 188, Rarity.RARE, mage.cards.u.Ursapine.class));
cards.add(new SetCardInfo("Vedalken Dismisser", 73, Rarity.COMMON, mage.cards.v.VedalkenDismisser.class));

View file

@ -9,21 +9,25 @@ import mage.game.permanent.Permanent;
public class CountersSourceCount implements DynamicValue {
private final CounterType counter;
private final String counterName;
public CountersSourceCount(CounterType counter) {
this.counter = counter;
this.counterName = counter.getName();
}
public CountersSourceCount(String counterName) {
this.counterName = counterName;
}
public CountersSourceCount(final CountersSourceCount countersCount) {
this.counter = countersCount.counter;
this.counterName = countersCount.counterName;
}
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent permanent = game.getPermanentOrLKIBattlefield(sourceAbility.getSourceId());
if (permanent != null) {
return permanent.getCounters(game).getCount(counter);
return permanent.getCounters(game).getCount(counterName);
}
return 0;
}
@ -40,6 +44,6 @@ public class CountersSourceCount implements DynamicValue {
@Override
public String getMessage() {
return counter.getName() + " counter on {this}";
return counterName + " counter on {this}";
}
}