mirror of
https://github.com/correl/mage.git
synced 2024-12-28 03:00:10 +00:00
Merge origin/master
This commit is contained in:
commit
aa0021b43c
42 changed files with 544 additions and 309 deletions
|
@ -90,10 +90,11 @@ class AstralCornucopiaEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,10 +91,11 @@ class OrochiHatcheryEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {;
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,23 +29,20 @@ package mage.sets.commander2013;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.common.GainLifeControllerTriggeredAbility;
|
import mage.abilities.common.GainLifeControllerTriggeredAbility;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.common.DamagePlayersEffect;
|
|
||||||
import mage.abilities.effects.common.DoIfCostPaid;
|
import mage.abilities.effects.common.DoIfCostPaid;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
import mage.abilities.effects.common.GainLifeEffect;
|
import mage.abilities.effects.common.GainLifeEffect;
|
||||||
|
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.Rarity;
|
import mage.constants.Rarity;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -65,11 +62,17 @@ public class OloroAgelessAscetic extends CardImpl {
|
||||||
|
|
||||||
// At the beginning of your upkeep, you gain 2 life.
|
// At the beginning of your upkeep, you gain 2 life.
|
||||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GainLifeEffect(2), TargetController.YOU, false));
|
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new GainLifeEffect(2), TargetController.YOU, false));
|
||||||
|
|
||||||
// Whenever you gain life, you may pay {1}. If you do, draw a card and each opponent loses 1 life.
|
// Whenever you gain life, you may pay {1}. If you do, draw a card and each opponent loses 1 life.
|
||||||
this.addAbility(new GainLifeControllerTriggeredAbility(new DoIfCostPaid(new OloroAgelessAsceticEffect(), new GenericManaCost(1)),false));
|
DoIfCostPaid effect = new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new GenericManaCost(1));
|
||||||
|
Effect effectToAdd = new LoseLifeOpponentsEffect(1);
|
||||||
|
effectToAdd.setText("and each opponent loses 1 life");
|
||||||
|
effect.addEffect(effectToAdd);
|
||||||
|
this.addAbility(new GainLifeControllerTriggeredAbility(effect, false));
|
||||||
|
|
||||||
// At the beginning of your upkeep, if Oloro, Ageless Ascetic is in the command zone, you gain 2 life.
|
// At the beginning of your upkeep, if Oloro, Ageless Ascetic is in the command zone, you gain 2 life.
|
||||||
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.COMMAND,
|
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.COMMAND,
|
||||||
new GainLifeEffect(new StaticValue(2), "if Oloro, Ageless Ascetic is in the command zone, you gain 2 life"),TargetController.YOU, false));
|
new GainLifeEffect(new StaticValue(2), "if {this} is in the command zone, you gain 2 life"), TargetController.YOU, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public OloroAgelessAscetic(final OloroAgelessAscetic card) {
|
public OloroAgelessAscetic(final OloroAgelessAscetic card) {
|
||||||
|
@ -81,27 +84,3 @@ public class OloroAgelessAscetic extends CardImpl {
|
||||||
return new OloroAgelessAscetic(this);
|
return new OloroAgelessAscetic(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OloroAgelessAsceticEffect extends OneShotEffect {
|
|
||||||
|
|
||||||
public OloroAgelessAsceticEffect() {
|
|
||||||
super(Outcome.Benefit);
|
|
||||||
this.staticText = "draw a card and each opponent loses 1 life";
|
|
||||||
}
|
|
||||||
|
|
||||||
public OloroAgelessAsceticEffect(final OloroAgelessAsceticEffect effect) {
|
|
||||||
super(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public OloroAgelessAsceticEffect copy() {
|
|
||||||
return new OloroAgelessAsceticEffect(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean apply(Game game, Ability source) {
|
|
||||||
new DrawCardSourceControllerEffect(1).apply(game, source);
|
|
||||||
new DamagePlayersEffect(1, TargetController.OPPONENT).apply(game, source);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -94,10 +94,11 @@ class LifebloodHydraComesIntoPlayEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null && !permanent.isFaceDown(game)) {
|
if (permanent != null && !permanent.isFaceDown(game)) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,10 +96,11 @@ class ApocalypseHydraEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
if (amount < 5) {
|
if (amount < 5) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
|
|
|
@ -100,9 +100,10 @@ class AcademyEliteEffect1 extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
CardsInAllGraveyardsCount instantsAndSorceries = new CardsInAllGraveyardsCount(new FilterInstantOrSorceryCard("instant or sorcery cards"));
|
CardsInAllGraveyardsCount instantsAndSorceries = new CardsInAllGraveyardsCount(new FilterInstantOrSorceryCard("instant or sorcery cards"));
|
||||||
int instantsAndSorceriesCount = instantsAndSorceries.calculate(game, source, this);
|
int instantsAndSorceriesCount = instantsAndSorceries.calculate(game, source, this);
|
||||||
if (instantsAndSorceriesCount > 0) {
|
if (instantsAndSorceriesCount > 0) {
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.mana.GenericManaCost;
|
import mage.abilities.costs.mana.GenericManaCost;
|
||||||
|
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -94,10 +95,11 @@ class GrenzoDungeonWardenEtBEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((Ability) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
import mage.abilities.common.ActivateAsSorceryActivatedAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
import mage.abilities.keyword.DoubleStrikeAbility;
|
import mage.abilities.keyword.DoubleStrikeAbility;
|
||||||
|
@ -95,12 +96,11 @@ class SavageBornHydraEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
// delete to prevent using it again if put into battlefield from other effect
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,11 +28,6 @@
|
||||||
package mage.sets.eventide;
|
package mage.sets.eventide;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.constants.Zone;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.SimpleStaticAbility;
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
@ -42,6 +37,10 @@ import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.abilities.keyword.LifelinkAbility;
|
import mage.abilities.keyword.LifelinkAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
@ -57,15 +56,19 @@ public class DivinityOfPride extends CardImpl {
|
||||||
this.subtype.add("Spirit");
|
this.subtype.add("Spirit");
|
||||||
this.subtype.add("Avatar");
|
this.subtype.add("Avatar");
|
||||||
|
|
||||||
|
|
||||||
this.power = new MageInt(4);
|
this.power = new MageInt(4);
|
||||||
this.toughness = new MageInt(4);
|
this.toughness = new MageInt(4);
|
||||||
|
// Flying
|
||||||
this.addAbility(FlyingAbility.getInstance());
|
this.addAbility(FlyingAbility.getInstance());
|
||||||
|
|
||||||
|
// Lifelink
|
||||||
this.addAbility(LifelinkAbility.getInstance());
|
this.addAbility(LifelinkAbility.getInstance());
|
||||||
|
|
||||||
|
// Divinity of Pride gets +4/+4 as long as you have 25 or more life.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
||||||
new ConditionalContinuousEffect(new BoostSourceEffect(4, 4, Duration.WhileOnBattlefield),
|
new ConditionalContinuousEffect(new BoostSourceEffect(4, 4, Duration.WhileOnBattlefield),
|
||||||
new DivinityOfPrideCondition(),
|
new DivinityOfPrideCondition(),
|
||||||
"Divinity of Pride gets +4/+4 as long as you have 25 or more life")));
|
"{this} gets +4/+4 as long as you have 25 or more life")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public DivinityOfPride(final DivinityOfPride card) {
|
public DivinityOfPride(final DivinityOfPride card) {
|
||||||
|
|
|
@ -87,10 +87,11 @@ class NimbusSwimmerEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,10 +110,11 @@ class MikaeusTheLunarchEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,10 +94,11 @@ class BribersPurseEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(new Counter("gem", amount), game);
|
permanent.addCounters(new Counter("gem", amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,10 +111,11 @@ class HoodedHydraEffect1 extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null && !permanent.isFaceDown(game)) {
|
if (permanent != null && !permanent.isFaceDown(game)) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,10 +102,11 @@ public class ProteanHydra extends CardImpl {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,10 +98,11 @@ class PrimordialHydraEntersEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,10 +102,11 @@ class VastwoodHydraEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,10 +101,10 @@ class GenesisHydraEntersBattlefieldEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
SpellAbility spellAbility = (SpellAbility) obj;
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast
|
if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast
|
||||||
int amount = spellAbility.getManaCostsToPay().getX();
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
|
|
|
@ -101,10 +101,11 @@ class HangarbackWalkerEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,10 +88,11 @@ class ChaliceOfTheVoidEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,17 +25,19 @@
|
||||||
* authors and should not be interpreted as representing official policies, either expressed
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.sets.mirrodinbesieged;
|
package mage.sets.mirrodinbesieged;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
import java.util.UUID;
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.abilities.effects.common.CopyEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.*;
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.TargetController;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
@ -43,12 +45,11 @@ import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.util.functions.ApplyToPermanent;
|
import mage.util.functions.ApplyToPermanent;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Loki
|
* @author Loki
|
||||||
*/
|
*/
|
||||||
public class Cryptoplasm extends CardImpl {
|
public class Cryptoplasm extends CardImpl {
|
||||||
|
|
||||||
final static FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
final static FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -64,7 +65,7 @@ public class Cryptoplasm extends CardImpl {
|
||||||
this.toughness = new MageInt(2);
|
this.toughness = new MageInt(2);
|
||||||
|
|
||||||
// At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.
|
// At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.
|
||||||
Ability ability = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmTransformEffect(), TargetController.YOU, true);
|
Ability ability = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(), TargetController.YOU, true);
|
||||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
@ -80,43 +81,39 @@ public class Cryptoplasm extends CardImpl {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class CryptoplasmTransformEffect extends ContinuousEffectImpl {
|
class CryptoplasmEffect extends OneShotEffect {
|
||||||
|
|
||||||
CryptoplasmTransformEffect() {
|
public CryptoplasmEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Layer.CopyEffects_1, SubLayer.NA, Outcome.Copy);
|
super(Outcome.Copy);
|
||||||
staticText = "you may have {this} become a copy of another target creature. If you do, {this} gains this ability";
|
this.staticText = "you may have {this} become a copy of another target creature. If you do, {this} gains this ability";
|
||||||
}
|
}
|
||||||
|
|
||||||
CryptoplasmTransformEffect(final CryptoplasmTransformEffect effect) {
|
public CryptoplasmEffect(final CryptoplasmEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, final Ability source) {
|
public CryptoplasmEffect copy() {
|
||||||
Permanent creature = game.getPermanent(targetPointer.getFirst(game, source));
|
return new CryptoplasmEffect(this);
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
|
||||||
|
|
||||||
if (creature == null || permanent == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
game.copyPermanent(creature, permanent, source, new ApplyToPermanent() {
|
|
||||||
@Override
|
|
||||||
public Boolean apply(Game game, Permanent permanent) {
|
|
||||||
Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmTransformEffect(), TargetController.YOU, true);
|
|
||||||
upkeepAbility.addTarget(new TargetCreaturePermanent());
|
|
||||||
permanent.addAbility(upkeepAbility, source.getSourceId(), game);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CryptoplasmTransformEffect copy() {
|
public boolean apply(Game game, final Ability source) {
|
||||||
return new CryptoplasmTransformEffect(this);
|
Permanent creatureToCopy = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||||
}
|
if (creatureToCopy != null) {
|
||||||
|
CopyEffect effect = new CopyEffect(creatureToCopy, source.getSourceId());
|
||||||
|
effect.setApplier(new ApplyToPermanent() {
|
||||||
|
@Override
|
||||||
|
public Boolean apply(Game game, Permanent permanent) {
|
||||||
|
Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(), TargetController.YOU, true);
|
||||||
|
upkeepAbility.addTarget(new TargetCreaturePermanent());
|
||||||
|
permanent.addAbility(upkeepAbility, source.getSourceId(), game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
game.addEffect(effect, source);
|
||||||
|
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,11 +136,12 @@ public class WorldheartPhoenix extends CardImpl {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
// TODO: No perfect solution because there could be other effects that allow to cast the card for this mana cost
|
// 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}")) {
|
if (spellAbility.getManaCosts().getText().equals("{W}{U}{B}{R}{G}")) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(2), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(2), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,10 +85,10 @@ class IvyElementalEntersBattlefieldEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
SpellAbility spellAbility = (SpellAbility) obj;
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast
|
if (spellAbility.getSourceId().equals(source.getSourceId())) { // put into play by normal cast
|
||||||
int amount = spellAbility.getManaCostsToPay().getX();
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
|
|
|
@ -112,11 +112,12 @@ class DralnusPetEffect extends OneShotEffect {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (controller != null && permanent != null) {
|
if (controller != null && permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
int cmc = 0;
|
int cmc = 0;
|
||||||
for (Cost cost : ((SpellAbility) obj).getCosts()) {
|
for (Cost cost : spellAbility.getCosts()) {
|
||||||
if (cost instanceof DiscardCardCost && ((DiscardCardCost) cost).getCards().size() > 0) {
|
if (cost instanceof DiscardCardCost && ((DiscardCardCost) cost).getCards().size() > 0) {
|
||||||
cmc = ((DiscardCardCost) cost).getCards().get(0).getManaCost().convertedManaCost();
|
cmc = ((DiscardCardCost) cost).getCards().get(0).getManaCost().convertedManaCost();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,10 @@ package mage.sets.ravnica;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.common.OnEventTriggeredAbility;
|
import mage.abilities.common.OnEventTriggeredAbility;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.AttachEffect;
|
import mage.abilities.effects.common.AttachEffect;
|
||||||
|
import mage.abilities.effects.common.PutTokenOntoBattlefieldCopyTargetEffect;
|
||||||
import mage.abilities.keyword.EnchantAbility;
|
import mage.abilities.keyword.EnchantAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.constants.CardType;
|
import mage.constants.CardType;
|
||||||
|
@ -40,15 +42,14 @@ import mage.constants.Rarity;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.EmptyToken;
|
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.TargetPermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
import mage.util.CardUtil;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LoneFox
|
* @author LoneFox
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
public class FollowedFootsteps extends CardImpl {
|
public class FollowedFootsteps extends CardImpl {
|
||||||
|
|
||||||
|
@ -99,10 +100,9 @@ class FollowedFootstepsEffect extends OneShotEffect {
|
||||||
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
Permanent enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
|
||||||
Permanent target = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());
|
Permanent target = game.getPermanentOrLKIBattlefield(enchantment.getAttachedTo());
|
||||||
if (target != null) {
|
if (target != null) {
|
||||||
EmptyToken token = new EmptyToken();
|
Effect effect = new PutTokenOntoBattlefieldCopyTargetEffect();
|
||||||
CardUtil.copyTo(token).from(target);
|
effect.setTargetPointer(new FixedTarget(enchantment.getAttachedTo()));
|
||||||
token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId());
|
return effect.apply(game, source);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,12 +100,13 @@ class ManaBloomEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
// delete to prevent using it again if put into battlefield from other effect
|
// delete to prevent using it again if put into battlefield from other effect
|
||||||
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
setValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY, null);
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -97,10 +97,11 @@ class MagaTraitorToMortalsEnterBattlefieldEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,10 +92,11 @@ class ChimericMassEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.InfoEffect;
|
import mage.abilities.effects.common.InfoEffect;
|
||||||
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
|
||||||
|
@ -96,10 +97,11 @@ class FeralHydraEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,10 +93,11 @@ class SigilOfDistinctionEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
permanent.addCounters(CounterType.CHARGE.createInstance(amount), game);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
import mage.abilities.common.SimpleActivatedAbility;
|
import mage.abilities.common.SimpleActivatedAbility;
|
||||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||||
|
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.RegenerateSourceEffect;
|
import mage.abilities.effects.common.RegenerateSourceEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
@ -90,10 +91,11 @@ class KrakilinEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.CantBeCounteredAbility;
|
import mage.abilities.common.CantBeCounteredAbility;
|
||||||
import mage.abilities.common.EntersBattlefieldAbility;
|
import mage.abilities.common.EntersBattlefieldAbility;
|
||||||
|
import mage.abilities.effects.EntersBattlefieldEffect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
import mage.abilities.keyword.ProtectionAbility;
|
import mage.abilities.keyword.ProtectionAbility;
|
||||||
|
@ -102,10 +103,11 @@ class MistcutterHydraEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
Object obj = getValue(mage.abilities.effects.EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((SpellAbility) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,10 +96,11 @@ class PhyrexianMarauderEntersEffect extends OneShotEffect {
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||||
if (permanent != null && !permanent.isFaceDown(game)) {
|
if (permanent != null && !permanent.isFaceDown(game)) {
|
||||||
Object obj = getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
SpellAbility spellAbility = (SpellAbility) getValue(EntersBattlefieldEffect.SOURCE_CAST_SPELL_ABILITY);
|
||||||
if (obj != null && obj instanceof SpellAbility
|
if (spellAbility != null
|
||||||
&& permanent.getZoneChangeCounter(game) - 1 == ((SpellAbility) obj).getSourceObjectZoneChangeCounter()) {
|
&& spellAbility.getSourceId().equals(source.getSourceId())
|
||||||
int amount = ((Ability) obj).getManaCostsToPay().getX();
|
&& permanent.getZoneChangeCounter(game) - 1 == spellAbility.getSourceObjectZoneChangeCounter()) {
|
||||||
|
int amount = spellAbility.getManaCostsToPay().getX();
|
||||||
if (amount > 0) {
|
if (amount > 0) {
|
||||||
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
permanent.addCounters(CounterType.P1P1.createInstance(amount), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,10 @@ public class CastCreaturesTest extends CardTestPlayerBaseAI {
|
||||||
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
assertPermanentCount(playerA, "Silvercoat Lion", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This test fails sometimes, probably because two plains are tapped for the
|
||||||
|
* first creature
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleCast2() {
|
public void testSimpleCast2() {
|
||||||
addCard(Zone.HAND, playerA, "Silvercoat Lion");
|
addCard(Zone.HAND, playerA, "Silvercoat Lion");
|
||||||
|
|
|
@ -36,9 +36,26 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class PlayFromNonHandZoneTest extends CardTestPlayerBase {
|
public class PlayFromNonHandZoneTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testWorldheartPhoenixNormal() {
|
||||||
|
// Creature - Phoenix {3}{R}
|
||||||
|
// Flying
|
||||||
|
// 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.
|
||||||
|
addCard(Zone.HAND, playerA, "Worldheart Phoenix");
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Mountain", 4);
|
||||||
|
|
||||||
|
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Worldheart Phoenix"); // can only be cast by {W}{U}{B}{R}{G}
|
||||||
|
|
||||||
|
setStopAt(1, PhaseStep.END_COMBAT);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPowerToughness(playerA, "Worldheart Phoenix", 2, 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWorldheartPhoenixNoMana() {
|
public void testWorldheartPhoenixNoMana() {
|
||||||
// Creature - Phoenix {3}{R}
|
// Creature - Phoenix {3}{R}
|
||||||
|
@ -57,7 +74,6 @@ public class PlayFromNonHandZoneTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testWorldheartPhoenix() {
|
public void testWorldheartPhoenix() {
|
||||||
// Creature - Phoenix {3}{R}
|
// Creature - Phoenix {3}{R}
|
||||||
|
@ -80,7 +96,6 @@ public class PlayFromNonHandZoneTest extends CardTestPlayerBase {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNarsetEnlightenedMaster() {
|
public void testNarsetEnlightenedMaster() {
|
||||||
// First strike
|
// First strike
|
||||||
|
@ -120,8 +135,6 @@ public class PlayFromNonHandZoneTest extends CardTestPlayerBase {
|
||||||
assertLife(playerA, 17);
|
assertLife(playerA, 17);
|
||||||
assertLife(playerB, 22);
|
assertLife(playerB, 22);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,4 +19,99 @@ public class CryptoplasmTest extends CardTestPlayerBase {
|
||||||
assertLife(playerB, 20);
|
assertLife(playerB, 20);
|
||||||
assertPermanentCount(playerA, "Craw Wurm", 2);
|
assertPermanentCount(playerA, "Craw Wurm", 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* I have a Cryptoplasm in play, currently copying a Sigiled Paladin, and I
|
||||||
|
* enchant it with a Followed Footsteps. Next turn the aura triggers (the
|
||||||
|
* Crypto is still copying the same creature) and places a token on the
|
||||||
|
* battlefield, except the token is an untransformed Cryptoplasm, when it
|
||||||
|
* should be a Sigiled Paladin with Cryptoplasm's ability (as per rule
|
||||||
|
* 706.3), since that's what the enchanted creature currently is.
|
||||||
|
*
|
||||||
|
* 6/1/2011 If another creature becomes a copy of Cryptoplasm, it will
|
||||||
|
* become a copy of whatever Cryptoplasm is currently copying (if anything),
|
||||||
|
* plus it will have Cryptoplasm's triggered ability.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testFollowedFootsteps() {
|
||||||
|
// First strike
|
||||||
|
// Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Sigiled Paladin", 1); // {W}{W}
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 5);
|
||||||
|
// Enchant creature
|
||||||
|
// At the beginning of your upkeep, put a token that's a copy of enchanted creature onto the battlefield.
|
||||||
|
addCard(Zone.HAND, playerB, "Followed Footsteps", 1); // {3}{U}{U}
|
||||||
|
// At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Cryptoplasm", 1); // {1}{U}{U}
|
||||||
|
|
||||||
|
castSpell(2, PhaseStep.PRECOMBAT_MAIN, playerB, "Followed Footsteps");
|
||||||
|
addTarget(playerB, "Sigiled Paladin[only copy]");
|
||||||
|
|
||||||
|
setStopAt(4, PhaseStep.END_TURN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerB, "Followed Footsteps", 1);
|
||||||
|
assertPermanentCount(playerB, "Cryptoplasm", 0);
|
||||||
|
assertPermanentCount(playerB, "Sigiled Paladin", 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* I'm at 8 life, opponent (AI) is at 21. I have a Cryptoplasm currently
|
||||||
|
* copying my opponent's Divinity of Pride, the Crypto also has my Followed
|
||||||
|
* Footsteps attached to it. Additionally, I have another Cryptoplasm on the
|
||||||
|
* battlefield also copying the same Divinity, and a Clever Impersonator
|
||||||
|
* that ETB copying the first Cryptoplasm and is currently also a copy of
|
||||||
|
* the Divinity.
|
||||||
|
*
|
||||||
|
* Opponent attacks with his only Divinity of Pride (4/4) and a Serra
|
||||||
|
* Avenger (3/3). I block the Divinity with two of my Divinity copies (the
|
||||||
|
* Clever Impersonator and unenchanted Cryptoplasm) and the Avenger with the
|
||||||
|
* enchanted Divinity (originally a Cryptoplasm). My opponent's Divinity
|
||||||
|
* kills my two copies and dies, and then his Avenger dies and kills the
|
||||||
|
* Divinity blocking it, also sending my Followed Footsteps down with it.
|
||||||
|
*
|
||||||
|
* How does any of that add up? Not only should his Divinity only kill one
|
||||||
|
* of mine since it was a 4/4 and only becomes an 8/8 after dealing its
|
||||||
|
* damage (at which point it should be too late to go back and say the 4
|
||||||
|
* damage are now 8, since it was that exact damage that put him at 25
|
||||||
|
* life), but even more confusing is how the Serra Avenger, which is a 3/3,
|
||||||
|
* somehow kills my 4/4 that had suffered no other damage that turn.
|
||||||
|
*
|
||||||
|
* No other permanents in play at that moment had any influence in this
|
||||||
|
* either, they were only basic lands and a couple of creatures with no
|
||||||
|
* relevant abilities.
|
||||||
|
*
|
||||||
|
* I won't put aside me completely missing something here, but I really
|
||||||
|
* can't see any other explanation to this other than a game bug.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testDamageLifelink() {
|
||||||
|
setLife(playerA, 21);
|
||||||
|
setLife(playerB, 8);
|
||||||
|
// First strike
|
||||||
|
// Exalted (Whenever a creature you control attacks alone, that creature gets +1/+1 until end of turn.)
|
||||||
|
addCard(Zone.BATTLEFIELD, playerA, "Divinity of Pride", 1); // {W}{W}
|
||||||
|
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Island", 5);
|
||||||
|
// At the beginning of your upkeep, you may have Cryptoplasm become a copy of another target creature. If you do, Cryptoplasm gains this ability.
|
||||||
|
addCard(Zone.BATTLEFIELD, playerB, "Cryptoplasm", 2); // {1}{U}{U}
|
||||||
|
addTarget(playerB, "Divinity of Pride");
|
||||||
|
addTarget(playerB, "Divinity of Pride");
|
||||||
|
|
||||||
|
attack(3, playerA, "Divinity of Pride");
|
||||||
|
block(3, playerB, "Divinity of Pride", "Divinity of Pride");
|
||||||
|
block(3, playerB, "Divinity of Pride", "Divinity of Pride");
|
||||||
|
|
||||||
|
setStopAt(3, PhaseStep.POSTCOMBAT_MAIN);
|
||||||
|
execute();
|
||||||
|
|
||||||
|
assertPermanentCount(playerB, "Cryptoplasm", 0);
|
||||||
|
|
||||||
|
assertPermanentCount(playerA, "Divinity of Pride", 0);
|
||||||
|
assertPermanentCount(playerB, "Divinity of Pride", 1);
|
||||||
|
|
||||||
|
assertLife(playerB, 16);
|
||||||
|
assertLife(playerA, 25);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,6 @@
|
||||||
package mage.abilities.effects.common;
|
package mage.abilities.effects.common;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.SpellAbility;
|
import mage.abilities.SpellAbility;
|
||||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||||
|
@ -38,6 +36,9 @@ import mage.abilities.effects.Effect;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
@ -49,34 +50,34 @@ import mage.target.targetpointer.FixedTarget;
|
||||||
*
|
*
|
||||||
* 702.97. Cipher
|
* 702.97. Cipher
|
||||||
*
|
*
|
||||||
* 702.97a Cipher appears on some instants and sorceries. It represents two static
|
* 702.97a Cipher appears on some instants and sorceries. It represents two
|
||||||
* abilities, one that functions while the spell is on the stack and one that functions
|
* static abilities, one that functions while the spell is on the stack and one
|
||||||
* while the card with cipher is in the exile zone. "Cipher" means "If this spell is
|
* that functions while the card with cipher is in the exile zone. "Cipher"
|
||||||
* represented by a card, you may exile this card encoded on a creature you control"
|
* means "If this spell is represented by a card, you may exile this card
|
||||||
* and "As long as this card is encoded on that creature, that creature has 'Whenever
|
* encoded on a creature you control" and "As long as this card is encoded on
|
||||||
* this creature deals combat damage to a player, you may copy this card and you may
|
* that creature, that creature has 'Whenever this creature deals combat damage
|
||||||
* cast the copy without paying its mana cost.'"
|
* to a player, you may copy this card and you may cast the copy without paying
|
||||||
|
* its mana cost.'"
|
||||||
*
|
*
|
||||||
* 702.97b The term "encoded" describes the relationship between the card with cipher
|
* 702.97b The term "encoded" describes the relationship between the card with
|
||||||
* while in the exile zone and the creature chosen when the spell represented by that
|
* cipher while in the exile zone and the creature chosen when the spell
|
||||||
* card resolves.
|
* represented by that card resolves.
|
||||||
*
|
*
|
||||||
* 702.97c The card with cipher remains encoded on the chosen creature as long as the
|
* 702.97c The card with cipher remains encoded on the chosen creature as long
|
||||||
* card with cipher remains exiled and the creature remains on the battlefield. The
|
* as the card with cipher remains exiled and the creature remains on the
|
||||||
* card remains encoded on that object even if it changes controller or stops being
|
* battlefield. The card remains encoded on that object even if it changes
|
||||||
* a creature, as long as it remains on the battlefield.
|
* controller or stops being a creature, as long as it remains on the
|
||||||
|
* battlefield.
|
||||||
*
|
*
|
||||||
* TODO: Implement Cipher as two static abilities concerning the rules.
|
* TODO: Implement Cipher as two static abilities concerning the rules.
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public class CipherEffect extends OneShotEffect {
|
public class CipherEffect extends OneShotEffect {
|
||||||
|
|
||||||
public CipherEffect() {
|
public CipherEffect() {
|
||||||
super(Outcome.Copy);
|
super(Outcome.Copy);
|
||||||
staticText ="<br><br/>Cipher <i>(Then you may exile this spell card encoded on a creature you control. Whenever that creature deals combat damage to a player, its controller may cast a copy of the encoded card without paying its mana cost.)</i>";
|
staticText = "<br><br/>Cipher <i>(Then you may exile this spell card encoded on a creature you control. Whenever that creature deals combat damage to a player, its controller may cast a copy of the encoded card without paying its mana cost.)</i>";
|
||||||
}
|
}
|
||||||
|
|
||||||
public CipherEffect(final CipherEffect effect) {
|
public CipherEffect(final CipherEffect effect) {
|
||||||
|
@ -86,10 +87,11 @@ public class CipherEffect extends OneShotEffect {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
|
TargetControlledCreaturePermanent target = new TargetControlledCreaturePermanent();
|
||||||
|
target.setNotTarget(true);
|
||||||
if (target.canChoose(source.getControllerId(), game)
|
if (target.canChoose(source.getControllerId(), game)
|
||||||
&& controller.chooseUse(outcome, "Cipher this spell to a creature?", source, game)) {
|
&& controller.chooseUse(outcome, "Cipher this spell to a creature?", source, game)) {
|
||||||
controller.chooseTarget(outcome, target, source, game);
|
controller.chooseTarget(outcome, target, source, game);
|
||||||
Card sourceCard = game.getCard(source.getSourceId());
|
Card sourceCard = game.getCard(source.getSourceId());
|
||||||
Permanent targetCreature = game.getPermanent(target.getFirstTarget());
|
Permanent targetCreature = game.getPermanent(target.getFirstTarget());
|
||||||
|
@ -99,9 +101,10 @@ public class CipherEffect extends OneShotEffect {
|
||||||
ContinuousEffect effect = new GainAbilityTargetEffect(ability, Duration.Custom);
|
ContinuousEffect effect = new GainAbilityTargetEffect(ability, Duration.Custom);
|
||||||
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
effect.setTargetPointer(new FixedTarget(target.getFirstTarget()));
|
||||||
game.addEffect(effect, source);
|
game.addEffect(effect, source);
|
||||||
if (!game.isSimulation())
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(new StringBuilder(sourceCard.getLogName()).append(": Spell ciphered to ").append(targetCreature.getLogName()).toString());
|
game.informPlayers(new StringBuilder(sourceCard.getLogName()).append(": Spell ciphered to ").append(targetCreature.getLogName()).toString());
|
||||||
return sourceCard.moveToExile(null, "", source.getSourceId(), game);
|
}
|
||||||
|
return controller.moveCards(sourceCard, null, Zone.EXILED, source, game);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -119,7 +122,7 @@ public class CipherEffect extends OneShotEffect {
|
||||||
|
|
||||||
class CipherStoreEffect extends OneShotEffect {
|
class CipherStoreEffect extends OneShotEffect {
|
||||||
|
|
||||||
private UUID cipherCardId;
|
private final UUID cipherCardId;
|
||||||
|
|
||||||
public CipherStoreEffect(UUID cipherCardId, String ruleText) {
|
public CipherStoreEffect(UUID cipherCardId, String ruleText) {
|
||||||
super(Outcome.Copy);
|
super(Outcome.Copy);
|
||||||
|
@ -141,13 +144,13 @@ class CipherStoreEffect extends OneShotEffect {
|
||||||
SpellAbility ability = copyCard.getSpellAbility();
|
SpellAbility ability = copyCard.getSpellAbility();
|
||||||
// remove the cipher effect from the copy
|
// remove the cipher effect from the copy
|
||||||
Effect cipherEffect = null;
|
Effect cipherEffect = null;
|
||||||
for (Effect effect :ability.getEffects()) {
|
for (Effect effect : ability.getEffects()) {
|
||||||
if (effect instanceof CipherEffect) {
|
if (effect instanceof CipherEffect) {
|
||||||
cipherEffect = effect;
|
cipherEffect = effect;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ability.getEffects().remove(cipherEffect);
|
ability.getEffects().remove(cipherEffect);
|
||||||
if (ability != null && ability instanceof SpellAbility) {
|
if (ability instanceof SpellAbility) {
|
||||||
controller.cast(ability, game, true);
|
controller.cast(ability, game, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
package mage.abilities.effects.common.continuous;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Layer;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.SubLayer;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class LoseAbilityAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
|
protected final FilterPermanent filter;
|
||||||
|
protected final Ability ability;
|
||||||
|
|
||||||
|
public LoseAbilityAllEffect(FilterPermanent filter, Ability ability, Duration duration) {
|
||||||
|
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||||
|
this.filter = filter;
|
||||||
|
this.ability = ability;
|
||||||
|
staticText = filter.getMessage() + " lose " + ability.toString() + (duration.toString().isEmpty() ? "" : " " + duration.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoseAbilityAllEffect(final LoseAbilityAllEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
this.filter = effect.filter.copy();
|
||||||
|
this.ability = effect.ability;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoseAbilityAllEffect copy() {
|
||||||
|
return new LoseAbilityAllEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
|
if (permanent != null) {
|
||||||
|
while (permanent.getAbilities().contains(ability)) {
|
||||||
|
permanent.getAbilities().remove(ability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,52 +1,50 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without modification, are
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
* permitted provided that the following conditions are met:
|
* permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
* conditions and the following disclaimer.
|
* conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
* 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
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
* provided with the distribution.
|
* provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
* 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
|
* 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
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
* 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
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
* The views and conclusions contained in the software and documentation are those of the
|
* 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
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
* or implied, of BetaSteward_at_googlemail.com.
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package mage.abilities.effects.common.continuous;
|
package mage.abilities.effects.common.continuous;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.Mode;
|
||||||
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Layer;
|
import mage.constants.Layer;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.SubLayer;
|
import mage.constants.SubLayer;
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.Mode;
|
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
|
||||||
import mage.filter.FilterPermanent;
|
import mage.filter.FilterPermanent;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class LoseAllAbilitiesAllEffect extends ContinuousEffectImpl {
|
public class LoseAllAbilitiesAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
private FilterPermanent filter;
|
private final FilterPermanent filter;
|
||||||
|
|
||||||
public LoseAllAbilitiesAllEffect(FilterPermanent filter, Duration duration) {
|
public LoseAllAbilitiesAllEffect(FilterPermanent filter, Duration duration) {
|
||||||
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||||
|
@ -65,7 +63,7 @@ public class LoseAllAbilitiesAllEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (Permanent permanent: game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
if (permanent != null) {
|
if (permanent != null) {
|
||||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,12 +51,12 @@ public class MockSplitCard extends SplitCard {
|
||||||
|
|
||||||
CardInfo leftHalf = CardRepository.instance.findCard(getLeftHalfName(card));
|
CardInfo leftHalf = CardRepository.instance.findCard(getLeftHalfName(card));
|
||||||
if (leftHalf != null) {
|
if (leftHalf != null) {
|
||||||
this.leftHalfCard = new MockCard(leftHalf);
|
this.leftHalfCard = new MockSplitCardHalf(leftHalf);
|
||||||
}
|
}
|
||||||
|
|
||||||
CardInfo rightHalf = CardRepository.instance.findCard(getRightHalfName(card));
|
CardInfo rightHalf = CardRepository.instance.findCard(getRightHalfName(card));
|
||||||
if (rightHalf != null) {
|
if (rightHalf != null) {
|
||||||
this.rightHalfCard = new MockCard(rightHalf);
|
this.rightHalfCard = new MockSplitCardHalf(rightHalf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
58
Mage/src/mage/cards/mock/MockSplitCardHalf.java
Normal file
58
Mage/src/mage/cards/mock/MockSplitCardHalf.java
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without modification, are
|
||||||
|
* permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||||
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||||
|
* provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||||
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
|
||||||
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* The views and conclusions contained in the software and documentation are those of the
|
||||||
|
* authors and should not be interpreted as representing official policies, either expressed
|
||||||
|
* or implied, of BetaSteward_at_googlemail.com.
|
||||||
|
*/
|
||||||
|
package mage.cards.mock;
|
||||||
|
|
||||||
|
import mage.cards.SplitCard;
|
||||||
|
import mage.cards.SplitCardHalf;
|
||||||
|
import mage.cards.repository.CardInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class MockSplitCardHalf extends MockCard implements SplitCardHalf {
|
||||||
|
|
||||||
|
public MockSplitCardHalf(CardInfo card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MockSplitCardHalf(final MockSplitCardHalf card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MockSplitCardHalf copy() {
|
||||||
|
return new MockSplitCardHalf(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setParentCard(SplitCard card) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -72,17 +72,16 @@ public class FilterCard extends FilterObject<Card> {
|
||||||
* comparison returns a “yes” answer. The individual comparisons may involve
|
* comparison returns a “yes” answer. The individual comparisons may involve
|
||||||
* different halves of the same split card.
|
* different halves of the same split card.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean match(Card card, Game game) {
|
public boolean match(Card card, Game game) {
|
||||||
if(card.isSplitCard()){
|
if (card.isSplitCard()) {
|
||||||
return super.match(((SplitCard)card).getLeftHalfCard(), game) ||
|
return super.match(((SplitCard) card).getLeftHalfCard(), game)
|
||||||
super.match(((SplitCard)card).getRightHalfCard(), game);
|
|| super.match(((SplitCard) card).getRightHalfCard(), game);
|
||||||
}
|
} else {
|
||||||
else{
|
return super.match(card, game);
|
||||||
return super.match(card, game);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean match(Card card, UUID playerId, Game game) {
|
public boolean match(Card card, UUID playerId, Game game) {
|
||||||
if (!this.match(card, game)) {
|
if (!this.match(card, game)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -61,24 +61,24 @@ public class CopyTokenFunction implements Function<Token, Card> {
|
||||||
if (source instanceof PermanentToken) {
|
if (source instanceof PermanentToken) {
|
||||||
sourceObj = ((PermanentToken) source).getToken();
|
sourceObj = ((PermanentToken) source).getToken();
|
||||||
// to show the source image, the original values have to be used
|
// to show the source image, the original values have to be used
|
||||||
target.setOriginalExpansionSetCode(((Token)sourceObj).getOriginalExpansionSetCode());
|
target.setOriginalExpansionSetCode(((Token) sourceObj).getOriginalExpansionSetCode());
|
||||||
target.setOriginalCardNumber(((Token)sourceObj).getOriginalCardNumber());
|
target.setOriginalCardNumber(((Token) sourceObj).getOriginalCardNumber());
|
||||||
target.setCopySourceCard(((PermanentToken)source).getToken().getCopySourceCard());
|
target.setCopySourceCard(((PermanentToken) source).getToken().getCopySourceCard());
|
||||||
} else if (source instanceof PermanentCard) {
|
} else if (source instanceof PermanentCard) {
|
||||||
if (((PermanentCard)source).isMorphed() || ((PermanentCard)source).isManifested()) {
|
if (((PermanentCard) source).isMorphed() || ((PermanentCard) source).isManifested()) {
|
||||||
MorphAbility.setPermanentToFaceDownCreature(target);
|
MorphAbility.setPermanentToFaceDownCreature(target);
|
||||||
return target;
|
return target;
|
||||||
} else {
|
} else {
|
||||||
sourceObj = ((PermanentCard) source).getCard();
|
sourceObj = ((PermanentCard) source).getCard();
|
||||||
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
|
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
|
||||||
target.setOriginalCardNumber(source.getCardNumber());
|
target.setOriginalCardNumber(source.getCardNumber());
|
||||||
target.setCopySourceCard((Card)sourceObj);
|
target.setCopySourceCard((Card) sourceObj);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
|
target.setOriginalExpansionSetCode(source.getExpansionSetCode());
|
||||||
target.setOriginalCardNumber(source.getCardNumber());
|
target.setOriginalCardNumber(source.getCardNumber());
|
||||||
if (source instanceof Card) {
|
if (source instanceof Card) {
|
||||||
target.setCopySourceCard((Card)source);
|
target.setCopySourceCard((Card) source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue