cleanup add color/subtype attached effects

This commit is contained in:
xenohedron 2023-09-06 00:19:08 -04:00
parent 72be1856f7
commit 34b671bc83
15 changed files with 30 additions and 53 deletions

View file

@ -31,10 +31,10 @@ public final class AngelicArmaments extends CardImpl {
FlyingAbility.getInstance(), AttachmentType.EQUIPMENT
).setText(", has flying"));
ability.addEffect(new AddCardColorAttachedEffect(
ObjectColor.WHITE, Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT
ObjectColor.WHITE, AttachmentType.EQUIPMENT
).setText(","));
ability.addEffect(new AddCardSubtypeAttachedEffect(
SubType.ANGEL, Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT
SubType.ANGEL, AttachmentType.EQUIPMENT
).setText("is a white Angel in addition to its other colors and types").concatBy("and"));
this.addAbility(ability);

View file

@ -45,7 +45,7 @@ public final class AngelicDestiny extends CardImpl {
effect = new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.AURA);
effect.setText("and first strike");
ability.addEffect(effect);
effect = new AddCardSubtypeAttachedEffect(SubType.ANGEL, Duration.WhileOnBattlefield, AttachmentType.AURA);
effect = new AddCardSubtypeAttachedEffect(SubType.ANGEL, AttachmentType.AURA);
effect.setText(", and is an Angel in addition to its other types");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -39,7 +39,7 @@ public final class CallToServe extends CardImpl {
Effect effect = new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA);
effect.setText(", has flying");
ability.addEffect(effect);
effect = new AddCardSubtypeAttachedEffect(SubType.ANGEL, Duration.WhileOnBattlefield, AttachmentType.AURA);
effect = new AddCardSubtypeAttachedEffect(SubType.ANGEL, AttachmentType.AURA);
effect.setText(", and is an Angel in addition to its other types");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -17,7 +17,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
@ -42,7 +41,7 @@ public final class CaptainsHook extends CardImpl {
effect.setText(", has menace");
ability.addEffect(effect);
//, and is a Pirate in addition to its other creature types
effect = new AddCardSubtypeAttachedEffect(SubType.PIRATE, Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT);
effect = new AddCardSubtypeAttachedEffect(SubType.PIRATE, AttachmentType.EQUIPMENT);
effect.setText(", and is a Pirate in addition to its other creature types");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -48,7 +48,7 @@ public final class DemonicEmbrace extends CardImpl {
Effect effect = new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA);
effect.setText(", has flying");
ability.addEffect(effect);
effect = new AddCardSubtypeAttachedEffect(SubType.DEMON, Duration.WhileOnBattlefield, AttachmentType.AURA);
effect = new AddCardSubtypeAttachedEffect(SubType.DEMON, AttachmentType.AURA);
effect.setText(", and is a Demon in addition to its other types");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -45,7 +45,7 @@ public final class DraconicDestiny extends CardImpl {
ability.addEffect(new GainAbilityAttachedEffect(new SimpleActivatedAbility(
new BoostSourceEffect(1, 0, Duration.EndOfTurn), new GenericManaCost(1)
), AttachmentType.AURA).setText(", and \"{1}: This creature gets +1/+0 until end of turn.\""));
ability.addEffect(new AddCardSubtypeAttachedEffect(SubType.DRAGON, Duration.WhileOnBattlefield, AttachmentType.AURA)
ability.addEffect(new AddCardSubtypeAttachedEffect(SubType.DRAGON, AttachmentType.AURA)
.setText("It's a Dragon in addition to its other types"));
this.addAbility(ability);

View file

@ -15,7 +15,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone;
@ -45,7 +44,7 @@ public final class Dub extends CardImpl {
effect = new GainAbilityAttachedEffect(FirstStrikeAbility.getInstance(), AttachmentType.AURA);
effect.setText(", has first strike");
ability.addEffect(effect);
effect = new AddCardSubtypeAttachedEffect(SubType.KNIGHT, Duration.WhileOnBattlefield, AttachmentType.AURA);
effect = new AddCardSubtypeAttachedEffect(SubType.KNIGHT, AttachmentType.AURA);
effect.setText(", and is a Knight in addition to its other types");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -1,8 +1,8 @@
package mage.cards.g;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.AddCardColorAttachedEffect;
@ -24,7 +24,6 @@ public final class Ghoulflesh extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}");
this.subtype.add(SubType.AURA);
// Enchant creature
TargetPermanent auraTarget = new TargetCreaturePermanent();
this.getSpellAbility().addTarget(auraTarget);
@ -32,9 +31,12 @@ public final class Ghoulflesh extends CardImpl {
this.addAbility(new EnchantAbility(auraTarget));
// Enchanted creature gets -1/-1 and is a black Zombie in addition to its other colors and types.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEnchantedEffect(-1, -1, Duration.WhileOnBattlefield)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AddCardSubtypeAttachedEffect(SubType.ZOMBIE, Duration.WhileOnBattlefield, AttachmentType.AURA)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AddCardColorAttachedEffect(ObjectColor.BLACK, Duration.WhileOnBattlefield, AttachmentType.AURA)));
Ability ability = new SimpleStaticAbility(new BoostEnchantedEffect(-1, -1, Duration.WhileOnBattlefield));
ability.addEffect(new AddCardColorAttachedEffect(ObjectColor.BLACK, AttachmentType.AURA)
.setText(" and is a black"));
ability.addEffect(new AddCardSubtypeAttachedEffect(SubType.ZOMBIE, AttachmentType.AURA)
.setText(" Zombie in addition to its other colors and types"));
this.addAbility(ability);
}
private Ghoulflesh(final Ghoulflesh card) {

View file

@ -55,7 +55,7 @@ public final class InnerDemon extends CardImpl {
Effect effect = new GainAbilityAttachedEffect(FlyingAbility.getInstance(), AttachmentType.AURA);
effect.setText(", has flying");
ability.addEffect(effect);
effect = new AddCardSubtypeAttachedEffect(SubType.DEMON, Duration.WhileOnBattlefield, AttachmentType.AURA);
effect = new AddCardSubtypeAttachedEffect(SubType.DEMON, AttachmentType.AURA);
effect.setText(", and is a Demon in addition to its other types");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -11,7 +11,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import java.util.UUID;
@ -32,7 +31,7 @@ public final class RavenWings extends CardImpl {
FlyingAbility.getInstance(), AttachmentType.AURA
).setText(", has flying"));
ability.addEffect(new AddCardSubtypeAttachedEffect(
SubType.BIRD, Duration.WhileOnBattlefield, AttachmentType.AURA
SubType.BIRD, AttachmentType.AURA
).setText(", and is a Bird in addition to its other types"));
this.addAbility(ability);

View file

@ -16,7 +16,6 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AttachmentType;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.permanent.token.KnightToken;
@ -44,7 +43,6 @@ public final class SigiledSwordOfValeron extends CardImpl {
).setText(", has vigilance"));
ability.addEffect(new AddCardSubtypeAttachedEffect(
SubType.KNIGHT,
Duration.WhileOnBattlefield,
AttachmentType.EQUIPMENT
).setText(", and is a Knight in addition to its other types"));
this.addAbility(ability);

View file

@ -41,7 +41,7 @@ public final class TallAsABeanstalk extends CardImpl {
ReachAbility.getInstance(), AttachmentType.AURA
).setText(", has reach"));
ability.addEffect(new AddCardSubtypeAttachedEffect(
SubType.GIANT, Duration.WhileOnBattlefield, AttachmentType.AURA
SubType.GIANT, AttachmentType.AURA
).setText(", and is a Giant in addition to its other types"));
this.addAbility(ability);
}

View file

@ -26,7 +26,7 @@ public final class TrooperArmor extends CardImpl {
// Equiped creature gets +1/+1 and is a Trooper in addition to its other types.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostEquippedEffect(1, 1)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AddCardSubtypeAttachedEffect(SubType.TROOPER, Duration.WhileOnBattlefield, AttachmentType.EQUIPMENT)));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AddCardSubtypeAttachedEffect(SubType.TROOPER, AttachmentType.EQUIPMENT)));
// Whenever a Trooper enters the battlefield under your control, you may attach {this} to it.
this.addAbility(new EntersBattlefieldControlledTriggeredAbility(

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.ObjectColor;
@ -14,20 +12,18 @@ import mage.game.permanent.Permanent;
*/
public class AddCardColorAttachedEffect extends ContinuousEffectImpl {
private ObjectColor addedColor;
private AttachmentType attachmentType;
private final ObjectColor addedColor;
public AddCardColorAttachedEffect(ObjectColor addedColor, Duration duration, AttachmentType attachmentType) {
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
public AddCardColorAttachedEffect(ObjectColor addedColor, AttachmentType attachmentType) {
super(Duration.WhileOnBattlefield, Layer.ColorChangingEffects_5, SubLayer.NA, Outcome.Benefit);
this.addedColor = addedColor;
this.attachmentType = attachmentType;
setText();
staticText = attachmentType.verb() + " creature is " + addedColor.getDescription()
+ " in addition to its other colors";
}
protected AddCardColorAttachedEffect(final AddCardColorAttachedEffect effect) {
super(effect);
this.addedColor = effect.addedColor;
this.attachmentType = effect.attachmentType;
}
@Override
@ -56,10 +52,4 @@ public class AddCardColorAttachedEffect extends ContinuousEffectImpl {
return new AddCardColorAttachedEffect(this);
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append(attachmentType.verb());
sb.append(" creature is a ").append(addedColor.getDescription()).append(" in addition to its colors");
staticText = sb.toString();
}
}

View file

@ -1,5 +1,3 @@
package mage.abilities.effects.common.continuous;
import mage.abilities.Ability;
@ -7,25 +5,24 @@ import mage.abilities.effects.ContinuousEffectImpl;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
/**
* @author nantuko
*/
public class AddCardSubtypeAttachedEffect extends ContinuousEffectImpl {
private SubType addedSubtype;
private AttachmentType attachmentType;
private final SubType addedSubtype;
public AddCardSubtypeAttachedEffect(SubType addedSubtype, Duration duration, AttachmentType attachmentType) {
super(duration, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
public AddCardSubtypeAttachedEffect(SubType addedSubtype, AttachmentType attachmentType) {
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
this.addedSubtype = addedSubtype;
this.attachmentType = attachmentType;
setText();
staticText = attachmentType.verb() +
" creature becomes " + CardUtil.addArticle(addedSubtype.getDescription()) + " in addition to its other types";
}
protected AddCardSubtypeAttachedEffect(final AddCardSubtypeAttachedEffect effect) {
super(effect);
this.addedSubtype = effect.addedSubtype;
this.attachmentType = effect.attachmentType;
}
@Override
@ -44,11 +41,4 @@ public class AddCardSubtypeAttachedEffect extends ContinuousEffectImpl {
return new AddCardSubtypeAttachedEffect(this);
}
private void setText() {
StringBuilder sb = new StringBuilder();
sb.append(attachmentType.verb());
sb.append(" creature becomes ").append(addedSubtype).append(" in addition to its other types"); //TODO add attacked card type detection
staticText = sb.toString();
}
}