diff --git a/Mage.Sets/src/mage/cards/c/CherishedHatchling.java b/Mage.Sets/src/mage/cards/c/CherishedHatchling.java index 45602d1076..fa22c05462 100644 --- a/Mage.Sets/src/mage/cards/c/CherishedHatchling.java +++ b/Mage.Sets/src/mage/cards/c/CherishedHatchling.java @@ -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() { diff --git a/Mage.Sets/src/mage/cards/w/WindSail.java b/Mage.Sets/src/mage/cards/w/WindSail.java index 8bdfb4be97..751dc29918 100644 --- a/Mage.Sets/src/mage/cards/w/WindSail.java +++ b/Mage.Sets/src/mage/cards/w/WindSail.java @@ -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)); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java index 8ae7458ccc..2d8d183a1c 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/CastAsThoughItHadFlashAllEffect.java @@ -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()); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java index 1e6c99f7c2..59104a1e7a 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/GainAbilityTargetEffect.java @@ -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)); diff --git a/Mage/src/main/java/mage/target/TargetImpl.java b/Mage/src/main/java/mage/target/TargetImpl.java index 5e098fa900..233afdaaaa 100644 --- a/Mage/src/main/java/mage/target/TargetImpl.java +++ b/Mage/src/main/java/mage/target/TargetImpl.java @@ -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) { - sb.append("up to "); + 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")) { diff --git a/Mage/src/main/java/mage/target/common/TargetCreaturePermanent.java b/Mage/src/main/java/mage/target/common/TargetCreaturePermanent.java index 196d965365..ab04063f60 100644 --- a/Mage/src/main/java/mage/target/common/TargetCreaturePermanent.java +++ b/Mage/src/main/java/mage/target/common/TargetCreaturePermanent.java @@ -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) {