* Fixed some problems with abilities that let permanents become artifact creatures but only added creature card type instead of artifact and creature card type (fixes #4290).

This commit is contained in:
LevelX2 2017-12-31 11:31:58 +01:00
parent 6a23a0f707
commit 519eae42fc
24 changed files with 225 additions and 177 deletions

View file

@ -119,7 +119,7 @@ class ArbiterOfTheIdealEffect extends OneShotEffect {
Permanent permanent = game.getPermanent(card.getId());
if (permanent != null) {
permanent.addCounters(new Counter("Manifestation"), source, game);
ContinuousEffect effect = new AddCardTypeTargetEffect(CardType.ENCHANTMENT, Duration.Custom);
ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.Custom, CardType.ENCHANTMENT);
effect.setTargetPointer(new FixedTarget(permanent.getId()));
game.addEffect(effect, source);
}

View file

@ -46,7 +46,7 @@ public class ArgentMutation extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{U}");
this.getSpellAbility().addEffect(new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.EndOfTurn));
this.getSpellAbility().addEffect(new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT));
this.getSpellAbility().addTarget(new TargetPermanent());
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
}

View file

@ -65,7 +65,7 @@ public class AshnodsTransmogrant extends CardImpl {
// {T}, Sacrifice Ashnod's Transmogrant: Put a +1/+1 counter on target nonartifact creature. That creature becomes an artifact in addition to its other types.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.P1P1.createInstance()), new TapSourceCost());
ability.addCost(new SacrificeSourceCost());
Effect effect = new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.WhileOnBattlefield);
Effect effect = new AddCardTypeTargetEffect(Duration.WhileOnBattlefield, CardType.ARTIFACT);
effect.setText("That creature becomes an artifact in addition to its other types");
ability.addEffect(effect);
ability.addTarget(new TargetCreaturePermanent(filter));

View file

@ -27,10 +27,9 @@
*/
package mage.cards.f;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.AddCardTypeSourceEffect;
import mage.abilities.keyword.CrewAbility;
import mage.abilities.keyword.HasteAbility;
@ -41,8 +40,6 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import java.util.UUID;
/**
*
* @author emerald000
@ -50,7 +47,7 @@ import java.util.UUID;
public class FleetwheelCruiser extends CardImpl {
public FleetwheelCruiser(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{4}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}");
this.subtype.add(SubType.VEHICLE);
this.power = new MageInt(5);
this.toughness = new MageInt(3);
@ -62,13 +59,8 @@ public class FleetwheelCruiser extends CardImpl {
this.addAbility(HasteAbility.getInstance());
// When Fleetwheel Cruiser enters the battlefield, it becomes an artifact creature until the end of turn.
Effect effect = new AddCardTypeSourceEffect(CardType.ARTIFACT, Duration.EndOfTurn);
effect.setText("it becomes an artifact");
Ability ability = new EntersBattlefieldTriggeredAbility(effect);
effect = new AddCardTypeSourceEffect(CardType.CREATURE, Duration.EndOfTurn);
effect.setText(" creature until end of turn");
ability.addEffect(effect);
this.addAbility(ability);
this.addAbility(new EntersBattlefieldTriggeredAbility(
new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE)));
// Crew 2
this.addAbility(new CrewAbility(2));

View file

@ -27,6 +27,7 @@
*/
package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -48,8 +49,6 @@ import mage.game.permanent.Permanent;
import mage.target.Target;
import mage.target.common.TargetControlledPermanent;
import java.util.UUID;
/**
* @author JRHerlehy
*/
@ -74,7 +73,7 @@ public class HeartOfKiran extends CardImpl {
// You may remove a loyalty counter from a planeswalker you control rather than pay Heart of Kiran's crew cost.
Cost cost = new HeartOfKiranAlternateCrewCost(CounterType.LOYALTY, 1);
Effect effect = new AddCardTypeSourceEffect(CardType.CREATURE, Duration.EndOfTurn);
Effect effect = new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.CREATURE, CardType.CREATURE);
effect.setText("You may remove a loyalty counter from a planeswalker you control rather than pay {this}'s crew cost");
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, cost));
}
@ -91,8 +90,8 @@ public class HeartOfKiran extends CardImpl {
class HeartOfKiranAlternateCrewCost extends CostImpl {
private CounterType counterTypeToRemove;
private int countersToRemove;
private final CounterType counterTypeToRemove;
private final int countersToRemove;
private static final FilterControlledPlaneswalkerPermanent filter = new FilterControlledPlaneswalkerPermanent("planeswalker you control");

View file

@ -99,6 +99,9 @@ class KarnsTouchEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (!artifact.isArtifact()) {
artifact.addCardType(CardType.ARTIFACT);
}
if (!artifact.isCreature()) {
artifact.addCardType(CardType.CREATURE);
}

View file

@ -50,7 +50,7 @@ public class LiquimetalCoating extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
// {T}: Target permanent becomes an artifact in addition to its other types until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.EndOfTurn), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT), new TapSourceCost());
ability.addTarget(new TargetPermanent());
this.addAbility(ability);
}

View file

@ -60,7 +60,7 @@ public class Memnarch extends CardImpl {
this.toughness = new MageInt(5);
// {1}{U}{U}: Target permanent becomes an artifact in addition to its other types.
Effect effect = new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.WhileOnBattlefield);
Effect effect = new AddCardTypeTargetEffect(Duration.WhileOnBattlefield, CardType.ARTIFACT);
effect.setText("Target permanent becomes an artifact in addition to its other types");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{U}{U}"));
ability.addTarget(new TargetPermanent());

View file

@ -103,7 +103,7 @@ class MirrorOfTheForebearsCopyEffect extends OneShotEffect {
if (sourcePermanent != null && copyFromPermanent != null) {
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyApplyToPermanent());
if (!copyFromPermanent.isArtifact()) {
ContinuousEffect effect = new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.EndOfTurn);
ContinuousEffect effect = new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT);
effect.setTargetPointer(new FixedTarget(sourcePermanent, game));
game.addEffect(effect, source);
}

View file

@ -55,7 +55,7 @@ public class MyrLandshaper extends CardImpl {
this.toughness = new MageInt(1);
// {tap}: Target land becomes an artifact in addition to its other types until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.EndOfTurn), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT), new TapSourceCost());
Target target = new TargetLandPermanent();
ability.addTarget(target);
this.addAbility(ability);

View file

@ -67,7 +67,7 @@ public class PeacewalkerColossus extends CardImpl {
this.toughness = new MageInt(6);
// {1}{W}: Another target Vehicle you control becomes an artifact creature until end of turn.
Effect effect = new AddCardTypeTargetEffect(CardType.CREATURE, Duration.EndOfTurn);
Effect effect = new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.CREATURE);
effect.setText("Another target Vehicle you control becomes an artifact creature until end of turn");
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{1}{W}"));
ability.addTarget(new TargetControlledPermanent(filter));

View file

@ -44,12 +44,15 @@ import mage.constants.*;
public class SilverskinArmor extends CardImpl {
public SilverskinArmor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
this.subtype.add(SubType.EQUIPMENT);
this.addAbility(new EquipAbility(Outcome.BoostCreature, new ManaCostsImpl("{2}")));
// Equipped creature gets +1/+1 and is an artifact in addition to its other types.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AddCardTypeAttachedEffect(CardType.ARTIFACT, Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT)));
// Equip {2}
this.addAbility(new EquipAbility(Outcome.BoostCreature, new ManaCostsImpl("{2}")));
}
public SilverskinArmor(final SilverskinArmor card) {

View file

@ -56,6 +56,7 @@ public class SydriGalvanicGenius extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("artifact creature");
private static final FilterArtifactPermanent filterNonCreature = new FilterArtifactPermanent("noncreature artifact");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
filter.add(new CardTypePredicate(CardType.CREATURE));
@ -63,7 +64,7 @@ public class SydriGalvanicGenius extends CardImpl {
}
public SydriGalvanicGenius(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{W}{U}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{W}{U}{B}");
addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.ARTIFICER);
@ -119,6 +120,9 @@ class SydriGalvanicGeniusEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (!artifact.isArtifact()) {
artifact.addCardType(CardType.ARTIFACT);
}
if (!artifact.isCreature()) {
artifact.addCardType(CardType.CREATURE);
}
@ -140,7 +144,6 @@ class SydriGalvanicGeniusEffect extends ContinuousEffectImpl {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.PTChangingEffects_7 || layer == Layer.TypeChangingEffects_4;

View file

@ -31,7 +31,6 @@ import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlanswalkerEntersWithLoyalityCountersAbility;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
@ -41,12 +40,12 @@ import mage.abilities.effects.common.continuous.SetPowerToughnessTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterCard;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game;
import mage.players.Player;
@ -66,7 +65,7 @@ public class TezzeretAgentOfBolas extends CardImpl {
}
public TezzeretAgentOfBolas(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.PLANESWALKER},"{2}{U}{B}");
super(ownerId, setInfo, new CardType[]{CardType.PLANESWALKER}, "{2}{U}{B}");
this.addSuperType(SuperType.LEGENDARY);
this.subtype.add(SubType.TEZZERET);
@ -76,7 +75,7 @@ public class TezzeretAgentOfBolas extends CardImpl {
this.addAbility(new LoyaltyAbility(new LookLibraryAndPickControllerEffect(5, 1, filter, true), 1));
// -1: Target artifact becomes an artifact creature with base power and toughness 5/5.
Effect effect = new AddCardTypeTargetEffect(CardType.CREATURE, Duration.EndOfGame);
Effect effect = new AddCardTypeTargetEffect(Duration.EndOfGame, CardType.ARTIFACT, CardType.CREATURE);
effect.setText("Target artifact becomes an artifact creature");
LoyaltyAbility ability1 = new LoyaltyAbility(effect, -1);
effect = new SetPowerToughnessTargetEffect(5, 5, Duration.EndOfGame);
@ -105,12 +104,6 @@ public class TezzeretAgentOfBolas extends CardImpl {
class TezzeretAgentOfBolasEffect2 extends OneShotEffect {
final static FilterControlledPermanent filter = new FilterControlledPermanent("artifacts");
static {
filter.add(new CardTypePredicate(CardType.ARTIFACT));
}
public TezzeretAgentOfBolasEffect2() {
super(Outcome.DrawCard);
staticText = "Target player loses X life and you gain X life, where X is twice the number of artifacts you control";
@ -127,16 +120,16 @@ class TezzeretAgentOfBolasEffect2 extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
DynamicValue value = new PermanentsOnBattlefieldCount(filter);
int count = value.calculate(game, source, this) * 2;
Player player = game.getPlayer(source.getFirstTarget());
if (player != null) {
player.loseLife(count, game, false);
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.gainLife(count, game);
int count = new PermanentsOnBattlefieldCount(StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT).calculate(game, source, this) * 2;
if (count > 0) {
Player targetPlayer = game.getPlayer(getTargetPointer().getFirst(game, source));
if (targetPlayer != null) {
targetPlayer.loseLife(count, game, false);
}
Player controller = game.getPlayer(source.getControllerId());
if (controller != null) {
controller.gainLife(count, game);
}
}
return true;
}

View file

@ -65,7 +65,7 @@ public class ThranForge extends CardImpl {
.setText("Until end of turn, target nonartifact creature gets +1/+0"),
new GenericManaCost(2));
ability.addEffect(
new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.EndOfTurn)
new AddCardTypeTargetEffect(Duration.EndOfTurn, CardType.ARTIFACT)
.setText("and becomes an artifact in addition to its other types")
);
ability.addTarget(new TargetPermanent(filter));

View file

@ -55,11 +55,11 @@ import mage.game.permanent.Permanent;
public class TitaniasSong extends CardImpl {
public TitaniasSong(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{G}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}");
// Each noncreature artifact loses all abilities and becomes an artifact creature with power and toughness each equal to its converted mana cost. If Titania's Song leaves the battlefield, this effect continues until end of turn.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new TitaniasSongEffect(Duration.WhileOnBattlefield)));
this.addAbility(new LeavesBattlefieldTriggeredAbility(new TitaniasSongEffect(Duration.EndOfTurn), false));
this.addAbility(new LeavesBattlefieldTriggeredAbility(new TitaniasSongEffect(Duration.EndOfTurn), false));
}
public TitaniasSong(final TitaniasSong card) {
@ -71,12 +71,15 @@ public class TitaniasSong extends CardImpl {
return new TitaniasSong(this);
}
}
class TitaniasSongEffect extends ContinuousEffectImpl {
private static final FilterArtifactPermanent filter = new FilterArtifactPermanent();
static {
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
}
public TitaniasSongEffect(Duration duration) {
super(duration, Outcome.BecomeCreature);
staticText = "Each noncreature artifact loses its abilities and is an artifact creature with power and toughness each equal to its converted mana cost";
@ -97,8 +100,8 @@ class TitaniasSongEffect extends ContinuousEffectImpl {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
affectedObjectList.clear();
for(Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)){
if(permanent != null){
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, game)) {
if (permanent != null) {
affectedObjectList.add(new MageObjectReference(permanent, game));
permanent.addCardType(CardType.CREATURE);
}
@ -106,18 +109,18 @@ class TitaniasSongEffect extends ContinuousEffectImpl {
}
break;
case AbilityAddingRemovingEffects_6:
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null){
permanent.removeAllAbilities(source.getSourceId(), game);
}
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null) {
permanent.removeAllAbilities(source.getSourceId(), game);
}
break;
}
break;
case PTChangingEffects_7:
if (sublayer == SubLayer.SetPT_7b) {
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
Permanent permanent = it.next().getPermanent(game);
if (permanent != null){
if (permanent != null) {
int manaCost = permanent.getConvertedManaCost();
permanent.getPower().setValue(manaCost);
permanent.getToughness().setValue(manaCost);
@ -133,7 +136,6 @@ class TitaniasSongEffect extends ContinuousEffectImpl {
return false;
}
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.PTChangingEffects_7 || layer == Layer.AbilityAddingRemovingEffects_6 || layer == Layer.TypeChangingEffects_4;

View file

@ -35,7 +35,6 @@ import mage.abilities.costs.common.DiscardCardCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.SubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -43,6 +42,7 @@ import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.Predicates;
@ -113,6 +113,9 @@ class ToymakerEffect extends ContinuousEffectImpl {
switch (layer) {
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (!artifact.isArtifact()) {
artifact.addCardType(CardType.ARTIFACT);
}
if (!artifact.isCreature()) {
artifact.addCardType(CardType.CREATURE);
}

View file

@ -76,7 +76,7 @@ public class XathridGorgon extends CardImpl {
Effect effect = new GainAbilityTargetEffect(DefenderAbility.getInstance(), Duration.Custom);
effect.setText("It gains defender");
ability.addEffect(effect);
effect = new AddCardTypeTargetEffect(CardType.ARTIFACT, Duration.Custom);
effect = new AddCardTypeTargetEffect(Duration.Custom, CardType.ARTIFACT);
effect.setText("and becomes a colorless artifact in addition to its other types");
ability.addEffect(effect);
ability.addEffect(new BecomesColorTargetEffect(new ObjectColor(), Duration.Custom, ""));

View file

@ -36,12 +36,12 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.constants.SubLayer;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.common.FilterArtifactPermanent;
import mage.filter.predicate.Predicates;
@ -125,7 +125,12 @@ class XenicPoltergeistEffect extends ContinuousEffectImpl {
UUID permanentId = targetPointer.getFirst(game, source);
Permanent permanent = game.getPermanentOrLKIBattlefield(permanentId);
if (permanent != null) {
permanent.addCardType(CardType.CREATURE);
if (!permanent.isArtifact()) {
permanent.addCardType(CardType.ARTIFACT);
}
if (!permanent.isCreature()) {
permanent.addCardType(CardType.CREATURE);
}
}
}
break;