Merge remote-tracking branch 'upstream/master'

This commit is contained in:
MarcoMarin 2016-04-25 14:26:23 -03:00
commit 457bc29b34
40 changed files with 1576 additions and 287 deletions

View file

@ -55,9 +55,6 @@ public class SpellboundDragon extends CardImpl {
super(ownerId, 90, "Spellbound Dragon", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}{R}");
this.expansionSetCode = "ARB";
this.subtype.add("Dragon");
this.power = new MageInt(3);
this.toughness = new MageInt(5);

View file

@ -37,6 +37,7 @@ import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.AddManaInAnyCombinationEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
@ -57,11 +58,11 @@ public class DreadshipReef extends CardImpl {
// {tap}: Add {C} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {1}, {tap}: Put a storage counter on Dreadship Reef.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()),new GenericManaCost(1));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
// {1}, Remove X storage counters from Dreadship Reef: Add X mana in any combination of {U} and/or {B} to your mana pool.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
ability = new SimpleManaAbility(Zone.BATTLEFIELD,
new AddManaInAnyCombinationEffect(new RemovedCountersForCostValue(), ColoredManaSymbol.U, ColoredManaSymbol.B),
new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance()));

View file

@ -37,6 +37,7 @@ import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.AddManaInAnyCombinationEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
@ -58,12 +59,12 @@ public class FungalReaches extends CardImpl {
this.addAbility(new ColorlessManaAbility());
// {1}, {tap}: Put a storage counter on Fungal Reaches.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()),new GenericManaCost(1));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
// {1}, Remove X storage counters from Fungal Reaches: Add X mana in any combination of {R} and/or {G} to your mana pool.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
ability = new SimpleManaAbility(Zone.BATTLEFIELD,
new AddManaInAnyCombinationEffect(new RemovedCountersForCostValue(), ColoredManaSymbol.R, ColoredManaSymbol.G),
new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance()));

View file

@ -37,6 +37,7 @@ import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.AddManaInAnyCombinationEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
@ -57,11 +58,11 @@ public class MoltenSlagheap extends CardImpl {
// {tap}: Add {C} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {1}, {tap}: Put a storage counter on Molten Slagheap.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()),new GenericManaCost(1));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
// {1}, Remove X storage counters from Molten Slagheap: Add X mana in any combination of {B} and/or {R} to your mana pool.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
ability = new SimpleManaAbility(Zone.BATTLEFIELD,
new AddManaInAnyCombinationEffect(new RemovedCountersForCostValue(), ColoredManaSymbol.B, ColoredManaSymbol.R),
new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance()));

View file

@ -37,6 +37,7 @@ import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.AddManaInAnyCombinationEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
@ -57,11 +58,11 @@ public class SaltcrustedSteppe extends CardImpl {
// {tap}: Add {C} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {1}, {tap}: Put a storage counter on Saltcrusted Steppe.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()),new GenericManaCost(1));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
// {1}, Remove X storage counters from Saltcrusted Steppe: Add X mana in any combination of {G} and/or {W} to your mana pool.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
ability = new SimpleManaAbility(Zone.BATTLEFIELD,
new AddManaInAnyCombinationEffect(new RemovedCountersForCostValue(), ColoredManaSymbol.G, ColoredManaSymbol.W),
new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance()));

View file

@ -85,7 +85,7 @@ class BalanceOfPowerEffect extends OneShotEffect {
Player player = game.getPlayer(source.getControllerId());
Player opponent = game.getPlayer(source.getFirstTarget());
if (opponent != null || player != null && opponent.getHand().size() > player.getHand().size()) {
if (opponent != null && player != null && opponent.getHand().size() > player.getHand().size()) {
player.drawCards(opponent.getHand().size() - player.getHand().size(), game);
return true;
}

View file

@ -31,19 +31,20 @@ import java.util.UUID;
import mage.MageInt;
import static mage.Mana.WhiteMana;
import mage.abilities.Ability;
import mage.abilities.ActivationInfo;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
@ -60,11 +61,11 @@ public class FarrelitePriest extends CardImpl {
this.toughness = new MageInt(3);
// {1}: Add {W} to your mana pool. If this ability has been activated four or more times this turn, sacrifice Farrelite Priest at the beginning of the next end step.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD,
new BasicManaEffect(WhiteMana(1)),
new ManaCostsImpl("{1}"));
ability.addEffect(new FarrelitePriestEffect());
this.addAbility(ability);
this.addAbility(ability);
}
public FarrelitePriest(final FarrelitePriest card) {
@ -76,6 +77,7 @@ public class FarrelitePriest extends CardImpl {
return new FarrelitePriest(this);
}
}
class FarrelitePriestEffect extends OneShotEffect {
public FarrelitePriestEffect() {
@ -94,46 +96,13 @@ class FarrelitePriestEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Integer amount = (Integer) game.getState().getValue(source.getSourceId().toString() + "FarrelitePriest");
if (amount == null) {
amount = 0;
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new FarrelitePriestResetEffect());
ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
activationInfo.addActivation(game);
if (activationInfo.getActivationCounter() == 4) {
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect());
game.addDelayedTriggeredAbility(delayedAbility, source);
}
amount++;
game.getState().setValue(source.getSourceId().toString() + "FarrelitePriest", amount);
return true;
}
}
class FarrelitePriestResetEffect extends OneShotEffect {
public FarrelitePriestResetEffect() {
super(Outcome.Neutral);
this.staticText = "If this ability has been activated four or more times this turn, sacrifice {this} at the beginning of the next end step";
}
public FarrelitePriestResetEffect(final FarrelitePriestResetEffect effect) {
super(effect);
}
@Override
public FarrelitePriestResetEffect copy() {
return new FarrelitePriestResetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Integer amount = (Integer) game.getState().getValue(source.getSourceId().toString() + "FarrelitePriest");
if (amount != null && amount >= 4) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.sacrifice(source.getSourceId(), game);
}
}
game.getState().setValue(source.getSourceId().toString() + "FarrelitePriest", null);
return true;
}
}

View file

@ -31,19 +31,20 @@ import java.util.UUID;
import mage.MageInt;
import static mage.Mana.BlackMana;
import mage.abilities.Ability;
import mage.abilities.ActivationInfo;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.BasicManaEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
@ -59,11 +60,11 @@ public class InitiatesOfTheEbonHand extends CardImpl {
this.toughness = new MageInt(1);
// {1}: Add {B} to your mana pool. If this ability has been activated four or more times this turn, sacrifice Initiates of the Ebon Hand at the beginning of the next end step.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
SimpleManaAbility ability = new SimpleManaAbility(Zone.BATTLEFIELD,
new BasicManaEffect(BlackMana(1)),
new ManaCostsImpl("{1}"));
ability.addEffect(new InitiatesOfTheEbonHandEffect());
this.addAbility(ability);
this.addAbility(ability);
}
public InitiatesOfTheEbonHand(final InitiatesOfTheEbonHand card) {
@ -94,46 +95,13 @@ class InitiatesOfTheEbonHandEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Integer amount = (Integer) game.getState().getValue(source.getSourceId().toString() + "InitiatesOfTheEbonHand");
if (amount == null) {
amount = 0;
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new InitiatesOfTheEbonHandResetEffect());
ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
activationInfo.addActivation(game);
if (activationInfo.getActivationCounter() == 4) {
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect());
game.addDelayedTriggeredAbility(delayedAbility, source);
}
amount++;
game.getState().setValue(source.getSourceId().toString() + "InitiatesOfTheEbonHand", amount);
return true;
}
}
class InitiatesOfTheEbonHandResetEffect extends OneShotEffect {
public InitiatesOfTheEbonHandResetEffect() {
super(Outcome.Neutral);
this.staticText = "If this ability has been activated four or more times this turn, sacrifice {this} at the beginning of the next end step";
}
public InitiatesOfTheEbonHandResetEffect(final InitiatesOfTheEbonHandResetEffect effect) {
super(effect);
}
@Override
public InitiatesOfTheEbonHandResetEffect copy() {
return new InitiatesOfTheEbonHandResetEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Integer amount = (Integer) game.getState().getValue(source.getSourceId().toString() + "InitiatesOfTheEbonHand");
if (amount != null && amount >= 4) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.sacrifice(source.getSourceId(), game);
}
}
game.getState().setValue(source.getSourceId().toString() + "InitiatesOfTheEbonHand", null);
return true;
}
}

View file

@ -49,7 +49,6 @@ import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.ZoneChangeEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.PermanentToken;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetOpponent;
@ -188,8 +187,7 @@ class BrainMaggotReturnExiledCardEffect extends OneShotEffect {
Player controller = game.getPlayer(source.getControllerId());
MageObject sourceObject = source.getSourceObject(game);
if (sourceObject != null && controller != null) {
int zoneChangeCounter = (sourceObject instanceof PermanentToken) ? source.getSourceObjectZoneChangeCounter() : source.getSourceObjectZoneChangeCounter() - 1;
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), zoneChangeCounter));
ExileZone exile = game.getExile().getExileZone(CardUtil.getExileZoneId(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter()));
Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (exile != null && sourcePermanent != null) {
controller.moveCards(exile, Zone.HAND, source, game);

View file

@ -0,0 +1,121 @@
/*
* 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.judgment;
import java.util.UUID;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.costs.common.TapTargetCost;
import mage.abilities.effects.PreventionEffectImpl;
import mage.abilities.keyword.FlashbackAbility;
import mage.cards.CardImpl;
import mage.choices.ChoiceColor;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TimingRule;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.target.common.TargetControlledCreaturePermanent;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class PrismaticStrands extends CardImpl {
private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("untapped white creature you control");
static {
filter.add(Predicates.not(new TappedPredicate()));
filter.add(new ColorPredicate(ObjectColor.WHITE));
}
public PrismaticStrands(UUID ownerId) {
super(ownerId, 18, "Prismatic Strands", Rarity.COMMON, new CardType[]{CardType.INSTANT}, "{2}{W}");
this.expansionSetCode = "JUD";
// Prevent all damage that sources of the color of your choice would deal this turn.
this.getSpellAbility().addEffect(new PrismaticStrandsEffect(Duration.EndOfTurn, Integer.MAX_VALUE, false));
this.getSpellAbility().addChoice(new ChoiceColor());
// Flashback-Tap an untapped white creature you control.
this.addAbility(new FlashbackAbility(new TapTargetCost(new TargetControlledCreaturePermanent(1,1,filter,false)), TimingRule.INSTANT));
}
public PrismaticStrands(final PrismaticStrands card) {
super(card);
}
@Override
public PrismaticStrands copy() {
return new PrismaticStrands(this);
}
}
class PrismaticStrandsEffect extends PreventionEffectImpl {
public PrismaticStrandsEffect(Duration duration, int amount, boolean onlyCombat) {
super(duration, amount, onlyCombat, false);
this.staticText = "Prevent all damage that sources of the color of your choice would deal this turn";
}
public PrismaticStrandsEffect(PrismaticStrandsEffect effect) {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (super.applies(event, source, game)) {
if (event.getType().equals(GameEvent.EventType.DAMAGE_PLAYER)
|| event.getType().equals(GameEvent.EventType.DAMAGE_CREATURE)
|| event.getType().equals(GameEvent.EventType.DAMAGE_PLANESWALKER)) {
ChoiceColor choice = (ChoiceColor) source.getChoices().get(0);
MageObject sourceObject = game.getObject(event.getSourceId());
if (sourceObject != null && choice != null && sourceObject.getColor(game).shares(choice.getColor())) {
return true;
}
}
}
return false;
}
@Override
public PrismaticStrandsEffect copy() {
return new PrismaticStrandsEffect(this);
}
}

View file

@ -0,0 +1,162 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.ChangelingAbility;
import mage.cards.CardImpl;
import mage.cards.repository.CardRepository;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
/**
*
* @author Styxo
*/
public class EgoErasure extends CardImpl {
public EgoErasure(UUID ownerId) {
super(ownerId, 59, "Ego Erasure", Rarity.UNCOMMON, new CardType[]{CardType.TRIBAL, CardType.INSTANT}, "{2}{U}");
this.expansionSetCode = "LRW";
this.subtype.add("Shapeshifter");
// Changeling
this.addAbility(ChangelingAbility.getInstance());
//Creatures target player controls get -2/+0 and lose all creature types until end of turn.
this.getSpellAbility().addEffect(new EgoErasureBoostEffect());
this.getSpellAbility().addEffect(new EgoErasureLoseEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public EgoErasure(final EgoErasure card) {
super(card);
}
@Override
public EgoErasure copy() {
return new EgoErasure(this);
}
}
class EgoErasureLoseEffect extends ContinuousEffectImpl {
public EgoErasureLoseEffect() {
super(Duration.EndOfTurn, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
staticText = "and lose all creature types until end of turn";
}
public EgoErasureLoseEffect(final EgoErasureLoseEffect effect) {
super(effect);
}
@Override
public EgoErasureLoseEffect copy() {
return new EgoErasureLoseEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (this.affectedObjectsSet) {
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
for (Permanent creature : creatures) {
affectedObjectList.add(new MageObjectReference(creature, game));
}
}
}
@Override
public boolean apply(Game game, Ability source) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null) {
permanent.getSubtype().retainAll(CardRepository.instance.getLandTypes());
} else {
it.remove();
}
}
return true;
}
}
class EgoErasureBoostEffect extends ContinuousEffectImpl {
public EgoErasureBoostEffect() {
super(Duration.EndOfTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.Benefit);
staticText = "Creatures target player controls get -2/+0";
}
public EgoErasureBoostEffect(final EgoErasureBoostEffect effect) {
super(effect);
}
@Override
public EgoErasureBoostEffect copy() {
return new EgoErasureBoostEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (this.affectedObjectsSet) {
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
for (Permanent creature : creatures) {
affectedObjectList.add(new MageObjectReference(creature, game));
}
}
}
@Override
public boolean apply(Game game, Ability source) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null) {
permanent.addPower(-2);
} else {
it.remove();
}
}
return true;
}
}

View file

@ -29,18 +29,13 @@ package mage.sets.lorwyn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.PutIntoGraveFromBattlefieldSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ClashEffect;
import mage.abilities.effects.common.DoIfClashWonEffect;
import mage.abilities.effects.common.ReturnToHandSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.game.Game;
import mage.players.Player;
/**
*
@ -60,8 +55,8 @@ public class Ringskipper extends CardImpl {
//Flying
this.addAbility(FlyingAbility.getInstance());
//When Ringskipper is put into graveyard from play, clash with an opponent. If you win return Ringskipper to its owner's hand
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new RingskipperEffect()));
//When {this} is put into graveyard from play, clash with an opponent. If you win return {this} to its owner's hand
this.addAbility(new PutIntoGraveFromBattlefieldSourceTriggeredAbility(new DoIfClashWonEffect(new ReturnToHandSourceEffect())));
}
public Ringskipper(final Ringskipper card) {
@ -73,34 +68,3 @@ public class Ringskipper extends CardImpl {
return new Ringskipper(this);
}
}
class RingskipperEffect extends OneShotEffect {
public RingskipperEffect() {
super(Outcome.ReturnToHand);
this.staticText = "clash with an opponent. If you win return Ringskipper to its owner's hand";
}
public RingskipperEffect(final RingskipperEffect effect) {
super(effect);
}
@Override
public RingskipperEffect copy() {
return new RingskipperEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (ClashEffect.getInstance().apply(game, source)) {
ReturnToHandSourceEffect effect = new ReturnToHandSourceEffect();
effect.apply(game, source);
}
return true;
}
return false;
}
}

View file

@ -0,0 +1,160 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.keyword.ChangelingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
/**
*
* @author Styxo
*/
public class ShieldsOfVelisVel extends CardImpl {
public ShieldsOfVelisVel(UUID ownerId) {
super(ownerId, 39, "Shields of Velis Vel", Rarity.COMMON, new CardType[]{CardType.TRIBAL, CardType.INSTANT}, "{W}");
this.expansionSetCode = "LRW";
this.subtype.add("Shapeshifter");
// Changeling
this.addAbility(ChangelingAbility.getInstance());
//Creatures target player controls get +0/+1 and gain all creature types until end of turn.
this.getSpellAbility().addEffect(new ShieldsOfVelisVelBoostEffect());
this.getSpellAbility().addEffect(new ShieldsOfVelisVelGainEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
}
public ShieldsOfVelisVel(final ShieldsOfVelisVel card) {
super(card);
}
@Override
public ShieldsOfVelisVel copy() {
return new ShieldsOfVelisVel(this);
}
}
class ShieldsOfVelisVelGainEffect extends ContinuousEffectImpl {
public ShieldsOfVelisVelGainEffect() {
super(Duration.EndOfTurn, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
staticText = "and gain all creature types until end of turn";
}
public ShieldsOfVelisVelGainEffect(final ShieldsOfVelisVelGainEffect effect) {
super(effect);
}
@Override
public ShieldsOfVelisVelGainEffect copy() {
return new ShieldsOfVelisVelGainEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (this.affectedObjectsSet) {
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
for (Permanent creature : creatures) {
affectedObjectList.add(new MageObjectReference(creature, game));
}
}
}
@Override
public boolean apply(Game game, Ability source) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null) {
permanent.addAbility(ChangelingAbility.getInstance(), source.getSourceId(), game, false);
} else {
it.remove();
}
}
return true;
}
}
class ShieldsOfVelisVelBoostEffect extends ContinuousEffectImpl {
public ShieldsOfVelisVelBoostEffect() {
super(Duration.EndOfTurn, Layer.PTChangingEffects_7, SubLayer.ModifyPT_7c, Outcome.BoostCreature);
staticText = "Creatures target player controls get +0/+1";
}
public ShieldsOfVelisVelBoostEffect(final ShieldsOfVelisVelBoostEffect effect) {
super(effect);
}
@Override
public ShieldsOfVelisVelBoostEffect copy() {
return new ShieldsOfVelisVelBoostEffect(this);
}
@Override
public void init(Ability source, Game game) {
super.init(source, game);
if (this.affectedObjectsSet) {
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(new FilterCreaturePermanent(), source.getFirstTarget(), game);
for (Permanent creature : creatures) {
affectedObjectList.add(new MageObjectReference(creature, game));
}
}
}
@Override
public boolean apply(Game game, Ability source) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null) {
permanent.addToughness(1);
} else {
it.remove();
}
}
return true;
}
}

View file

@ -0,0 +1,72 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.effects.common.DoIfClashWonEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.DoubleStrikeAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Styxo
*/
public class SpringjackKnight extends CardImpl {
public SpringjackKnight(UUID ownerId) {
super(ownerId, 41, "Springjack Knight", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{2}{W}");
this.expansionSetCode = "LRW";
this.subtype.add("Kithkin");
this.subtype.add("Knight");
this.power = new MageInt(2);
this.toughness = new MageInt(1);
//Whenever {this} attacks, clash with an opponent. If you win, target creature gains double strike until end of turn.
Ability ability = new AttacksTriggeredAbility(new DoIfClashWonEffect(new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn)), false);
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}
public SpringjackKnight(final SpringjackKnight card) {
super(card);
}
@Override
public SpringjackKnight copy() {
return new SpringjackKnight(this);
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.continuous.SwitchPowerToughnessSourceEffect;
import mage.abilities.keyword.ChangelingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
/**
*
* @author Styxo
*/
public class TurtleshellChangeling extends CardImpl {
public TurtleshellChangeling(UUID ownerId) {
super(ownerId, 94, "Turtleshell Changeling", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{3}{U}");
this.expansionSetCode = "LRW";
this.subtype.add("Shapesifter");
this.power = new MageInt(1);
this.toughness = new MageInt(4);
//Changeling
this.addAbility(ChangelingAbility.getInstance());
//{1}{U}: Switch {this}'s power and toughness until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new SwitchPowerToughnessSourceEffect(Duration.EndOfTurn), new ManaCostsImpl("{1}{U}")));
}
public TurtleshellChangeling(final TurtleshellChangeling card) {
super(card);
}
@Override
public TurtleshellChangeling copy() {
return new TurtleshellChangeling(this);
}
}

View file

@ -0,0 +1,83 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.PreventDamageToTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.target.common.TargetCreaturePermanent;
/**
*
* @author Styxo
*/
public class WellgabberApothecary extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("target tapped Merfolk or Kithkin creature this turn");
static {
filter.add(new TappedPredicate());
filter.add(Predicates.or(new SubtypePredicate("Merfolk"), new SubtypePredicate("Kithkin")));
}
public WellgabberApothecary(UUID ownerId) {
super(ownerId, 47, "Wellgabber Apothecary", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{4}{W}");
this.expansionSetCode = "LRW";
this.subtype.add("Merfolk");
this.subtype.add("Cleric");
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// {1}{W} : Prevent all damage that would be dealt to target tapped Merfolk or Kithkin creatuer this turn
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, Integer.MAX_VALUE), new ManaCostsImpl("{1}{W}"));
ability.addTarget(new TargetCreaturePermanent(filter));
this.addAbility(ability);
}
public WellgabberApothecary(final WellgabberApothecary card) {
super(card);
}
@Override
public WellgabberApothecary copy() {
return new WellgabberApothecary(this);
}
}

View file

@ -30,11 +30,13 @@ package mage.sets.magic2010;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.ActivationInfo;
import mage.abilities.DelayedTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.SacrificeSourceEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
@ -44,7 +46,6 @@ import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
/**
*
@ -60,7 +61,10 @@ public class DragonWhelp extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Flying
this.addAbility(FlyingAbility.getInstance());
// {R}: Dragon Whelp gets +1/+0 until end of turn. If this ability has been activated four or more times this turn, sacrifice Dragon Whelp at the beginning of the next end step.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BoostSourceEffect(1, 0, Duration.EndOfTurn),
new ManaCostsImpl("{R}"));
@ -96,46 +100,13 @@ class DragonWhelpEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Integer amount = (Integer) game.getState().getValue(source.getSourceId().toString() + "DragonWhelp");
if (amount == null) {
amount = 0;
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new DragonWhelpDelayedEffect());
ActivationInfo activationInfo = ActivationInfo.getInstance(game, source.getSourceId(), source.getSourceObjectZoneChangeCounter());
activationInfo.addActivation(game);
if (activationInfo.getActivationCounter() == 4) {
DelayedTriggeredAbility delayedAbility = new AtTheBeginOfNextEndStepDelayedTriggeredAbility(new SacrificeSourceEffect());
game.addDelayedTriggeredAbility(delayedAbility, source);
}
amount++;
game.getState().setValue(source.getSourceId().toString() + "DragonWhelp", amount);
return true;
}
}
class DragonWhelpDelayedEffect extends OneShotEffect {
public DragonWhelpDelayedEffect() {
super(Outcome.Damage);
this.staticText = "If this ability has been activated four or more times this turn, sacrifice {this} at the beginning of the next end step";
}
public DragonWhelpDelayedEffect(final DragonWhelpDelayedEffect effect) {
super(effect);
}
@Override
public DragonWhelpDelayedEffect copy() {
return new DragonWhelpDelayedEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Integer amount = (Integer) game.getState().getValue(source.getSourceId().toString() + "DragonWhelp");
if (amount != null && amount >= 4) {
Permanent permanent = game.getPermanent(source.getSourceId());
if (permanent != null) {
permanent.sacrifice(source.getSourceId(), game);
}
}
game.getState().setValue(source.getSourceId().toString() + "DragonWhelp", null);
return true;
}
}

View file

@ -30,7 +30,6 @@ package mage.sets.magic2015;
import java.util.UUID;
import mage.MageInt;
import mage.MageObject;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -152,8 +151,6 @@ class AvacynGuardianAngelPreventToPlayerEffect extends PreventionEffectImpl {
super(effect);
}
@Override
public boolean apply(Game game, Ability source) {
return true;

View file

@ -124,7 +124,7 @@ class ActivatedLoyaltyAbilityWatcher extends Watcher {
return new ActivatedLoyaltyAbilityWatcher(this);
}
public boolean activatedLayaltyAbility(UUID playerId) {
public boolean activatedLoyaltyAbility(UUID playerId) {
return playerIds.contains(playerId);
}
}
@ -177,7 +177,7 @@ class TheChainVeilCondition implements Condition {
public boolean apply(Game game, Ability source) {
ActivatedLoyaltyAbilityWatcher watcher = (ActivatedLoyaltyAbilityWatcher) game.getState().getWatchers().get("ActivatedLoyaltyAbilityWatcher");
if (watcher != null) {
if (!watcher.activatedLayaltyAbility(source.getControllerId())) {
if (!watcher.activatedLoyaltyAbility(source.getControllerId())) {
return true;
}
}

View file

@ -0,0 +1,81 @@
/*
* 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.nemesis;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.DiscardCostCardConvertedMana;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class VolrathTheFallen extends CardImpl {
public VolrathTheFallen(UUID ownerId) {
super(ownerId, 75, "Volrath the Fallen", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{B}{B}{B}");
this.expansionSetCode = "NMS";
this.supertype.add("Legendary");
this.subtype.add("Shapeshifter");
this.power = new MageInt(6);
this.toughness = new MageInt(4);
// {1}{B}, Discard a creature card:
// Volrath the Fallen gets +X/+X until end of turn, where X is the discarded card's converted mana cost.
Effect effect = new BoostSourceEffect(new DiscardCostCardConvertedMana(),new DiscardCostCardConvertedMana(),Duration.EndOfTurn);
effect.setText("{this} gets +X/+X until end of turn, where X is the discarded card's converted mana cost");
Ability ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD,
effect,
new ManaCostsImpl("{1}{B}"));
ability.addCost(new DiscardCardCost(new FilterCreatureCard()));
this.addAbility(ability);
}
public VolrathTheFallen(final VolrathTheFallen card) {
super(card);
}
@Override
public VolrathTheFallen copy() {
return new VolrathTheFallen(this);
}
}

View file

@ -137,7 +137,8 @@ class VileRedeemerNonTokenCreaturesDiedWatcher extends Watcher {
if (zEvent.isDiesEvent() && zEvent.getTarget() != null
&& zEvent.getTarget().getCardType().contains(CardType.CREATURE)
&& !(zEvent.getTarget() instanceof PermanentToken)) {
int count = amountOfCreaturesThatDied.containsKey(zEvent.getTarget().getControllerId()) ? amountOfCreaturesThatDied.get(zEvent.getTarget().getControllerId()) : 0;
int count = amountOfCreaturesThatDied.containsKey(zEvent.getTarget().getControllerId())
? amountOfCreaturesThatDied.get(zEvent.getTarget().getControllerId()) : 0;
amountOfCreaturesThatDied.put(zEvent.getTarget().getControllerId(), ++count);
}
}
@ -145,6 +146,7 @@ class VileRedeemerNonTokenCreaturesDiedWatcher extends Watcher {
@Override
public void reset() {
super.reset();
amountOfCreaturesThatDied.clear();
}

View file

@ -0,0 +1,124 @@
/*
* 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.prophecy;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledEnchantmentPermanent;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class CalmingVerse extends CardImpl {
public CalmingVerse(UUID ownerId) {
super(ownerId, 110, "Calming Verse", Rarity.COMMON, new CardType[]{CardType.SORCERY}, "{3}{G}");
this.expansionSetCode = "PCY";
// Destroy all enchantments you don't control. Then, if you control an untapped land, destroy all enchantments you control.
this.getSpellAbility().addEffect(new CalmingVerseEffect());
}
public CalmingVerse(final CalmingVerse card) {
super(card);
}
@Override
public CalmingVerse copy() {
return new CalmingVerse(this);
}
}
class CalmingVerseEffect extends OneShotEffect {
private static final FilterPermanent untappedLandFilter = new FilterPermanent("If you control an untapped land");
static {
untappedLandFilter.add(new CardTypePredicate(CardType.LAND));
untappedLandFilter.add(Predicates.not(new TappedPredicate()));
}
private static final FilterEnchantmentPermanent opponentEnchantmentsFilter = new FilterEnchantmentPermanent("enchantments you don't control");
static {
opponentEnchantmentsFilter.add(new ControllerPredicate(TargetController.OPPONENT));
}
private static final FilterControlledEnchantmentPermanent controlledEnchantmentsFilter = new FilterControlledEnchantmentPermanent("enchantments you control");
public CalmingVerseEffect() {
super(Outcome.Detriment);
this.staticText = "Destroy all enchantments you don't control. Then, if you control an untapped land, destroy all enchantments you control";
}
public CalmingVerseEffect(final CalmingVerseEffect effect) {
super(effect);
}
@Override
public CalmingVerseEffect copy() {
return new CalmingVerseEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
// Destroy all other enchantments
for (Permanent permanent : game.getBattlefield().getActivePermanents(opponentEnchantmentsFilter, source.getControllerId(), source.getSourceId(), game)) {
permanent.destroy(source.getSourceId(), game, false);
}
// Then if you control an untapped land, destroy all own enchantments
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
if (game.getState().getBattlefield().countAll(untappedLandFilter, controller.getId(), game) > 0) {
for (Permanent permanent : game.getBattlefield().getActivePermanents(controlledEnchantmentsFilter, source.getControllerId(), source.getSourceId(), game)) {
permanent.destroy(source.getSourceId(), game, false);
}
}
}
return true;
}
}

View file

@ -29,12 +29,18 @@ package mage.sets.shadowsoverinnistrad;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.InfoEffect;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.TargetPermanent;
/**
*
@ -57,7 +63,7 @@ public class DemonPossessedWitch extends CardImpl {
this.nightCard = true;
// When this creature transforms into Demon-Possessed Witch, you may destroy target creature.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new InfoEffect(rule)));
this.addAbility(new DemonPossessedWitchAbility());
}
public DemonPossessedWitch(final DemonPossessedWitch card) {
@ -69,3 +75,42 @@ public class DemonPossessedWitch extends CardImpl {
return new DemonPossessedWitch(this);
}
}
class DemonPossessedWitchAbility extends TriggeredAbilityImpl {
public DemonPossessedWitchAbility() {
super(Zone.BATTLEFIELD, new DestroyTargetEffect(), true);
Target target = new TargetPermanent(new FilterCreaturePermanent());
this.addTarget(target);
}
public DemonPossessedWitchAbility(final DemonPossessedWitchAbility ability) {
super(ability);
}
@Override
public DemonPossessedWitchAbility copy() {
return new DemonPossessedWitchAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TRANSFORMED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(sourceId)) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.isTransformed()) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "When this creature transforms into Demon-Possessed Witch, you may destroy target creature.";
}
}

View file

@ -29,23 +29,15 @@ package mage.sets.shadowsoverinnistrad;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.condition.common.DeliriumCondition;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.TransformSourceEffect;
import mage.abilities.keyword.TransformAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.TargetPermanent;
/**
*
@ -67,9 +59,6 @@ public class KindlyStranger extends CardImpl {
this.addAbility(new TransformAbility());
this.addAbility(new ConditionalActivatedAbility(Zone.BATTLEFIELD,
new TransformSourceEffect(true), new ManaCostsImpl<>("{2}{B}"), DeliriumCondition.getInstance()));
// When this creature transforms into Demon-Possessed Witch, you may destroy target creature.
this.addAbility(new DemonPossessedWitchAbility());
}
public KindlyStranger(final KindlyStranger card) {
@ -81,44 +70,3 @@ public class KindlyStranger extends CardImpl {
return new KindlyStranger(this);
}
}
class DemonPossessedWitchAbility extends TriggeredAbilityImpl {
public DemonPossessedWitchAbility() {
super(Zone.BATTLEFIELD, new DestroyTargetEffect(), true);
Target target = new TargetPermanent(new FilterCreaturePermanent());
this.addTarget(target);
// Rule only shown on the night side
this.setRuleVisible(false);
}
public DemonPossessedWitchAbility(final DemonPossessedWitchAbility ability) {
super(ability);
}
@Override
public DemonPossessedWitchAbility copy() {
return new DemonPossessedWitchAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.TRANSFORMED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getTargetId().equals(sourceId)) {
Permanent permanent = game.getPermanent(sourceId);
if (permanent != null && permanent.isTransformed()) {
return true;
}
}
return false;
}
@Override
public String getRule() {
return "When this creature transforms into Demon-Possessed Witch, you may destroy target creature.";
}
}

View file

@ -0,0 +1,52 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.thedark;
import java.util.UUID;
/**
*
* @author spjspj
*/
public class Preacher extends mage.sets.mastersedition.Preacher {
public Preacher(UUID ownerId) {
super(ownerId);
this.cardNumber = 89;
this.expansionSetCode = "DRK";
}
public Preacher(final Preacher card) {
super(card);
}
@Override
public Preacher copy() {
return new Preacher(this);
}
}

View file

@ -37,6 +37,7 @@ import mage.abilities.dynamicvalue.common.RemovedCountersForCostValue;
import mage.abilities.effects.common.AddManaInAnyCombinationEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.mana.ColorlessManaAbility;
import mage.abilities.mana.SimpleManaAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.ColoredManaSymbol;
@ -57,11 +58,11 @@ public class CalciformPools extends CardImpl {
// {tap}: Add {C} to your mana pool.
this.addAbility(new ColorlessManaAbility());
// {1}, {tap}: Put a storage counter on Calciform Pools.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()),new GenericManaCost(1));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.STORAGE.createInstance()), new GenericManaCost(1));
ability.addCost(new TapSourceCost());
this.addAbility(ability);
// {1}, Remove X storage counters from Calciform Pools: Add X mana in any combination of {W} and/or {U} to your mana pool.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
ability = new SimpleManaAbility(Zone.BATTLEFIELD,
new AddManaInAnyCombinationEffect(new RemovedCountersForCostValue(), ColoredManaSymbol.W, ColoredManaSymbol.U),
new GenericManaCost(1));
ability.addCost(new RemoveVariableCountersSourceCost(CounterType.STORAGE.createInstance()));

View file

@ -0,0 +1,128 @@
/*
* 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.urzassaga;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.keyword.CyclingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public class WildDogs extends CardImpl {
public WildDogs(UUID ownerId) {
super(ownerId, 284, "Wild Dogs", Rarity.COMMON, new CardType[]{CardType.CREATURE}, "{G}");
this.expansionSetCode = "USG";
this.subtype.add("Hound");
this.power = new MageInt(2);
this.toughness = new MageInt(1);
// At the beginning of your upkeep, if a player has more life than each other player, the player with the most life gains control of Wild Dogs.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new WildDogsEffect(), TargetController.YOU, false));
// Cycling {2}
this.addAbility(new CyclingAbility(new ManaCostsImpl("{2}")));
}
public WildDogs(final WildDogs card) {
super(card);
}
@Override
public WildDogs copy() {
return new WildDogs(this);
}
}
class WildDogsEffect extends OneShotEffect {
public WildDogsEffect() {
super(Outcome.GainControl);
this.staticText = "the player with the most life gains control of {this}";
}
public WildDogsEffect(final WildDogsEffect effect) {
super(effect);
}
@Override
public WildDogsEffect copy() {
return new WildDogsEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
if (sourcePermanent != null) {
Player newController = null;
int lowLife = Integer.MIN_VALUE;
boolean tie = false;
for (UUID playerID : game.getState().getPlayersInRange(source.getControllerId(), game)) {
Player player = game.getPlayer(playerID);
if (player != null) {
if (player.getLife() > lowLife) {
lowLife = player.getLife();
newController = player;
tie = false;
} else if (player.getLife() == lowLife) {
tie = true;
}
}
}
if (!controller.equals(newController) && !tie && newController != null) {
ContinuousEffect effect = new GainControlTargetEffect(Duration.Custom, newController.getId());
effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
game.addEffect(effect, source);
}
}
return true;
}
return false;
}
}