This commit is contained in:
Alex W. Jackson 2022-09-12 06:56:07 -04:00
parent 46cc674a8e
commit dc33531792
6 changed files with 24 additions and 44 deletions

View file

@ -46,7 +46,7 @@ public final class CherishedHatchling extends CardImpl {
// When Cherished Hatchling dies, you may cast Dinosaur spells this turn as though they had flash, and whenever you cast a Dinosaur spell this turn, it gains "When this creature enters the battlefield, you may have it fight another target creature."
Ability ability = new DiesSourceTriggeredAbility(new CastAsThoughItHadFlashAllEffect(Duration.EndOfTurn, filterCard, false));
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new CherishedHatchlingTriggeredAbility()));
ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new CherishedHatchlingTriggeredAbility()).concatBy(", and"));
this.addAbility(ability);
}
@ -69,8 +69,8 @@ class CherishedHatchlingTriggeredAbility extends DelayedTriggeredAbility {
}
public CherishedHatchlingTriggeredAbility() {
super(getEffectToAdd(), Duration.EndOfTurn, true);
setTriggerPhrase("and whenever you cast a Dinosaur spell this turn, ");
super(getEffectToAdd(), Duration.EndOfTurn, false);
setTriggerPhrase("whenever you cast a Dinosaur spell this turn, ");
}
private static Effect getEffectToAdd() {

View file

@ -22,7 +22,6 @@ public final class WindSail extends CardImpl {
// One or two target creatures gain flying until end of turn.
Effect effect = new GainAbilityTargetEffect(FlyingAbility.getInstance(), Duration.EndOfTurn);
effect.setText("One or two target creatures gain flying until end of turn");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetCreaturePermanent(1, 2));
}

View file

@ -71,19 +71,13 @@ public class CastAsThoughItHadFlashAllEffect extends AsThoughEffectImpl {
}
private String setText() {
StringBuilder sb = new StringBuilder();
if (anyPlayer) {
sb.append("Any player");
} else {
sb.append("You");
}
StringBuilder sb = new StringBuilder(anyPlayer ? "any player" : "you");
sb.append(" may cast ");
sb.append(filter.getMessage());
if (!duration.toString().isEmpty()) {
if (duration == Duration.EndOfTurn) {
sb.append(" this turn");
} else {
sb.append(' ');
sb.append(' ');
sb.append(duration.toString());
}

View file

@ -42,11 +42,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
}
public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean useOnCard) {
this(ability, duration, rule, useOnCard, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA);
}
public GainAbilityTargetEffect(Ability ability, Duration duration, String rule, boolean useOnCard, Layer layer, SubLayer subLayer) {
super(duration, layer, subLayer, ability.getEffects().getOutcome(ability, Outcome.AddAbility));
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, ability.getEffects().getOutcome(ability, Outcome.AddAbility));
this.ability = ability;
this.staticText = rule;
this.useOnCard = useOnCard;
@ -159,6 +155,8 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
// start waiting a spell's permanent (example: Tyvar Kell's emblem)
Permanent perm = game.getPermanent(mor.getSourceId());
if (perm != null) {
perm.addAbility(ability, source.getSourceId(), game);
affectedTargets++;
newWaitingPermanents.add(new MageObjectReference(perm, game));
this.waitingCardPermanent = false;
}
@ -209,27 +207,8 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder();
if (mode.getTargets().size() > 0) {
Target target = mode.getTargets().get(0);
if (target.getMaxNumberOfTargets() == Integer.MAX_VALUE) {
sb.append("any number of target ").append(target.getTargetName()).append(" gain ");
} else if (target.getMaxNumberOfTargets() > 1) {
if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) {
sb.append("up to ");
}
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName()).append(" gain ");
} else {
if (!target.getTargetName().toLowerCase(Locale.ENGLISH).startsWith("another")) {
sb.append("target ");
}
sb.append(target.getTargetName()).append(" gains ");
}
} else {
sb.append("gains ");
}
StringBuilder sb = new StringBuilder(getTargetPointer().describeTargets(mode.getTargets(), ""));
sb.append(getTargetPointer().isPlural(mode.getTargets()) ? " gain " : " gains ");
sb.append(ability.getRule());
if (durationPhaseStep != null) {
sb.append(" until your next ").append(durationPhaseStep.toString().toLowerCase(Locale.ENGLISH));

View file

@ -101,11 +101,19 @@ public abstract class TargetImpl implements Target {
public String getDescription() {
// target description for ability text
StringBuilder sb = new StringBuilder();
if (getNumberOfTargets() != 1 || getMaxNumberOfTargets() != 1) {
if (getNumberOfTargets() < getMaxNumberOfTargets() && getMaxNumberOfTargets() != Integer.MAX_VALUE) {
int min = getMinNumberOfTargets();
int max = getMaxNumberOfTargets();
if (min != 1 || max != 1) {
if (min < max && max != Integer.MAX_VALUE) {
if (min == 1 && max == 2) {
sb.append("one or ");
} else if (min == 1 && max == 3) {
sb.append("one, two, or ");
} else {
sb.append("up to ");
}
sb.append(CardUtil.numberToText(getMaxNumberOfTargets()));
}
sb.append(CardUtil.numberToText(max));
sb.append(' ');
}
if (!isNotTarget() && !getTargetName().contains("target")) {

View file

@ -13,7 +13,7 @@ import mage.target.TargetPermanent;
public class TargetCreaturePermanent extends TargetPermanent {
public TargetCreaturePermanent() {
this(1, 1, FILTER_PERMANENT_CREATURE, false);
this(1);
}
public TargetCreaturePermanent(FilterCreaturePermanent filter) {
@ -21,11 +21,11 @@ public class TargetCreaturePermanent extends TargetPermanent {
}
public TargetCreaturePermanent(int numTargets) {
this(numTargets, numTargets, StaticFilters.FILTER_PERMANENT_CREATURE, false);
this(numTargets, numTargets);
}
public TargetCreaturePermanent(int minNumTargets, int maxNumTargets) {
this(minNumTargets, maxNumTargets, StaticFilters.FILTER_PERMANENT_CREATURE, false);
this(minNumTargets, maxNumTargets, maxNumTargets > 1 ? StaticFilters.FILTER_PERMANENT_CREATURES : StaticFilters.FILTER_PERMANENT_CREATURE, false);
}
public TargetCreaturePermanent(int minNumTargets, int maxNumTargets, FilterCreaturePermanent filter, boolean notTarget) {