Merge origin/master

This commit is contained in:
LevelX2 2019-01-04 21:35:32 +01:00
commit b765f27a0c
34 changed files with 209 additions and 233 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 {
@ -33,9 +32,11 @@ public final class ArgothianEnchantress extends CardImpl {
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,8 +1,5 @@
package mage.cards.a;
import java.util.List;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
@ -27,8 +24,10 @@ import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import java.util.List;
import java.util.UUID;
/**
*
* @author Styxo
*/
public final class AurraSingBaneOfJedi extends CardImpl {

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,8 +12,9 @@ import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.TargetController;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class BalefulForce extends CardImpl {
@ -28,10 +27,9 @@ public final class BalefulForce extends CardImpl {
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 {
@ -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 {
@ -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,13 +12,15 @@ 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));
}
@ -28,14 +28,11 @@ public final class DarkProphecy extends CardImpl {
public DarkProphecy(UUID ownerId, CardSetInfo setInfo) {
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,15 +7,15 @@ 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 {
@ -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,13 +21,15 @@ 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));
}
@ -39,24 +39,28 @@ public final class DivinersWand extends CardImpl {
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,19 +1,19 @@
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 {
@ -27,12 +27,10 @@ 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);
}

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,8 +14,9 @@ import mage.constants.SubType;
import mage.constants.TargetController;
import mage.counters.CounterType;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class FretworkColony extends CardImpl {
@ -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.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.PlaneswalkerEntersWithLoyaltyCountersAbility;
@ -12,7 +10,10 @@ import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.GetEmblemTargetPlayerEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
@ -25,8 +26,9 @@ import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class GarrukApexPredator extends CardImpl {
@ -62,7 +64,6 @@ public final class GarrukApexPredator extends CardImpl {
// -8: Target opponent gets an emblem with "Whenever a creature attacks you, it gets +5/+5 and gains trample until end of turn."
Effect effect = new GetEmblemTargetPlayerEffect(new GarrukApexPredatorEmblem());
effect.setText("Target opponent gets an emblem with \"Whenever a creature attacks you, it gets +5/+5 and gains trample until end of turn.\"");
ability = new LoyaltyAbility(effect, -8);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);

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,8 +13,9 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Zone;
import java.util.UUID;
/**
*
* @author emerald000
*/
public final class MetalspinnersPuzzleknot extends CardImpl {
@ -25,12 +24,10 @@ public final class MetalspinnersPuzzleknot extends CardImpl {
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,22 +1,16 @@
package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CopyTargetSpellEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.CreateTokenCopyTargetEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.SetTargetPointer;
import mage.constants.SuperType;
import mage.constants.Zone;
import mage.constants.*;
import mage.filter.FilterSpell;
import mage.filter.common.FilterControlledCreaturePermanent;
import mage.filter.predicate.Predicates;
@ -24,8 +18,9 @@ import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.permanent.AnotherPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import java.util.UUID;
/**
*
* @author LevelX2
*/
public final class RikuOfTwoReflections extends CardImpl {
@ -53,7 +48,6 @@ public final class RikuOfTwoReflections extends CardImpl {
// Whenever you cast an instant or sorcery spell, you may pay {U}{R}. If you do, copy that spell. You may choose new targets for the copy.
Effect effect = new CopyTargetSpellEffect(true);
effect.setText("copy that spell. You may choose new targets for the copy");
this.addAbility(new SpellCastControllerTriggeredAbility(new DoIfCostPaid(effect, new ManaCostsImpl("{U}{R}")), filter, false, true));
// Whenever another nontoken creature enters the battlefield under your control, you may pay {G}{U}. If you do, create a token that's a copy of that creature.

View file

@ -1,7 +1,5 @@
package mage.cards.r;
import java.util.UUID;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
@ -13,14 +11,9 @@ import mage.abilities.effects.RequirementEffect;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.effects.common.GetEmblemTargetPlayerEffect;
import mage.abilities.keyword.PartnerWithAbility;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.TurnPhase;
import mage.constants.*;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.filter.predicate.permanent.TappedPredicate;
@ -29,8 +22,9 @@ import mage.game.command.emblems.RowanKenrithEmblem;
import mage.game.permanent.Permanent;
import mage.target.TargetPlayer;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class RowanKenrith extends CardImpl {
@ -54,11 +48,6 @@ public final class RowanKenrith extends CardImpl {
// -8: Target player gets an emblem with "Whenever you activate an ability that isn't a mana ability, copy it. You may choose new targets for the copy."
Effect effect = new GetEmblemTargetPlayerEffect(new RowanKenrithEmblem());
effect.setText(
"Target player gets an emblem with "
+ "\"Whenever you activate an ability that isn't a mana ability, "
+ "copy it. You may choose new targets for the copy.\""
);
ability = new LoyaltyAbility(effect, -8);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);

View file

@ -1,7 +1,5 @@
package mage.cards.w;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.LoyaltyAbility;
import mage.abilities.common.CanBeYourCommanderAbility;
@ -16,11 +14,7 @@ import mage.abilities.effects.common.cost.SpellsCostReductionAllEffect;
import mage.abilities.keyword.PartnerWithAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.constants.*;
import mage.filter.FilterCard;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate;
@ -29,8 +23,9 @@ import mage.game.command.emblems.WillKenrithEmblem;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author TheElk801
*/
public final class WillKenrith extends CardImpl {
@ -60,11 +55,6 @@ public final class WillKenrith extends CardImpl {
// -8: Target player gets an emblem with "Whenever you cast an instant or sorcery spell, copy it. You may choose new targets for the copy."
Effect effect = new GetEmblemTargetPlayerEffect(new WillKenrithEmblem());
effect.setText(
"Target player gets an emblem with "
+ "\"Whenever you cast an instant or sorcery spell, "
+ "copy it. You may choose new targets for the copy.\""
);
ability = new LoyaltyAbility(effect, -8);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);

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

@ -2,6 +2,7 @@ package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
@ -17,6 +18,7 @@ public class CopyTargetSpellEffect extends OneShotEffect {
private final boolean useController;
private final boolean useLKI;
private String copyThatSpellName = "that spell";
public CopyTargetSpellEffect() {
this(false);
@ -36,6 +38,12 @@ public class CopyTargetSpellEffect extends OneShotEffect {
super(effect);
this.useLKI = effect.useLKI;
this.useController = effect.useController;
this.copyThatSpellName = effect.copyThatSpellName;
}
public Effect withSpellName(String copyThatSpellName) {
this.copyThatSpellName = copyThatSpellName;
return this;
}
@Override
@ -81,7 +89,7 @@ public class CopyTargetSpellEffect extends OneShotEffect {
if (!mode.getTargets().isEmpty()) {
sb.append("target ").append(mode.getTargets().get(0).getTargetName());
} else {
sb.append("that spell");
sb.append(copyThatSpellName);
}
sb.append(". You may choose new targets for the copy");

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');
}

View file

@ -1,4 +1,3 @@
package mage.abilities.effects.common;
import mage.MageObject;
@ -10,8 +9,9 @@ import mage.game.Game;
import mage.game.command.Emblem;
import mage.players.Player;
import java.util.stream.Collectors;
/**
*
* @author LevelX2
*/
public class GetEmblemTargetPlayerEffect extends OneShotEffect {
@ -53,6 +53,6 @@ public class GetEmblemTargetPlayerEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null) + '"';
return "Target " + mode.getTargets().get(0).getTargetName() + " gets an emblem with \"" + emblem.getAbilities().getRules(null).stream().collect(Collectors.joining("; ")) + "\"";
}
}

View file

@ -70,7 +70,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl {
public void init(Ability source, Game game) {
super.init(source, game);
if (affectedObjectsSet) {
Permanent equipment = game.getPermanent(source.getSourceId());
Permanent equipment = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (equipment != null && equipment.getAttachedTo() != null) {
this.setTargetPointer(new FixedTarget(equipment.getAttachedTo(), game.getState().getZoneChangeCounter(equipment.getAttachedTo())));
}
@ -107,7 +107,7 @@ public class GainAbilityAttachedEffect extends ContinuousEffectImpl {
} else {
sb.append("gains ");
}
sb.append(ability.getRule());
sb.append('"' + ability.getRule("this creature") + '"');
if (!duration.toString().isEmpty()) {
sb.append(' ').append(duration.toString());
}

View file

@ -1,24 +1,18 @@
package mage.abilities.effects.common.continuous;
import java.util.Locale;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.Card;
import mage.constants.DependencyType;
import mage.constants.Duration;
import mage.constants.Layer;
import mage.constants.Outcome;
import mage.constants.PhaseStep;
import mage.constants.SubLayer;
import mage.constants.*;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.target.Target;
import java.util.Locale;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class GainAbilityTargetEffect extends ContinuousEffectImpl {
@ -88,9 +82,7 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
return true;
}
if (durationPhaseStep != null && durationPhaseStep == game.getPhase().getStep().getType()) {
if (!sameStep && game.isActivePlayer(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving()) {
return true;
}
return !sameStep && game.isActivePlayer(durationPlayerId) || game.getPlayer(durationPlayerId).hasReachedNextTurnAfterLeaving();
} else {
sameStep = false;
}
@ -137,6 +129,8 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
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 ");
@ -150,8 +144,11 @@ public class GainAbilityTargetEffect extends ContinuousEffectImpl {
sb.append("target ");
}
sb.append(target.getTargetName()).append(" gains ");
}
} else {
sb.append("gains ");
}
sb.append(ability.getRule());
if (durationPhaseStep != null) {
sb.append(" until your next ").append(durationPhaseStep.toString().toLowerCase(Locale.ENGLISH));

View file

@ -477,7 +477,7 @@ public final class StaticFilters {
FILTER_SPELL_AN_INSTANT_OR_SORCERY.setLockedFilter(true);
}
public static final FilterSpell FILTER_SPELL_INSTANT_OR_SORCERY = new FilterSpell("instant or sorcery spell");
public static final FilterSpell FILTER_SPELL_INSTANT_OR_SORCERY = new FilterSpell("an instant or sorcery spell");
static {
FILTER_SPELL_INSTANT_OR_SORCERY.add(Predicates.or(

View file

@ -1,4 +1,3 @@
package mage.game.command.emblems;
import mage.abilities.Ability;
@ -13,7 +12,6 @@ import mage.constants.Zone;
import mage.game.command.Emblem;
/**
*
* @author spjspj
*/
public final class GarrukApexPredatorEmblem extends Emblem {
@ -25,12 +23,12 @@ public final class GarrukApexPredatorEmblem extends Emblem {
public GarrukApexPredatorEmblem() {
setName("Emblem Garruk");
Effect effect = new BoostTargetEffect(5, 5, Duration.EndOfTurn);
effect.setText("it gets +5/+5");
Effect effect = new BoostTargetEffect(-1, 0, Duration.EndOfTurn);
effect.setText("it gets -1/-0");
Ability ability = new AttackedByCreatureTriggeredAbility(Zone.COMMAND, effect, false, SetTargetPointer.PERMANENT);
effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn,
"and gains trample until end of turn");
ability.addEffect(effect);
effect = new GainAbilityTargetEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
ability.addEffect(effect.concatBy("and"));
this.getAbilities().add(ability);
}
}

View file

@ -1,4 +1,3 @@
package mage.game.command.emblems;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
@ -8,7 +7,6 @@ import mage.filter.StaticFilters;
import mage.game.command.Emblem;
/**
*
* @author TheElk801
*/
public final class WillKenrithEmblem extends Emblem {
@ -18,8 +16,7 @@ public final class WillKenrithEmblem extends Emblem {
this.setName("Emblem Will Kenrith");
this.getAbilities().add(new SpellCastControllerTriggeredAbility(
Zone.COMMAND,
new CopyTargetSpellEffect(true)
.setText("copy that spell. You may choose new targets for the copy"),
new CopyTargetSpellEffect(true).withSpellName("it"),
StaticFilters.FILTER_SPELL_INSTANT_OR_SORCERY,
false,
true