mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
Refactoring subtypes to make Maskwood Nexus work (ready for review) (#7432)
* removed and renamed SubTypeList * updated subtype test * refactored Changeling to be an ability that actually does something * moved isAllCreatureTypes into SubTypes class * renamed copyTo method to copyFrom * added removeAllCreatureTypes where usable * replaced some subtype methods * replaced some more subtype methods * replaced subtype mass add/remove methods * updated more subtype methods * fixed some errors * made common shared creature type predicate * refactored another card involving subtypes * Added usage of object attribute in subTypes's write operations; * Refactor: use same param styles in subtype methods * Refactor: simplified usage of copy appliers; * Refactor: fixed code usage in CopyApplier Co-authored-by: Oleg Agafonov <jaydi85@gmail.com>
This commit is contained in:
parent
6f42b90305
commit
dacf30f4b9
259 changed files with 1857 additions and 1922 deletions
|
@ -7,7 +7,7 @@ import mage.client.dialog.PreferencesDialog;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.MageObjectType;
|
||||
import mage.constants.SubType;
|
||||
import mage.util.SubTypeList;
|
||||
import mage.util.SubTypes;
|
||||
import mage.view.CardView;
|
||||
import mage.view.PermanentView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
@ -1466,7 +1466,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
|
||||
// Determine which background paint to use from a set of colors
|
||||
// and the current card.
|
||||
protected static Paint getBackgroundPaint(ObjectColor colors, Collection<CardType> types, SubTypeList subTypes) {
|
||||
protected static Paint getBackgroundPaint(ObjectColor colors, Collection<CardType> types, SubTypes subTypes) {
|
||||
if (subTypes.contains(SubType.VEHICLE)) {
|
||||
return BG_TEXTURE_VEHICLE;
|
||||
} else if (types.contains(CardType.LAND)) {
|
||||
|
@ -1493,7 +1493,7 @@ public class ModernCardRenderer extends CardRenderer {
|
|||
|
||||
// Determine which background image to use from a set of colors
|
||||
// and the current card.
|
||||
protected static BufferedImage getBackgroundImage(ObjectColor colors, Collection<CardType> types, SubTypeList subTypes, boolean isExped) {
|
||||
protected static BufferedImage getBackgroundImage(ObjectColor colors, Collection<CardType> types, SubTypes subTypes, boolean isExped) {
|
||||
if (subTypes.contains(SubType.VEHICLE)) {
|
||||
return BG_IMG_VEHICLE;
|
||||
} else if (types.contains(CardType.LAND)) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import java.util.EnumSet;
|
|||
import mage.ObjectColor;
|
||||
import mage.abilities.Ability;
|
||||
import mage.constants.SuperType;
|
||||
import mage.util.SubTypeList;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
/**
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
|
@ -28,7 +28,7 @@ public class AbilityView extends CardView {
|
|||
this.toughness = "";
|
||||
this.loyalty = "";
|
||||
this.cardTypes = new ArrayList<>();
|
||||
this.subTypes = new SubTypeList();
|
||||
this.subTypes = new SubTypes();
|
||||
this.superTypes = EnumSet.noneOf(SuperType.class);
|
||||
this.color = new ObjectColor();
|
||||
this.manaCostLeft = ability.getManaCosts().getSymbols();
|
||||
|
|
|
@ -29,7 +29,7 @@ import mage.game.stack.StackAbility;
|
|||
import mage.target.Target;
|
||||
import mage.target.Targets;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.SubTypeList;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -58,7 +58,7 @@ public class CardView extends SimpleCardView {
|
|||
protected String loyalty = "";
|
||||
protected String startingLoyalty;
|
||||
protected ArrayList<CardType> cardTypes;
|
||||
protected SubTypeList subTypes;
|
||||
protected SubTypes subTypes;
|
||||
protected Set<SuperType> superTypes;
|
||||
protected ObjectColor color;
|
||||
protected ObjectColor frameColor;
|
||||
|
@ -165,7 +165,7 @@ public class CardView extends SimpleCardView {
|
|||
this.loyalty = cardView.loyalty;
|
||||
this.startingLoyalty = cardView.startingLoyalty;
|
||||
this.cardTypes = new ArrayList<>(cardView.cardTypes);
|
||||
this.subTypes = new SubTypeList(cardView.subTypes);
|
||||
this.subTypes = new SubTypes(cardView.subTypes);
|
||||
this.superTypes = cardView.superTypes;
|
||||
|
||||
this.color = cardView.color;
|
||||
|
@ -552,9 +552,9 @@ public class CardView extends SimpleCardView {
|
|||
this.loyalty = "";
|
||||
}
|
||||
this.cardTypes = object.getCardType();
|
||||
this.subTypes = object.getSubtype(null);
|
||||
this.subTypes = object.getSubtype(game);
|
||||
this.superTypes = object.getSuperType();
|
||||
this.color = object.getColor(null);
|
||||
this.color = object.getColor(game);
|
||||
this.manaCostLeft = object.getManaCost().getSymbols();
|
||||
this.manaCostRight = new ArrayList<>();
|
||||
this.convertedManaCost = object.getManaCost().convertedManaCost();
|
||||
|
@ -596,7 +596,7 @@ public class CardView extends SimpleCardView {
|
|||
}
|
||||
}
|
||||
// Frame color
|
||||
this.frameColor = object.getFrameColor(null);
|
||||
this.frameColor = object.getFrameColor(game);
|
||||
// Frame style
|
||||
this.frameStyle = object.getFrameStyle();
|
||||
// Starting loyalty. Must be extracted from an ability
|
||||
|
@ -671,7 +671,7 @@ public class CardView extends SimpleCardView {
|
|||
this.loyalty = "";
|
||||
this.startingLoyalty = "";
|
||||
this.cardTypes = new ArrayList<>();
|
||||
this.subTypes = new SubTypeList();
|
||||
this.subTypes = new SubTypes();
|
||||
this.superTypes = EnumSet.noneOf(SuperType.class);
|
||||
this.color = new ObjectColor();
|
||||
this.frameColor = new ObjectColor();
|
||||
|
@ -707,7 +707,7 @@ public class CardView extends SimpleCardView {
|
|||
|
||||
}
|
||||
|
||||
CardView(Token token) {
|
||||
CardView(Token token, Game game) {
|
||||
super(token.getId(), "", "0", false, "", "");
|
||||
this.isToken = true;
|
||||
this.id = token.getId();
|
||||
|
@ -720,10 +720,10 @@ public class CardView extends SimpleCardView {
|
|||
this.loyalty = "";
|
||||
this.startingLoyalty = "";
|
||||
this.cardTypes = token.getCardType();
|
||||
this.subTypes = token.getSubtype(null);
|
||||
this.subTypes = token.getSubtype(game);
|
||||
this.superTypes = token.getSuperType();
|
||||
this.color = token.getColor(null);
|
||||
this.frameColor = token.getFrameColor(null);
|
||||
this.color = token.getColor(game);
|
||||
this.frameColor = token.getFrameColor(game);
|
||||
this.frameStyle = token.getFrameStyle();
|
||||
this.manaCostLeft = token.getManaCost().getSymbols();
|
||||
this.manaCostRight = new ArrayList<>();
|
||||
|
@ -816,7 +816,7 @@ public class CardView extends SimpleCardView {
|
|||
return cardTypes;
|
||||
}
|
||||
|
||||
public SubTypeList getSubTypes() {
|
||||
public SubTypes getSubTypes() {
|
||||
return subTypes;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import mage.cards.Card;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import mage.game.permanent.token.Token;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -51,7 +52,7 @@ public class PermanentView extends CardView {
|
|||
}
|
||||
this.attachedTo = permanent.getAttachedTo();
|
||||
if (isToken()) {
|
||||
original = new CardView(((PermanentToken) permanent).getToken());
|
||||
original = new CardView(((PermanentToken) permanent).getToken(), game);
|
||||
original.expansionSetCode = permanent.getExpansionSetCode();
|
||||
tokenSetCode = original.getTokenSetCode();
|
||||
tokenDescriptor = original.getTokenDescriptor();
|
||||
|
|
|
@ -56,7 +56,7 @@ public final class ArtificialScoringSystem {
|
|||
//score + =cardDefinition.getActivations().size()*50;
|
||||
//score += cardDefinition.getManaActivations().size()*80;
|
||||
} else {
|
||||
if (permanent.getSubtype(game).contains(SubType.EQUIPMENT)) {
|
||||
if (permanent.hasSubtype(SubType.EQUIPMENT, game)) {
|
||||
score += 100;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -74,7 +74,7 @@ class AbsorbIdentityEffect extends OneShotEffect {
|
|||
FilterCreaturePermanent filter = new FilterCreaturePermanent("shapeshifter");
|
||||
filter.add(SubType.SHAPESHIFTER.getPredicate());
|
||||
for (Permanent copyTo : game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) {
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), source, new EmptyCopyApplier());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
|
@ -18,8 +17,9 @@ import mage.game.permanent.Permanent;
|
|||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Eirkei
|
||||
*/
|
||||
public final class AlphaStatus extends CardImpl {
|
||||
|
@ -61,7 +61,7 @@ class AlphaStatusDynamicValue implements DynamicValue {
|
|||
if (enchanted != null) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) {
|
||||
if (!permanent.getId().equals(enchanted.getId())) {
|
||||
if (enchanted.shareCreatureTypes(permanent, game)) {
|
||||
if (enchanted.shareCreatureTypes(game, permanent)) {
|
||||
xValue += 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ class AlpineMoonEffect extends ContinuousEffectImpl {
|
|||
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
|
||||
// So the ability removing has to be done before Layer 6
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
land.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
|
||||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
land.addAbility(new AnyColorManaAbility(), source.getSourceId(), game);
|
||||
|
|
|
@ -28,8 +28,7 @@ public final class AmoeboidChangeling extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// {tap}: Target creature gains all creature types until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -21,6 +19,10 @@ import mage.game.stack.Spell;
|
|||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
|
@ -31,11 +33,12 @@ public final class ArcaneAdaptation extends CardImpl {
|
|||
|
||||
// As Arcane Adaptation enters the battlefield, choose a creature type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.Neutral)));
|
||||
|
||||
// Creatures you control are the chosen type in addition to their other types. The same is true for creature spells you control and creature cards you own that aren't on the battlefield.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new ConspyEffect()));
|
||||
this.addAbility(new SimpleStaticAbility(new ArcaneAdaptationEffect()));
|
||||
}
|
||||
|
||||
public ArcaneAdaptation(final ArcaneAdaptation card) {
|
||||
private ArcaneAdaptation(final ArcaneAdaptation card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -45,96 +48,94 @@ public final class ArcaneAdaptation extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class ConspyEffect extends ContinuousEffectImpl {
|
||||
class ArcaneAdaptationEffect extends ContinuousEffectImpl {
|
||||
|
||||
public ConspyEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
staticText = "Creatures you control are the chosen type in addition to their other types. The same is true for creature spells you control and creature cards you own that aren't on the battlefield";
|
||||
ArcaneAdaptationEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "Creatures you control are the chosen type in addition to their other types. " +
|
||||
"The same is true for creature spells you control and creature cards you own that aren't on the battlefield";
|
||||
}
|
||||
|
||||
public ConspyEffect(final ConspyEffect effect) {
|
||||
private ArcaneAdaptationEffect(final ArcaneAdaptationEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConspyEffect copy() {
|
||||
return new ConspyEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game);
|
||||
if (controller != null && subType != null) {
|
||||
// Creature cards you own that aren't on the battlefield
|
||||
// in graveyard
|
||||
for (UUID cardId : controller.getGraveyard()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// on Hand
|
||||
for (UUID cardId : controller.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// in Exile
|
||||
for (Card card : game.getState().getExile().getAllCards(game)) {
|
||||
if (card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// in Library (e.g. for Mystical Teachings)
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
if (card.isOwnedBy(controller.getId()) && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// commander in command zone
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
if (commandObject instanceof Commander) {
|
||||
Card card = game.getCard(((Commander) commandObject).getId());
|
||||
if (card != null && card.isOwnedBy(controller.getId())
|
||||
&& card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
}
|
||||
// creature spells you control
|
||||
for (Iterator<StackObject> iterator = game.getStack().iterator(); iterator.hasNext(); ) {
|
||||
StackObject stackObject = iterator.next();
|
||||
if (stackObject instanceof Spell
|
||||
&& stackObject.isControlledBy(source.getControllerId())
|
||||
&& stackObject.isCreature()
|
||||
&& !stackObject.hasSubtype(subType, game)) {
|
||||
Card card = ((Spell) stackObject).getCard();
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// creatures you control
|
||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(
|
||||
new FilterControlledCreaturePermanent(), source.getControllerId(), game);
|
||||
for (Permanent creature : creatures) {
|
||||
if (creature != null) {
|
||||
creature.addSubType(game, subType);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
public ArcaneAdaptationEffect copy() {
|
||||
return new ArcaneAdaptationEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game);
|
||||
if (controller == null || subType == null) {
|
||||
return false;
|
||||
}
|
||||
// Creature cards you own that aren't on the battlefield
|
||||
// in graveyard
|
||||
for (UUID cardId : controller.getGraveyard()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// on Hand
|
||||
for (UUID cardId : controller.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// in Exile
|
||||
for (Card card : game.getState().getExile().getAllCards(game)) {
|
||||
if (card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// in Library (e.g. for Mystical Teachings)
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
if (card.isOwnedBy(controller.getId()) && card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// commander in command zone
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
if (commandObject instanceof Commander) {
|
||||
Card card = game.getCard(((Commander) commandObject).getId());
|
||||
if (card != null && card.isOwnedBy(controller.getId())
|
||||
&& card.isCreature() && !card.hasSubtype(subType, game)) {
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
}
|
||||
// creature spells you control
|
||||
for (Iterator<StackObject> iterator = game.getStack().iterator(); iterator.hasNext(); ) {
|
||||
StackObject stackObject = iterator.next();
|
||||
if (stackObject instanceof Spell
|
||||
&& stackObject.isControlledBy(source.getControllerId())
|
||||
&& stackObject.isCreature()
|
||||
&& !stackObject.hasSubtype(subType, game)) {
|
||||
Card card = ((Spell) stackObject).getCard();
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().add(subType);
|
||||
}
|
||||
}
|
||||
// creatures you control
|
||||
List<Permanent> creatures = game.getBattlefield().getAllActivePermanents(
|
||||
new FilterControlledCreaturePermanent(), source.getControllerId(), game);
|
||||
for (Permanent creature : creatures) {
|
||||
if (creature != null) {
|
||||
creature.addSubType(game, subType);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.TypeChangingEffects_4;
|
||||
private void setCreatureSubtype(MageObject object, SubType subtype, Game game) {
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
game.getState().getCreateMageObjectAttribute(object, game).getSubtype().add(subtype);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ import mage.filter.StaticFilters;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -46,24 +46,18 @@ public final class ArtisanOfForms extends CardImpl {
|
|||
static Ability createAbility() {
|
||||
Ability ability = new HeroicAbility(new CopyPermanentEffect(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE,
|
||||
new ArtisanOfFormsApplyToPermanent(), true
|
||||
new ArtisanOfFormsCopyApplier(), true
|
||||
).setText("have {this} become a copy of target creature, except it has this ability"), true);
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
return ability;
|
||||
}
|
||||
}
|
||||
|
||||
class ArtisanOfFormsApplyToPermanent extends ApplyToPermanent {
|
||||
class ArtisanOfFormsCopyApplier extends CopyApplier {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
mageObject.getAbilities().add(ArtisanOfForms.createAbility());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
permanent.addAbility(ArtisanOfForms.createAbility(), source.getSourceId(), game);
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
blueprint.getAbilities().add(ArtisanOfForms.createAbility());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,11 +89,9 @@ class AshayaSoulOfTheWildEffect extends ContinuousEffectImpl {
|
|||
if (!permanent.isLand()) {
|
||||
permanent.addCardType(CardType.LAND);
|
||||
}
|
||||
if (!permanent.hasSubtype(SubType.FOREST, game)) {
|
||||
permanent.addSubType(game, SubType.FOREST);
|
||||
if (!permanent.getAbilities(game).containsClass(GreenManaAbility.class)) {
|
||||
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
permanent.addSubType(game, SubType.FOREST);
|
||||
if (!permanent.getAbilities(game).containsClass(GreenManaAbility.class)) {
|
||||
permanent.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -19,8 +19,8 @@ import mage.game.Game;
|
|||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
|
@ -44,10 +44,7 @@ public final class Aurification extends CardImpl {
|
|||
this.addAbility(new AddGoldCountersAbility());
|
||||
|
||||
// Each creature with a gold counter on it is a Wall in addition to its other creature types and has defender.
|
||||
SubTypeList subtypes = new SubTypeList();
|
||||
subtypes.add(SubType.WALL);
|
||||
|
||||
BecomesSubtypeAllEffect becomesSubtypeAllEffect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subtypes, filter, false);
|
||||
BecomesSubtypeAllEffect becomesSubtypeAllEffect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, Arrays.asList(SubType.WALL), filter, false);
|
||||
becomesSubtypeAllEffect.setText("");
|
||||
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, becomesSubtypeAllEffect));
|
||||
|
|
|
@ -22,8 +22,7 @@ public final class AvianChangeling extends CardImpl {
|
|||
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ class BakisCurseEffect extends OneShotEffect {
|
|||
List<UUID> attachments = creature.getAttachments();
|
||||
for (UUID attachmentId : attachments) {
|
||||
Permanent attached = game.getPermanent(attachmentId);
|
||||
if (attached != null && attached.getSubtype(game).contains(SubType.AURA)) {
|
||||
if (attached != null && attached.hasSubtype(SubType.AURA, game)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
package mage.cards.b;
|
||||
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.EquippedHasSubtypeCondition;
|
||||
import mage.abilities.costs.mana.GenericManaCost;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
|
@ -11,8 +11,10 @@ import mage.abilities.keyword.EquipAbility;
|
|||
import mage.abilities.keyword.VigilanceAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.util.SubTypeList;
|
||||
import mage.constants.AttachmentType;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -22,27 +24,27 @@ import java.util.UUID;
|
|||
public final class BladedBracers extends CardImpl {
|
||||
|
||||
private static final String ruleText = "As long as equipped creature is a Human or an Angel, it has vigilance";
|
||||
private static final Condition condition = new EquippedHasSubtypeCondition(SubType.HUMAN, SubType.ANGEL);
|
||||
|
||||
public BladedBracers(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||
this.subtype.add(SubType.EQUIPMENT);
|
||||
|
||||
// Equipped creature gets +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1)));
|
||||
SubTypeList subTypes = new SubTypeList();
|
||||
subTypes.add(SubType.HUMAN);
|
||||
subTypes.add(SubType.ANGEL);
|
||||
this.addAbility(new SimpleStaticAbility(new BoostEquippedEffect(1, 1)));
|
||||
|
||||
// As long as equipped creature is a Human or an Angel, it has vigilance.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
|
||||
new ConditionalContinuousEffect(
|
||||
new GainAbilityAttachedEffect(VigilanceAbility.getInstance(), AttachmentType.EQUIPMENT),
|
||||
new EquippedHasSubtypeCondition(subTypes), ruleText)));
|
||||
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||
new GainAbilityAttachedEffect(
|
||||
VigilanceAbility.getInstance(), AttachmentType.EQUIPMENT
|
||||
), condition, ruleText
|
||||
)));
|
||||
|
||||
// Equip {2}
|
||||
this.addAbility(new EquipAbility(Outcome.BoostCreature, new GenericManaCost(2)));
|
||||
}
|
||||
|
||||
public BladedBracers(final BladedBracers card) {
|
||||
private BladedBracers(final BladedBracers card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,8 +22,7 @@ public final class BladesOfVelisVel extends CardImpl {
|
|||
this.subtype.add(SubType.SHAPESHIFTER);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// Up to two target creatures each get +2/+0 and gain all creature types until end of turn.
|
||||
this.getSpellAbility().addEffect(new BoostTargetEffect(2, 0, Duration.EndOfTurn)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
|
@ -13,8 +12,9 @@ import mage.filter.predicate.Predicates;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class BloodMoon extends CardImpl {
|
||||
|
@ -71,7 +71,7 @@ public final class BloodMoon extends CardImpl {
|
|||
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
|
||||
// So the ability removing has to be done before Layer 6
|
||||
// Lands have their mana ability intrinsically, so that is added in layer 4
|
||||
land.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
|
||||
land.addSubType(game, SubType.MOUNTAIN);
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
|
||||
|
|
|
@ -40,8 +40,7 @@ public final class BloodlinePretender extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// As Bloodline Pretender enters the battlefield, choose a creature type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.BoostCreature)));
|
||||
|
|
|
@ -19,7 +19,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.token.BrudicladTelchorMyrToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledPermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -99,7 +99,7 @@ class BrudicladTelchorEngineerEffect extends OneShotEffect {
|
|||
if (toCopyFromPermanent != null) {
|
||||
for (Permanent toCopyToPermanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (!toCopyToPermanent.equals(toCopyFromPermanent)) {
|
||||
game.copyPermanent(toCopyFromPermanent, toCopyToPermanent.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(toCopyFromPermanent, toCopyToPermanent.getId(), source, new EmptyCopyApplier());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -30,8 +30,7 @@ public final class CairnWanderer extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// As long as a creature card with flying is in a graveyard, Cairn Wanderer has flying. The same is true for fear, first strike, double strike, deathtouch, haste, landwalk, lifelink, protection, reach, trample, shroud, and vigilance.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CairnWandererEffect()));
|
||||
|
|
|
@ -11,7 +11,7 @@ import mage.constants.Outcome;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreatureCard;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.filter.predicate.permanent.SharesCreatureTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
@ -88,7 +88,7 @@ class CallToTheKindredEffect extends OneShotEffect {
|
|||
|
||||
Cards cards = new CardsImpl(controller.getLibrary().getTopCards(game, 5));
|
||||
FilterCreatureCard filter = new FilterCreatureCard();
|
||||
filter.add(new CallToTheKindredPredicate(creature));
|
||||
filter.add(new SharesCreatureTypePredicate(creature));
|
||||
|
||||
if (cards.count(filter, game) > 0) {
|
||||
TargetCard target = new TargetCardInLibrary(0, 1, filter);
|
||||
|
@ -103,17 +103,3 @@ class CallToTheKindredEffect extends OneShotEffect {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class CallToTheKindredPredicate implements Predicate<Card> {
|
||||
|
||||
private final Permanent permanent;
|
||||
|
||||
CallToTheKindredPredicate(Permanent permanent) {
|
||||
this.permanent = permanent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Card input, Game game) {
|
||||
return permanent != null && input != null && permanent.shareCreatureTypes(input, game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ class CelestialDawnToPlainsEffect extends ContinuousEffectImpl {
|
|||
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
|
||||
break;
|
||||
case TypeChangingEffects_4:
|
||||
land.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
land.removeAllSubTypes(game,SubTypeSet.NonBasicLandType);
|
||||
land.addSubType(game, SubType.PLAINS);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import mage.filter.common.FilterCreaturePermanent;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -71,7 +71,7 @@ class CemeteryPucaEffect extends OneShotEffect {
|
|||
if (copyToCreature != null) {
|
||||
Permanent copyFromCreature = getTargetPointer().getFirstTargetPermanentOrLKI(game, source);
|
||||
if (copyFromCreature != null) {
|
||||
game.copyPermanent(Duration.WhileOnBattlefield, copyFromCreature, copyToCreature.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(Duration.WhileOnBattlefield, copyFromCreature, copyToCreature.getId(), source, new EmptyCopyApplier());
|
||||
ContinuousEffect effect = new GainAbilityTargetEffect(new DiesCreatureTriggeredAbility(new DoIfCostPaid(new CemeteryPucaEffect(), new ManaCostsImpl("{1}")), false, new FilterCreaturePermanent("a creature"), true), Duration.WhileOnBattlefield);
|
||||
effect.setTargetPointer(new FixedTarget(copyToCreature.getId()));
|
||||
game.addEffect(effect, source);
|
||||
|
|
|
@ -31,8 +31,7 @@ public final class ChameleonColossus extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Changeling (This card is every creature type at all times.)
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// Protection from black
|
||||
this.addAbility(ProtectionAbility.from(ObjectColor.BLACK));
|
||||
|
|
|
@ -24,8 +24,7 @@ public final class ChangelingBerserker extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// Haste
|
||||
this.addAbility(HasteAbility.getInstance());
|
||||
|
|
|
@ -24,8 +24,7 @@ public final class ChangelingHero extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// Champion a creature
|
||||
this.addAbility(new ChampionAbility(this, true));
|
||||
|
|
|
@ -24,8 +24,7 @@ public final class ChangelingOutcast extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// Changeling Outcast can't block and can't be blocked.
|
||||
this.addAbility(new CantBlockAbility());
|
||||
|
|
|
@ -22,8 +22,7 @@ public final class ChangelingSentinel extends CardImpl {
|
|||
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(2);
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
this.addAbility(VigilanceAbility.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ public final class ChangelingTitan extends CardImpl {
|
|||
this.toughness = new MageInt(7);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// Champion a creature
|
||||
this.addAbility(new ChampionAbility(this, true));
|
||||
|
|
|
@ -68,7 +68,7 @@ class CoatOfArmsEffect extends ContinuousEffectImpl {
|
|||
private int getAmount(List<Permanent> permanents, Permanent target, Game game) {
|
||||
int amount = 0;
|
||||
for (Permanent permanent : permanents) {
|
||||
if (!permanent.getId().equals(target.getId()) && permanent.shareCreatureTypes(target, game)) {
|
||||
if (!permanent.getId().equals(target.getId()) && permanent.shareCreatureTypes(game, target)) {
|
||||
amount++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AsEntersBattlefieldAbility;
|
||||
|
@ -20,7 +17,11 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.game.stack.StackObject;
|
||||
import mage.players.Player;
|
||||
import mage.util.SubTypeList;
|
||||
import mage.util.SubTypes;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author bunchOfDevs
|
||||
|
@ -50,16 +51,16 @@ public final class Conspiracy extends CardImpl {
|
|||
|
||||
static class ConspiracyEffect extends ContinuousEffectImpl {
|
||||
|
||||
public ConspiracyEffect() {
|
||||
private ConspiracyEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Neutral);
|
||||
staticText = "Creatures you control are the chosen type. The same is "
|
||||
+ "true for creature spells you control and creature cards "
|
||||
+ "you own that aren't on the battlefield.";
|
||||
|
||||
|
||||
this.dependendToTypes.add(DependencyType.BecomeCreature); // Opalescence and Starfield of Nyx
|
||||
}
|
||||
|
||||
public ConspiracyEffect(final ConspiracyEffect effect) {
|
||||
private ConspiracyEffect(final ConspiracyEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
|
@ -69,94 +70,77 @@ public final class Conspiracy extends CardImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
SubType subType = ChooseCreatureTypeEffect.getChosenCreatureType(source.getSourceId(), game);
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (controller != null && subType != null) {
|
||||
// Creature cards you own that aren't on the battlefield
|
||||
// in graveyard
|
||||
for (UUID cardId : controller.getGraveyard()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature()) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
// on Hand
|
||||
for (UUID cardId : controller.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature()) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
// in Exile
|
||||
for (Card card : game.getState().getExile().getAllCards(game)) {
|
||||
if (card.isOwnedBy(controller.getId()) && card.isCreature()) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
// in Library (e.g. for Mystical Teachings)
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
if (card.isOwnedBy(controller.getId()) && card.isCreature()) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
// in command zone
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
if (commandObject instanceof Commander) {
|
||||
Card card = game.getCard(((Commander) commandObject).getId());
|
||||
if (card != null && card.isCreature() && card.isOwnedBy(controller.getId())) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
// creature spells you control
|
||||
for (Iterator<StackObject> iterator = game.getStack().iterator(); iterator.hasNext();) {
|
||||
StackObject stackObject = iterator.next();
|
||||
if (stackObject instanceof Spell
|
||||
&& stackObject.isControlledBy(controller.getId())
|
||||
&& stackObject.isCreature()) {
|
||||
setCreatureSubtype(stackObject, subType, game);
|
||||
setCreatureSubtype(((Spell) stackObject).getCard(), subType, game);
|
||||
}
|
||||
}
|
||||
// creatures you control
|
||||
List<Permanent> permanents = game.getState().getBattlefield().getAllActivePermanents(controller.getId());
|
||||
for (Permanent permanent : permanents) {
|
||||
if (permanent.isCreature()) {
|
||||
setCreatureSubtype(permanent, subType, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
if (controller == null || subType == null) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
// Creature cards you own that aren't on the battlefield
|
||||
// in graveyard
|
||||
for (UUID cardId : controller.getGraveyard()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature()) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
// on Hand
|
||||
for (UUID cardId : controller.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature()) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
// in Exile
|
||||
for (Card card : game.getState().getExile().getAllCards(game)) {
|
||||
if (card.isOwnedBy(controller.getId()) && card.isCreature()) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
// in Library (e.g. for Mystical Teachings)
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
if (card.isOwnedBy(controller.getId()) && card.isCreature()) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
// in command zone
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
if (commandObject instanceof Commander) {
|
||||
Card card = game.getCard(((Commander) commandObject).getId());
|
||||
if (card != null && card.isCreature() && card.isOwnedBy(controller.getId())) {
|
||||
setCreatureSubtype(card, subType, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
// creature spells you control
|
||||
for (Iterator<StackObject> iterator = game.getStack().iterator(); iterator.hasNext(); ) {
|
||||
StackObject stackObject = iterator.next();
|
||||
if (stackObject instanceof Spell
|
||||
&& stackObject.isControlledBy(controller.getId())
|
||||
&& stackObject.isCreature()) {
|
||||
setCreatureSubtype(stackObject, subType, game);
|
||||
setCreatureSubtype(((Spell) stackObject).getCard(), subType, game);
|
||||
}
|
||||
}
|
||||
// creatures you control
|
||||
List<Permanent> permanents = game.getState().getBattlefield().getAllActivePermanents(controller.getId());
|
||||
for (Permanent permanent : permanents) {
|
||||
if (permanent.isCreature()) {
|
||||
permanent.removeAllCreatureTypes(game);
|
||||
permanent.addSubType(game, subType);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setCreatureSubtype(MageObject object, SubType subtype, Game game) {
|
||||
if (object != null) {
|
||||
setChosenSubtype(game.getState()
|
||||
.getCreateMageObjectAttribute(object, game).getSubtype(), subtype);
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void setChosenSubtype(SubTypeList subtype, SubType choice) {
|
||||
if (subtype.size() != 1
|
||||
|| !subtype.contains(choice)) {
|
||||
subtype.clear();
|
||||
subtype.add(choice);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.TypeChangingEffects_4;
|
||||
SubTypes subTypes = game.getState().getCreateMageObjectAttribute(object, game).getSubtype();
|
||||
subTypes.setIsAllCreatureTypes(false);
|
||||
subTypes.removeAll(SubType.getCreatureTypes());
|
||||
subTypes.add(subtype);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package mage.cards.c;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -19,8 +15,12 @@ import mage.constants.*;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class Conversion extends CardImpl {
|
||||
|
@ -75,8 +75,8 @@ public final class Conversion extends CardImpl {
|
|||
for (Permanent land : game.getBattlefield().getAllActivePermanents(CardType.LAND)) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (land.getSubtype(game).contains(SubType.MOUNTAIN)) {
|
||||
land.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
if (land.hasSubtype(SubType.MOUNTAIN, game)) {
|
||||
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
|
||||
land.addSubType(game, SubType.PLAINS);
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
|
||||
|
|
|
@ -101,7 +101,7 @@ class ConvincingMirageContinousEffect extends ContinuousEffectImpl {
|
|||
if (land == null) {
|
||||
return false;
|
||||
}
|
||||
land.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
|
||||
land.addSubType(game, choice);
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
switch (choice) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.common.FilterArtifactPermanent;
|
||||
import mage.util.functions.CardTypeApplier;
|
||||
import mage.util.functions.CardTypeCopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -22,7 +22,7 @@ public final class CopyArtifact extends CardImpl {
|
|||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{U}");
|
||||
|
||||
// You may have Copy Artifact enter the battlefield as a copy of any artifact on the battlefield, except it's an enchantment in addition to its other types.
|
||||
Effect effect = new CopyPermanentEffect(new FilterArtifactPermanent(), new CardTypeApplier(CardType.ENCHANTMENT));
|
||||
Effect effect = new CopyPermanentEffect(new FilterArtifactPermanent(), new CardTypeCopyApplier(CardType.ENCHANTMENT));
|
||||
effect.setText("as a copy of any artifact on the battlefield, except it's an enchantment in addition to its other types");
|
||||
this.addAbility(new EntersBattlefieldAbility(effect, true));
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ public final class CribSwap extends CardImpl {
|
|||
this.subtype.add(SubType.SHAPESHIFTER);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
// Exile target creature. Its controller creates a 1/1 colorless Shapeshifter creature token with changeling.
|
||||
this.getSpellAbility().addEffect(new ExileTargetEffect());
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
package mage.cards.c;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
|
@ -17,26 +15,30 @@ import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
|
|||
import mage.abilities.effects.common.continuous.GainAbilityAttachedEffect;
|
||||
import mage.abilities.keyword.EnchantAbility;
|
||||
import mage.abilities.keyword.FirstStrikeAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.common.FilterOtherCreatureSharingCreatureSubtype;
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.MageObjectReferencePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author t-schroeder
|
||||
*/
|
||||
public final class CrownOfFury extends CardImpl {
|
||||
|
||||
public CrownOfFury(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||
this.subtype.add(SubType.AURA);
|
||||
|
||||
|
||||
TargetPermanent auraTarget = new TargetCreaturePermanent();
|
||||
this.getSpellAbility().addTarget(auraTarget);
|
||||
this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature));
|
||||
|
@ -69,6 +71,19 @@ public final class CrownOfFury extends CardImpl {
|
|||
|
||||
class CrownOfFuryEffect extends OneShotEffect {
|
||||
|
||||
private static class CrownOfFuryPredicate implements Predicate<Card> {
|
||||
private final Card card;
|
||||
|
||||
private CrownOfFuryPredicate(Card card) {
|
||||
this.card = card;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Card input, Game game) {
|
||||
return input.shareCreatureTypes(game, card);
|
||||
}
|
||||
}
|
||||
|
||||
public CrownOfFuryEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "Enchanted creature and other creatures that share a creature type with it get +1/+0 and gain first strike until end of turn.";
|
||||
|
@ -94,7 +109,9 @@ class CrownOfFuryEffect extends OneShotEffect {
|
|||
|
||||
// ... and other creatures that share a creature type with it ...
|
||||
Permanent enchantedCreature = game.getPermanent(source.getSourcePermanentOrLKI(game).getAttachedTo());
|
||||
FilterCreaturePermanent filter = new FilterOtherCreatureSharingCreatureSubtype(enchantedCreature, game);
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new CrownOfFuryPredicate(enchantedCreature));
|
||||
filter.add(Predicates.not(new MageObjectReferencePredicate(new MageObjectReference(enchantedCreature, game))));
|
||||
game.addEffect(new BoostAllEffect(1, 0, Duration.EndOfTurn, filter, false), source);
|
||||
game.addEffect(new GainAbilityAllEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn, filter), source);
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ class CrypticGatewayPredicate implements Predicate<Card> {
|
|||
@Override
|
||||
public boolean apply(Card input, Game game) {
|
||||
for (Permanent permanent : permanents) {
|
||||
if (!permanent.shareCreatureTypes(input, game)) {
|
||||
if (!permanent.shareCreatureTypes(game, input)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import mage.filter.predicate.permanent.AnotherPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -76,23 +76,14 @@ class CryptoplasmEffect extends OneShotEffect {
|
|||
public boolean apply(Game game, final Ability source) {
|
||||
Permanent creatureToCopy = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (creatureToCopy != null) {
|
||||
ApplyToPermanent applier = new ApplyToPermanent() {
|
||||
CopyApplier applier = new CopyApplier() {
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(), TargetController.YOU, true);
|
||||
upkeepAbility.addTarget(new TargetCreaturePermanent());
|
||||
permanent.addAbility(upkeepAbility, source.getSourceId(), game);
|
||||
blueprint.getAbilities().add(upkeepAbility);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
Ability upkeepAbility = new BeginningOfUpkeepTriggeredAbility(new CryptoplasmEffect(), TargetController.YOU, true);
|
||||
upkeepAbility.addTarget(new TargetCreaturePermanent());
|
||||
mageObject.getAbilities().add(upkeepAbility);
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
game.copyPermanent(creatureToCopy, source.getSourceId(), source, applier);
|
||||
}
|
||||
|
|
|
@ -12,9 +12,8 @@ import mage.filter.FilterPermanent;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -49,7 +48,7 @@ public final class CrystallineResonance extends CardImpl {
|
|||
Ability ability = new CycleControllerTriggeredAbility(
|
||||
new CopyPermanentEffect(
|
||||
StaticFilters.FILTER_PERMANENT_CREATURE,
|
||||
new CrystallineResonanceApplier(), true
|
||||
new CrystallineResonanceCopyApplier(), true
|
||||
).setDuration(Duration.UntilYourNextTurn).setText(
|
||||
"have {this} become a copy of another target permanent until your next turn, " +
|
||||
"except it has this ability"
|
||||
|
@ -60,17 +59,11 @@ public final class CrystallineResonance extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CrystallineResonanceApplier extends ApplyToPermanent {
|
||||
class CrystallineResonanceCopyApplier extends CopyApplier {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
permanent.getAbilities().add(CrystallineResonance.createAbility());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
mageObject.getAbilities().add(CrystallineResonance.createAbility());
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
blueprint.getAbilities().add(CrystallineResonance.createAbility());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -78,7 +78,7 @@ class CytoshapeEffect extends OneShotEffect {
|
|||
if (copyFrom != null) {
|
||||
Permanent copyTo = game.getPermanentOrLKIBattlefield(ability.getTargets().get(1).getFirstTarget());
|
||||
if (copyTo != null) {
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), ability, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFrom, copyTo.getId(), ability, new EmptyCopyApplier());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.d;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.Ability;
|
||||
|
@ -17,10 +16,11 @@ import mage.constants.SubType;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public final class DacksDuplicate extends CardImpl {
|
||||
|
@ -33,7 +33,7 @@ public final class DacksDuplicate extends CardImpl {
|
|||
this.toughness = new MageInt(0);
|
||||
|
||||
// You may have Dack's Duplicate enter the battlefield as a copy of any creature on the battlefield except it has haste and dethrone.
|
||||
Effect effect = new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new DacksDuplicateApplyToPermanent());
|
||||
Effect effect = new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new DacksDuplicateCopyApplier());
|
||||
effect.setText("as a copy of any creature on the battlefield except it has haste and dethrone");
|
||||
this.addAbility(new EntersBattlefieldAbility(effect, true));
|
||||
}
|
||||
|
@ -48,24 +48,15 @@ public final class DacksDuplicate extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class DacksDuplicateApplyToPermanent extends ApplyToPermanent {
|
||||
|
||||
class DacksDuplicateCopyApplier extends CopyApplier {
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
/**
|
||||
* 29/05/2014 The ability of Dack's Duplicate doesn't target the
|
||||
* creature.
|
||||
*/
|
||||
permanent.addAbility(new DethroneAbility(), source.getSourceId(), game);
|
||||
permanent.addAbility(HasteAbility.getInstance(), source.getSourceId(), game);
|
||||
blueprint.getAbilities().add(new DethroneAbility());
|
||||
blueprint.getAbilities().add(HasteAbility.getInstance());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
mageObject.getAbilities().add(new DethroneAbility());
|
||||
mageObject.getAbilities().add(HasteAbility.getInstance());
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ class DescendantsPathEffect extends OneShotEffect {
|
|||
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent();
|
||||
boolean found = false;
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(filter, controller.getId(), game)) {
|
||||
if (card.shareCreatureTypes(permanent, game)) {
|
||||
if (card.shareCreatureTypes(game, permanent)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentCard;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInGraveyard;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -83,7 +83,7 @@ class DimirDoppelgangerEffect extends OneShotEffect {
|
|||
controller.moveCards(cardsToExile, Zone.EXILED, source, game);
|
||||
newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game);
|
||||
newBluePrint.assignNewId();
|
||||
ApplyToPermanent applier = new DimirDoppelgangerApplier();
|
||||
CopyApplier applier = new DimirDoppelgangerCopyApplier();
|
||||
applier.apply(game, newBluePrint, source, dimirDoppelganger.getId());
|
||||
CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, dimirDoppelganger.getId());
|
||||
copyEffect.newId();
|
||||
|
@ -98,21 +98,13 @@ class DimirDoppelgangerEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
class DimirDoppelgangerApplier extends ApplyToPermanent {
|
||||
class DimirDoppelgangerCopyApplier extends CopyApplier {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DimirDoppelgangerEffect(), new ManaCostsImpl("{1}{U}{B}"));
|
||||
ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard")));
|
||||
permanent.getAbilities().add(ability);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DimirDoppelgangerEffect(), new ManaCostsImpl("{1}{U}{B}"));
|
||||
ability.addTarget(new TargetCardInGraveyard(new FilterCreatureCard("creature card in a graveyard")));
|
||||
mageObject.getAbilities().add(ability);
|
||||
blueprint.getAbilities().add(ability);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import mage.MageInt;
|
|||
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.continuous.IsAllCreatureTypesSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -33,10 +34,7 @@ public final class DrJuliusJumblemorph extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Dr. Julius Jumblemorph is every creature type (even if this card isn't on the battlefield).
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect(
|
||||
"{this} is every creature type <i>(even if this card isn't on the battlefield)</i>."
|
||||
)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new IsAllCreatureTypesSourceEffect()));
|
||||
|
||||
// Whenever a host enters the battlefield under your control, you may search your library and/or graveyard for a card with augment and combine it with that host. If you search your library this way, shuffle it.
|
||||
// TODO: Host currently isn't implemented, so this ability currently would never trigger
|
||||
|
@ -46,7 +44,7 @@ public final class DrJuliusJumblemorph extends CardImpl {
|
|||
));
|
||||
}
|
||||
|
||||
public DrJuliusJumblemorph(final DrJuliusJumblemorph card) {
|
||||
private DrJuliusJumblemorph(final DrJuliusJumblemorph card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -113,34 +113,32 @@ class DuplicantContinuousEffect extends ContinuousEffectImpl {
|
|||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
Permanent permanent = game.getPermanent(source.getSourceId());
|
||||
if (permanent != null) {
|
||||
if (!permanent.getImprinted().isEmpty()) {
|
||||
List<UUID> imprinted = permanent.getImprinted();
|
||||
if (imprinted == null || imprinted.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(imprinted.get(imprinted.size() - 1));
|
||||
if (card != null && card.isCreature()) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
permanent.getSubtype(game).addAll(card.getSubtype(game));
|
||||
}
|
||||
|
||||
break;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
permanent.getPower().setValue(card.getPower().getValue());
|
||||
permanent.getToughness().setValue(card.getToughness().getValue());
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
if (permanent.getImprinted().isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
List<UUID> imprinted = permanent.getImprinted();
|
||||
if (imprinted == null || imprinted.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(imprinted.get(imprinted.size() - 1));
|
||||
if (card == null || !card.isCreature()) {
|
||||
return false;
|
||||
}
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
permanent.copySubTypesFrom(game, card, SubTypeSet.CreatureType);
|
||||
break;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
permanent.getPower().setValue(card.getPower().getValue());
|
||||
permanent.getToughness().setValue(card.getToughness().getValue());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,5 +150,4 @@ class DuplicantContinuousEffect extends ContinuousEffectImpl {
|
|||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.TypeChangingEffects_4;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect;
|
||||
import mage.abilities.effects.common.continuous.BoostControlledEffect;
|
||||
import mage.abilities.keyword.SquirrellinkAbility;
|
||||
|
@ -14,20 +11,19 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.permanent.TokenPredicate;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author spjspj
|
||||
*/
|
||||
public final class EarlOfSquirrel extends CardImpl {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("Creature tokens you control");
|
||||
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("Other squirrels you control");
|
||||
|
||||
private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent("Squirrels you control");
|
||||
|
||||
static {
|
||||
filter.add(TokenPredicate.instance);
|
||||
|
@ -48,17 +44,17 @@ public final class EarlOfSquirrel extends CardImpl {
|
|||
this.addAbility(SquirrellinkAbility.getInstance());
|
||||
|
||||
// Creature tokens you control are Squirrels in addition to their other creature types.
|
||||
SubTypeList subTypes = new SubTypeList();
|
||||
subTypes.add(SubType.SQUIRREL);
|
||||
Effect effect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subTypes, filter, false);
|
||||
effect.setText("Creature tokens you control are Squirrels in addition to their other creature types");
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
this.addAbility(new SimpleStaticAbility(new BecomesSubtypeAllEffect(
|
||||
Duration.WhileOnBattlefield, Arrays.asList(SubType.SQUIRREL), filter, false
|
||||
).setText("Creature tokens you control are Squirrels in addition to their other creature types")));
|
||||
|
||||
// Other Squirrels you control get +1/+1.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 1, Duration.WhileOnBattlefield, filter2, true)));
|
||||
this.addAbility(new SimpleStaticAbility(new BoostControlledEffect(
|
||||
1, 1, Duration.WhileOnBattlefield, filter2, true
|
||||
)));
|
||||
}
|
||||
|
||||
public EarlOfSquirrel(final EarlOfSquirrel card) {
|
||||
private EarlOfSquirrel(final EarlOfSquirrel card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ public final class EgoErasure extends CardImpl {
|
|||
this.subtype.add(SubType.SHAPESHIFTER);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
//Creatures target player controls get -2/+0 and lose all creature types until end of turn.
|
||||
this.getSpellAbility().addEffect(new EgoErasureBoostEffect());
|
||||
|
|
|
@ -135,7 +135,7 @@ class ElsewhereFlaskContinuousEffect extends ContinuousEffectImpl {
|
|||
it.remove();
|
||||
continue;
|
||||
}
|
||||
land.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
|
||||
land.addSubType(game, choice);
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
switch (choice) {
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
|
||||
package mage.cards.e;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.costs.Cost;
|
||||
import mage.abilities.costs.common.SacrificeTargetCost;
|
||||
|
@ -13,18 +9,18 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SubTypeSet;
|
||||
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.SharesCreatureTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetControlledCreaturePermanent;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import static mage.filter.StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class EndemicPlague extends CardImpl {
|
||||
|
@ -39,7 +35,7 @@ public final class EndemicPlague extends CardImpl {
|
|||
this.getSpellAbility().addEffect(new EndemicPlagueEffect());
|
||||
}
|
||||
|
||||
public EndemicPlague(final EndemicPlague card) {
|
||||
private EndemicPlague(final EndemicPlague card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -51,40 +47,34 @@ public final class EndemicPlague extends CardImpl {
|
|||
|
||||
class EndemicPlagueEffect extends OneShotEffect {
|
||||
|
||||
public EndemicPlagueEffect() {
|
||||
EndemicPlagueEffect() {
|
||||
super(Outcome.DestroyPermanent);
|
||||
staticText = "destroy all creatures that share a creature type with the sacrificed creature. They can't be regenerated";
|
||||
}
|
||||
|
||||
public EndemicPlagueEffect(final EndemicPlagueEffect effect) {
|
||||
private EndemicPlagueEffect(final EndemicPlagueEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
SubTypeList subs = null;
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) {
|
||||
subs = ((SacrificeTargetCost) cost).getPermanents().get(0).getSubtype(game);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (subs == null) {
|
||||
return false;
|
||||
}
|
||||
List<SubType.SubTypePredicate> preds = new ArrayList<>();
|
||||
for (SubType subType : subs) {
|
||||
if (subType.getSubTypeSet() == SubTypeSet.CreatureType) {
|
||||
preds.add(subType.getPredicate());
|
||||
}
|
||||
}
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(Predicates.or(preds));
|
||||
new DestroyAllEffect(filter, true).apply(game, source);
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
Permanent permanent = null;
|
||||
for (Cost cost : source.getCosts()) {
|
||||
if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) {
|
||||
permanent = ((SacrificeTargetCost) cost).getPermanents().get(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (permanent == null) {
|
||||
return false;
|
||||
}
|
||||
FilterCreaturePermanent filter = new FilterCreaturePermanent();
|
||||
filter.add(new SharesCreatureTypePredicate(permanent));
|
||||
return new DestroyAllEffect(filter, true).apply(game, source);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -17,7 +17,7 @@ import mage.filter.FilterPermanent;
|
|||
import mage.filter.common.FilterControlledEnchantmentPermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -33,7 +33,7 @@ public final class EstridsInvocation extends CardImpl {
|
|||
|
||||
// You may have Estrid's Invocation enter the battlefield as a copy of any enchantment you control, except it gains "At the beginning of your upkeep, you may exile this enchantment. If you do, return it to the battlefield under its owner's control."
|
||||
this.addAbility(new EntersBattlefieldAbility(new CopyPermanentEffect(
|
||||
filter, new EstridsInvocationApplier()
|
||||
filter, new EstridsInvocationCopyApplier()
|
||||
).setText("as a copy of an enchantment you control, except it gains "
|
||||
+ "\"At the beginning of your upkeep, "
|
||||
+ "you may exile this enchantment. "
|
||||
|
@ -52,26 +52,16 @@ public final class EstridsInvocation extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class EstridsInvocationApplier extends ApplyToPermanent {
|
||||
class EstridsInvocationCopyApplier extends CopyApplier {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
// At the beginning of your upkeep, you may exile this enchantment. If you do, return it to the battlefield under its owner's control.
|
||||
permanent.addAbility(new BeginningOfUpkeepTriggeredAbility(
|
||||
new EstridsInvocationEffect(), TargetController.YOU, true
|
||||
), source.getSourceId(), game);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
// At the beginning of your upkeep, you may exile this enchantment. If you do, return it to the battlefield under its owner's control.
|
||||
mageObject.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(
|
||||
blueprint.getAbilities().add(new BeginningOfUpkeepTriggeredAbility(
|
||||
new EstridsInvocationEffect(), TargetController.YOU, true
|
||||
));
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class EstridsInvocationEffect extends OneShotEffect {
|
||||
|
|
|
@ -23,7 +23,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.CardUtil;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -40,7 +40,7 @@ public final class EvilTwin extends CardImpl {
|
|||
this.toughness = new MageInt(0);
|
||||
|
||||
// You may have Evil Twin enter the battlefield as a copy of any creature on the battlefield, except it has "{U}{B}, {T}: Destroy target creature with the same name as this creature."
|
||||
Effect effect = new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new EvilTwinApplyToPermanent());
|
||||
Effect effect = new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new EvilTwinCopyApplier());
|
||||
effect.setText("as a copy of any creature on the battlefield, except it has \"{U}{B}, {T}: Destroy target creature with the same name as this creature.\"");
|
||||
this.addAbility(new EntersBattlefieldAbility(effect, true));
|
||||
|
||||
|
@ -56,7 +56,7 @@ public final class EvilTwin extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class EvilTwinApplyToPermanent extends ApplyToPermanent {
|
||||
class EvilTwinCopyApplier extends CopyApplier {
|
||||
|
||||
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("creature with the same name as this creature");
|
||||
|
||||
|
@ -65,20 +65,11 @@ class EvilTwinApplyToPermanent extends ApplyToPermanent {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{U}{B}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
permanent.addAbility(ability, source.getSourceId(), game);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DestroyTargetEffect(), new ManaCostsImpl("{U}{B}"));
|
||||
ability.addCost(new TapSourceCost());
|
||||
ability.addTarget(new TargetCreaturePermanent(filter));
|
||||
mageObject.getAbilities().add(ability);
|
||||
blueprint.getAbilities().add(ability);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ enum FaceOfDivinityCondition implements Condition {
|
|||
for (UUID id : permanent.getAttachments()) {
|
||||
Permanent otherAura = game.getPermanent(id);
|
||||
if (otherAura != null && !otherAura.getId().equals(currentAura.getId())
|
||||
&& otherAura.getSubtype(game).contains(SubType.AURA)) {
|
||||
&& otherAura.hasSubtype(SubType.AURA, game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class FacelessHavenToken extends TokenImpl {
|
|||
FacelessHavenToken() {
|
||||
super("", "4/3 creature with vigilance and all creature types");
|
||||
cardType.add(CardType.CREATURE);
|
||||
setIsAllCreatureTypes(true);
|
||||
subtype.setIsAllCreatureTypes(true);
|
||||
power = new MageInt(4);
|
||||
toughness = new MageInt(3);
|
||||
addAbility(VigilanceAbility.getInstance());
|
||||
|
|
|
@ -62,13 +62,13 @@ class FacesOfThePastEffect extends OneShotEffect {
|
|||
if (controller != null) {
|
||||
if (controller.chooseUse(outcome, "Tap all untapped creatures that share a creature type with " + targetPermanent.getLogName() + "? (Otherwise, untaps all tapped)", source, game)) {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) {
|
||||
if (!permanent.isTapped() && targetPermanent.shareCreatureTypes(permanent, game)) {
|
||||
if (!permanent.isTapped() && targetPermanent.shareCreatureTypes(game, permanent)) {
|
||||
permanent.tap(source, game);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (Permanent permanent : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, game)) {
|
||||
if (permanent.isTapped() && targetPermanent.shareCreatureTypes(permanent, game)) {
|
||||
if (permanent.isTapped() && targetPermanent.shareCreatureTypes(game, permanent)) {
|
||||
permanent.untap(game);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.f;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -16,7 +15,8 @@ import mage.constants.Zone;
|
|||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.game.permanent.token.custom.CreatureToken;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author anonymous
|
||||
|
@ -30,7 +30,7 @@ public final class FendeepSummoner extends CardImpl {
|
|||
}
|
||||
|
||||
public FendeepSummoner(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{4}{B}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{B}");
|
||||
this.subtype.add(SubType.TREEFOLK);
|
||||
this.subtype.add(SubType.SHAMAN);
|
||||
|
||||
|
@ -39,7 +39,7 @@ public final class FendeepSummoner extends CardImpl {
|
|||
|
||||
// {T}: Up to two target Swamps each become 3/5 Treefolk Warrior creatures in addition to their other types until end of turn.
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(
|
||||
new CreatureToken(3, 5, "3/5 Treefolk Warrior", new SubTypeList(SubType.TREEFOLK, SubType.WARRIOR)),
|
||||
new CreatureToken(3, 5, "3/5 Treefolk Warrior", SubType.TREEFOLK, SubType.WARRIOR),
|
||||
false, false, Duration.EndOfTurn), new TapSourceCost());
|
||||
ability.addTarget(new TargetLandPermanent(0, 2, filter, false));
|
||||
this.addAbility(ability);
|
||||
|
|
|
@ -27,8 +27,7 @@ public final class FireBellyChangeling extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// {R}: Fire-Belly Changeling gets +1/+0 until end of turn. Activate this ability no more than twice each turn.
|
||||
this.addAbility(new LimitedTimesPerTurnActivatedAbility(Zone.BATTLEFIELD,
|
||||
|
|
|
@ -22,8 +22,7 @@ public final class GameTrailChangeling extends CardImpl {
|
|||
|
||||
this.power = new MageInt(4);
|
||||
this.toughness = new MageInt(4);
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ public final class GhostlyChangeling extends CardImpl {
|
|||
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostSourceEffect(1, 1, Duration.EndOfTurn), new ManaCostsImpl("{1}{B}")));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import mage.constants.Zone;
|
|||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -38,7 +38,7 @@ public final class Gigantoplasm extends CardImpl {
|
|||
this.toughness = new MageInt(0);
|
||||
|
||||
// You may have Gigantoplasm enter the battlefield as a copy of any creature on the battlefield, except it has "{X}: This creature has base power and toughness X/X."
|
||||
Effect effect = new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new GigantoplasmApplyToPermanent());
|
||||
Effect effect = new CopyPermanentEffect(StaticFilters.FILTER_PERMANENT_CREATURE, new GigantoplasmCopyApplier());
|
||||
effect.setText("a copy of any creature on the battlefield, except it has \"{X}: This creature has base power and toughness X/X.\"");
|
||||
this.addAbility(new EntersBattlefieldAbility(effect, true));
|
||||
}
|
||||
|
@ -53,25 +53,15 @@ public final class Gigantoplasm extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class GigantoplasmApplyToPermanent extends ApplyToPermanent {
|
||||
class GigantoplasmCopyApplier extends CopyApplier {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
DynamicValue variableMana = ManacostVariableValue.instance;
|
||||
Effect effect = new SetPowerToughnessSourceEffect(variableMana, Duration.WhileOnBattlefield, SubLayer.SetPT_7b);
|
||||
effect.setText("This creature has base power and toughness X/X");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}"));
|
||||
permanent.getAbilities().add(ability);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
DynamicValue variableMana = ManacostVariableValue.instance;
|
||||
Effect effect = new SetPowerToughnessSourceEffect(variableMana, Duration.WhileOnBattlefield, SubLayer.SetPT_7b);
|
||||
effect.setText("This creature has base power and toughness X/X");
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl("{X}"));
|
||||
mageObject.getAbilities().add(ability);
|
||||
blueprint.getAbilities().add(ability);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ public final class Glaciers extends CardImpl {
|
|||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
// the land mana ability is intrinsic, so apply at this layer not layer 6
|
||||
if (land.getSubtype(game).contains(SubType.MOUNTAIN)) {
|
||||
land.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
if (land.hasSubtype(SubType.MOUNTAIN, game)) {
|
||||
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
|
||||
land.addSubType(game, SubType.PLAINS);
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
|
||||
|
|
|
@ -36,8 +36,7 @@ public final class GladewalkerRitualist extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// Whenever another creature named Gladewalker Ritualist enters the battlefield under your control, draw a card.
|
||||
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(
|
||||
|
|
|
@ -13,8 +13,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -36,7 +35,7 @@ public final class GlasspoolMimic extends ModalDoubleFacesCard {
|
|||
|
||||
// You may have Glasspool Mimic enter the battlefield as a copy of a creature you control, except it's a Shapeshifter Rogue in addition to its other types.
|
||||
this.getLeftHalfCard().addAbility(new EntersBattlefieldAbility(
|
||||
new CopyPermanentEffect(StaticFilters.FILTER_CONTROLLED_CREATURE, new GlasspoolMimicApplier()),
|
||||
new CopyPermanentEffect(StaticFilters.FILTER_CONTROLLED_CREATURE, new GlasspoolMimicCopyApplier()),
|
||||
true, null, "You may have {this} enter the battlefield as a copy of " +
|
||||
"a creature you control, except it's a Shapeshifter Rogue in addition to its other types.", ""
|
||||
));
|
||||
|
@ -62,19 +61,11 @@ public final class GlasspoolMimic extends ModalDoubleFacesCard {
|
|||
}
|
||||
}
|
||||
|
||||
class GlasspoolMimicApplier extends ApplyToPermanent {
|
||||
class GlasspoolMimicCopyApplier extends CopyApplier {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
permanent.addSubType(game, SubType.SHAPESHIFTER);
|
||||
permanent.addSubType(game, SubType.ROGUE);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
mageObject.addSubType(game, SubType.SHAPESHIFTER);
|
||||
mageObject.addSubType(game, SubType.ROGUE);
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
blueprint.addSubType(SubType.SHAPESHIFTER, SubType.ROGUE);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,14 +76,15 @@ class GodPharaohsGiftEffect extends OneShotEffect {
|
|||
Card cardChosen = game.getCard(target.getFirstTarget());
|
||||
if (cardChosen != null
|
||||
&& cardChosen.moveToExile(exileId, sourceObject.getIdName(), source, game)) {
|
||||
// create token and modify all attributes permanently (without game usage)
|
||||
EmptyToken token = new EmptyToken();
|
||||
CardUtil.copyTo(token).from(cardChosen, game);
|
||||
token.removePTCDA();
|
||||
token.getPower().modifyBaseValue(4);
|
||||
token.getToughness().modifyBaseValue(4);
|
||||
token.getColor(game).setColor(ObjectColor.BLACK);
|
||||
token.removeAllCreatureTypes(game);
|
||||
token.addSubType(game, SubType.ZOMBIE);
|
||||
token.getColor().setColor(ObjectColor.BLACK);
|
||||
token.removeAllCreatureTypes();
|
||||
token.addSubType(SubType.ZOMBIE);
|
||||
if (token.putOntoBattlefield(1, game, source, source.getControllerId())) {
|
||||
Permanent tokenPermanent = game.getPermanent(token.getLastAddedToken());
|
||||
if (tokenPermanent != null) {
|
||||
|
|
|
@ -27,8 +27,7 @@ public final class Graveshifter extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// When Graveshifter enters the battlefield, you may return target creature card from your graveyard to your hand.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(new ReturnToHandTargetEffect(), true);
|
||||
|
|
|
@ -27,8 +27,7 @@ public final class GuardianGladewalker extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// When Guardian Gladewalker enters the battlefield, put a +1/+1 counter on target creature.
|
||||
Ability ability = new EntersBattlefieldTriggeredAbility(
|
||||
|
|
|
@ -82,7 +82,7 @@ class HeirloomBladeEffect extends OneShotEffect {
|
|||
Cards otherCards = new CardsImpl();
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
revealed.add(card);
|
||||
if (card != null && card.isCreature() && equipped.shareCreatureTypes(card, game)) {
|
||||
if (card != null && card.isCreature() && equipped.shareCreatureTypes(game, card)) {
|
||||
controller.moveCardToHandWithInfo(card, source, game, true);
|
||||
break;
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package mage.cards.h;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.BecomesSubtypeAllEffect;
|
||||
|
@ -9,7 +8,9 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* Created by Alexsandr0x.
|
||||
|
@ -26,9 +27,7 @@ public final class Hivestone extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// Creatures you control are Slivers in addition to their other creature types.
|
||||
SubTypeList subTypes = new SubTypeList();
|
||||
subTypes.add(SubType.SLIVER);
|
||||
Effect effect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, subTypes, filter, false);
|
||||
Effect effect = new BecomesSubtypeAllEffect(Duration.WhileOnBattlefield, Arrays.asList(SubType.SLIVER), filter, false);
|
||||
effect.setText("Creatures you control are Slivers in addition to their other creature types");
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||
}
|
||||
|
|
|
@ -90,14 +90,15 @@ class HourOfEternityEffect extends OneShotEffect {
|
|||
controller.moveCardsToExile(cardsToExile, source, game, true, null, "");
|
||||
for (Card card : cardsToExile) {
|
||||
if (game.getState().getZone(card.getId()) == Zone.EXILED) {
|
||||
// create token and modify all attributes permanently (without game usage)
|
||||
EmptyToken token = new EmptyToken();
|
||||
CardUtil.copyTo(token).from(card, game);
|
||||
token.removePTCDA();
|
||||
token.getPower().modifyBaseValue(4);
|
||||
token.getToughness().modifyBaseValue(4);
|
||||
token.getColor(game).setColor(ObjectColor.BLACK);
|
||||
token.removeAllCreatureTypes(game);
|
||||
token.addSubType(game, SubType.ZOMBIE);
|
||||
token.getColor().setColor(ObjectColor.BLACK);
|
||||
token.removeAllCreatureTypes();
|
||||
token.addSubType(SubType.ZOMBIE);
|
||||
token.putOntoBattlefield(1, game, source, source.getControllerId());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ class HydroformToken extends TokenImpl {
|
|||
public HydroformToken() {
|
||||
super("", "3/3 Elemental creature with flying");
|
||||
this.cardType.add(CardType.CREATURE);
|
||||
this.getSubtype(null).add(SubType.ELEMENTAL);
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
|
||||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(3);
|
||||
|
|
|
@ -19,15 +19,10 @@ import mage.cards.CardImpl;
|
|||
import mage.cards.CardSetInfo;
|
||||
import mage.choices.ChoiceBasicLandType;
|
||||
import mage.choices.ChoiceImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.DependencyType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
import mage.constants.*;
|
||||
|
||||
import static mage.constants.Layer.TypeChangingEffects_4;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.SubLayer;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
@ -93,27 +88,27 @@ class IllusionaryTerrainEffect extends ContinuousEffectImpl {
|
|||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
// the land mana ability is intrinsic, so add it here, not layer 6
|
||||
if (land.getSubtype(game).contains(firstChoice)) {
|
||||
land.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
if (land.hasSubtype(firstChoice, game)) {
|
||||
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
|
||||
land.addSubType(game, secondChoice);
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
if (land.getSubtype(game).contains(SubType.FOREST)) {
|
||||
if (land.hasSubtype(SubType.FOREST, game)) {
|
||||
this.dependencyTypes.add(DependencyType.BecomeForest);
|
||||
land.addAbility(new GreenManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
if (land.getSubtype(game).contains(SubType.PLAINS)) {
|
||||
if (land.hasSubtype(SubType.PLAINS, game)) {
|
||||
this.dependencyTypes.add(DependencyType.BecomePlains);
|
||||
land.addAbility(new WhiteManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
if (land.getSubtype(game).contains(SubType.MOUNTAIN)) {
|
||||
if (land.hasSubtype(SubType.MOUNTAIN, game)) {
|
||||
this.dependencyTypes.add(DependencyType.BecomeMountain);
|
||||
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
if (land.getSubtype(game).contains(SubType.ISLAND)) {
|
||||
if (land.hasSubtype(SubType.ISLAND, game)) {
|
||||
this.dependencyTypes.add(DependencyType.BecomeIsland);
|
||||
land.addAbility(new BlueManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
if (land.getSubtype(game).contains(SubType.SWAMP)) {
|
||||
if (land.hasSubtype(SubType.SWAMP, game)) {
|
||||
this.dependencyTypes.add(DependencyType.BecomeSwamp);
|
||||
land.addAbility(new BlackManaAbility(), source.getSourceId(), game);
|
||||
}
|
||||
|
|
|
@ -22,8 +22,7 @@ public final class ImpostorOfTheSixthPride extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
}
|
||||
|
||||
private ImpostorOfTheSixthPride(final ImpostorOfTheSixthPride card) {
|
||||
|
|
|
@ -27,7 +27,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentToken;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -89,7 +89,7 @@ class InfiniteReflectionTriggeredEffect extends OneShotEffect {
|
|||
if (toCopyFromPermanent != null) {
|
||||
for (Permanent toCopyToPermanent : game.getBattlefield().getAllActivePermanents(filter, source.getControllerId(), game)) {
|
||||
if (!toCopyToPermanent.equals(toCopyFromPermanent) && !(toCopyToPermanent instanceof PermanentToken)) {
|
||||
game.copyPermanent(toCopyFromPermanent, toCopyToPermanent.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(toCopyFromPermanent, toCopyToPermanent.getId(), source, new EmptyCopyApplier());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -129,7 +129,7 @@ class InfiniteReflectionEntersBattlefieldEffect extends ReplacementEffectImpl {
|
|||
if (sourcePermanent != null && toCopyToObject != null && sourcePermanent.getAttachedTo() != null) {
|
||||
Permanent toCopyFromPermanent = game.getPermanent(sourcePermanent.getAttachedTo());
|
||||
if (toCopyFromPermanent != null) {
|
||||
game.copyPermanent(toCopyFromPermanent, toCopyToObject.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(toCopyFromPermanent, toCopyToObject.getId(), source, new EmptyCopyApplier());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -24,8 +24,7 @@ public final class IrregularCohort extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// When Irregular Cohort enters the battlefield, create a 2/2 colorless Shapeshifter creature token with changeling.
|
||||
this.addAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new ShapeshifterToken())));
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.cards.j;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.condition.LockedInCondition;
|
||||
import mage.abilities.condition.common.SourceHasSubtypeCondition;
|
||||
import mage.abilities.decorator.ConditionalContinuousEffect;
|
||||
|
@ -14,29 +12,26 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Styxo
|
||||
*/
|
||||
public final class JarKaiBattleStance extends CardImpl {
|
||||
|
||||
public JarKaiBattleStance(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{R}");
|
||||
|
||||
// Target creature gains double strike until end of turn.
|
||||
this.getSpellAbility().addEffect(new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
SubTypeList s = new SubTypeList();
|
||||
s.add(SubType.JEDI);
|
||||
s.add(SubType.SITH);
|
||||
|
||||
// If that creature is a Jedi or Sith, it also gains trample until end of turn.
|
||||
this.getSpellAbility().addEffect(new ConditionalContinuousEffect(
|
||||
new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn),
|
||||
new LockedInCondition(new SourceHasSubtypeCondition(s)),
|
||||
new LockedInCondition(new SourceHasSubtypeCondition(SubType.JEDI, SubType.SITH)),
|
||||
"If that creature is a Jedi or Sith, it also gains trample until end of turn"));
|
||||
|
||||
}
|
||||
|
||||
public JarKaiBattleStance(final JarKaiBattleStance card) {
|
||||
|
|
|
@ -16,8 +16,9 @@ import mage.constants.*;
|
|||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.permanent.AnotherPredicate;
|
||||
import mage.util.SubTypeList;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -83,7 +84,7 @@ enum KaheeraTheOrphanguardCompanionCondition implements CompanionCondition {
|
|||
return "Each creature card in your starting deck is a Cat, Elemental, Nightmare, Dinosaur or Beast card.";
|
||||
}
|
||||
|
||||
private static final SubTypeList subtypes = new SubTypeList(
|
||||
private static final List<SubType> subtypes = Arrays.asList(
|
||||
SubType.CAT,
|
||||
SubType.ELEMENTAL,
|
||||
SubType.NIGHTMARE,
|
||||
|
@ -92,7 +93,7 @@ enum KaheeraTheOrphanguardCompanionCondition implements CompanionCondition {
|
|||
);
|
||||
|
||||
private static boolean checkTypes(Card card) {
|
||||
return subtypes.stream().anyMatch(subtype -> card.hasSubtype(subtype, null));
|
||||
return subtypes.stream().anyMatch(subtype -> card.getSubtype().contains(subtype));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -109,7 +109,7 @@ class KondasBannerTypeBoostEffect extends BoostAllEffect {
|
|||
Permanent equipedCreature = game.getPermanent(equipment.getAttachedTo());
|
||||
if (equipedCreature != null) {
|
||||
for (Permanent perm : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source.getSourceId(), game)) {
|
||||
if (perm.shareCreatureTypes(equipedCreature, game)) {
|
||||
if (perm.shareCreatureTypes(game, equipedCreature)) {
|
||||
perm.addPower(power.calculate(game, source, this));
|
||||
perm.addToughness(toughness.calculate(game, source, this));
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.permanent.PermanentCard;
|
||||
import mage.players.Player;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -82,7 +82,7 @@ class LazavDimirMastermindEffect extends OneShotEffect {
|
|||
if (copyFromCard != null) {
|
||||
newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game);
|
||||
newBluePrint.assignNewId();
|
||||
ApplyToPermanent applier = new LazavDimirMastermindApplier();
|
||||
CopyApplier applier = new LazavDimirMastermindCopyApplier();
|
||||
applier.apply(game, newBluePrint, source, lazavDimirMastermind.getId());
|
||||
CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, lazavDimirMastermind.getId());
|
||||
copyEffect.newId();
|
||||
|
@ -97,31 +97,18 @@ class LazavDimirMastermindEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
class LazavDimirMastermindApplier extends ApplyToPermanent {
|
||||
class LazavDimirMastermindCopyApplier extends CopyApplier {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
Ability ability = new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new LazavDimirMastermindEffect(), true,
|
||||
new FilterCreatureCard("a creature card"),
|
||||
TargetController.OPPONENT, SetTargetPointer.CARD);
|
||||
permanent.getAbilities().add(ability);
|
||||
permanent.setName("Lazav, Dimir Mastermind");
|
||||
permanent.addSuperType(SuperType.LEGENDARY);
|
||||
permanent.getAbilities().add(HexproofAbility.getInstance());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
Ability ability = new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
|
||||
new LazavDimirMastermindEffect(), true,
|
||||
new FilterCreatureCard("a creature card"),
|
||||
TargetController.OPPONENT, SetTargetPointer.CARD);
|
||||
mageObject.getAbilities().add(ability);
|
||||
mageObject.setName("Lazav, Dimir Mastermind");
|
||||
mageObject.addSuperType(SuperType.LEGENDARY);
|
||||
mageObject.getAbilities().add(HexproofAbility.getInstance());
|
||||
blueprint.getAbilities().add(ability);
|
||||
blueprint.setName("Lazav, Dimir Mastermind");
|
||||
blueprint.addSuperType(SuperType.LEGENDARY);
|
||||
blueprint.getAbilities().add(HexproofAbility.getInstance());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import mage.game.permanent.PermanentCard;
|
|||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInYourGraveyard;
|
||||
import mage.target.targetadjustment.TargetAdjuster;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -112,7 +112,7 @@ class LazavTheMultifariousEffect extends OneShotEffect {
|
|||
if (copyFromCard != null) {
|
||||
newBluePrint = new PermanentCard(copyFromCard, source.getControllerId(), game);
|
||||
newBluePrint.assignNewId();
|
||||
ApplyToPermanent applier = new LazavTheMultifariousApplier();
|
||||
CopyApplier applier = new LazavTheMultifariousCopyApplier();
|
||||
applier.apply(game, newBluePrint, source, lazavTheMultifarious.getId());
|
||||
CopyEffect copyEffect = new CopyEffect(Duration.Custom, newBluePrint, lazavTheMultifarious.getId());
|
||||
copyEffect.newId();
|
||||
|
@ -127,31 +127,18 @@ class LazavTheMultifariousEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
class LazavTheMultifariousApplier extends ApplyToPermanent {
|
||||
class LazavTheMultifariousCopyApplier extends CopyApplier {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent permanent, Ability source, UUID copyToObjectId) {
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
new LazavTheMultifariousEffect(),
|
||||
new ManaCostsImpl("{X}")
|
||||
);
|
||||
ability.setTargetAdjuster(LazavTheMultifariousAdjuster.instance);
|
||||
permanent.getAbilities().add(ability);
|
||||
permanent.setName("Lazav, the Multifarious");
|
||||
permanent.addSuperType(SuperType.LEGENDARY);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject mageObject, Ability source, UUID copyToObjectId) {
|
||||
Ability ability = new SimpleActivatedAbility(
|
||||
new LazavTheMultifariousEffect(),
|
||||
new ManaCostsImpl("{X}")
|
||||
);
|
||||
ability.setTargetAdjuster(LazavTheMultifariousAdjuster.instance);
|
||||
mageObject.getAbilities().add(ability);
|
||||
mageObject.setName("Lazav, the Multifarious");
|
||||
mageObject.addSuperType(SuperType.LEGENDARY);
|
||||
blueprint.getAbilities().add(ability);
|
||||
blueprint.setName("Lazav, the Multifarious");
|
||||
blueprint.addSuperType(SuperType.LEGENDARY);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObjectReference;
|
||||
import mage.ObjectColor;
|
||||
|
@ -20,20 +18,21 @@ import mage.filter.StaticFilters;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.DamagedPlayerEvent;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.custom.ElementalCreatureToken;
|
||||
import mage.target.Target;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
*/
|
||||
public final class LiegeOfTheTangle extends CardImpl {
|
||||
|
||||
public LiegeOfTheTangle (UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}{G}{G}");
|
||||
public LiegeOfTheTangle(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{G}{G}");
|
||||
this.subtype.add(SubType.ELEMENTAL);
|
||||
|
||||
this.power = new MageInt(8);
|
||||
|
@ -42,7 +41,7 @@ public final class LiegeOfTheTangle extends CardImpl {
|
|||
this.addAbility(new LiegeOfTheTangleTriggeredAbility());
|
||||
}
|
||||
|
||||
public LiegeOfTheTangle (final LiegeOfTheTangle card) {
|
||||
public LiegeOfTheTangle(final LiegeOfTheTangle card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -76,7 +75,7 @@ class LiegeOfTheTangleTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent)event;
|
||||
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
|
||||
Permanent p = game.getPermanent(event.getSourceId());
|
||||
return damageEvent.isCombatDamage() && p != null && p.getId().equals(this.getSourceId());
|
||||
}
|
||||
|
@ -101,32 +100,33 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext();) {
|
||||
for (Iterator<MageObjectReference> it = affectedObjectList.iterator(); it.hasNext(); ) {
|
||||
Permanent perm = it.next().getPermanent(game);
|
||||
if (perm != null) {
|
||||
if (perm.getCounters(game).getCount(CounterType.AWAKENING) > 0) {
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
perm.addCardTypes(token.getCardType());
|
||||
perm.getSubtype(game).addAll(token.getSubtype(game));
|
||||
}
|
||||
break;
|
||||
case ColorChangingEffects_5:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
perm.getColor(game).setColor(token.getColor(game));
|
||||
}
|
||||
break;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
perm.getPower().setValue(token.getPower().getValue());
|
||||
perm.getToughness().setValue(token.getToughness().getValue());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (perm == null) {
|
||||
it.remove();
|
||||
continue;
|
||||
}
|
||||
if (perm.getCounters(game).getCount(CounterType.AWAKENING) <= 0) {
|
||||
continue;
|
||||
}
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
perm.addCardTypes(token.getCardType());
|
||||
perm.copySubTypesFrom(game, token);
|
||||
}
|
||||
break;
|
||||
case ColorChangingEffects_5:
|
||||
if (sublayer == SubLayer.NA) {
|
||||
perm.getColor(game).setColor(token.getColor(game));
|
||||
}
|
||||
break;
|
||||
case PTChangingEffects_7:
|
||||
if (sublayer == SubLayer.SetPT_7b) {
|
||||
perm.getPower().setValue(token.getPower().getValue());
|
||||
perm.getToughness().setValue(token.getToughness().getValue());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -141,7 +141,7 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl {
|
|||
public void init(Ability source, Game game) {
|
||||
super.init(source, game);
|
||||
if (this.affectedObjectsSet) {
|
||||
for (UUID permId: targetPointer.getTargets(game, source)) {
|
||||
for (UUID permId : targetPointer.getTargets(game, source)) {
|
||||
affectedObjectList.add(new MageObjectReference(permId, game));
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +154,9 @@ class LiegeOfTheTangleEffect extends ContinuousEffectImpl {
|
|||
|
||||
@Override
|
||||
public boolean hasLayer(Layer layer) {
|
||||
return layer == Layer.PTChangingEffects_7 || layer == Layer.ColorChangingEffects_5 || layer == layer.TypeChangingEffects_4;
|
||||
return layer == Layer.PTChangingEffects_7
|
||||
|| layer == Layer.ColorChangingEffects_5
|
||||
|| layer == layer.TypeChangingEffects_4;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class ChangeLandAttachedEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
switch (layer) {
|
||||
case TypeChangingEffects_4:
|
||||
permanent.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
permanent.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
|
||||
break;
|
||||
case AbilityAddingRemovingEffects_6:
|
||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||
|
|
|
@ -33,8 +33,7 @@ public final class LittjaraGladeWarden extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// {2}{G}, {T}, Exile a creature card from your graveyard: Put two +1/+1 counters on target creature. Activate this ability only any time you could cast a sorcery.
|
||||
Ability ability = new ActivateAsSorceryActivatedAbility(
|
||||
|
|
|
@ -31,8 +31,7 @@ public final class LittjaraKinseekers extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// When Littjara Kinseekers enters the battlefield, if you control three or more creatures that share a creature type, put a +1/+1 counter on Littjara Kinseekers, then scry 1.
|
||||
Ability ability = new ConditionalInterveningIfTriggeredAbility(
|
||||
|
|
|
@ -77,7 +77,7 @@ public final class MagusOfTheMoon extends CardImpl {
|
|||
// 305.7 Note that this doesn't remove any abilities that were granted to the land by other effects
|
||||
// So the ability removing has to be done before Layer 6
|
||||
land.removeAllAbilities(source.getSourceId(), game);
|
||||
land.getSubtype(game).removeAll(SubType.getLandTypes());
|
||||
land.removeAllSubTypes(game, SubTypeSet.NonBasicLandType);
|
||||
land.addSubType(game, SubType.MOUNTAIN);
|
||||
// Mountains have the red mana ability intrinsically so the ability must be added in this layer
|
||||
land.addAbility(new RedManaAbility(), source.getSourceId(), game);
|
||||
|
|
|
@ -65,7 +65,7 @@ class ManaEchoesEffect extends OneShotEffect {
|
|||
if (controller != null && permanent != null) {
|
||||
int foundCreatures = 0;
|
||||
for (Permanent perm : game.getBattlefield().getAllActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), game)) {
|
||||
if (permanent.shareCreatureTypes(perm, game)) {
|
||||
if (permanent.shareCreatureTypes(game, perm)) {
|
||||
foundCreatures++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,8 +40,7 @@ public final class MaskedVandal extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// When enters the battlefield, you may exile a creature card from your graveyard. If you do, exile target artifact or enchantment an opponent controls.
|
||||
Ability ability = new EntersBattlefieldAbility(
|
||||
|
|
|
@ -57,7 +57,7 @@ public final class MaskwoodNexus extends CardImpl {
|
|||
class MaskwoodNexusEffect extends ContinuousEffectImpl {
|
||||
|
||||
MaskwoodNexusEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "Creatures you control are every creature type. " +
|
||||
"The same is true for creature spells you control " +
|
||||
"and creature cards you own that aren't on the battlefield.";
|
||||
|
@ -73,7 +73,7 @@ class MaskwoodNexusEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) {
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
|
@ -83,26 +83,26 @@ class MaskwoodNexusEffect extends ContinuousEffectImpl {
|
|||
for (UUID cardId : controller.getGraveyard()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature()) {
|
||||
card.setIsAllCreatureTypes(true);
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().setIsAllCreatureTypes(true);
|
||||
}
|
||||
}
|
||||
// on Hand
|
||||
for (UUID cardId : controller.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature()) {
|
||||
card.setIsAllCreatureTypes(true);
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().setIsAllCreatureTypes(true);
|
||||
}
|
||||
}
|
||||
// in Exile
|
||||
for (Card card : game.getState().getExile().getAllCards(game)) {
|
||||
if (card.isCreature() && card.isOwnedBy(controller.getId())) {
|
||||
card.setIsAllCreatureTypes(true);
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().setIsAllCreatureTypes(true);
|
||||
}
|
||||
}
|
||||
// in Library (e.g. for Mystical Teachings)
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
if (card.isOwnedBy(controller.getId()) && card.isCreature()) {
|
||||
card.setIsAllCreatureTypes(true);
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().setIsAllCreatureTypes(true);
|
||||
}
|
||||
}
|
||||
// commander in command zone
|
||||
|
@ -114,7 +114,7 @@ class MaskwoodNexusEffect extends ContinuousEffectImpl {
|
|||
if (card != null
|
||||
&& card.isOwnedBy(controller.getId())
|
||||
&& card.isCreature()) {
|
||||
card.setIsAllCreatureTypes(true);
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().setIsAllCreatureTypes(true);
|
||||
}
|
||||
}
|
||||
// creature spells you control
|
||||
|
@ -124,7 +124,7 @@ class MaskwoodNexusEffect extends ContinuousEffectImpl {
|
|||
&& stackObject.isControlledBy(source.getControllerId())
|
||||
&& stackObject.isCreature()) {
|
||||
Card card = ((Spell) stackObject).getCard();
|
||||
card.setIsAllCreatureTypes(true);
|
||||
game.getState().getCreateMageObjectAttribute(card, game).getSubtype().setIsAllCreatureTypes(true);
|
||||
}
|
||||
}
|
||||
// creatures you control
|
||||
|
@ -132,16 +132,10 @@ class MaskwoodNexusEffect extends ContinuousEffectImpl {
|
|||
new FilterControlledCreaturePermanent(), source.getControllerId(), game);
|
||||
for (Permanent creature : creatures) {
|
||||
if (creature != null) {
|
||||
creature.setIsAllCreatureTypes(true);
|
||||
creature.setIsAllCreatureTypes(game, true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.token.GolemToken;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -71,7 +71,7 @@ class MasterfulReplicationEffect extends OneShotEffect {
|
|||
}
|
||||
for (Permanent copyToArtifact : game.getBattlefield().getAllActivePermanents(source.getControllerId())) {
|
||||
if (copyToArtifact.isArtifact() && !copyToArtifact.getId().equals(copyFromArtifact.getId())) {
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromArtifact, copyToArtifact.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromArtifact, copyToArtifact.getId(), source, new EmptyCopyApplier());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -13,7 +13,7 @@ import mage.constants.CardType;
|
|||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.util.functions.AbilityApplier;
|
||||
import mage.util.functions.AbilityCopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public final class MercurialPretender extends CardImpl {
|
|||
// You may have Mercurial Pretender enter the battlefield as a copy of any creature you control,
|
||||
// except it has "{2}{U}{U}: Return this creature to its owner's hand."
|
||||
Effect effect = new CopyPermanentEffect(new FilterControlledCreaturePermanent(),
|
||||
new AbilityApplier(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ManaCostsImpl("{2}{U}{U}"))));
|
||||
new AbilityCopyApplier(new SimpleActivatedAbility(Zone.BATTLEFIELD, new ReturnToHandSourceEffect(true), new ManaCostsImpl("{2}{U}{U}"))));
|
||||
effect.setText(effectText);
|
||||
this.addAbility(new EntersBattlefieldAbility(effect, true));
|
||||
}
|
||||
|
|
|
@ -133,9 +133,7 @@ class MetamorphicAlterationEffect extends ContinuousEffectImpl {
|
|||
permanent.addCardType(cardType);
|
||||
}
|
||||
permanent.removeAllSubTypes(game);
|
||||
permanent.setIsAllCreatureTypes(copied.isAllCreatureTypes());
|
||||
permanent.getSubtype(game).addAll(copied.getSubtype(game));
|
||||
permanent.setIsAllCreatureTypes(copied.isAllCreatureTypes());
|
||||
permanent.copySubTypesFrom(game, copied);
|
||||
permanent.getColor(game).setColor(copied.getColor(game));
|
||||
permanent.removeAllAbilities(source.getSourceId(), game);
|
||||
for (Ability ability : copied.getAbilities()) {
|
||||
|
|
|
@ -16,7 +16,7 @@ import mage.filter.StaticFilters;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -66,7 +66,7 @@ class MirageMirrorCopyEffect extends OneShotEffect {
|
|||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (sourcePermanent != null && copyFromPermanent != null) {
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -32,8 +32,7 @@ public final class MirrorEntity extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// {X}: Until end of turn, creatures you control have base power and toughness X/X and gain all creature types.
|
||||
Ability ability = new SimpleActivatedAbility(new SetPowerToughnessAllEffect(
|
||||
|
@ -88,7 +87,7 @@ class MirrorEntityEffect extends ContinuousEffectImpl {
|
|||
it.remove(); // no longer on the battlefield, remove reference to object
|
||||
continue;
|
||||
}
|
||||
permanent.setIsAllCreatureTypes(true);
|
||||
permanent.setIsAllCreatureTypes(game, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import mage.filter.predicate.mageobject.ChosenSubtypePredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -77,7 +77,7 @@ class MirrorOfTheForebearsCopyEffect extends OneShotEffect {
|
|||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (sourcePermanent != null && copyFromPermanent != null) {
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
|
||||
game.addEffect(new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT), source);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ import mage.game.Game;
|
|||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -77,7 +77,7 @@ class MirrorWeaveEffect extends OneShotEffect {
|
|||
filter.add(Predicates.not(new PermanentIdPredicate(copyFromCreature.getId())));
|
||||
for (Permanent copyToCreature : game.getBattlefield().getAllActivePermanents(filter, game)) {
|
||||
if (copyToCreature != null) {
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromCreature, copyToCreature.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromCreature, copyToCreature.getId(), source, new EmptyCopyApplier());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package mage.cards.m;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.continuous.IsAllCreatureTypesSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
|
@ -26,13 +26,10 @@ public final class MistformUltimus extends CardImpl {
|
|||
this.toughness = new MageInt(3);
|
||||
|
||||
// Mistform Ultimus is every creature type.
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new InfoEffect(
|
||||
"{this} is every creature type <i>(even if this card isn't on the battlefield)</i>."
|
||||
)));
|
||||
this.addAbility(new SimpleStaticAbility(Zone.ALL, new IsAllCreatureTypesSourceEffect()));
|
||||
}
|
||||
|
||||
public MistformUltimus(final MistformUltimus card) {
|
||||
private MistformUltimus(final MistformUltimus card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.m;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.MageObject;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
|
@ -9,24 +8,24 @@ import mage.abilities.common.SimpleStaticAbility;
|
|||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.effects.common.continuous.BecomesChosenCreatureTypeSourceEffect;
|
||||
import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect;
|
||||
import mage.constants.SubType;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubTypeSet;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.SubType;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TheElk801
|
||||
*/
|
||||
public final class MistformWarchief extends CardImpl {
|
||||
|
||||
private static final FilterCard filter = new FilterCard("Creature spells you cast that share a creature type with {this}");
|
||||
private static final FilterCard filter = new FilterCard();
|
||||
|
||||
static {
|
||||
filter.add(new MistformWarchiefPredicate());
|
||||
|
@ -41,7 +40,6 @@ public final class MistformWarchief extends CardImpl {
|
|||
|
||||
// Creature spells you cast that share a creature type with Mistform Warchief cost {1} less to cast.
|
||||
this.addAbility(new SimpleStaticAbility(
|
||||
Zone.BATTLEFIELD,
|
||||
new SpellsCostReductionControllerEffect(filter, 1)
|
||||
.setText("Creature spells you cast that share a creature type with {this} cost {1} less to cast")
|
||||
));
|
||||
|
@ -50,7 +48,7 @@ public final class MistformWarchief extends CardImpl {
|
|||
this.addAbility(new SimpleActivatedAbility(new BecomesChosenCreatureTypeSourceEffect(), new TapSourceCost()));
|
||||
}
|
||||
|
||||
public MistformWarchief(final MistformWarchief card) {
|
||||
private MistformWarchief(final MistformWarchief card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
|
@ -60,20 +58,12 @@ public final class MistformWarchief extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class MistformWarchiefPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<MageObject>> {
|
||||
class MistformWarchiefPredicate implements ObjectSourcePlayerPredicate<ObjectSourcePlayer<Card>> {
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<MageObject> input, Game game) {
|
||||
public boolean apply(ObjectSourcePlayer<Card> input, Game game) {
|
||||
MageObject sourceObject = game.getObject(input.getSourceId());
|
||||
if (sourceObject != null) {
|
||||
for (SubType subType : sourceObject.getSubtype(game)) {
|
||||
if (subType.getSubTypeSet() == SubTypeSet.CreatureType && input.getObject().hasSubtype(subType, game)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return sourceObject != null && sourceObject.shareCreatureTypes(game, input.getObject());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,8 +27,7 @@ public final class Mistwalker extends CardImpl {
|
|||
this.toughness = new MageInt(4);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// Flying
|
||||
this.addAbility(FlyingAbility.getInstance());
|
||||
|
|
|
@ -15,7 +15,7 @@ import mage.constants.Zone;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.common.TargetArtifactPermanent;
|
||||
import mage.util.functions.EmptyApplyToPermanent;
|
||||
import mage.util.functions.EmptyCopyApplier;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -68,7 +68,7 @@ class MizziumTransreliquatCopyEffect extends OneShotEffect {
|
|||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (sourcePermanent != null && copyFromPermanent != null) {
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyApplyToPermanent());
|
||||
game.copyPermanent(Duration.EndOfTurn, copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -96,7 +96,7 @@ class MizziumTransreliquatCopyAndGainAbilityEffect extends OneShotEffect {
|
|||
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
|
||||
Permanent copyFromPermanent = game.getPermanent(getTargetPointer().getFirst(game, source));
|
||||
if (sourcePermanent != null && copyFromPermanent != null) {
|
||||
Permanent newPermanent = game.copyPermanent(copyFromPermanent, sourcePermanent.getId(), source, new EmptyApplyToPermanent());
|
||||
Permanent newPermanent = game.copyPermanent(copyFromPermanent, sourcePermanent.getId(), source, new EmptyCopyApplier());
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MizziumTransreliquatCopyAndGainAbilityEffect(), new ManaCostsImpl("{1}{U}{R}"));
|
||||
ability.addTarget(new TargetArtifactPermanent());
|
||||
newPermanent.addAbility(ability, source.getSourceId(), game);
|
||||
|
|
|
@ -24,8 +24,7 @@ public final class MoongloveChangeling extends CardImpl {
|
|||
|
||||
this.power = new MageInt(2);
|
||||
this.toughness = new MageInt(2);
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new GainAbilitySourceEffect(DeathtouchAbility.getInstance(), Duration.EndOfTurn), new ColoredManaCost(ColoredManaSymbol.B)));
|
||||
}
|
||||
|
||||
|
|
|
@ -15,8 +15,7 @@ import mage.constants.SuperType;
|
|||
import mage.counters.CounterType;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.util.functions.ApplyToPermanent;
|
||||
import mage.util.functions.CopyApplier;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -35,12 +34,11 @@ public final class MoritteOfTheFrost extends CardImpl {
|
|||
this.toughness = new MageInt(0);
|
||||
|
||||
// Changeling
|
||||
this.setIsAllCreatureTypes(true);
|
||||
this.addAbility(ChangelingAbility.getInstance());
|
||||
this.addAbility(new ChangelingAbility());
|
||||
|
||||
// You may have Moritte of the Frost enter the battlefield as a copy of a permanent you control, except it's legendary and snow in addition to its other types and, if it's a creature, it enters with two additional +1/+1 counters on it and has changeling.
|
||||
this.addAbility(new EntersBattlefieldAbility(new CopyPermanentEffect(
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT, new MoritteOfTheFrostApplier()
|
||||
StaticFilters.FILTER_CONTROLLED_PERMANENT, new MoritteOfTheFrostCopyApplier()
|
||||
).setText("as a copy of a permanent you control, except it's legendary and snow in addition to its other types " +
|
||||
"and, if it's a creature, it enters with two additional +1/+1 counters on it and has changeling."
|
||||
), true));
|
||||
|
@ -56,24 +54,18 @@ public final class MoritteOfTheFrost extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class MoritteOfTheFrostApplier extends ApplyToPermanent {
|
||||
class MoritteOfTheFrostCopyApplier extends CopyApplier {
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Permanent copyFromBlueprint, Ability source, UUID copyToObjectId) {
|
||||
return apply(game, (MageObject) copyFromBlueprint, source, copyToObjectId);
|
||||
}
|
||||
public boolean apply(Game game, MageObject blueprint, Ability source, UUID copyToObjectId) {
|
||||
blueprint.addSuperType(SuperType.LEGENDARY);
|
||||
blueprint.addSuperType(SuperType.SNOW);
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, MageObject copyFromBlueprint, Ability source, UUID copyToObjectId) {
|
||||
copyFromBlueprint.addSuperType(SuperType.LEGENDARY);
|
||||
copyFromBlueprint.addSuperType(SuperType.SNOW);
|
||||
|
||||
if (!isCopyOfCopy(source, copyToObjectId) && copyFromBlueprint.isCreature()) {
|
||||
copyFromBlueprint.setIsAllCreatureTypes(true);
|
||||
copyFromBlueprint.getAbilities().add(ChangelingAbility.getInstance());
|
||||
new AddCountersSourceEffect(
|
||||
CounterType.P1P1.createInstance(2), false
|
||||
).apply(game, source);
|
||||
if (!isCopyOfCopy(source, copyToObjectId) && blueprint.isCreature()) {
|
||||
blueprint.getAbilities().add(new ChangelingAbility());
|
||||
blueprint.getAbilities().add(new EntersBattlefieldAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance(2), false)
|
||||
));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue