* Amoeboid Changeling, Wings of Veles-Vel - Fixed that the character types were changed on the wrong layer.

This commit is contained in:
LevelX2 2015-12-08 15:24:24 +01:00
parent 4d01eb143a
commit 0488da6b22
6 changed files with 73 additions and 21 deletions

View file

@ -28,7 +28,6 @@
package mage.sets.lorwyn;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -39,7 +38,9 @@ import mage.abilities.keyword.ChangelingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.constants.Zone;
import mage.target.common.TargetCreaturePermanent;
@ -58,17 +59,18 @@ public class AmoeboidChangeling extends CardImpl {
// Changeling
this.addAbility(ChangelingAbility.getInstance());
// {tap}: Target creature gains all creature types until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilityTargetEffect(ChangelingAbility.getInstance(), Duration.EndOfTurn), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new GainAbilityTargetEffect(ChangelingAbility.getInstance(), Duration.EndOfTurn, null, false, Layer.TypeChangingEffects_4, SubLayer.NA), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
// {tap}: Target creature loses all creature types until end of turn.
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new LoseAllCreatureTypesTargetEffect(Duration.EndOfTurn), new TapSourceCost());
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);
}

View file

@ -36,7 +36,9 @@ import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Rarity;
import mage.constants.SubLayer;
import mage.target.common.TargetCreaturePermanent;
/**
@ -52,20 +54,20 @@ public class WingsOfVelisVel extends CardImpl {
// Changeling
this.addAbility(ChangelingAbility.getInstance());
// Target creature becomes 4/4, gains all creature types, and gains flying until end of turn.
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
Effect effect = new SetPowerToughnessTargetEffect(4, 4, Duration.EndOfTurn);
effect.setText("Target creature becomes 4/4");
this.getSpellAbility().addEffect(effect);
effect = new GainAbilityTargetEffect(ChangelingAbility.getInstance(), Duration.EndOfTurn);
this.getSpellAbility().addEffect(effect);
effect = new GainAbilityTargetEffect(ChangelingAbility.getInstance(), Duration.EndOfTurn, null, false, Layer.TypeChangingEffects_4, SubLayer.NA);
effect.setText(", gains all creature types");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addEffect(effect);
effect = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn);
effect.setText(", and gains flying until end of turn");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addEffect(effect);
}
public WingsOfVelisVel(final WingsOfVelisVel card) {

View file

@ -61,7 +61,9 @@ public class HibernationSliver extends CardImpl {
Effect effect = new ReturnToHandSourceEffect(true);
effect.setText("Return this permanent to its owner's hand");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new PayLifeCost(2));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, new FilterPermanent("Sliver", "All Slivers"), "All Slivers have \"Pay 2 life: Return this permanent to its owner's hand")));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield,
new FilterPermanent("Sliver", "All Slivers"), "All Slivers have \"Pay 2 life: Return this permanent to its owner's hand")));
}
public HibernationSliver(final HibernationSliver card) {

View file

@ -27,8 +27,11 @@
*/
package org.mage.test.cards.abilities.keywords;
import mage.abilities.Ability;
import mage.constants.PhaseStep;
import mage.constants.Zone;
import mage.game.permanent.Permanent;
import org.junit.Assert;
import org.junit.Test;
import org.mage.test.serverside.base.CardTestPlayerBase;
@ -36,18 +39,17 @@ import org.mage.test.serverside.base.CardTestPlayerBase;
*
* @author LevelX2
*/
public class ChangelingTest extends CardTestPlayerBase {
/**
* Casting changelings with a Long-Forgotten Gohei in play reduces its casting cost by {1}.
* Casting changelings with a Long-Forgotten Gohei in play reduces its
* casting cost by {1}.
*/
@Test
public void testLongForgottenGohei() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 1);
addCard(Zone.HAND, playerA, "Woodland Changeling");
addCard(Zone.BATTLEFIELD, playerA, "Long-Forgotten Gohei");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Woodland Changeling");
@ -58,6 +60,46 @@ public class ChangelingTest extends CardTestPlayerBase {
assertPermanentCount(playerA, "Woodland Changeling", 0); // Casting cost of spell is not reduced so not on the battlefield
assertHandCount(playerA, "Woodland Changeling", 1);
}
}
}
/**
* Another bug, was playing Slivers again. I had a Amoeboid Changeling, a
* Hibernation Sliver and a Prophet of Kruphix. In response to a boardwipe,
* I tapped my Changeling, giving my Prophet Changeling. However, it didn't
* gain any Sliver abilities despite having all creature types, including
* Sliver, so I couldn't save it with my Hibernation Sliver. I clicked the
* Prophet and nothing happened at all.
*/
@Test
public void testGainingChangeling() {
addCard(Zone.BATTLEFIELD, playerA, "Forest", 2);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
// Untap all creatures and lands you control during each other player's untap step.
// You may cast creature cards as though they had flash.
addCard(Zone.HAND, playerA, "Prophet of Kruphix");// {3}{G}{U}
// Changeling
// {T}: Target creature gains all creature types until end of turn.
// {T}: Target creature loses all creature types until end of turn.
addCard(Zone.BATTLEFIELD, playerA, "Amoeboid Changeling");
// All Slivers have "Pay 2 life: Return this permanent to its owner's hand."
addCard(Zone.BATTLEFIELD, playerA, "Hibernation Sliver");
castSpell(1, PhaseStep.PRECOMBAT_MAIN, playerA, "Prophet of Kruphix");
activateAbility(1, PhaseStep.POSTCOMBAT_MAIN, playerA, "{T}: Target creature gains", "Prophet of Kruphix");
setStopAt(1, PhaseStep.END_TURN);
execute();
assertTapped("Amoeboid Changeling", true);
Permanent prophet = getPermanent("Prophet of Kruphix", playerA);
boolean abilityFound = false;
for (Ability ability : prophet.getAbilities()) {
if (ability.getRule().startsWith("Pay 2 life")) {
abilityFound = true;
}
}
Assert.assertTrue("Prophet of Kruphix has to have the 'Pay 2 life: Return this permanent to its owner's hand.' ability, but has not.", abilityFound);
}
}

View file

@ -66,7 +66,11 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
}
public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean onCard) {
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA,
this(ability, duration, rule, onCard, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA);
}
public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean onCard, Layer layer, SubLayer subLayer) {
super(duration, layer, subLayer,
ability.getEffects().size() > 0 ? ability.getEffects().get(0).getOutcome() : Outcome.AddAbility);
this.ability = ability;
staticText = rule;

View file

@ -70,7 +70,7 @@ public class UntapAllDuringEachOtherPlayersUntapStepEffect extends ContinuousEff
applied = Boolean.FALSE;
}
if (!applied && layer.equals(Layer.RulesEffects)) {
if (!game.getActivePlayerId().equals(source.getControllerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
if (!source.getControllerId().equals(game.getActivePlayerId()) && game.getStep().getType() == PhaseStep.UNTAP) {
game.getState().setValue(source.getSourceId() + "applied", true);
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
boolean untap = true;