mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
* 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:
parent
6a23a0f707
commit
519eae42fc
24 changed files with 225 additions and 177 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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
|
||||
|
@ -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));
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -47,9 +47,12 @@ public class SilverskinArmor extends CardImpl {
|
|||
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) {
|
||||
|
|
|
@ -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));
|
||||
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
@ -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,17 +120,17 @@ 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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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";
|
||||
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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, ""));
|
||||
|
|
|
@ -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,9 +125,14 @@ class XenicPoltergeistEffect extends ContinuousEffectImpl {
|
|||
UUID permanentId = targetPointer.getFirst(game, source);
|
||||
Permanent permanent = game.getPermanentOrLKIBattlefield(permanentId);
|
||||
if (permanent != null) {
|
||||
if (!permanent.isArtifact()) {
|
||||
permanent.addCardType(CardType.ARTIFACT);
|
||||
}
|
||||
if (!permanent.isCreature()) {
|
||||
permanent.addCardType(CardType.CREATURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PTChangingEffects_7:
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
@ -38,8 +37,9 @@ import mage.game.permanent.Permanent;
|
|||
* @author nantuko
|
||||
*/
|
||||
public class AddCardTypeAttachedEffect extends ContinuousEffectImpl {
|
||||
private CardType addedCardType;
|
||||
private AttachmentType attachmentType;
|
||||
|
||||
private final CardType addedCardType;
|
||||
private final AttachmentType attachmentType;
|
||||
|
||||
public AddCardTypeAttachedEffect(CardType addedCardType, Duration duration, AttachmentType attachmentType) {
|
||||
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
|
@ -59,9 +59,10 @@ public class AddCardTypeAttachedEffect extends ContinuousEffectImpl {
|
|||
Permanent equipment = game.getPermanent(source.getSourceId());
|
||||
if (equipment != null && equipment.getAttachedTo() != null) {
|
||||
Permanent target = game.getPermanent(equipment.getAttachedTo());
|
||||
if (target != null && !target.getCardType().contains(addedCardType))
|
||||
if (target != null && !target.getCardType().contains(addedCardType)) {
|
||||
target.addCardType(addedCardType);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
|
@ -40,19 +41,23 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class AddCardTypeSourceEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final CardType addedCardType;
|
||||
private final ArrayList<CardType> addedCardTypes = new ArrayList<>();
|
||||
|
||||
public AddCardTypeSourceEffect(CardType addedCardType, Duration duration) {
|
||||
public AddCardTypeSourceEffect(Duration duration, CardType... addedCardType) {
|
||||
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.addedCardType = addedCardType;
|
||||
if (addedCardType == CardType.ENCHANTMENT) {
|
||||
for (CardType cardType : addedCardType) {
|
||||
this.addedCardTypes.add(cardType);
|
||||
if (cardType == CardType.ENCHANTMENT) {
|
||||
dependencyTypes.add(DependencyType.EnchantmentAddingRemoving);
|
||||
} else if (cardType == CardType.ARTIFACT) {
|
||||
dependencyTypes.add(DependencyType.ArtifactAddingRemoving);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public AddCardTypeSourceEffect(final AddCardTypeSourceEffect effect) {
|
||||
super(effect);
|
||||
this.addedCardType = effect.addedCardType;
|
||||
this.addedCardTypes.addAll(effect.addedCardTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +70,11 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl {
|
|||
public boolean apply(Game game, Ability source) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null && affectedObjectList.contains(new MageObjectReference(permanent, game))) {
|
||||
permanent.addCardType(addedCardType);
|
||||
for (CardType cardType : addedCardTypes) {
|
||||
if (!permanent.getCardType().contains(cardType)) {
|
||||
permanent.addCardType(cardType);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else if (this.getDuration() == Duration.Custom) {
|
||||
this.discard();
|
||||
|
@ -84,7 +93,20 @@ public class AddCardTypeSourceEffect extends ContinuousEffectImpl {
|
|||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("{this} becomes ").append(addedCardType.toString()).append(" in addition to its other types " + this.getDuration().toString());
|
||||
sb.append("{this} becomes ");
|
||||
boolean article = false;
|
||||
for (CardType cardType : addedCardTypes) {
|
||||
if (!article) {
|
||||
if (cardType.toString().startsWith("A") || cardType.toString().startsWith("E")) {
|
||||
sb.append("an ");
|
||||
} else {
|
||||
sb.append("a ");
|
||||
}
|
||||
article = true;
|
||||
}
|
||||
sb.append(cardType.toString().toLowerCase()).append(" ");
|
||||
}
|
||||
sb.append(" in addition to its other types ").append(this.getDuration().toString());
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
|
@ -45,21 +46,24 @@ import mage.game.permanent.Permanent;
|
|||
*/
|
||||
public class AddCardTypeTargetEffect extends ContinuousEffectImpl {
|
||||
|
||||
private final CardType addedCardType;
|
||||
private final ArrayList<CardType> addedCardTypes = new ArrayList<>();
|
||||
|
||||
public AddCardTypeTargetEffect(CardType addedCardType, Duration duration) {
|
||||
public AddCardTypeTargetEffect(Duration duration, CardType... addedCardType) {
|
||||
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
this.addedCardType = addedCardType;
|
||||
if (addedCardType == CardType.ENCHANTMENT) {
|
||||
for (CardType cardType : addedCardType) {
|
||||
this.addedCardTypes.add(cardType);
|
||||
if (cardType == CardType.ENCHANTMENT) {
|
||||
dependencyTypes.add(DependencyType.EnchantmentAddingRemoving);
|
||||
} else if (addedCardType == CardType.ARTIFACT) {
|
||||
} else if (cardType == CardType.ARTIFACT) {
|
||||
dependencyTypes.add(DependencyType.ArtifactAddingRemoving);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public AddCardTypeTargetEffect(final AddCardTypeTargetEffect effect) {
|
||||
super(effect);
|
||||
this.addedCardType = effect.addedCardType;
|
||||
this.addedCardTypes.addAll(effect.addedCardTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,8 +72,10 @@ public class AddCardTypeTargetEffect extends ContinuousEffectImpl {
|
|||
for (UUID targetId : targetPointer.getTargets(game, source)) {
|
||||
Permanent target = game.getPermanent(targetId);
|
||||
if (target != null) {
|
||||
if (!target.getCardType().contains(addedCardType)) {
|
||||
target.addCardType(addedCardType);
|
||||
for (CardType cardType : addedCardTypes) {
|
||||
if (!target.getCardType().contains(cardType)) {
|
||||
target.addCardType(cardType);
|
||||
}
|
||||
}
|
||||
result = true;
|
||||
}
|
||||
|
@ -93,7 +99,23 @@ public class AddCardTypeTargetEffect extends ContinuousEffectImpl {
|
|||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Target ").append(mode.getTargets().get(0).getTargetName()).append(" becomes ").append(addedCardType.toString()).append(" in addition to its other types until end of turn");
|
||||
sb.append("Target ").append(mode.getTargets().get(0).getTargetName()).append(" becomes ");
|
||||
boolean article = false;
|
||||
for (CardType cardType : addedCardTypes) {
|
||||
if (!article) {
|
||||
if (cardType.toString().startsWith("A") || cardType.toString().startsWith("E")) {
|
||||
sb.append("an ");
|
||||
} else {
|
||||
sb.append("a ");
|
||||
}
|
||||
article = true;
|
||||
}
|
||||
sb.append(cardType.toString().toLowerCase()).append(" ");
|
||||
}
|
||||
sb.append("in addition to its other types");
|
||||
if (getDuration().equals(Duration.EndOfTurn)) {
|
||||
sb.append(" until end of turn");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,8 +54,8 @@ public class CrewAbility extends SimpleActivatedAbility {
|
|||
private final int value;
|
||||
|
||||
public CrewAbility(int value) {
|
||||
super(Zone.BATTLEFIELD, new AddCardTypeSourceEffect(CardType.ARTIFACT, Duration.EndOfTurn), new CrewCost(value));
|
||||
this.addEffect(new AddCardTypeSourceEffect(CardType.CREATURE, Duration.EndOfTurn));
|
||||
super(Zone.BATTLEFIELD, new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT), new CrewCost(value));
|
||||
this.addEffect(new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE));
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledArtifactPermanent;
|
||||
import static mage.filter.StaticFilters.FILTER_CONTROLLED_PERMANENT_ARTIFACT;
|
||||
import mage.game.command.Emblem;
|
||||
import mage.target.TargetPermanent;
|
||||
|
||||
|
@ -49,13 +49,13 @@ public class TezzeretTheSchemerEmblem extends Emblem {
|
|||
public TezzeretTheSchemerEmblem() {
|
||||
this.setName("Emblem Tezzeret");
|
||||
|
||||
Effect effect = new AddCardTypeTargetEffect(CardType.CREATURE, Duration.EndOfGame);
|
||||
Effect effect = new AddCardTypeTargetEffect(Duration.EndOfGame, CardType.ARTIFACT, CardType.CREATURE);
|
||||
effect.setText("target artifact you control becomes an artifact creature");
|
||||
Ability ability = new BeginningOfCombatTriggeredAbility(Zone.COMMAND, effect, TargetController.YOU, false, true);
|
||||
effect = new SetPowerToughnessTargetEffect(5, 5, Duration.EndOfGame);
|
||||
effect.setText("with base power and toughness 5/5");
|
||||
ability.addEffect(effect);
|
||||
ability.addTarget(new TargetPermanent(new FilterControlledArtifactPermanent()));
|
||||
ability.addTarget(new TargetPermanent(FILTER_CONTROLLED_PERMANENT_ARTIFACT));
|
||||
this.getAbilities().add(ability);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue