mirror of
https://github.com/correl/mage.git
synced 2025-04-10 09:11:04 -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
* 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,7 +67,6 @@ 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"));
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -142,7 +144,7 @@ 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) {
|
||||
|
|
|
@ -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}";
|
||||
|
|
|
@ -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);
|
||||
|
@ -109,12 +108,10 @@ class ChaliceOfTheVoidEffect extends OneShotEffect {
|
|||
|
||||
class ChaliceOfTheVoidTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
|
||||
public ChaliceOfTheVoidTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new CounterEffect());
|
||||
}
|
||||
|
||||
|
||||
public ChaliceOfTheVoidTriggeredAbility(final ChaliceOfTheVoidTriggeredAbility abiltity) {
|
||||
super(abiltity);
|
||||
}
|
||||
|
@ -133,7 +130,7 @@ class ChaliceOfTheVoidTriggeredAbility extends TriggeredAbilityImpl {
|
|||
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() {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -27,11 +27,7 @@
|
|||
*/
|
||||
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
|
||||
*/
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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