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

@ -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();
}
}