removed unfinished text changing implementation

This commit is contained in:
Evan Kranzler 2022-02-06 18:09:41 -05:00
parent 3ca6a38bb1
commit f7b1078210
17 changed files with 41 additions and 379 deletions

View file

@ -7,18 +7,16 @@ import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.KickerAbility;
import mage.abilities.text.TextPartSubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.TextPartSubtypePredicate;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetOpponent;
import java.util.UUID;
@ -28,15 +26,18 @@ import java.util.UUID;
*/
public final class BloodTribute extends CardImpl {
private static final FilterControlledPermanent filter
= new FilterControlledPermanent(SubType.VAMPIRE, "an untapped Vampire you control");
static {
filter.add(TappedPredicate.UNTAPPED);
}
public BloodTribute(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{4}{B}{B}");
// Kicker - Tap an untapped Vampire you control.
TextPartSubType textPartVampire = (TextPartSubType) addTextPart(new TextPartSubType(SubType.VAMPIRE));
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("an untapped Vampire you control");
filter.add(new TextPartSubtypePredicate(textPartVampire));
filter.add(TappedPredicate.UNTAPPED);
this.addAbility(new KickerAbility(new TapTargetCost(new TargetControlledCreaturePermanent(1, 1, filter, true))));
this.addAbility(new KickerAbility(new TapTargetCost(new TargetControlledPermanent(filter))));
// Target opponent loses half their life, rounded up.
this.getSpellAbility().addEffect(new BloodTributeLoseLifeEffect());

View file

@ -1,7 +1,5 @@
package mage.cards.n;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.Mode;
@ -10,38 +8,39 @@ import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainControlTargetEffect;
import mage.abilities.text.TextPartSubType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.choices.Choice;
import mage.choices.ChoiceCreatureType;
import mage.constants.*;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.mageobject.TextPartSubtypePredicate;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class NewBlood extends CardImpl {
private static final FilterControlledPermanent filter
= new FilterControlledPermanent(SubType.VAMPIRE, "an untapped Vampire you control");
static {
filter.add(TappedPredicate.UNTAPPED);
}
public NewBlood(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{B}{B}");
TextPartSubType textPartVampire = (TextPartSubType) addTextPart(new TextPartSubType(SubType.VAMPIRE));
FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("an untapped Vampire you control");
filter.add(new TextPartSubtypePredicate(textPartVampire));
filter.add(TappedPredicate.UNTAPPED);
// As an additional cost to cast New Blood, tap an untapped Vampire you control.
this.getSpellAbility().addCost(new TapTargetCost(
new TargetControlledCreaturePermanent(1, 1, filter, true)));
this.getSpellAbility().addCost(new TapTargetCost(new TargetControlledPermanent(filter)));
// Gain control of target creature. Change the text of that creature by replacing all instances of one creature type with Vampire.
getSpellAbility().addEffect(new NewBloodEffect());
@ -136,36 +135,26 @@ class ChangeCreatureTypeTargetEffect extends ContinuousEffectImpl {
if (controller == null) {
return false;
}
if (fromSubType != null) {
boolean objectFound = false;
for (UUID targetId : targetPointer.getTargets(game, source)) {
MageObject targetObject = game.getObject(targetId);
if (targetObject != null) {
objectFound = true;
switch (layer) {
case TextChangingEffects_3:
targetObject.changeSubType(fromSubType, toSubType);
break;
case TypeChangingEffects_4:
if (sublayer == SubLayer.NA) {
if (targetObject.hasSubtype(fromSubType, game)) {
targetObject.removeSubType(game, fromSubType);
if (!targetObject.hasSubtype(toSubType, game)) {
targetObject.addSubType(game, toSubType);
}
}
break;
}
}
}
if (!objectFound && this.getDuration() == Duration.Custom) {
this.discard();
}
}
return true;
} else {
if (fromSubType == null) {
throw new UnsupportedOperationException("No subtype to change set");
}
boolean objectFound = false;
for (UUID targetId : targetPointer.getTargets(game, source)) {
MageObject targetObject = game.getObject(targetId);
if (targetObject != null) {
objectFound = true;
if (targetObject.hasSubtype(fromSubType, game)) {
targetObject.removeSubType(game, fromSubType);
if (!targetObject.hasSubtype(toSubType, game)) {
targetObject.addSubType(game, toSubType);
}
}
}
if (!objectFound && this.getDuration() == Duration.Custom) {
this.discard();
}
}
return true;
}
@Override
@ -175,8 +164,7 @@ class ChangeCreatureTypeTargetEffect extends ContinuousEffectImpl {
@Override
public boolean hasLayer(Layer layer) {
return layer == Layer.TextChangingEffects_3
|| layer == Layer.TypeChangingEffects_4;
return layer == Layer.TypeChangingEffects_4;
}
@Override

View file

@ -4,7 +4,6 @@ import mage.abilities.Abilities;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.CardType;
@ -508,13 +507,5 @@ public interface MageObject extends MageItem, Serializable, Copyable<MageObject>
*/
void setIsAllCreatureTypes(Game game, boolean value);
List<TextPart> getTextParts();
TextPart addTextPart(TextPart textPart);
void removePTCDA();
default void changeSubType(SubType fromSubType, SubType toSubType) {
}
}

View file

@ -9,10 +9,7 @@ import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.keyword.ChangelingAbility;
import mage.abilities.mana.ActivatedManaAbilityImpl;
import mage.abilities.text.TextPart;
import mage.abilities.text.TextPartSubType;
import mage.cards.FrameStyle;
import mage.cards.mock.MockCard;
import mage.constants.*;
@ -45,7 +42,6 @@ public abstract class MageObjectImpl implements MageObject {
protected MageInt toughness;
protected boolean copy;
protected MageObject copyFrom; // copied card INFO (used to call original adjusters)
protected List<TextPart> textParts;
public MageObjectImpl() {
this(UUID.randomUUID());
@ -60,7 +56,6 @@ public abstract class MageObjectImpl implements MageObject {
frameStyle = FrameStyle.M15_NORMAL;
manaCost = new ManaCostsImpl<>();
abilities = new AbilitiesImpl<>();
textParts = new ArrayList<>();
}
public MageObjectImpl(final MageObjectImpl object) {
@ -79,8 +74,6 @@ public abstract class MageObjectImpl implements MageObject {
supertype.addAll(object.supertype);
this.copy = object.copy;
this.copyFrom = (object.copyFrom != null ? object.copyFrom.copy() : null);
textParts = new ArrayList<>();
textParts.addAll(object.textParts);
}
@Override
@ -316,26 +309,6 @@ public abstract class MageObjectImpl implements MageObject {
this.getSubtype(game).setIsAllCreatureTypes(value && (this.isTribal(game) || this.isCreature(game)));
}
@Override
public List<TextPart> getTextParts() {
return textParts;
}
@Override
public TextPart addTextPart(TextPart textPart) {
textParts.add(textPart);
return textPart;
}
@Override
public void changeSubType(SubType fromSubType, SubType toSubType) {
for (TextPart textPart : textParts) {
if (textPart instanceof TextPartSubType && textPart.getCurrentValue().equals(fromSubType)) {
textPart.replaceWith(toSubType);
}
}
}
/**
* Remove power/toughness character defining abilities
*/

View file

@ -1,26 +0,0 @@
package mage.abilities.text;
import java.io.Serializable;
import java.util.UUID;
import mage.util.Copyable;
/**
*
* @author LevelX2
* @param <E>
*/
public interface TextPart<E> extends Serializable, Copyable<TextPart> {
UUID getId();
String getText();
E getBaseValue();
E getCurrentValue();
void replaceWith(E o);
void reset();
}

View file

@ -1,64 +0,0 @@
package mage.abilities.text;
import mage.ObjectColor;
/**
*
* This implementation is not finished yet. There is no support to also change
* the rules text of an object.
*
* @author LevelX2
*/
public class TextPartColor extends TextPartImpl<ObjectColor> {
private final ObjectColor objectColorBase;
private ObjectColor objectColorCurrent;
public TextPartColor(ObjectColor objectColor) {
this.objectColorBase = objectColor;
this.objectColorCurrent = objectColor;
}
public TextPartColor(final TextPartColor textPartColor) {
super();
this.objectColorBase = textPartColor.objectColorBase;
this.objectColorCurrent = textPartColor.objectColorCurrent;
}
@Override
public String getText() {
return objectColorCurrent.getDescription();
}
@Override
public ObjectColor getCurrentValue() {
return objectColorCurrent;
}
@Override
public ObjectColor getBaseValue() {
return objectColorBase;
}
@Override
public void replaceWith(ObjectColor objectColor) {
this.objectColorCurrent = objectColor;
}
@Override
public void reset() {
this.objectColorCurrent = this.objectColorBase;
}
@Override
public TextPartColor copy() {
return new TextPartColor(this);
}
@Override
public String toString() {
return objectColorCurrent.toString();
}
}

View file

@ -1,27 +0,0 @@
package mage.abilities.text;
import java.util.UUID;
/**
*
* @author LevelX2
* @param <E>
*/
public abstract class TextPartImpl<E> implements TextPart<E> {
private final UUID id;
public TextPartImpl() {
this.id = UUID.randomUUID();
}
public TextPartImpl(final TextPartImpl textPartimpl) {
this.id = textPartimpl.id;
}
@Override
public UUID getId() {
return id;
}
}

View file

@ -1,64 +0,0 @@
package mage.abilities.text;
import mage.constants.SubType;
/**
* This implementation is not finished yet. There is no support to also change
* the rules text of an object. Also all the cards that user subtypes in the
* text have to be updated with the new elements.
*
* @author LevelX2
*/
public class TextPartSubType extends TextPartImpl<SubType> {
private final SubType subTypeBase;
private SubType subTypeCurrent;
public TextPartSubType(SubType subType) {
this.subTypeBase = subType;
this.subTypeCurrent = subType;
}
public TextPartSubType(final TextPartSubType textPartSubType) {
super();
this.subTypeBase = textPartSubType.subTypeBase;
this.subTypeCurrent = textPartSubType.subTypeCurrent;
}
@Override
public String getText() {
return subTypeCurrent.getDescription();
}
@Override
public SubType getCurrentValue() {
return subTypeCurrent;
}
@Override
public SubType getBaseValue() {
return subTypeBase;
}
@Override
public void replaceWith(SubType subType) {
this.subTypeCurrent = subType;
}
@Override
public void reset() {
this.subTypeCurrent = this.subTypeBase;
}
@Override
public TextPartSubType copy() {
return new TextPartSubType(this);
}
@Override
public String toString() {
return subTypeCurrent.toString();
}
}

View file

@ -9,7 +9,6 @@ import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.text.TextPart;
import mage.cards.FrameStyle;
import mage.constants.CardType;
import mage.constants.SubType;
@ -271,16 +270,6 @@ public abstract class Designation implements MageObject {
public void setIsAllCreatureTypes(Game game, boolean value) {
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public boolean isUnique() {
return unique;
}

View file

@ -1,29 +0,0 @@
package mage.filter.predicate.mageobject;
import mage.MageObject;
import mage.abilities.text.TextPartSubType;
import mage.filter.predicate.Predicate;
import mage.game.Game;
/**
*
* @author LevelX2
*/
public class TextPartSubtypePredicate implements Predicate<MageObject> {
private final TextPartSubType textPartSubtype;
public TextPartSubtypePredicate(TextPartSubType textPartSubtype) {
this.textPartSubtype = textPartSubtype;
}
@Override
public boolean apply(MageObject input, Game game) {
return input.hasSubtype(textPartSubtype.getCurrentValue(), game);
}
@Override
public String toString() {
return "Subtype(" + textPartSubtype.getCurrentValue() + ')';
}
}

View file

@ -8,7 +8,6 @@ import mage.abilities.common.CastCommanderAbility;
import mage.abilities.common.PlayLandAsCommanderAbility;
import mage.abilities.costs.mana.ManaCost;
import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.CardType;
@ -319,16 +318,6 @@ public class Commander implements CommandObject {
public void setIsAllCreatureTypes(Game game, boolean value) {
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void removePTCDA() {
}

View file

@ -12,7 +12,6 @@ import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.hint.HintUtils;
import mage.abilities.text.TextPart;
import mage.cards.FrameStyle;
import mage.choices.Choice;
import mage.choices.ChoiceHintType;
@ -382,16 +381,6 @@ public class Dungeon implements CommandObject {
}
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void removePTCDA() {
}

View file

@ -11,7 +11,6 @@ import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.CardType;
@ -291,16 +290,6 @@ public class Emblem implements CommandObject {
}
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void removePTCDA() {
}

View file

@ -11,7 +11,6 @@ import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.CardType;
@ -300,16 +299,6 @@ public class Plane implements CommandObject {
}
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void removePTCDA() {
}

View file

@ -15,7 +15,6 @@ import mage.abilities.effects.common.RegenerateSourceEffect;
import mage.abilities.hint.Hint;
import mage.abilities.hint.HintUtils;
import mage.abilities.keyword.*;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.*;
@ -210,9 +209,6 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
this.minBlockedBy = 1;
this.maxBlockedBy = 0;
this.copy = false;
for (TextPart textPart : textParts) {
textPart.reset();
}
}
@Override

View file

@ -12,7 +12,6 @@ import mage.abilities.costs.mana.ManaCosts;
import mage.abilities.keyword.BestowAbility;
import mage.abilities.keyword.MorphAbility;
import mage.abilities.keyword.TransformAbility;
import mage.abilities.text.TextPart;
import mage.cards.*;
import mage.constants.*;
import mage.counters.Counter;
@ -1103,16 +1102,6 @@ public class Spell extends StackObjectImpl implements Card {
public void setIsAllCreatureTypes(Game game, boolean value) {
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<UUID> getAttachments() {
throw new UnsupportedOperationException("Not supported."); //To change body of generated methods, choose Tools | Templates.

View file

@ -16,7 +16,6 @@ import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects;
import mage.abilities.hint.Hint;
import mage.abilities.icon.CardIcon;
import mage.abilities.text.TextPart;
import mage.cards.Card;
import mage.cards.FrameStyle;
import mage.constants.*;
@ -646,16 +645,6 @@ public class StackAbility extends StackObjectImpl implements Ability {
public void setIsAllCreatureTypes(Game game, boolean value) {
}
@Override
public List<TextPart> getTextParts() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public TextPart addTextPart(TextPart textPart) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public StackAbility setTargetAdjuster(TargetAdjuster targetAdjuster) {
this.targetAdjuster = targetAdjuster;