Improved and fixed cards texts:

* fixed wrong texts for draw card abilities;
 * added multi-effects text generation instead copy-paste (concatBy).
This commit is contained in:
Oleg Agafonov 2019-01-04 23:51:42 +04:00
parent 83cf370cc6
commit f6585ef734
23 changed files with 144 additions and 140 deletions

View file

@ -1,7 +1,5 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
@ -13,8 +11,9 @@ import mage.constants.SubType;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.CardTypePredicate;
import java.util.UUID;
/**
*
* @author Backfir3
*/
public final class ArgothianEnchantress extends CardImpl {
@ -26,16 +25,18 @@ public final class ArgothianEnchantress extends CardImpl {
}
public ArgothianEnchantress(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{G}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{G}");
this.subtype.add(SubType.HUMAN);
this.subtype.add(SubType.DRUID);
this.power = new MageInt(0);
this.toughness = new MageInt(1);
// Shroud
this.addAbility(ShroudAbility.getInstance());
// Whenever you cast an Enchantment spell, you draw a card.
this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1), filter, false));
this.addAbility(new SpellCastControllerTriggeredAbility(new DrawCardSourceControllerEffect(1, "you"), filter, false));
}
public ArgothianEnchantress(final ArgothianEnchantress card) {

View file

@ -1,7 +1,5 @@
package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -19,8 +17,9 @@ import mage.constants.ComparisonType;
import mage.constants.SubType;
import mage.constants.TargetController;
import java.util.UUID;
/**
*
* @author escplan9 (Derek Monturo - dmontur1 at gmail dot com)
*/
public final class AsylumVisitor extends CardImpl {
@ -33,11 +32,11 @@ public final class AsylumVisitor extends CardImpl {
this.toughness = new MageInt(1);
// At the beginning of each player's upkeep, if that player has no cards in hand, you draw a card and you lose 1 life.
Ability ability = new ConditionalInterveningIfTriggeredAbility(new BeginningOfUpkeepTriggeredAbility(new DrawCardSourceControllerEffect(1), TargetController.ANY, false),
Ability ability = new ConditionalInterveningIfTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new DrawCardSourceControllerEffect(1, "you"), TargetController.ANY, false),
new CardsInHandCondition(ComparisonType.EQUAL_TO, 0, null, TargetController.ACTIVE),
"At the beginning of each player's upkeep, if that player has no cards in hand, you draw a card and you lose 1 life.");
Effect effect = new LoseLifeSourceControllerEffect(1);
effect.setText("and you lose 1 life");
ability.addEffect(effect);
this.addAbility(ability);

View file

@ -1,7 +1,5 @@
package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -14,24 +12,24 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class BalefulForce extends CardImpl {
public BalefulForce(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{5}{B}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{B}{B}");
this.subtype.add(SubType.ELEMENTAL);
this.power = new MageInt(7);
this.toughness = new MageInt(7);
// At the beginning of each upkeep, you draw a card and you lose 1 life.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new DrawCardSourceControllerEffect(1), TargetController.ANY, false);
Ability ability = new BeginningOfUpkeepTriggeredAbility(new DrawCardSourceControllerEffect(1, "you"), TargetController.ANY, false);
Effect effect = new LoseLifeSourceControllerEffect(1);
effect.setText("and you lose 1 life");
ability.addEffect(effect);
ability.addEffect(effect.concatBy("and"));
this.addAbility(ability);
}

View file

@ -1,7 +1,5 @@
package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BecomesTappedAttachedTriggeredAbility;
import mage.abilities.effects.common.AttachEffect;
@ -18,8 +16,9 @@ import mage.filter.predicate.permanent.ControllerPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author LoneFox
*/
public final class Betrayal extends CardImpl {
@ -31,7 +30,7 @@ public final class Betrayal extends CardImpl {
}
public Betrayal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{U}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{U}");
this.subtype.add(SubType.AURA);
// Enchant creature an opponent controls
@ -40,8 +39,9 @@ public final class Betrayal extends CardImpl {
this.getSpellAbility().addEffect(new AttachEffect(Outcome.Detriment));
Ability ability = new EnchantAbility(auraTarget.getTargetName());
this.addAbility(ability);
// Whenever enchanted creature becomes tapped, you draw a card.
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DrawCardSourceControllerEffect(1), "enchanted creature"));
this.addAbility(new BecomesTappedAttachedTriggeredAbility(new DrawCardSourceControllerEffect(1, "you"), "enchanted creature"));
}
public Betrayal(final Betrayal card) {

View file

@ -1,4 +1,3 @@
package mage.cards.b;
import mage.MageInt;
@ -22,7 +21,6 @@ import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class BrassTalonChimera extends CardImpl {
@ -43,9 +41,9 @@ public final class BrassTalonChimera extends CardImpl {
// First strike
this.addAbility(FirstStrikeAbility.getInstance());
// Sacrifice Brass-Talon Chimera: Put a +2/+2 counter on target Chimera creature. It gains first strike.
// Sacrifice Brass-Talon Chimera: Put a +2/+2 counter on target Chimera creature. It gains first strike. (This effect lasts indefinitely.)
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AddCountersTargetEffect(CounterType.P2P2.createInstance()), new SacrificeSourceCost());
ability.addEffect(new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield).setText("It gains first strike. (This effect lasts indefinitely.)"));
ability.addEffect(new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.WhileOnBattlefield).setText("It gains first strike. <i>(This effect lasts indefinitely.)</i>"));
ability.addTarget(new TargetCreaturePermanent(filter));
addAbility(ability);
}

View file

@ -1,7 +1,5 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
@ -25,8 +23,9 @@ import mage.filter.predicate.permanent.TappedPredicate;
import mage.game.permanent.token.ZombieToken;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class Cryptbreaker extends CardImpl {
@ -39,7 +38,7 @@ public final class Cryptbreaker extends CardImpl {
}
public Cryptbreaker(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{B}");
this.subtype.add(SubType.ZOMBIE);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
@ -51,12 +50,10 @@ public final class Cryptbreaker extends CardImpl {
this.addAbility(ability);
// Tap three untapped Zombies you control: You draw a card and you lose 1 life.
Effect effect = new DrawCardSourceControllerEffect(1);
effect.setText("You draw a card");
Effect effect = new DrawCardSourceControllerEffect(1, "you");
ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, new TapTargetCost(new TargetControlledCreaturePermanent(3, 3, filter, true)));
effect = new LoseLifeSourceControllerEffect(1);
effect.setText("and you lose 1 life");
ability.addEffect(effect);
ability.addEffect(effect.concatBy("and"));
this.addAbility(ability);
}

View file

@ -1,7 +1,5 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.effects.Effect;
@ -14,28 +12,27 @@ import mage.constants.TargetController;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerPredicate;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class DarkProphecy extends CardImpl {
private static final FilterCreaturePermanent filter = new FilterCreaturePermanent("a creature you control");
static {
filter.add(new ControllerPredicate(TargetController.YOU));
}
public DarkProphecy(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}{B}{B}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}{B}{B}");
// Whenever a creature you control dies, you draw a card and you lose 1 life.
Effect effect = new DrawCardSourceControllerEffect(1);
effect.setText("you draw a card");
Effect effect = new DrawCardSourceControllerEffect(1, "you");
Ability ability = new DiesCreatureTriggeredAbility(effect, false, filter);
effect = new LoseLifeSourceControllerEffect(1);
effect.setText("and you lose 1 life");
ability.addEffect(effect);
ability.addEffect(effect.concatBy("and"));
this.addAbility(ability);
}

View file

@ -1,7 +1,5 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
@ -9,20 +7,20 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
*
* @author jeffwadsworth
*
*/
public final class DimirCutpurse extends CardImpl {
public DimirCutpurse(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{U}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{U}{B}");
this.subtype.add(SubType.SPIRIT);
this.power = new MageInt(2);
@ -30,7 +28,6 @@ public final class DimirCutpurse extends CardImpl {
// Whenever Dimir Cutpurse deals combat damage to a player, that player discards a card and you draw a card.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DimirCutpurseEffect(), false, true));
}
public DimirCutpurse(final DimirCutpurse card) {

View file

@ -1,6 +1,5 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -16,8 +15,9 @@ import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class DisinformationCampaign extends CardImpl {
@ -27,11 +27,9 @@ public final class DisinformationCampaign extends CardImpl {
// When Disinformation Campaign enters the battlefield, you draw a card and each opponent discards a card.
Ability ability = new EntersBattlefieldTriggeredAbility(
new DrawCardSourceControllerEffect(1).setText("you draw a card")
);
new DrawCardSourceControllerEffect(1, "you"));
ability.addEffect(new DiscardEachPlayerEffect(
new StaticValue(1), false, TargetController.OPPONENT
).setText("and each opponent discards a card"));
new StaticValue(1), false, TargetController.OPPONENT).concatBy("and"));
this.addAbility(ability);
// Whenever you surveil, return Disinformation Campaign to its owner's hand.

View file

@ -1,7 +1,5 @@
package mage.cards.d;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.DrawCardControllerTriggeredAbility;
import mage.abilities.common.EntersBattlefieldAllTriggeredAbility;
@ -23,40 +21,46 @@ import mage.filter.FilterPermanent;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class DivinersWand extends CardImpl {
private static final FilterPermanent filter = new FilterCreaturePermanent("a Wizard creature");
static {
filter.add(new SubtypePredicate(SubType.WIZARD));
}
public DivinersWand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.TRIBAL,CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.TRIBAL, CardType.ARTIFACT}, "{3}");
this.subtype.add(SubType.WIZARD);
this.subtype.add(SubType.EQUIPMENT);
// Equipped creature has "Whenever you draw a card, this creature gets +1/+1 and gains flying until end of turn" and "{4}: Draw a card."
Ability gainedAbility = new DrawCardControllerTriggeredAbility(new BoostSourceEffect(1,1, Duration.EndOfTurn), false);
gainedAbility.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn));
Effect effect = new GainAbilityAttachedEffect(gainedAbility, AttachmentType.EQUIPMENT);
effect.setText("Equipped creature has \"Whenever you draw a card, this creature gets +1/+1 and gains flying until end of turn\"");
Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, effect);
effect = new GainAbilityAttachedEffect(
new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new GenericManaCost(4)), AttachmentType.EQUIPMENT);
effect.setText("and \"{4}: Draw a card.\"");
ability.addEffect(effect);
this.addAbility(ability);
// Whenever a Wizard creature enters the battlefield, you may attach Diviner's Wand to it.
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
Zone.BATTLEFIELD, new AttachEffect(Outcome.Detriment, "attach {source} to it"),
filter, true, SetTargetPointer.PERMANENT, null));
// Equip {3}
this.addAbility(new EquipAbility(Outcome.AddAbility, new GenericManaCost(3)));
// Equipped creature has "Whenever you draw a card, this creature gets +1/+1 and gains flying until end of turn" and "{4}: Draw a card."
// new abilities
Ability newBoost = new DrawCardControllerTriggeredAbility(new BoostSourceEffect(1, 1, Duration.EndOfTurn), false);
newBoost.addEffect(new GainAbilitySourceEffect(FlyingAbility.getInstance(), Duration.EndOfTurn).concatBy("and"));
Ability newDraw = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1), new GenericManaCost(4));
// gain new abilities
Effect effectBoost = new GainAbilityAttachedEffect(newBoost, AttachmentType.EQUIPMENT)
.setText("Equipped creature has \"Whenever you draw a card, this creature gets +1/+1 and gains flying until end of turn\"");
Effect effectDraw = new GainAbilityAttachedEffect(newDraw, AttachmentType.EQUIPMENT)
.setText("\"{4}: Draw a card.\"");
// total ability
Ability totalAbility = new SimpleStaticAbility(Zone.BATTLEFIELD, effectBoost);
totalAbility.addEffect(effectDraw.concatBy("and"));
this.addAbility(totalAbility);
}
public DivinersWand(final DivinersWand card) {

View file

@ -1,24 +1,24 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
import mage.constants.*;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.UUID;
/**
*
* @author JayDi85
*/
public final class DuskLegionZealot extends CardImpl {
public final class DuskLegionZealot extends CardImpl {
public DuskLegionZealot (UUID ownerId, CardSetInfo setInfo) {
public DuskLegionZealot(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.subtype.add(SubType.VAMPIRE);
@ -27,21 +27,19 @@ public final class DuskLegionZealot extends CardImpl {
this.toughness = new MageInt(1);
// When Dusk Legion Zealot enters the battlefield, you draw a card and you lose 1 life.
Effect drawEffect = new DrawCardSourceControllerEffect(1);
drawEffect.setText("you draw a card");
Effect drawEffect = new DrawCardSourceControllerEffect(1, "you");
Ability ability = new EntersBattlefieldTriggeredAbility(drawEffect);
Effect lifeEffect = new LoseLifeSourceControllerEffect(1);
lifeEffect.setText("and you lose 1 life");
ability.addEffect(lifeEffect);
ability.addEffect(lifeEffect.concatBy("and"));
this.addAbility(ability);
}
public DuskLegionZealot (final DuskLegionZealot card) {
public DuskLegionZealot(final DuskLegionZealot card) {
super(card);
}
@Override
public DuskLegionZealot copy() {
return new DuskLegionZealot (this);
public DuskLegionZealot copy() {
return new DuskLegionZealot(this);
}
}

View file

@ -29,7 +29,7 @@ public final class Foreshadow extends CardImpl {
// Choose a card name, then target opponent puts the top card of their library into their graveyard. If that card has the chosen name, you draw a card.
this.getSpellAbility().addEffect(new ChooseACardNameEffect(ChooseACardNameEffect.TypeOfName.ALL));
this.getSpellAbility().addEffect(new ForeshadowEffect());
this.getSpellAbility().addEffect(new ForeshadowEffect().concatBy("then"));
this.getSpellAbility().addTarget(new TargetOpponent());
// Draw a card at the beginning of the next turn's upkeep.
@ -51,7 +51,7 @@ class ForeshadowEffect extends OneShotEffect {
public ForeshadowEffect() {
super(Outcome.DrawCard);
this.staticText = ", then target opponent puts the top card of their library into their graveyard. If that card has the chosen name, you draw a card";
this.staticText = "target opponent puts the top card of their library into their graveyard. If that card has the chosen name, you draw a card";
}
public ForeshadowEffect(final ForeshadowEffect effect) {

View file

@ -1,7 +1,5 @@
package mage.cards.f;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -16,14 +14,15 @@ import mage.constants.SubType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class FretworkColony extends CardImpl {
public FretworkColony(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}");
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}");
this.subtype.add(SubType.INSECT);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
@ -34,8 +33,7 @@ public final class FretworkColony extends CardImpl {
// At the beginning of your upkeep, put a +1/+1 counter on Fretwork Colony and you lose 1 life.
Ability ability = new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.P1P1.createInstance()), TargetController.YOU, false);
Effect effect = new LoseLifeSourceControllerEffect(1);
effect.setText("and you lose 1 life");
ability.addEffect(effect);
ability.addEffect(effect.concatBy("and"));
this.addAbility(ability);
}

View file

@ -1,7 +1,5 @@
package mage.cards.f;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastOpponentTriggeredAbility;
@ -15,8 +13,9 @@ import mage.constants.CardType;
import mage.filter.FilterSpell;
import mage.filter.predicate.mageobject.ColorPredicate;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class FreyalisesCharm extends CardImpl {
@ -33,7 +32,7 @@ public final class FreyalisesCharm extends CardImpl {
// Whenever an opponent casts a black spell, you may pay {G}{G}. If you do, you draw a card.
this.addAbility(new SpellCastOpponentTriggeredAbility(
new DoIfCostPaid(
new DrawCardSourceControllerEffect(1),
new DrawCardSourceControllerEffect(1, "you"),
new ManaCostsImpl("{G}{G}")
), filter, false
));

View file

@ -1,7 +1,5 @@
package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.EntersBattlefieldOrAttacksSourceTriggeredAbility;
@ -19,8 +17,9 @@ import mage.constants.SubType;
import mage.constants.TargetController;
import mage.constants.Zone;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class GlintSleeveSiphoner extends CardImpl {
@ -42,8 +41,7 @@ public final class GlintSleeveSiphoner extends CardImpl {
// At the beginning of your upkeep, you may pay {E}{E}. If you do, draw a card and you lose 1 life.
DoIfCostPaid doIfCostPaidEffect = new DoIfCostPaid(new DrawCardSourceControllerEffect(1), new PayEnergyCost(2));
Effect effect = new LoseLifeSourceControllerEffect(1);
effect.setText("and you lose 1 life");
doIfCostPaidEffect.addEffect(effect);
doIfCostPaidEffect.addEffect(effect.concatBy("and"));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, doIfCostPaidEffect, TargetController.YOU, false, false,
"At the beginning of your upkeep, "));
}

View file

@ -1,7 +1,5 @@
package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -15,22 +13,21 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import java.util.UUID;
/**
*
* @author emerald000
*/
public final class MetalspinnersPuzzleknot extends CardImpl {
public MetalspinnersPuzzleknot(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// When Metalspinner's Puzzleknot enters the battlefield, you draw a card and you lose 1 life.
Effect drawEffect = new DrawCardSourceControllerEffect(1);
drawEffect.setText("you draw a card");
Effect drawEffect = new DrawCardSourceControllerEffect(1, "you");
Ability ability = new EntersBattlefieldTriggeredAbility(drawEffect);
Effect lifeEffect = new LoseLifeSourceControllerEffect(1);
lifeEffect.setText("and you lose 1 life");
ability.addEffect(lifeEffect);
ability.addEffect(lifeEffect.concatBy("and"));
this.addAbility(ability);
// {2}{B}, Sacrifice Metalspinner's Puzzleknot: You draw a card and you lose 1 life.

View file

@ -1,7 +1,5 @@
package mage.cards.m;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DiesThisOrAnotherCreatureTriggeredAbility;
@ -17,8 +15,9 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import java.util.UUID;
/**
*
* @author Styxo
*/
public final class MidnightEntourage extends CardImpl {
@ -42,10 +41,9 @@ public final class MidnightEntourage extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BoostAllEffect(1, 1, Duration.WhileOnBattlefield, filter, true)));
// Whenever Midnight Entourage or another Aetherborn you control dies, you draw a card and you lose 1 life.
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new DrawCardSourceControllerEffect(1), false, filter);
Ability ability = new DiesThisOrAnotherCreatureTriggeredAbility(new DrawCardSourceControllerEffect(1, "you"), false, filter);
Effect effect = new LoseLifeSourceControllerEffect(1);
effect.setText("and you lose 1 life");
ability.addEffect(effect);
ability.addEffect(effect.concatBy("and"));
this.addAbility(ability);
}

View file

@ -1,7 +1,5 @@
package mage.cards.o;
import java.util.UUID;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
import mage.abilities.effects.Effect;
@ -18,8 +16,9 @@ import mage.game.command.emblems.ObNixilisReignitedEmblem;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
*
* @author fireshoes
*/
public final class ObNixilisReignited extends CardImpl {
@ -32,12 +31,10 @@ public final class ObNixilisReignited extends CardImpl {
this.addAbility(new PlaneswalkerEntersWithLoyaltyCountersAbility(5));
// +1: You draw a card and you lose 1 life.
Effect effect = new DrawCardSourceControllerEffect(1);
effect.setText("You draw a card");
Effect effect = new DrawCardSourceControllerEffect(1, "you");
LoyaltyAbility ability1 = new LoyaltyAbility(effect, 1);
effect = new LoseLifeSourceControllerEffect(1);
effect.setText("and you lose 1 life");
ability1.addEffect(effect);
ability1.addEffect(effect.concatBy("and"));
this.addAbility(ability1);
// -3: Destroy target creature.
@ -47,7 +44,6 @@ public final class ObNixilisReignited extends CardImpl {
// -8: Target opponent gets an emblem with "Whenever a player draws a card, you lose 2 life."
effect = new GetEmblemTargetPlayerEffect(new ObNixilisReignitedEmblem());
effect.setText("Target opponent gets an emblem with \"Whenever a player draws a card, you lose 2 life.\"");
LoyaltyAbility ability3 = new LoyaltyAbility(effect, -8);
ability3.addTarget(new TargetOpponent());
this.addAbility(ability3);

View file

@ -1,8 +1,5 @@
package mage.abilities.effects;
import java.io.Serializable;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.constants.EffectType;
@ -10,8 +7,10 @@ import mage.constants.Outcome;
import mage.game.Game;
import mage.target.targetpointer.TargetPointer;
import java.io.Serializable;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public interface Effect extends Serializable {
@ -64,4 +63,7 @@ public interface Effect extends Serializable {
Effect copy();
Effect concatBy(String concatPrefix);
String getConcatPrefix();
}

View file

@ -1,9 +1,5 @@
package mage.abilities.effects;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.abilities.MageSingleton;
import mage.abilities.Mode;
import mage.constants.EffectType;
@ -11,8 +7,11 @@ import mage.constants.Outcome;
import mage.target.targetpointer.FirstTargetPointer;
import mage.target.targetpointer.TargetPointer;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public abstract class EffectImpl implements Effect {
@ -23,7 +22,7 @@ public abstract class EffectImpl implements Effect {
protected TargetPointer targetPointer = FirstTargetPointer.getInstance();
protected String staticText = "";
protected Map<String, Object> values;
protected boolean applyEffectsAfter = false;
protected String concatPrefix = ""; // combines multiple effects in text rule
public EffectImpl(Outcome outcome) {
this.id = UUID.randomUUID();
@ -36,6 +35,7 @@ public abstract class EffectImpl implements Effect {
this.staticText = effect.staticText;
this.effectType = effect.effectType;
this.targetPointer = effect.targetPointer.copy();
this.concatPrefix = effect.concatPrefix;
if (effect.values != null) {
values = new HashMap<>();
Map<String, Object> map = effect.values;
@ -43,7 +43,6 @@ public abstract class EffectImpl implements Effect {
values.put(entry.getKey(), entry.getValue());
}
}
this.applyEffectsAfter = effect.applyEffectsAfter;
}
@Override
@ -112,4 +111,15 @@ public abstract class EffectImpl implements Effect {
}
return values.get(key);
}
@Override
public Effect concatBy(String concatPrefix) {
this.concatPrefix = concatPrefix;
return this;
}
@Override
public String getConcatPrefix() {
return this.concatPrefix;
}
}

View file

@ -42,6 +42,7 @@ public class Effects extends ArrayList<Effect> {
public String getText(Mode mode) {
StringBuilder sbText = new StringBuilder();
String lastRule = null;
int effectNum = 0;
for (Effect effect : this) {
String endString = "";
String nextRule = effect.getText(mode);
@ -50,9 +51,16 @@ public class Effects extends ArrayList<Effect> {
if (nextRule == null || nextRule.isEmpty()) {
continue;
}
effectNum++;
// concat effects (default: each effect with a new sentence)
String concatPrefix = effect.getConcatPrefix();
if (effectNum > 1 && !concatPrefix.isEmpty() && !concatPrefix.equals(".")) {
nextRule = concatPrefix + " " + nextRule;
}
if (nextRule != null) {
if (nextRule.startsWith("and ") || nextRule.startsWith("with ")) {
if (nextRule.startsWith("and ") || nextRule.startsWith("with ") || nextRule.startsWith("then ")) {
endString = " ";
} else if (nextRule.startsWith(",") || nextRule.startsWith(" ")) {
endString = "";

View file

@ -38,6 +38,7 @@ public class CopyTargetSpellEffect extends OneShotEffect {
super(effect);
this.useLKI = effect.useLKI;
this.useController = effect.useController;
this.copyThatSpellName = effect.copyThatSpellName;
}
public Effect withSpellName(String copyThatSpellName) {

View file

@ -1,9 +1,7 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.MultikickerCount;
import mage.abilities.dynamicvalue.common.PermanentsOnBattlefieldCount;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
@ -18,20 +16,32 @@ import mage.util.CardUtil;
public class DrawCardSourceControllerEffect extends OneShotEffect {
protected DynamicValue amount;
protected String whoDrawCard = "";
public DrawCardSourceControllerEffect(int amount) {
this(new StaticValue(amount));
this(amount, "");
}
public DrawCardSourceControllerEffect(int amount, String whoDrawCard) {
this(new StaticValue(amount), whoDrawCard);
}
public DrawCardSourceControllerEffect(DynamicValue amount) {
this(amount, "");
}
public DrawCardSourceControllerEffect(DynamicValue amount, String whoDrawCard) {
super(Outcome.DrawCard);
this.amount = amount.copy();
this.whoDrawCard = whoDrawCard;
setText();
}
public DrawCardSourceControllerEffect(final DrawCardSourceControllerEffect effect) {
super(effect);
this.amount = effect.amount.copy();
this.whoDrawCard = effect.whoDrawCard;
setText();
}
@Override
@ -53,7 +63,7 @@ public class DrawCardSourceControllerEffect extends OneShotEffect {
StringBuilder sb = new StringBuilder();
boolean oneCard = (amount instanceof StaticValue && amount.calculate(null, null, this) == 1)
|| amount instanceof PermanentsOnBattlefieldCount || amount.toString().equals("1") || amount.toString().equals("a");
sb.append("draw ").append(oneCard ? "a" : CardUtil.numberToText(amount.toString())).append(" card");
sb.append(whoDrawCard.isEmpty() ? "" : whoDrawCard + " ").append("draw ").append(oneCard ? "a" : CardUtil.numberToText(amount.toString())).append(" card");
if (!oneCard) {
sb.append('s');
}