mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
BecomesCreatureTargetEffect - improved text generation
This commit is contained in:
parent
3df7f6940d
commit
e848f85e81
20 changed files with 84 additions and 46 deletions
|
@ -43,7 +43,7 @@ public final class AlloyAnimist extends CardImpl {
|
|||
new CreatureToken(4, 4, "4/4 artifact creature")
|
||||
.withType(CardType.ARTIFACT),
|
||||
false, false, Duration.EndOfTurn
|
||||
), new ManaCostsImpl<>("{2}{G}"));
|
||||
).withDurationRuleAtStart(true), new ManaCostsImpl<>("{2}{G}"));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.effects.common.continuous.BecomesCreatureTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -10,17 +9,21 @@ import mage.constants.Duration;
|
|||
import mage.game.permanent.token.custom.CreatureToken;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public final class AnimateLand extends CardImpl {
|
||||
|
||||
public AnimateLand(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{G}");
|
||||
|
||||
// Until end of turn, target land becomes a 3/3 creature that's still a land.
|
||||
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new CreatureToken(3, 3), false, true, Duration.EndOfTurn));
|
||||
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(
|
||||
new CreatureToken(3, 3),
|
||||
false, true, Duration.EndOfTurn
|
||||
).withDurationRuleAtStart(true));
|
||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ public final class AnthousaSetessanHero extends CardImpl {
|
|||
this.toughness = new MageInt(5);
|
||||
|
||||
// <i>Heroic</i> — Whenever you cast a spell that targets Anthousa, Setessan Hero, up to three target lands you control each become 2/2 Warrior creatures until end of turn. They're still lands.
|
||||
Ability ability = new HeroicAbility(new BecomesCreatureTargetEffect(new CreatureToken(2, 2, "2/2 Warrior creature", SubType.WARRIOR),false,true, Duration.EndOfTurn));
|
||||
Ability ability = new HeroicAbility(new BecomesCreatureTargetEffect(new CreatureToken(2, 2, "2/2 Warrior creatures", SubType.WARRIOR),false,true, Duration.EndOfTurn));
|
||||
ability.addTarget(new TargetControlledPermanent(0,3,new FilterControlledLandPermanent("lands"), false));
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@ public final class DanceOfTheSkywise extends CardImpl {
|
|||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}");
|
||||
|
||||
// Until end of turn, target creature you control becomes a blue Dragon Illusion with base power and toughness 4/4, loses all abilities, and gains flying.
|
||||
Effect effect = new BecomesCreatureTargetEffect(new DragonIllusionToken(), true, false, Duration.EndOfTurn);
|
||||
Effect effect = new BecomesCreatureTargetEffect(
|
||||
new DragonIllusionToken(), true, false, Duration.EndOfTurn)
|
||||
.withDurationRuleAtStart(true);
|
||||
effect.setText("Until end of turn, target creature you control becomes a blue Dragon Illusion with base power and toughness 4/4, loses all abilities, and gains flying.");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
|
||||
|
|
|
@ -36,7 +36,8 @@ public final class Dragonshift extends CardImpl {
|
|||
.withSubType(SubType.DRAGON)
|
||||
.withColor("UR")
|
||||
.withAbility(FlyingAbility.getInstance()),
|
||||
true, false, Duration.EndOfTurn);
|
||||
true, false, Duration.EndOfTurn)
|
||||
.withDurationRuleAtStart(true);
|
||||
effect.setText("Until end of turn, target creature you control becomes a blue and red Dragon with base power and toughness 4/4, loses all abilities, and gains flying.");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
|
||||
|
|
|
@ -78,7 +78,10 @@ class ElvishBranchbenderEffect extends OneShotEffect {
|
|||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
int xValue = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this);
|
||||
ContinuousEffect effect = new BecomesCreatureTargetEffect(new ElvishBranchbenderToken(xValue), false, false, Duration.EndOfTurn); // fix
|
||||
ContinuousEffect effect = new BecomesCreatureTargetEffect(
|
||||
new ElvishBranchbenderToken(xValue),
|
||||
false, false, Duration.EndOfTurn)
|
||||
.withDurationRuleAtStart(true);
|
||||
effect.setTargetPointer(targetPointer);
|
||||
game.addEffect(effect, source);
|
||||
return false;
|
||||
|
|
|
@ -21,7 +21,10 @@ public final class GiftOfTusks extends CardImpl {
|
|||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{U}");
|
||||
|
||||
// Until end of turn, target creature loses all abilities and becomes a green Elephant with base power and toughness 3/3.
|
||||
Effect effect = new BecomesCreatureTargetEffect(new ElephantToken(), true, false, Duration.EndOfTurn);
|
||||
Effect effect = new BecomesCreatureTargetEffect(
|
||||
new ElephantToken(),
|
||||
true, false, Duration.EndOfTurn)
|
||||
.withDurationRuleAtStart(true);
|
||||
effect.setText("Until end of turn, target creature loses all abilities and becomes a green Elephant with base power and toughness 3/3");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
|
|
@ -43,14 +43,14 @@ public final class KamahlHeartOfKrosa extends CardImpl {
|
|||
this.addAbility(ability);
|
||||
|
||||
// {1}{G}: Until end of turn, target land you control becomes a 1/1 Elemental creature with vigilance, indestructible, and haste. It's still a land.
|
||||
ability = new SimpleActivatedAbility(new BecomesCreatureTargetEffect(new CreatureToken(
|
||||
1, 1, "1/1 Elemental creature with vigilance, indestructible, and haste"
|
||||
).withSubType(SubType.ELEMENTAL)
|
||||
.withAbility(VigilanceAbility.getInstance())
|
||||
.withAbility(IndestructibleAbility.getInstance())
|
||||
.withAbility(HasteAbility.getInstance()),
|
||||
ability = new SimpleActivatedAbility(new BecomesCreatureTargetEffect(
|
||||
new CreatureToken(1, 1, "1/1 Elemental creature with vigilance, indestructible, and haste")
|
||||
.withSubType(SubType.ELEMENTAL)
|
||||
.withAbility(VigilanceAbility.getInstance())
|
||||
.withAbility(IndestructibleAbility.getInstance())
|
||||
.withAbility(HasteAbility.getInstance()),
|
||||
false, true, Duration.EndOfTurn
|
||||
), new ManaCostsImpl<>("{1}{G}"));
|
||||
).withDurationRuleAtStart(true), new ManaCostsImpl<>("{1}{G}"));
|
||||
ability.addTarget(new TargetPermanent(StaticFilters.FILTER_CONTROLLED_PERMANENT_LAND));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
@ -38,14 +38,14 @@ public final class KamahlsWill extends CardImpl {
|
|||
|
||||
// • Until end of turn, any number of target lands you control become 1/1 Elemental creatures with vigilance, indestructible, and haste. They're still lands.
|
||||
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(
|
||||
new CreatureToken(1, 1, "")
|
||||
new CreatureToken(1, 1, "1/1 Elemental creatures with vigilance, indestructible, and haste")
|
||||
.withSubType(SubType.ELEMENTAL)
|
||||
.withAbility(VigilanceAbility.getInstance())
|
||||
.withAbility(IndestructibleAbility.getInstance())
|
||||
.withAbility(HasteAbility.getInstance()),
|
||||
false, true, Duration.EndOfTurn
|
||||
).setText("until end of turn, any number of target lands you control become 1/1 Elemental creatures " +
|
||||
"with vigilance, indestructible, and haste. They're still lands"));
|
||||
).withDurationRuleAtStart(true)/*.setText("until end of turn, any number of target lands you control become 1/1 Elemental creatures " +
|
||||
"with vigilance, indestructible, and haste. They're still lands")*/);
|
||||
this.getSpellAbility().addTarget(new TargetPermanent(
|
||||
0, Integer.MAX_VALUE, StaticFilters.FILTER_CONTROLLED_PERMANENT_LANDS, false
|
||||
));
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
|
||||
package mage.cards.l;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleActivatedAbility;
|
||||
import mage.abilities.costs.common.SacrificeSourceCost;
|
||||
|
@ -18,17 +17,22 @@ import mage.constants.Zone;
|
|||
import mage.game.permanent.token.custom.CreatureToken;
|
||||
import mage.target.common.TargetLandPermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
*/
|
||||
public final class LifesparkSpellbomb extends CardImpl {
|
||||
|
||||
public LifesparkSpellbomb(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||
|
||||
// {G}, Sacrifice Lifespark Spellbomb: Until end of turn, target land becomes a 3/3 creature that's still a land.
|
||||
Ability firstAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new CreatureToken(3, 3), false, true, Duration.EndOfTurn), new ColoredManaCost(ColoredManaSymbol.G));
|
||||
Ability firstAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD,
|
||||
new BecomesCreatureTargetEffect(
|
||||
new CreatureToken(3, 3),
|
||||
false, true, Duration.EndOfTurn)
|
||||
.withDurationRuleAtStart(true), new ColoredManaCost(ColoredManaSymbol.G));
|
||||
firstAbility.addCost(new SacrificeSourceCost());
|
||||
firstAbility.addTarget(new TargetLandPermanent());
|
||||
this.addAbility(firstAbility);
|
||||
|
|
|
@ -77,7 +77,7 @@ class MercurialTransformationEffect extends OneShotEffect {
|
|||
}
|
||||
game.addEffect(new BecomesCreatureTargetEffect(
|
||||
token, true, false, Duration.EndOfTurn
|
||||
), source);
|
||||
).withDurationRuleAtStart(true), source);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class NissaVitalForce extends CardImpl {
|
|||
LoyaltyAbility ability = new LoyaltyAbility(new UntapTargetEffect(), 1);
|
||||
ability.addEffect(new BecomesCreatureTargetEffect(
|
||||
new NissaVitalForceToken(), false, true, Duration.UntilYourNextTurn
|
||||
).setText("Until your next turn, it becomes a 5/5 Elemental creature with haste. It's still a land"));
|
||||
).withDurationRuleAtStart(true).setText("Until your next turn, it becomes a 5/5 Elemental creature with haste. It's still a land"));
|
||||
ability.addTarget(new TargetLandPermanent(filter));
|
||||
this.addAbility(ability);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ public final class PhantasmalForm extends CardImpl {
|
|||
// Until end of turn, up to two target creatures each have base power and toughness 3/3, gain flying, and become blue Illusions in addition to their other colors and types.
|
||||
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(
|
||||
new PhantasmalFormToken(), false, false, Duration.EndOfTurn
|
||||
).setText("Until end of turn, up to two target creatures each have base power and toughness 3/3, " +
|
||||
).withDurationRuleAtStart(true).setText("Until end of turn, up to two target creatures each have base power and toughness 3/3, " +
|
||||
"gain flying, and become blue Illusions in addition to their other colors and types.")
|
||||
);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 2));
|
||||
|
|
|
@ -78,7 +78,7 @@ class RampagingGrowthEffect extends OneShotEffect {
|
|||
new CreatureToken(4, 3, "", SubType.INSECT
|
||||
).withAbility(ReachAbility.getInstance()).withAbility(HasteAbility.getInstance()),
|
||||
false, true, Duration.EndOfTurn
|
||||
).setTargetPointer(new FixedTarget(permanent, game)), source);
|
||||
).withDurationRuleAtStart(true).setTargetPointer(new FixedTarget(permanent, game)), source);
|
||||
}
|
||||
player.shuffleLibrary(source, game);
|
||||
return true;
|
||||
|
|
|
@ -32,8 +32,7 @@ public final class ScaleUp extends CardImpl {
|
|||
new CreatureToken(6, 4, "green Wurm with base power and toughness 6/4")
|
||||
.withColor("G").withSubType(SubType.WURM),
|
||||
true, false, Duration.EndOfTurn, false, true
|
||||
).setText("Until end of turn, target creature you control " +
|
||||
"becomes a green Wurm with base power and toughness 6/4."));
|
||||
).withDurationRuleAtStart(true));
|
||||
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
|
||||
|
||||
// Overload {4}{G}{G}
|
||||
|
|
|
@ -24,7 +24,8 @@ public final class Snakeform extends CardImpl {
|
|||
|
||||
|
||||
// Until end of turn, target creature loses all abilities and becomes a green Snake with base power and toughness 1/1.
|
||||
Effect effect = new BecomesCreatureTargetEffect(new SnakeToken(), true, false, Duration.EndOfTurn);
|
||||
Effect effect = new BecomesCreatureTargetEffect(new SnakeToken(), true, false, Duration.EndOfTurn)
|
||||
.withDurationRuleAtStart(true);
|
||||
effect.setText("Until end of turn, target creature loses all abilities and becomes a green Snake with base power and toughness 1/1");
|
||||
this.getSpellAbility().addEffect(effect);
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
|
|
@ -27,7 +27,7 @@ public final class StartlingDevelopment extends CardImpl {
|
|||
4, 4, "blue Serpent with base power and toughness 4/4"
|
||||
).withColor("U").withSubType(SubType.SERPENT),
|
||||
false, false, Duration.EndOfTurn
|
||||
).setRemoveSubtypes(true));
|
||||
).withDurationRuleAtStart(true).setRemoveSubtypes(true));
|
||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||
|
||||
// Cycling {1}
|
||||
|
|
|
@ -27,8 +27,8 @@ public final class TurnBurn extends SplitCard {
|
|||
|
||||
// Turn
|
||||
// Until end of turn, target creature loses all abilities and becomes a red Weird with base power and toughness 0/1.
|
||||
Effect effect = new BecomesCreatureTargetEffect(new WeirdToken(), true, false, Duration.EndOfTurn);
|
||||
effect.setText("Until end of turn, target creature loses all abilities and becomes a red Weird with base power and toughness 0/1");
|
||||
Effect effect = new BecomesCreatureTargetEffect(new WeirdToken(), true, false, Duration.EndOfTurn)
|
||||
.withDurationRuleAtStart(true);
|
||||
getLeftHalfCard().getSpellAbility().addEffect(effect);
|
||||
getLeftHalfCard().getSpellAbility().addTarget(new TargetCreaturePermanent().withChooseHint("becomes a Weird"));
|
||||
|
||||
|
@ -53,7 +53,7 @@ public final class TurnBurn extends SplitCard {
|
|||
private static class WeirdToken extends TokenImpl {
|
||||
|
||||
private WeirdToken() {
|
||||
super("Weird", "a red Weird with base power and toughness 0/1");
|
||||
super("Weird", "red Weird with base power and toughness 0/1");
|
||||
cardType.add(CardType.CREATURE);
|
||||
color.setRed(true);
|
||||
subtype.add(SubType.WEIRD);
|
||||
|
|
|
@ -39,9 +39,8 @@ public final class WoodwraithCorrupter extends CardImpl {
|
|||
this.power = new MageInt(3);
|
||||
this.toughness = new MageInt(6);
|
||||
|
||||
// {1}{B}{G}, {tap}: Target Forest becomes a 4/4 black and green Elemental Horror creature. It's still a land.
|
||||
Effect effect = new BecomesCreatureTargetEffect(new WoodwraithCorrupterToken(), false, true, Duration.EndOfGame);
|
||||
effect.setText("Target Forest becomes a 4/4 black and green Elemental Horror creature. It's still a land");
|
||||
// {1}{B}{G}, {T}: Target Forest becomes a 4/4 black and green Elemental Horror creature. It's still a land.
|
||||
Effect effect = new BecomesCreatureTargetEffect(new WoodwraithCorrupterToken(), false, true, Duration.Custom);
|
||||
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new ManaCostsImpl<>("{1}{B}{G}"));
|
||||
ability.addTarget(new TargetPermanent(filter));
|
||||
ability.addCost(new TapSourceCost());
|
||||
|
|
|
@ -25,6 +25,8 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
protected boolean removeSubtypes = false;
|
||||
protected boolean loseOtherCardTypes;
|
||||
|
||||
protected boolean durationRuleAtStart = false; // put duration rule to the start of the rules instead end
|
||||
|
||||
public BecomesCreatureTargetEffect(Token token, boolean loseAllAbilities, boolean stillALand, Duration duration) {
|
||||
this(token, loseAllAbilities, stillALand, duration, false);
|
||||
}
|
||||
|
@ -68,6 +70,7 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
this.keepAbilities = effect.keepAbilities;
|
||||
this.loseOtherCardTypes = effect.loseOtherCardTypes;
|
||||
this.dependencyTypes.add(DependencyType.BecomeCreature);
|
||||
this.durationRuleAtStart = effect.durationRuleAtStart;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -172,34 +175,54 @@ public class BecomesCreatureTargetEffect extends ContinuousEffectImpl {
|
|||
|| layer == Layer.TextChangingEffects_3;
|
||||
}
|
||||
|
||||
public BecomesCreatureTargetEffect withDurationRuleAtStart(boolean durationRuleAtStart) {
|
||||
this.durationRuleAtStart = durationRuleAtStart;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Mode mode) {
|
||||
if (staticText != null && !staticText.isEmpty()) {
|
||||
return staticText;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (durationRuleAtStart && duration != Duration.Custom) {
|
||||
sb.append(duration.toString());
|
||||
sb.append(", ");
|
||||
}
|
||||
|
||||
Target target = mode.getTargets().get(0);
|
||||
if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
if (target.getMaxNumberOfTargets() == 1) {
|
||||
sb.append("one ");
|
||||
if (target.getMaxNumberOfTargets() != Integer.MAX_VALUE) {
|
||||
if (target.getNumberOfTargets() < target.getMaxNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
if (target.getMaxNumberOfTargets() == 1) {
|
||||
sb.append("one ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (target.getMaxNumberOfTargets() > 1) {
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" target ").append(target.getTargetName());
|
||||
if (loseAllAbilities) {
|
||||
sb.append(" lose all their abilities and ");
|
||||
sb.append(" lose all their abilities and");
|
||||
}
|
||||
sb.append(" each become ");
|
||||
if (target.getMaxNumberOfTargets() != Integer.MAX_VALUE) {
|
||||
sb.append(" each");
|
||||
}
|
||||
sb.append(" become ");
|
||||
} else {
|
||||
sb.append("target ").append(target.getTargetName());
|
||||
if (loseAllAbilities && !keepAbilities) {
|
||||
sb.append(" loses all abilities and ");
|
||||
sb.append(" loses all abilities and");
|
||||
}
|
||||
sb.append(" becomes a ");
|
||||
}
|
||||
sb.append(token.getDescription());
|
||||
sb.append(' ').append(duration.toString());
|
||||
|
||||
if (!durationRuleAtStart && duration != Duration.Custom) {
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
|
||||
if (addStillALandText) {
|
||||
if (!sb.toString().endsWith("\" ")) {
|
||||
sb.append(". ");
|
||||
|
|
Loading…
Reference in a new issue