mirror of
https://github.com/correl/mage.git
synced 2025-03-31 01:07:39 -09:00
Fixed that the X value of permanents like Hangbar Walker isn't used again if the permanent enters the battlefield later without beeing cast (e.g. returning from leaving Oblivion Ring).
This commit is contained in:
parent
454bd5ca57
commit
2cf5907189
29 changed files with 219 additions and 197 deletions
Mage.Sets/src/mage/sets
bornofthegods
championsofkamigawa
commander2014
conflux
conspiracy
dragonsmaze
gatecrash
innistrad
khansoftarkir
magic2010
magic2012
magic2014
magic2015
magicorigins
mirrodin
modernmasters2015
planechase
planeshift
returntoravnica
saviorsofkamigawa
scarsofmirrodin
shardsofalara
tempest
theros
visions
Mage.Tests/src/test/java/org/mage/test/cards/triggers
|
@ -77,6 +77,7 @@ public class AstralCornucopia extends CardImpl {
|
|||
}
|
||||
|
||||
class AstralCornucopiaEffect extends OneShotEffect {
|
||||
|
||||
public AstralCornucopiaEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
@ -90,9 +91,8 @@ class AstralCornucopiaEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||
|
@ -130,7 +130,7 @@ class AstralCornucopiaManaAbility extends ManaAbility {
|
|||
if (sourcePermanent != null) {
|
||||
int counters = sourcePermanent.getCounters().getCount(CounterType.CHARGE.getName());
|
||||
if (counters > 0) {
|
||||
netMana.add(new Mana(0,0,0,0,0,0,counters));
|
||||
netMana.add(new Mana(0, 0, 0, 0, 0, 0, counters));
|
||||
}
|
||||
}
|
||||
return netMana;
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2011 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
|
||||
|
@ -20,7 +20,7 @@
|
|||
* 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.
|
||||
|
@ -28,10 +28,6 @@
|
|||
package mage.sets.championsofkamigawa;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
|
@ -43,6 +39,10 @@ import mage.abilities.effects.EntersBattlefieldEffect;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -61,7 +61,7 @@ public class OrochiHatchery extends CardImpl {
|
|||
this.addAbility(new EntersBattlefieldAbility(new OrochiHatcheryEffect(), "with X charge counters on it"));
|
||||
|
||||
// {5}, {T}: Put a 1/1 green Snake creature token onto the battlefield for each charge counter on Orochi Hatchery.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SnakeToken(),new CountersCount(CounterType.CHARGE)), new GenericManaCost(5));
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SnakeToken(), new CountersCount(CounterType.CHARGE)), new GenericManaCost(5));
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ public class OrochiHatchery extends CardImpl {
|
|||
}
|
||||
|
||||
class OrochiHatcheryEffect extends OneShotEffect {
|
||||
|
||||
public OrochiHatcheryEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
@ -91,9 +92,8 @@ class OrochiHatcheryEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {;
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||
|
@ -107,4 +107,4 @@ class OrochiHatcheryEffect extends OneShotEffect {
|
|||
public OrochiHatcheryEffect copy() {
|
||||
return new OrochiHatcheryEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ public class LifebloodHydra extends CardImpl {
|
|||
|
||||
// Trample
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
|
||||
|
||||
// Lifeblood Hydra enters the battlefield with X +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new LifebloodHydraComesIntoPlayEffect(), "with X +1/+1 counters on it"));
|
||||
|
||||
|
@ -95,7 +95,8 @@ class LifebloodHydraComesIntoPlayEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && !permanent.isFaceDown(game)) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
@ -111,6 +112,7 @@ class LifebloodHydraComesIntoPlayEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class LifebloodHydraEffect extends OneShotEffect {
|
||||
|
||||
public LifebloodHydraEffect() {
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
*/
|
||||
package mage.sets.conflux;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -40,15 +39,15 @@ import mage.abilities.effects.EntersBattlefieldEffect;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.DamageTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
|
@ -83,6 +82,7 @@ public class ApocalypseHydra extends CardImpl {
|
|||
}
|
||||
|
||||
class ApocalypseHydraEffect extends OneShotEffect {
|
||||
|
||||
ApocalypseHydraEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
staticText = "with X +1/+1 counters on it. If X is 5 or more, it enters the battlefield with an additional X +1/+1 counters on it";
|
||||
|
@ -97,10 +97,9 @@ class ApocalypseHydraEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
int amount = ((SpellAbility)obj).getManaCostsToPay().getX();
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
if (amount < 5) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.conspiracy;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -49,14 +48,13 @@ import mage.counters.CounterType;
|
|||
import mage.filter.common.FilterInstantOrSorceryCard;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreatureOrPlayer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author andyfries
|
||||
*/
|
||||
|
||||
public class AcademyElite extends CardImpl {
|
||||
|
||||
public AcademyElite(UUID ownerId) {
|
||||
super(ownerId, 20, "Academy Elite", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{U}");
|
||||
this.expansionSetCode = "CNS";
|
||||
|
@ -76,7 +74,6 @@ public class AcademyElite extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
|
||||
public AcademyElite(final AcademyElite card) {
|
||||
super(card);
|
||||
}
|
||||
|
@ -104,7 +101,8 @@ class AcademyEliteEffect1 extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
CardsInAllGraveyardsCount instantsAndSorceries = new CardsInAllGraveyardsCount(new FilterInstantOrSorceryCard("instant or sorcery cards"));
|
||||
int instantsAndSorceriesCount = instantsAndSorceries.calculate(game, source, this);
|
||||
if (instantsAndSorceriesCount > 0) {
|
||||
|
@ -120,4 +118,3 @@ class AcademyEliteEffect1 extends OneShotEffect {
|
|||
return new AcademyEliteEffect1(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ public class GrenzoDungeonWarden extends CardImpl {
|
|||
|
||||
// Grenzo, Dungeon Warden enters the battlefield with X +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new GrenzoDungeonWardenEtBEffect()));
|
||||
|
||||
|
||||
// {2}: Put the bottom card of your library into your graveyard. If it's a creature card with power less than or equal to Grenzo's power, put it onto the battlefield.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GrenzoDungeonWardenEffect(), new GenericManaCost(2)));
|
||||
}
|
||||
|
@ -95,9 +95,8 @@ class GrenzoDungeonWardenEtBEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((Ability) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
@ -114,21 +113,21 @@ class GrenzoDungeonWardenEtBEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
class GrenzoDungeonWardenEffect extends OneShotEffect {
|
||||
|
||||
|
||||
GrenzoDungeonWardenEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Put the bottom card of your library into your graveyard. If it's a creature card with power less than or equal to {this}'s power, put it onto the battlefield";
|
||||
}
|
||||
|
||||
|
||||
GrenzoDungeonWardenEffect(final GrenzoDungeonWardenEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GrenzoDungeonWardenEffect copy() {
|
||||
return new GrenzoDungeonWardenEffect(this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
package mage.sets.dragonsmaze;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -42,7 +38,10 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.abilities.keyword.DoubleStrikeAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -63,10 +62,10 @@ public class SavagebornHydra extends CardImpl {
|
|||
|
||||
// Double strike
|
||||
this.addAbility(DoubleStrikeAbility.getInstance());
|
||||
|
||||
|
||||
// Savageborn Hydra enters the battlefield with X +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new SavageBornHydraEffect(), true));
|
||||
|
||||
|
||||
// {1}{RG}: Put a +1/+1 counter on Savageborn Hydra. Activate this ability only any time you could cast a sorcery.
|
||||
this.addAbility(new ActivateAsSorceryActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new ManaCostsImpl("{1}{R/G}")));
|
||||
}
|
||||
|
@ -97,10 +96,11 @@ class SavageBornHydraEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
int amount = ((SpellAbility)obj).getManaCostsToPay().getX();
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
}
|
||||
|
@ -113,4 +113,4 @@ class SavageBornHydraEffect extends OneShotEffect {
|
|||
public SavageBornHydraEffect copy() {
|
||||
return new SavageBornHydraEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
package mage.sets.gatecrash;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -38,7 +35,9 @@ import mage.abilities.common.EntersBattlefieldAbility;
|
|||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -89,10 +88,9 @@ class NimbusSwimmerEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
int amount = ((SpellAbility)obj).getManaCostsToPay().getX();
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
*/
|
||||
package mage.sets.innistrad;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -42,7 +41,9 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.counter.AddCountersAllEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
|
@ -50,8 +51,6 @@ import mage.filter.predicate.permanent.AnotherPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author nantuko
|
||||
*/
|
||||
|
@ -112,7 +111,8 @@ class MikaeusTheLunarchEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
|
|
@ -35,11 +35,9 @@ import mage.abilities.common.SimpleActivatedAbility;
|
|||
import mage.abilities.costs.common.RemoveCountersSourceCost;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.combat.CantAttackBlockTargetEffect;
|
||||
import mage.abilities.effects.common.combat.CantAttackTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
|
@ -62,7 +60,7 @@ public class BribersPurse extends CardImpl {
|
|||
this.expansionSetCode = "KTK";
|
||||
|
||||
// Briber's Purse enters the battlefield with X gem counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new BribersPurseEffect(), "{this} enters the battlefield with X gem counters on it"));
|
||||
this.addAbility(new EntersBattlefieldAbility(new BribersPurseEffect(), "{this} enters the battlefield with X gem counters on it"));
|
||||
|
||||
// {1}, {T}, Remove a gem counter from Briber's Purse: Target creature can't attack or block this turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CantAttackBlockTargetEffect(Duration.EndOfTurn), new GenericManaCost(1));
|
||||
|
@ -83,6 +81,7 @@ public class BribersPurse extends CardImpl {
|
|||
}
|
||||
|
||||
class BribersPurseEffect extends OneShotEffect {
|
||||
|
||||
public BribersPurseEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
@ -96,7 +95,8 @@ class BribersPurseEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(new Counter("gem", amount), game);
|
||||
|
@ -110,4 +110,4 @@ class BribersPurseEffect extends OneShotEffect {
|
|||
public BribersPurseEffect copy() {
|
||||
return new BribersPurseEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,13 +70,13 @@ public class HoodedHydra extends CardImpl {
|
|||
|
||||
// Hooded Hydra enters the battlefield with X +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new HoodedHydraEffect1(), "with X +1/+1 counters on it"));
|
||||
|
||||
|
||||
// When Hooded Hydra dies, put a 1/1 green Snake creature token onto the battlefield for each +1/+1 counter on it.
|
||||
this.addAbility(new DiesTriggeredAbility(new CreateTokenEffect(new SnakeToken("KTK"), new CountersCount(CounterType.P1P1)), false));
|
||||
|
||||
|
||||
// Morph {3}{G}{G}
|
||||
this.addAbility(new MorphAbility(this, new ManaCostsImpl("{3}{G}{G}")));
|
||||
|
||||
|
||||
// As Hooded Hydra is turned face up, put five +1/+1 counters on it.
|
||||
Effect effect = new AddCountersSourceEffect(CounterType.P1P1.createInstance(5));
|
||||
effect.setText("put five +1/+1 counters on it");
|
||||
|
@ -112,7 +112,8 @@ class HoodedHydraEffect1 extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && !permanent.isFaceDown(game)) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* 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
|
||||
|
@ -20,14 +20,14 @@
|
|||
* 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.magic2010;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.DelayedTriggeredAbility;
|
||||
|
@ -37,20 +37,22 @@ import mage.abilities.common.EntersBattlefieldAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
import mage.abilities.effects.PreventionEffectImpl;
|
||||
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.*;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.PreventionEffectData;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -65,10 +67,9 @@ public class ProteanHydra extends CardImpl {
|
|||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
||||
|
||||
// Protean Hydra enters the battlefield with X +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new ProteanHydraEffect1(), "with X +1/+1 counters on it"));
|
||||
|
||||
|
||||
// If damage would be dealt to Protean Hydra, prevent that damage and remove that many +1/+1 counters from it.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ProteanHydraEffect2()));
|
||||
|
||||
|
@ -102,8 +103,9 @@ public class ProteanHydra extends CardImpl {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
int amount = ((SpellAbility)obj).getManaCostsToPay().getX();
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
}
|
||||
|
@ -127,7 +129,7 @@ public class ProteanHydra extends CardImpl {
|
|||
}
|
||||
|
||||
public ProteanHydraEffect2(final ProteanHydraEffect2 effect) {
|
||||
super(effect);
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -142,12 +144,12 @@ public class ProteanHydra extends CardImpl {
|
|||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
|
||||
PreventionEffectData preventionEffectData = preventDamageAction(event, source, game);
|
||||
if (preventionEffectData.getPreventedDamage() > 0) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
permanent.removeCounters(CounterType.P1P1.createInstance(preventionEffectData.getPreventedDamage()), game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@
|
|||
*/
|
||||
package mage.sets.magic2012;
|
||||
|
||||
|
||||
import mage.constants.*;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -42,12 +41,15 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
|
@ -83,6 +85,7 @@ public class PrimordialHydra extends CardImpl {
|
|||
}
|
||||
|
||||
class PrimordialHydraEntersEffect extends OneShotEffect {
|
||||
|
||||
public PrimordialHydraEntersEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
}
|
||||
|
@ -96,7 +99,8 @@ class PrimordialHydraEntersEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
@ -113,6 +117,7 @@ class PrimordialHydraEntersEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
class PrimordialHydraDoubleEffect extends OneShotEffect {
|
||||
|
||||
PrimordialHydraDoubleEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
staticText = "double the number of +1/+1 counters on {this}";
|
||||
|
@ -139,4 +144,4 @@ class PrimordialHydraDoubleEffect extends OneShotEffect {
|
|||
public PrimordialHydraDoubleEffect copy() {
|
||||
return new PrimordialHydraDoubleEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,6 @@ import mage.constants.Outcome;
|
|||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.counters.CounterType;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||
import mage.game.Game;
|
||||
|
@ -57,6 +56,7 @@ import mage.target.common.TargetCreaturePermanentAmount;
|
|||
public class VastwoodHydra extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creatures you control");
|
||||
|
||||
static {
|
||||
filter.add(new ControllerPredicate(TargetController.YOU));
|
||||
}
|
||||
|
@ -103,9 +103,8 @@ class VastwoodHydraEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
@ -126,7 +125,7 @@ class VastwoodHydraDistributeEffect extends OneShotEffect {
|
|||
|
||||
public VastwoodHydraDistributeEffect() {
|
||||
super(Outcome.BoostCreature);
|
||||
this.staticText = "distribute a number of +1/+1 counters equal to the number of +1/+1 counters on {this} among any number of creatures you control";
|
||||
this.staticText = "distribute a number of +1/+1 counters equal to the number of +1/+1 counters on {this} among any number of creatures you control";
|
||||
}
|
||||
|
||||
public VastwoodHydraDistributeEffect(final VastwoodHydraDistributeEffect effect) {
|
||||
|
@ -142,7 +141,7 @@ class VastwoodHydraDistributeEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
if (source.getTargets().size() > 0) {
|
||||
Target multiTarget = source.getTargets().get(0);
|
||||
for (UUID target: multiTarget.getTargets()) {
|
||||
for (UUID target : multiTarget.getTargets()) {
|
||||
Permanent permanent = game.getPermanent(target);
|
||||
if (permanent != null) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(multiTarget.getTargetAmount(target)), game);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.sets.magic2015;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -54,10 +55,6 @@ import mage.game.permanent.Permanent;
|
|||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
|
@ -73,7 +70,6 @@ public class GenesisHydra extends CardImpl {
|
|||
this.power = new MageInt(0);
|
||||
this.toughness = new MageInt(0);
|
||||
|
||||
|
||||
// When you cast Genesis Hydra, reveal the top X cards of your library. You may put a nonland permanent card with converted mana cost X or less from among them onto the battlefield. Then shuffle the rest into your library.
|
||||
this.addAbility(new CastSourceTriggeredAbility(new GenesisHydraPutOntoBattlefieldEffect(), false));
|
||||
// Genesis Hydra enters the battlefield with X +1/+1 counters on it.
|
||||
|
@ -106,9 +102,8 @@ class GenesisHydraEntersBattlefieldEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
SpellAbility spellAbility = (SpellAbility) obj;
|
||||
if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast
|
||||
int amount = spellAbility.getManaCostsToPay().getX();
|
||||
|
|
|
@ -102,7 +102,8 @@ class HangarbackWalkerEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
|
|
@ -74,8 +74,8 @@ public class ChaliceOfTheVoid extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class ChaliceOfTheVoidEffect extends OneShotEffect {
|
||||
|
||||
public ChaliceOfTheVoidEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
@ -89,9 +89,8 @@ class ChaliceOfTheVoidEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||
|
@ -108,13 +107,11 @@ class ChaliceOfTheVoidEffect extends OneShotEffect {
|
|||
}
|
||||
|
||||
class ChaliceOfTheVoidTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
|
||||
public ChaliceOfTheVoidTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CounterEffect());
|
||||
}
|
||||
|
||||
|
||||
public ChaliceOfTheVoidTriggeredAbility(final ChaliceOfTheVoidTriggeredAbility abiltity) {
|
||||
super(abiltity);
|
||||
}
|
||||
|
@ -128,12 +125,12 @@ class ChaliceOfTheVoidTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.SPELL_CAST;
|
||||
}
|
||||
|
||||
|
||||
@java.lang.Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
Permanent chalice = game.getPermanent(getSourceId());
|
||||
Spell spell = game.getStack().getSpell(event.getTargetId());
|
||||
if(spell != null && chalice != null && spell.getConvertedManaCost() == chalice.getCounters().getCount(CounterType.CHARGE)){
|
||||
if (spell != null && chalice != null && spell.getConvertedManaCost() == chalice.getCounters().getCount(CounterType.CHARGE)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(event.getTargetId()));
|
||||
}
|
||||
|
@ -148,7 +145,6 @@ class ChaliceOfTheVoidTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class CounterEffect extends OneShotEffect {
|
||||
|
||||
public CounterEffect() {
|
||||
|
|
|
@ -65,10 +65,10 @@ public class WorldheartPhoenix extends CardImpl {
|
|||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
||||
// You may cast Worldheart Phoenix from your graveyard by paying {W}{U}{B}{R}{G} rather than paying its mana cost.
|
||||
// You may cast Worldheart Phoenix from your graveyard by paying {W}{U}{B}{R}{G} rather than paying its mana cost.
|
||||
// If you do, it enters the battlefield with two +1/+1 counters on it.
|
||||
Ability ability = new SimpleStaticAbility(Zone.ALL, new WorldheartPhoenixPlayEffect());
|
||||
ability.addEffect(new EntersBattlefieldEffect(new WorldheartPhoenixEntersBattlefieldEffect(),
|
||||
ability.addEffect(new EntersBattlefieldEffect(new WorldheartPhoenixEntersBattlefieldEffect(),
|
||||
"If you do, it enters the battlefield with two +1/+1 counters on it"));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
@ -137,7 +137,8 @@ public class WorldheartPhoenix extends CardImpl {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
// TODO: No perfect solution because there could be other effects that allow to cast the card for this mana cost
|
||||
if (((SpellAbility) obj).getManaCosts().getText().equals("{W}{U}{B}{R}{G}")) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(2), game);
|
||||
|
|
|
@ -32,10 +32,8 @@ import mage.MageInt;
|
|||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
|
@ -59,7 +57,7 @@ public class IvyElemental extends CardImpl {
|
|||
this.toughness = new MageInt(0);
|
||||
|
||||
// Ivy Elemental enters the battlefield with X +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new IvyElementalEntersBattlefieldEffect() ,"with X +1/+1 counters on it"));
|
||||
this.addAbility(new EntersBattlefieldAbility(new IvyElementalEntersBattlefieldEffect(), "with X +1/+1 counters on it"));
|
||||
}
|
||||
|
||||
public IvyElemental(final IvyElemental card) {
|
||||
|
@ -88,9 +86,8 @@ class IvyElementalEntersBattlefieldEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
SpellAbility spellAbility = (SpellAbility) obj;
|
||||
if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast
|
||||
int amount = spellAbility.getManaCostsToPay().getX();
|
||||
|
@ -108,4 +105,4 @@ class IvyElementalEntersBattlefieldEffect extends OneShotEffect {
|
|||
return new IvyElementalEntersBattlefieldEffect(this);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import mage.abilities.costs.Costs;
|
|||
import mage.abilities.costs.CostsImpl;
|
||||
import mage.abilities.costs.common.DiscardCardCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
|
@ -77,7 +76,7 @@ public class DralnusPet extends CardImpl {
|
|||
this.addAbility(new KickerAbility(kickerCosts));
|
||||
// If Dralnu's Pet was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost.
|
||||
Ability ability = new EntersBattlefieldAbility(new DralnusPetEffect(), KickedCondition.getInstance(), true,
|
||||
"If {this} was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost", "");
|
||||
"If {this} was kicked, it enters the battlefield with flying and with X +1/+1 counters on it, where X is the discarded card's converted mana cost", "");
|
||||
ability.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.WhileOnBattlefield));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
@ -114,7 +113,8 @@ class DralnusPetEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (controller != null && permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int cmc = 0;
|
||||
for (Cost cost : ((SpellAbility) obj).getCosts()) {
|
||||
if (cost instanceof DiscardCardCost && ((DiscardCardCost) cost).getCards().size() > 0) {
|
||||
|
|
|
@ -25,15 +25,9 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.returntoravnica;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.TriggeredAbility;
|
||||
|
@ -48,7 +42,11 @@ import mage.abilities.effects.common.AddManaOfAnyColorEffect;
|
|||
import mage.abilities.effects.common.ReturnToHandSourceEffect;
|
||||
import mage.abilities.mana.ActivateOncePerTurnManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -61,13 +59,12 @@ public class ManaBloom extends CardImpl {
|
|||
|
||||
static final String rule = "with X charge counters on it";
|
||||
|
||||
public ManaBloom (UUID ownerId) {
|
||||
public ManaBloom(UUID ownerId) {
|
||||
super(ownerId, 130, "Mana Bloom", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{X}{G}");
|
||||
this.expansionSetCode = "RTR";
|
||||
|
||||
|
||||
// Mana Bloom enters the battlefield with X charge counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new ManaBloomEffect(),rule));
|
||||
this.addAbility(new EntersBattlefieldAbility(new ManaBloomEffect(), rule));
|
||||
|
||||
// Remove a charge counter from Mana Bloom: Add one mana of any color to your mana pool. Activate this ability only once each turn.
|
||||
Ability ability = new ActivateOncePerTurnManaAbility(Zone.BATTLEFIELD, new AddManaOfAnyColorEffect(), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance()));
|
||||
|
@ -75,11 +72,11 @@ public class ManaBloom extends CardImpl {
|
|||
|
||||
// At the beginning of your upkeep, if Mana Bloom has no charge counters on it, return it to its owner's hand.
|
||||
TriggeredAbility triggeredAbility = new BeginningOfUpkeepTriggeredAbility(new ReturnToHandSourceEffect(true), TargetController.YOU, false);
|
||||
this.addAbility(new ConditionalTriggeredAbility(triggeredAbility, new SourceHasCounterCondition(CounterType.CHARGE, 0,0), "At the beginning of your upkeep, if Mana Bloom has no charge counters on it, return it to its owner's hand."));
|
||||
this.addAbility(new ConditionalTriggeredAbility(triggeredAbility, new SourceHasCounterCondition(CounterType.CHARGE, 0, 0), "At the beginning of your upkeep, if Mana Bloom has no charge counters on it, return it to its owner's hand."));
|
||||
|
||||
}
|
||||
|
||||
public ManaBloom (final ManaBloom card) {
|
||||
public ManaBloom(final ManaBloom card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -90,6 +87,7 @@ public class ManaBloom extends CardImpl {
|
|||
}
|
||||
|
||||
class ManaBloomEffect extends OneShotEffect {
|
||||
|
||||
public ManaBloomEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
@ -103,7 +101,8 @@ class ManaBloomEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
|
@ -120,4 +119,4 @@ class ManaBloomEffect extends OneShotEffect {
|
|||
public ManaBloomEffect copy() {
|
||||
return new ManaBloomEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,7 +98,8 @@ class MagaTraitorToMortalsEnterBattlefieldEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
/*
|
||||
* Copyright 2011 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
|
||||
|
@ -20,18 +20,14 @@
|
|||
* 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.scarsofmirrodin;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -45,13 +41,16 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.Token;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
|
@ -60,10 +59,10 @@ public class ChimericMass extends CardImpl {
|
|||
public ChimericMass(UUID ownerId) {
|
||||
super(ownerId, 141, "Chimeric Mass", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{X}");
|
||||
this.expansionSetCode = "SOM";
|
||||
|
||||
|
||||
// Chimeric Mass enters the battlefield with X charge counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new ChimericMassEffect(), "{this} enters the battlefield with X charge counters on it"));
|
||||
|
||||
|
||||
// {1}: Until end of turn, Chimeric Mass becomes a Construct artifact creature with "This creature's power and toughness are each equal to the number of charge counters on it."
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericMassToken(), "", Duration.EndOfTurn), new GenericManaCost(1)));
|
||||
}
|
||||
|
@ -80,6 +79,7 @@ public class ChimericMass extends CardImpl {
|
|||
}
|
||||
|
||||
class ChimericMassEffect extends OneShotEffect {
|
||||
|
||||
public ChimericMassEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
@ -93,9 +93,8 @@ class ChimericMassEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
package mage.sets.shardsofalara;
|
||||
|
||||
import java.util.UUID;
|
||||
import static javax.xml.bind.JAXBIntrospector.getValue;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
|
@ -66,7 +65,7 @@ public class FeralHydra extends CardImpl {
|
|||
// Feral Hydra enters the battlefield with X +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new FeralHydraEffect(), true));
|
||||
// {3}: Put a +1/+1 counter on Feral Hydra. Any player may activate this ability.
|
||||
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()) , new ManaCostsImpl("{3}"));
|
||||
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersSourceEffect(CounterType.P1P1.createInstance()), new ManaCostsImpl("{3}"));
|
||||
ability.setMayActivate(TargetController.ANY);
|
||||
ability.addEffect(new InfoEffect("Any player may activate this ability"));
|
||||
this.addAbility(ability);
|
||||
|
@ -82,7 +81,6 @@ public class FeralHydra extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class FeralHydraEffect extends OneShotEffect {
|
||||
|
||||
public FeralHydraEffect() {
|
||||
|
@ -99,10 +97,9 @@ class FeralHydraEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
int amount = ((SpellAbility)obj).getManaCostsToPay().getX();
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
}
|
||||
|
@ -115,4 +112,4 @@ class FeralHydraEffect extends OneShotEffect {
|
|||
public FeralHydraEffect copy() {
|
||||
return new FeralHydraEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,14 +25,9 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.sets.shardsofalara;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.SpellAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
|
@ -44,11 +39,14 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
|
||||
import mage.abilities.keyword.EquipAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
|
||||
/**
|
||||
* @author Loki
|
||||
*/
|
||||
|
@ -82,6 +80,7 @@ public class SigilOfDistinction extends CardImpl {
|
|||
}
|
||||
|
||||
class SigilOfDistinctionEffect extends OneShotEffect {
|
||||
|
||||
public SigilOfDistinctionEffect() {
|
||||
super(Outcome.Benefit);
|
||||
}
|
||||
|
@ -95,9 +94,8 @@ class SigilOfDistinctionEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||
|
|
|
@ -60,7 +60,7 @@ public class Krakilin extends CardImpl {
|
|||
|
||||
// Krakilin enters the battlefield with X +1/+1 counters on it.
|
||||
this.addAbility(new EntersBattlefieldAbility(new KrakilinEffect()));
|
||||
|
||||
|
||||
// {1}{G}: Regenerate Krakilin.
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new RegenerateSourceEffect(), new ManaCostsImpl("{1}{G}")));
|
||||
}
|
||||
|
@ -91,10 +91,9 @@ class KrakilinEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
int amount = ((SpellAbility)obj).getManaCostsToPay().getX();
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
}
|
||||
|
@ -107,4 +106,4 @@ class KrakilinEffect extends OneShotEffect {
|
|||
public KrakilinEffect copy() {
|
||||
return new KrakilinEffect(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ import mage.game.permanent.Permanent;
|
|||
public class MistcutterHydra extends CardImpl {
|
||||
|
||||
private static final FilterObject filter = new FilterObject("from blue");
|
||||
|
||||
static {
|
||||
filter.add(new ColorPredicate(ObjectColor.BLUE));
|
||||
}
|
||||
|
@ -102,10 +103,9 @@ class MistcutterHydraEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
// delete to prevent using it again if put into battlefield from other effect
|
||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||
int amount = ((SpellAbility)obj).getManaCostsToPay().getX();
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,8 @@ class PhyrexianMarauderEntersEffect extends OneShotEffect {
|
|||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && !permanent.isFaceDown(game)) {
|
||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||
if (obj != null && obj instanceof SpellAbility) {
|
||||
if (obj != null && obj instanceof SpellAbility
|
||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
||||
int amount = ((Ability) obj).getManaCostsToPay().getX();
|
||||
if (amount > 0) {
|
||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||
|
|
|
@ -8,13 +8,15 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
|||
/**
|
||||
* @author noxx
|
||||
*
|
||||
* Card: When Oblivion Ring enters the battlefield, exile another target nonland permanent.
|
||||
* When Oblivion Ring leaves the battlefield, return the exiled card to the battlefield under its owner's control.
|
||||
* Card: When Oblivion Ring enters the battlefield, exile another target nonland
|
||||
* permanent. When Oblivion Ring leaves the battlefield, return the exiled card
|
||||
* to the battlefield under its owner's control.
|
||||
*/
|
||||
public class OblivionRingTest extends CardTestPlayerBase {
|
||||
|
||||
/**
|
||||
* When Oblivion Ring enters the battlefield, exile another target nonland permanent.
|
||||
* When Oblivion Ring enters the battlefield, exile another target nonland
|
||||
* permanent.
|
||||
*/
|
||||
@Test
|
||||
public void testFirstTriggeredAbility() {
|
||||
|
@ -24,7 +26,7 @@ public class OblivionRingTest extends CardTestPlayerBase {
|
|||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Oblivion Ring");
|
||||
|
||||
setStopAt(2, PhaseStep.END_TURN);
|
||||
setStopAt(1, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
|
@ -34,7 +36,8 @@ public class OblivionRingTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* When Oblivion Ring leaves the battlefield, return the exiled card to the battlefield under its owner's control.
|
||||
* When Oblivion Ring leaves the battlefield, return the exiled card to the
|
||||
* battlefield under its owner's control.
|
||||
*/
|
||||
@Test
|
||||
public void testSecondTriggeredAbility() {
|
||||
|
@ -79,7 +82,8 @@ public class OblivionRingTest extends CardTestPlayerBase {
|
|||
}
|
||||
|
||||
/**
|
||||
* Tests that when Oblivion Ring gets destroyed planeswalker returns with new counters and can be used second time at the same turn
|
||||
* Tests that when Oblivion Ring gets destroyed planeswalker returns with
|
||||
* new counters and can be used second time at the same turn
|
||||
*/
|
||||
@Test
|
||||
public void testExilePlaneswalker() {
|
||||
|
@ -100,4 +104,36 @@ public class OblivionRingTest extends CardTestPlayerBase {
|
|||
assertPermanentCount(playerA, "Jace Beleren", 1); // returns back
|
||||
assertHandCount(playerA, 2); // can use ability twice
|
||||
}
|
||||
|
||||
/**
|
||||
* Oblivion Ring leaves from battlefield Effect brings Hangarback Walker
|
||||
* back with counters. But with rules it should come back with no counters
|
||||
*/
|
||||
@Test
|
||||
public void testReturningHangarbackWalker() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Forest", 4);
|
||||
// Hangarback Walker enters the battlefield with X +1/+1 counters on it.
|
||||
// When Hangarback Walker dies, put a 1/1 colorless Thopter artifact creature token with flying onto the battlefield for each +1/+1 counter on Hangarback Walker.
|
||||
// {1}, {t}: Put a +1/+1 counter on Hangarback Walker.
|
||||
addCard(Zone.HAND, playerA, "Hangarback Walker"); // {X}{X}
|
||||
addCard(Zone.HAND, playerA, "Naturalize");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerB, "Plains", 3);
|
||||
addCard(Zone.HAND, playerB, "Oblivion Ring");
|
||||
|
||||
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Hangarback Walker");
|
||||
setChoice(playerA, "X=2");
|
||||
|
||||
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Oblivion Ring");
|
||||
|
||||
castSpell(3, PhaseStep.PRECOMBAT_MAIN, playerA, "Naturalize", "Oblivion Ring");
|
||||
setStopAt(3, PhaseStep.BEGIN_COMBAT);
|
||||
execute();
|
||||
|
||||
assertPermanentCount(playerB, "Oblivion Ring", 0);
|
||||
assertGraveyardCount(playerB, "Oblivion Ring", 1);
|
||||
assertPermanentCount(playerA, "Hangarback Walker", 0);
|
||||
assertGraveyardCount(playerA, "Hangarback Walker", 1);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue