cleanup DamageTargetEffect (closes #11111) (#14096)

This commit is contained in:
xenohedron 2025-11-23 01:00:34 -05:00 committed by GitHub
parent 934d8e13f5
commit 074f58d341
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
89 changed files with 154 additions and 234 deletions

View file

@ -1,4 +1,3 @@
package mage.cards.a;
import java.util.UUID;
@ -28,7 +27,9 @@ public final class AcolyteOfTheInferno extends CardImpl {
this.addAbility(new RenownAbility(1));
// Whenever Acolyte of the Inferno becomes blocked by a creature, it deals 2 damage to that creature
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(new DamageTargetEffect(2, true, "that creature", "it"), false));
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(
new DamageTargetEffect(2, "it")
.withTargetDescription("that creature"), false));
}
private AcolyteOfTheInferno(final AcolyteOfTheInferno card) {

View file

@ -41,7 +41,7 @@ public final class AdrenalineJockey extends CardImpl {
// Whenever a player casts a spell, if it's not their turn, this creature deals 4 damage to them.
this.addAbility(new SpellCastAllTriggeredAbility(
new DamageTargetEffect(4, true, "them"),
new DamageTargetEffect(4).withTargetDescription("them"),
filter, false, SetTargetPointer.PLAYER
));

View file

@ -7,7 +7,6 @@ import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.hint.common.RaidHint;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.AbilityWord;
import mage.constants.CardType;
import mage.target.common.TargetAnyTarget;
import mage.watchers.common.PlayerAttackedWatcher;
@ -30,7 +29,7 @@ public final class ArrowStorm extends CardImpl {
this.getSpellAbility().addTarget(new TargetAnyTarget());
// Raid - If you attacked with a creature this turn, instead Arrow Storm deals 5 damage to that creature or player and the damage can't be prevented.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DamageTargetEffect(5, false),
new DamageTargetEffect(5).withCantBePrevented(),
RaidCondition.instance,
"<br/><br/><i>Raid</i> &mdash; If you attacked this turn, instead {this} deals 5 damage to that permanent or player and the damage can't be prevented"));
this.getSpellAbility().addWatcher(new PlayerAttackedWatcher());

View file

@ -23,7 +23,7 @@ public final class AshmouthHound extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Ashmouth Hound blocks or becomes blocked by a creature, Ashmouth Hound deals 1 damage to that creature.
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(new DamageTargetEffect(1, true, "that creature")));
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(new DamageTargetEffect(1).withTargetDescription("that creature")));
}
private AshmouthHound(final AshmouthHound card) {

View file

@ -65,7 +65,7 @@ public final class AvalancheOfSector7 extends CardImpl {
class AvalancheOfSector7TriggeredAbility extends TriggeredAbilityImpl {
AvalancheOfSector7TriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(1, true, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(1).withTargetDescription("that player"));
setTriggerPhrase("Whenever an opponent activates an ability of an artifact they control, ");
}

View file

@ -49,10 +49,10 @@ public final class BarretWallace extends CardImpl {
// Whenever Barret Wallace attacks, it deals damage equal to the number of equipped creatures you control to defending player.
this.addAbility(new AttacksTriggeredAbility(
new DamageTargetEffect(xValue, true, "it")
new DamageTargetEffect(xValue)
.setText("it deals damage equal to the number of equipped creatures you control to defending player"),
false, null, SetTargetPointer.PLAYER
).withRuleTextReplacement(true).addHint(hint));
).addHint(hint));
}
private BarretWallace(final BarretWallace card) {

View file

@ -39,7 +39,7 @@ public final class BenBenAkkiHermit extends CardImpl {
this.power = new MageInt(1);
this.toughness = new MageInt(1);
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(new PermanentsOnBattlefieldCount(filter), true), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(new PermanentsOnBattlefieldCount(filter)), new TapSourceCost());
ability.addTarget(new TargetAttackingCreature());
this.addAbility(ability);
}

View file

@ -29,9 +29,8 @@ public final class BonecrusherGiant extends AdventureCard {
// Whenever Bonecrusher Giant becomes the target of a spell, Bonecrusher Giant deals 2 damage to that spell's controller.
this.addAbility(new BecomesTargetSourceTriggeredAbility(
new DamageTargetEffect(
2, true, "that spell's controller", "{this}"
), StaticFilters.FILTER_SPELL_A, SetTargetPointer.PLAYER, false)
new DamageTargetEffect(2).withTargetDescription("that spell's controller"),
StaticFilters.FILTER_SPELL_A, SetTargetPointer.PLAYER, false)
.withRuleTextReplacement(false));
// Stomp

View file

@ -51,8 +51,11 @@ public final class BoobyTrap extends CardImpl {
class BoobyTrapTriggeredAbility extends TriggeredAbilityImpl {
public BoobyTrapTriggeredAbility() {
super(Zone.BATTLEFIELD, new DoIfCostPaid(new DamageTargetEffect(10, true, "that player"), new SacrificeSourceCost(), "", false), false);
BoobyTrapTriggeredAbility() {
super(Zone.BATTLEFIELD, new DoIfCostPaid(
new DamageTargetEffect(10).withTargetDescription("that player"),
new SacrificeSourceCost(), "", false
), false);
}
private BoobyTrapTriggeredAbility(final BoobyTrapTriggeredAbility ability) {

View file

@ -29,7 +29,7 @@ public final class BurningEarth extends CardImpl {
// Whenever a player taps a nonbasic land for mana, Burning Earth deals 1 damage to that player.
this.addAbility(new TapForManaAllTriggeredAbility(
new DamageTargetEffect(1, true, "that player"),
new DamageTargetEffect(1).withTargetDescription("that player"),
filter, SetTargetPointer.PLAYER));
}

View file

@ -2,7 +2,6 @@ package mage.cards.b;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
@ -46,7 +45,8 @@ public final class BurningTreeShaman extends CardImpl {
class BurningTreeShamanTriggeredAbility extends TriggeredAbilityImpl {
BurningTreeShamanTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(StaticValue.get(1), true, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(1).withTargetDescription("that player"));
setTriggerPhrase("Whenever a player activates an ability that isn't a mana ability, ");
}
private BurningTreeShamanTriggeredAbility(final BurningTreeShamanTriggeredAbility ability) {
@ -75,8 +75,4 @@ class BurningTreeShamanTriggeredAbility extends TriggeredAbilityImpl {
return false;
}
@Override
public String getRule() {
return "Whenever a player activates an ability that isn't a mana ability, {this} deals 1 damage to that player.";
}
}

View file

@ -99,7 +99,7 @@ class CemeteryGatekeeperEffect extends OneShotEffect {
class CemeteryGatekeeperTriggeredAbility extends TriggeredAbilityImpl {
public CemeteryGatekeeperTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(2, true, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(2).withTargetDescription("that player"));
setTriggerPhrase("Whenever a player plays a land or casts a spell, if it shares a card type with the exiled card, ");
}

View file

@ -51,9 +51,8 @@ public class ChandraHopesBeacon extends CardImpl {
this.addAbility(new LoyaltyAbility(new ChandraHopesBeaconEffect(), 1), new ChandraHopesBeaconWatcher());
//X: Chandra, Hopes Beacon deals X damage to each of up to two targets.
LoyaltyAbility loyaltyAbility = new LoyaltyAbility(new DamageTargetEffect(
GetXValue.instance, true, "each of up to two targets"
));
LoyaltyAbility loyaltyAbility = new LoyaltyAbility(new DamageTargetEffect(GetXValue.instance)
.withTargetDescription("each of up to two targets"));
loyaltyAbility.addTarget(new TargetAnyTarget(0, 2));
this.addAbility(loyaltyAbility);
}

View file

@ -36,7 +36,7 @@ public final class ChandraTheFirebrand extends CardImpl {
));
// -6: Chandra, the Firebrand deals 6 damage to each of up to six target creatures and/or players
LoyaltyAbility ability2 = new LoyaltyAbility(new DamageTargetEffect(6, true, "each of up to six targets"), -6);
LoyaltyAbility ability2 = new LoyaltyAbility(new DamageTargetEffect(6).withTargetDescription("each of up to six targets"), -6);
ability2.addTarget(new TargetAnyTarget(0, 6));
this.addAbility(ability2);
}

View file

@ -31,7 +31,7 @@ public final class Cindervines extends CardImpl {
// Whenever an opponent casts a noncreature spell, Cindervines deals 1 damage to that player.
this.addAbility(new SpellCastOpponentTriggeredAbility(
Zone.BATTLEFIELD, new DamageTargetEffect(1, true, "that player"),
Zone.BATTLEFIELD, new DamageTargetEffect(1).withTargetDescription("that player"),
StaticFilters.FILTER_SPELL_A_NON_CREATURE, false, SetTargetPointer.PLAYER
));

View file

@ -2,7 +2,6 @@
package mage.cards.c;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
@ -16,7 +15,8 @@ import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.target.TargetPermanent;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
@ -36,7 +36,7 @@ public final class Combust extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
// Combust deals 5 damage to target white or blue creature. The damage can't be prevented.
this.getSpellAbility().addEffect(new DamageTargetEffect(5, false));
this.getSpellAbility().addEffect(new DamageTargetEffect(5).withCantBePrevented());
this.getSpellAbility().addTarget(new TargetPermanent(filter));
// Combust can't be countered.

View file

@ -20,7 +20,7 @@ public final class CopperTablet extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
// At the beginning of each player's upkeep, Copper Tablet deals 1 damage to that player.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(TargetController.EACH_PLAYER, new DamageTargetEffect(1, true, "that player"), false));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(TargetController.EACH_PLAYER, new DamageTargetEffect(1).withTargetDescription("that player"), false));
}
private CopperTablet(final CopperTablet card) {

View file

@ -31,9 +31,7 @@ public final class DavrielRogueShadowmage extends CardImpl {
// At the beginning of each opponent's upkeep, if that player has one or fewer cards in hand, Davriel, Rogue Shadowmage deals 2 damage to them.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
TargetController.OPPONENT,
new DamageTargetEffect(
2, true, "them", "{this}"
), false
new DamageTargetEffect(2).withTargetDescription("them"), false
).withInterveningIf(condition));
// -1: Target player discards a card.

View file

@ -41,7 +41,7 @@ public final class Demonfire extends CardImpl {
// Hellbent - If you have no cards in hand, Demonfire can't be countered and the damage can't be prevented.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DamageTargetEffect(GetXValue.instance, false),
new DamageTargetEffect(GetXValue.instance).withCantBePrevented(),
HellbentCondition.instance,
"<br/><i>Hellbent</i> &mdash; If you have no cards in hand, this spell can't be countered and the damage can't be prevented."));
// can't be countered

View file

@ -42,7 +42,7 @@ public final class DwarvenSeaClan extends CardImpl {
// {tap}: Choose target attacking or blocking creature whose controller controls an Island. Dwarven Sea Clan deals 2 damage to that creature at end of combat. Activate this ability only before the end of combat step.
Ability ability = new ActivateIfConditionActivatedAbility(
new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(
new DamageTargetEffect(2, true, "that creature")
new DamageTargetEffect(2).withTargetDescription("that creature")
)).setText("Choose target attacking or blocking creature whose controller controls an Island. " +
"{this} deals 2 damage to that creature at end of combat."),
new TapSourceCost(), BeforeEndCombatCondition.getInstance()

View file

@ -49,7 +49,7 @@ class EidolonOfTheGreatRevelTriggeredAbility extends TriggeredAbilityImpl {
public EidolonOfTheGreatRevelTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(2, true, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(2).withTargetDescription("that player"));
}

View file

@ -24,9 +24,8 @@ public final class FalkenrathPerforator extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Falkenrath Perforator attacks, it deals 1 damage to defending player.
this.addAbility(new AttacksTriggeredAbility(new DamageTargetEffect(
1, true, "defending player", "it"
), false, null, SetTargetPointer.PLAYER));
this.addAbility(new AttacksTriggeredAbility(new DamageTargetEffect(1)
.withTargetDescription("defending player"), false, null, SetTargetPointer.PLAYER));
}
private FalkenrathPerforator(final FalkenrathPerforator card) {

View file

@ -21,7 +21,8 @@ public final class FallOfTheTitans extends CardImpl {
// Fall of the Titans deals X damage to each of up to two target creatures and/or players.
this.getSpellAbility().addTarget(new TargetAnyTarget(0, 2));
this.getSpellAbility().addEffect(new DamageTargetEffect(GetXValue.instance, true, "each of up to two targets"));
this.getSpellAbility().addEffect(new DamageTargetEffect(GetXValue.instance)
.withTargetDescription("each of up to two targets"));
// Surge {X}{R}
addAbility(new SurgeAbility(this, "{X}{R}"));

View file

@ -24,7 +24,7 @@ public final class FateUnraveler extends CardImpl {
this.toughness = new MageInt(4);
// Whenever an opponent draws a card, Fate Unraveler deals 1 damage to that player.
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(1, true, "that player"), false, true));
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(1).withTargetDescription("that player"), false, true));
}
private FateUnraveler(final FateUnraveler card) {

View file

@ -18,7 +18,7 @@ public final class FatefulEnd extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
// Fateful End deals 3 damage to any target. Scry 1.
this.getSpellAbility().addEffect(new DamageTargetEffect(3, true, "any target"));
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
this.getSpellAbility().addTarget(new TargetAnyTarget());
this.getSpellAbility().addEffect(new ScryEffect(1, false));
}

View file

@ -36,14 +36,12 @@ public final class FieryAnnihilation extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
// Fiery Annihilation deals 5 damage to target creature. Exile up to one target Equipment attached to that creature. If that creature would die this turn, exile it instead.
this.getSpellAbility().addEffect(new DamageTargetEffect(
5, true, "target creature"
));
this.getSpellAbility().addEffect(new DamageTargetEffect(5));
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addEffect(new ExileTargetEffect()
.setTargetPointer(new SecondTargetPointer())
.setText("exile up to one target Equipment attached to that creature"));
this.getSpellAbility().addEffect(new ExileTargetIfDiesEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
this.getSpellAbility().addTarget(new TargetPermanent(0, 1, filter));
}

View file

@ -28,7 +28,7 @@ public final class FlamebladeAngel extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// Whenever a source an opponent controls deals damage to you or a permanent you control, you may have Flameblade Angel deal 1 damage to that source's controller.
Effect effect = new DamageTargetEffect(1, true, "that source's controller");
Effect effect = new DamageTargetEffect(1).withTargetDescription("that source's controller");
this.addAbility(new SourceDealsDamageToYouTriggeredAbility(effect, StaticFilters.FILTER_PERMANENT, true));
}

View file

@ -27,7 +27,7 @@ public final class FlameheartWerewolf extends CardImpl {
this.nightCard = true;
// Whenever Flameheart Werewolf blocks or becomes blocked by a creature, Flameheart Werewolf deals 2 damage to that creature.
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(new DamageTargetEffect(2, true, "that creature")));
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(new DamageTargetEffect(2).withTargetDescription("that creature")));
// At the beginning of each upkeep, if a player cast two or more spells last turn, transform Flameheart Werewolf.
this.addAbility(new WerewolfBackTriggeredAbility());

View file

@ -24,7 +24,7 @@ public final class FlamesOfTheBloodHand extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}");
// Flames of the Blood Hand deals 4 damage to target player. The damage can't be prevented.
this.getSpellAbility().addEffect(new DamageTargetEffect(4, false));
this.getSpellAbility().addEffect(new DamageTargetEffect(4).withCantBePrevented());
// If that player would gain life this turn, that player gains no life instead.
this.getSpellAbility().addEffect(new FlamesOfTheBloodHandReplacementEffect());
this.getSpellAbility().addTarget(new TargetPlayerOrPlaneswalker());

View file

@ -6,7 +6,6 @@ import mage.abilities.LoyaltyAbility;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.ExileSpellEffect;
@ -73,7 +72,8 @@ public final class FlamescrollCelebrant extends ModalDoubleFacedCard {
class FlamescrollCelebrantTriggeredAbility extends TriggeredAbilityImpl {
FlamescrollCelebrantTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(StaticValue.get(1), true, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(1).withTargetDescription("that player"));
setTriggerPhrase("Whenever an opponent activates an ability that isn't a mana ability, ");
}
private FlamescrollCelebrantTriggeredAbility(final FlamescrollCelebrantTriggeredAbility ability) {
@ -103,11 +103,6 @@ class FlamescrollCelebrantTriggeredAbility extends TriggeredAbilityImpl {
return true;
}
@Override
public String getRule() {
return "Whenever an opponent activates an ability that isn't a mana ability, " +
"{this} deals 1 damage to that player.";
}
}
class RevelInSilenceEffect extends ContinuousRuleModifyingEffectImpl {

View file

@ -18,7 +18,7 @@ public final class FuriousReprisal extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}");
// Furious Reprisal deals 2 damage to each of two target creatures and/or players.
this.getSpellAbility().addEffect(new DamageTargetEffect(2, true, "each of two targets"));
this.getSpellAbility().addEffect(new DamageTargetEffect(2).withTargetDescription("each of two targets"));
this.getSpellAbility().addTarget(new TargetAnyTarget(2, 2));
}

View file

@ -28,7 +28,7 @@ public final class FurnaceScamp extends CardImpl {
// Whenever Furnace Scamp deals combat damage to a player, you may sacrifice it. If you do, Furnace Scamp deals 3 damage to that player.
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(new DoIfCostPaid(
new DamageTargetEffect(3, true, "that player"), new SacrificeSourceCost()
new DamageTargetEffect(3).withTargetDescription("that player"), new SacrificeSourceCost()
), false, true);
this.addAbility(ability);
}

View file

@ -35,7 +35,7 @@ public final class GibberingFiend extends CardImpl {
// <i>Delirium</i> &mdash; At the beginning of each opponent's upkeep, if there are four or more card types among cards in your graveyard,
// Gibbering Fiend deals 1 damage to that player.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
TargetController.OPPONENT, new DamageTargetEffect(1, true, "that player"), false
TargetController.OPPONENT, new DamageTargetEffect(1).withTargetDescription("that player"), false
).withInterveningIf(DeliriumCondition.instance).setAbilityWord(AbilityWord.DELIRIUM).addHint(CardTypesInGraveyardCount.YOU.getHint()));
}

View file

@ -2,7 +2,6 @@ package mage.cards.h;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.Card;
@ -48,7 +47,8 @@ public final class HarshMentor extends CardImpl {
class HarshMentorTriggeredAbility extends TriggeredAbilityImpl {
HarshMentorTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(StaticValue.get(2), true, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(2).withTargetDescription("that player"));
setTriggerPhrase("Whenever an opponent activates an ability of an artifact, creature, or land on the battlefield, if it isn't a mana ability, ");
}
private HarshMentorTriggeredAbility(final HarshMentorTriggeredAbility ability) {
@ -82,8 +82,4 @@ class HarshMentorTriggeredAbility extends TriggeredAbilityImpl {
return false;
}
@Override
public String getRule() {
return "Whenever an opponent activates an ability of an artifact, creature, or land on the battlefield, if it isn't a mana ability, {this} deals 2 damage to that player.";
}
}

View file

@ -33,7 +33,7 @@ public final class HellfireMongrel extends CardImpl {
// At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Hellfire Mongrel deals 2 damage to that player.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
TargetController.OPPONENT,
new DamageTargetEffect(2, true, "that player"),
new DamageTargetEffect(2).withTargetDescription("that player"),
false
).withInterveningIf(condition));
}

View file

@ -1,11 +1,7 @@
package mage.cards.i;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
@ -20,6 +16,10 @@ import mage.game.stack.Spell;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.Watcher;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
*
* @author L_J
@ -50,7 +50,8 @@ public final class IchneumonDruid extends CardImpl {
class IchneumonDruidAbility extends TriggeredAbilityImpl {
IchneumonDruidAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(StaticValue.get(4), false, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(4).withTargetDescription("that player"));
setTriggerPhrase("Whenever an opponent casts an instant spell other than the first instant spell that player casts each turn, ");
}
private IchneumonDruidAbility(final IchneumonDruidAbility ability) {
@ -84,10 +85,6 @@ class IchneumonDruidAbility extends TriggeredAbilityImpl {
return false;
}
@Override
public String getRule() {
return "Whenever an opponent casts an instant spell other than the first instant spell that player casts each turn, {this} deals 4 damage to that player.";
}
}
class IchneumonDruidWatcher extends Watcher {

View file

@ -5,7 +5,6 @@ import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
@ -67,7 +66,7 @@ public final class ImmolationShaman extends CardImpl {
class ImmolationShamanTriggeredAbility extends TriggeredAbilityImpl {
ImmolationShamanTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(StaticValue.get(1), true, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(1).withTargetDescription("that player"));
setTriggerPhrase("Whenever an opponent activates an ability of an artifact, creature, or land that isn't a mana ability, ");
}

View file

@ -23,7 +23,8 @@ public final class InfernoElemental extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Inferno Elemental blocks or becomes blocked by a creature, Inferno Elemental deals 3 damage to that creature.
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(new DamageTargetEffect(3, true, "that creature")));
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(
new DamageTargetEffect(3).withTargetDescription("that creature")));
}
private InfernoElemental(final InfernoElemental card) {

View file

@ -28,7 +28,7 @@ public final class IshiIshiAkkiCrackshot extends CardImpl {
// Whenever an opponent casts a Spirit or Arcane spell, Ishi-Ishi, Akki Crackshot deals 2 damage to that player.
this.addAbility(new SpellCastOpponentTriggeredAbility(Zone.BATTLEFIELD,
new DamageTargetEffect(2, true, "that player"),
new DamageTargetEffect(2).withTargetDescription("that player"),
StaticFilters.FILTER_SPELL_SPIRIT_OR_ARCANE, false, SetTargetPointer.PLAYER));
}

View file

@ -17,7 +17,7 @@ public final class JaggedLightning extends CardImpl {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{3}{R}{R}");
// Jagged Lightning deals 3 damage to each of two target creatures.
this.getSpellAbility().addEffect(new DamageTargetEffect(3, true, "each of two target creatures"));
this.getSpellAbility().addEffect(new DamageTargetEffect(3).withTargetDescription("each of two target creatures"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2));
}

View file

@ -22,9 +22,7 @@ public final class JeskaiRevelation extends CardImpl {
// Return target spell or permanent to its owner's hand. Jeskai Revelation deals 4 damage to any target. Create two 1/1 white Monk creature tokens with prowess. Draw two cards. You gain 4 life.
this.getSpellAbility().addEffect(new ReturnToHandTargetEffect());
this.getSpellAbility().addTarget(new TargetSpellOrPermanent());
this.getSpellAbility().addEffect(new DamageTargetEffect(
4, true, "any target"
).setTargetPointer(new SecondTargetPointer()));
this.getSpellAbility().addEffect(new DamageTargetEffect(4).setTargetPointer(new SecondTargetPointer()));
this.getSpellAbility().addTarget(new TargetAnyTarget());
this.getSpellAbility().addEffect(new CreateTokenEffect(new MonasteryMentorToken(), 2));
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(2));

View file

@ -1,4 +1,3 @@
package mage.cards.k;
import java.util.UUID;
@ -17,7 +16,6 @@ import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.ColorPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.target.targetpointer.FixedTarget;
/**
@ -56,7 +54,7 @@ class KederektParasiteTriggeredAbility extends TriggeredAbilityImpl {
}
KederektParasiteTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(1, true, "opponent"), true);
super(Zone.BATTLEFIELD, new DamageTargetEffect(1), true);
}
private KederektParasiteTriggeredAbility(final KederektParasiteTriggeredAbility ability) {

View file

@ -27,7 +27,7 @@ public final class KessigForgemaster extends CardImpl {
this.secondSideCardClazz = mage.cards.f.FlameheartWerewolf.class;
// Whenever Kessig Forgemaster blocks or becomes blocked by a creature, Kessig Forgemaster deals 1 damage to that creature.
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(new DamageTargetEffect(1, true, "that creature")));
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(new DamageTargetEffect(1).withTargetDescription("that creature")));
// At the beginning of each upkeep, if no spells were cast last turn, transform Kessig Forgemaster.
this.addAbility(new TransformAbility());

View file

@ -30,13 +30,11 @@ import java.util.UUID;
*/
public final class KnollspineInvocation extends CardImpl {
protected static final FilterCard filter = new FilterCard("a card with mana value X");
public KnollspineInvocation(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}{R}");
// {X}, Discard a card with mana value X: This enchantment deals X damage to any target.
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(GetXValue.instance, true), new ManaCostsImpl<>("{X}"));
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(GetXValue.instance), new ManaCostsImpl<>("{X}"));
ability.addCost(new KnollspineInvocationDiscardCost());
ability.addTarget(new TargetAnyTarget());
ability.setCostAdjuster(KnollspineInvocationAdjuster.instance);

View file

@ -24,7 +24,7 @@ public final class KolaghanAspirant extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Kolaghan Aspirant becomes blocked by a creature, Kolaghan Aspirant deals 1 damage to that creature.
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(new DamageTargetEffect(1, true, "that creature"), false));
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(new DamageTargetEffect(1).withTargetDescription("that creature"), false));
}
private KolaghanAspirant(final KolaghanAspirant card) {

View file

@ -30,7 +30,7 @@ public final class LavabornMuse extends CardImpl {
// At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Lavaborn Muse deals 3 damage to that player.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
TargetController.OPPONENT,
new DamageTargetEffect(3, true, "that player"),
new DamageTargetEffect(3).withTargetDescription("that player"),
false
).withInterveningIf(condition));
}

View file

@ -25,7 +25,7 @@ public final class LightningSurge extends CardImpl {
// Lightning Surge deals 4 damage to any target.
// Threshold - If seven or more cards are in your graveyard, instead Lightning Surge deals 6 damage to that creature or player and the damage can't be prevented.
Effect effect = new ConditionalOneShotEffect(
new DamageTargetEffect(6, false), new DamageTargetEffect(4),
new DamageTargetEffect(6).withCantBePrevented(), new DamageTargetEffect(4),
ThresholdCondition.instance, "{this} deals 4 damage to any target.<br>" +
AbilityWord.THRESHOLD.formatWord() + "If seven or more cards are in your graveyard, " +
"instead {this} deals 6 damage to that permanent or player and the damage can't be prevented"

View file

@ -22,7 +22,7 @@ public final class Manabarbs extends CardImpl {
// Whenever a player taps a land for mana, Manabarbs deals 1 damage to that player.
this.addAbility(new TapForManaAllTriggeredAbility(
new DamageTargetEffect(1, true, "that player"),
new DamageTargetEffect(1).withTargetDescription("that player"),
new FilterLandPermanent("a player taps a land"), SetTargetPointer.PLAYER));
}

View file

@ -24,7 +24,7 @@ public final class MaskOfIntolerance extends CardImpl {
// At the beginning of each player's upkeep, if there are four or more basic land types among lands that player controls, Mask of Intolerance deals 3 damage to that player.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
TargetController.EACH_PLAYER, new DamageTargetEffect(3, true, "that player"), false
TargetController.EACH_PLAYER, new DamageTargetEffect(3).withTargetDescription("that player"), false
).withInterveningIf(MaskOfIntoleranceCondition.instance).addHint(DomainHint.instance));
}

View file

@ -19,7 +19,7 @@ public final class Megrim extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{B}");
// Whenever an opponent discards a card, Megrim deals 2 damage to that player.
this.addAbility(new DiscardsACardOpponentTriggeredAbility(new DamageTargetEffect(2, true, "that player"), false, SetTargetPointer.PLAYER));
this.addAbility(new DiscardsACardOpponentTriggeredAbility(new DamageTargetEffect(2).withTargetDescription("that player"), false, SetTargetPointer.PLAYER));
}
private Megrim(final Megrim card) {

View file

@ -33,7 +33,7 @@ public final class NekusarTheMindrazer extends CardImpl {
false));
// Whenever an opponent draws a card, Nekusar, the Mindrazer deals 1 damage to that player.
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(1, true, "that player"), false, true));
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(1).withTargetDescription("that player"), false, true));
}
private NekusarTheMindrazer(final NekusarTheMindrazer card) {

View file

@ -28,9 +28,8 @@ public final class ObNixilisTheHateTwisted extends CardImpl {
this.setStartingLoyalty(5);
// Whenever an opponent draws a card, Ob Nixilis, the Hate-Twisted deals 1 damage to that player.
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(
1, true, "that player"
), false, true));
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(1)
.withTargetDescription("that player"), false, true));
// -2: Destroy target creature. Its controller draws two cards.
Ability ability = new LoyaltyAbility(new DestroyTargetEffect(), -2);

View file

@ -24,7 +24,7 @@ public final class OrneryGoblin extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Ornery Goblin blocks or becomes blocked by a creature, Ornery Goblin deals 1 damage to that creature.
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(new DamageTargetEffect(1, true, "that creature")));
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(new DamageTargetEffect(1).withTargetDescription("that creature")));
}
private OrneryGoblin(final OrneryGoblin card) {

View file

@ -30,7 +30,7 @@ public final class Overabundance extends CardImpl {
));
this.addAbility(new TapForManaAllTriggeredAbility(
new DamageTargetEffect(1, true, "that player"),
new DamageTargetEffect(1).withTargetDescription("that player"),
new FilterLandPermanent("a player taps a land"),
SetTargetPointer.PLAYER
));

View file

@ -24,7 +24,7 @@ public final class PaupersCage extends CardImpl {
// At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Paupers' Cage deals 2 damage to that player.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
TargetController.OPPONENT, new DamageTargetEffect(2, true, "that player"), false
TargetController.OPPONENT, new DamageTargetEffect(2).withTargetDescription("that player"), false
).withInterveningIf(condition));
}

View file

@ -18,7 +18,7 @@ public final class PinpointAvalanche extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{R}{R}");
// Pinpoint Avalanche deals 4 damage to target creature. The damage can't be prevented.
this.getSpellAbility().addEffect(new DamageTargetEffect(4, false));
this.getSpellAbility().addEffect(new DamageTargetEffect(4).withCantBePrevented());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
}

View file

@ -34,7 +34,7 @@ public final class PrickleFaeries extends CardImpl {
// At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Prickle Faeries deals 2 damage to them.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD, TargetController.OPPONENT,
new DamageTargetEffect(2, true, "them"), false
new DamageTargetEffect(2).withTargetDescription("them"), false
).withInterveningIf(condition));
}

View file

@ -42,7 +42,7 @@ class PyrostaticPillarTriggeredAbility extends TriggeredAbilityImpl {
public PyrostaticPillarTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(2, true, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(2).withTargetDescription("that player"));
}
@ -76,4 +76,4 @@ class PyrostaticPillarTriggeredAbility extends TriggeredAbilityImpl {
public String getRule() {
return "Whenever a player casts a spell with mana value 3 or less, {this} deals 2 damage to that player.";
}
}
}

View file

@ -24,7 +24,7 @@ public final class QuenchableFire extends CardImpl {
this.getSpellAbility().addEffect(new DamageTargetEffect(3));
// It deals an additional 3 damage to that player or planeswalker at the beginning of your next upkeep step unless that player or that planeswalkers controller pays {U} before that step.
this.getSpellAbility().addEffect(new UnlessPaysDelayedEffect(new ManaCostsImpl<>("{U}"),
new DamageTargetEffect(3, true, "that player or that planeswalker's controller"), PhaseStep.UPKEEP, false,
new DamageTargetEffect(3).withTargetDescription("that player or that planeswalker's controller"), PhaseStep.UPKEEP, false,
"It deals an additional 3 damage to that player or planeswalker at the beginning of your next upkeep step unless that player or that planeswalker's controller pays {U} before that step."));
}

View file

@ -43,8 +43,9 @@ public final class RampagingFerocidon extends CardImpl {
this.addAbility(new SimpleStaticAbility(new CantGainLifeAllEffect()));
// Whenever another creature enters the battlefield, Rampaging Ferocidon deals 1 damage to that creature's controller.
this.addAbility(new EntersBattlefieldAllTriggeredAbility(
Zone.BATTLEFIELD, new DamageTargetEffect(1, true, "that creature's controller"), filter, false, SetTargetPointer.PLAYER));
this.addAbility(new EntersBattlefieldAllTriggeredAbility(Zone.BATTLEFIELD,
new DamageTargetEffect(1).withTargetDescription("that creature's controller"),
filter, false, SetTargetPointer.PLAYER));
}
private RampagingFerocidon(final RampagingFerocidon card) {

View file

@ -25,7 +25,7 @@ public final class RazorPendulum extends CardImpl {
// At the beginning of each players end step, if that player has 5 or less life, Razor Pendulum deals 2 damage to that player.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.EACH_PLAYER,
new DamageTargetEffect(2, true, "that player"),
new DamageTargetEffect(2).withTargetDescription("that player"),
false, condition
));
}

View file

@ -35,9 +35,9 @@ public final class RazorkinNeedlehead extends CardImpl {
)));
// Whenever an opponent draws a card, Razorkin Needlehead deals 1 damage to them.
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(
1, true, "them"
), false, true));
this.addAbility(new DrawCardOpponentTriggeredAbility(
new DamageTargetEffect(1).withTargetDescription("them"),
false, true));
}
private RazorkinNeedlehead(final RazorkinNeedlehead card) {

View file

@ -32,15 +32,15 @@ public final class RoilingVortex extends CardImpl {
// At the beginning of each player's upkeep, Roiling Vortex deals 1 damage to them.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
TargetController.EACH_PLAYER, new DamageTargetEffect(1, true, "them"),
TargetController.EACH_PLAYER, new DamageTargetEffect(1).withTargetDescription("them"),
false
));
// Whenever a player casts a spell, if no mana was spent to cast that spell, Roiling Vortex deals 5 damage to that player.
this.addAbility(new SpellCastAllTriggeredAbility(new DamageTargetEffect(
5, true, "that player",
"if no mana was spent to cast that spell, {this}"
), filter, false, SetTargetPointer.PLAYER));
this.addAbility(new SpellCastAllTriggeredAbility(
new DamageTargetEffect(5)
.setText("if no mana was spent to cast that spell, {this} deals 5 damage to that player"),
filter, false, SetTargetPointer.PLAYER));
// {R}: Your opponents can't gain life this turn.
this.addAbility(new SimpleActivatedAbility(

View file

@ -37,7 +37,7 @@ public final class ScabClanBerserker extends CardImpl {
// Whenever an opponent casts a noncreature spell, if Scab-Clan Berserker is renowned, Scab-Clan Berserker deals 2 damage to that player.
this.addAbility(new SpellCastOpponentTriggeredAbility(
Zone.BATTLEFIELD,
new DamageTargetEffect(2, true, "that player"),
new DamageTargetEffect(2).withTargetDescription("that player"),
StaticFilters.FILTER_SPELL_A_NON_CREATURE, false, SetTargetPointer.PLAYER
).withInterveningIf(RenownedSourceCondition.THIS));
}

View file

@ -29,7 +29,7 @@ public final class Scald extends CardImpl {
// Whenever a player taps an Island for mana, Scald deals 1 damage to that player.
this.addAbility(new TapForManaAllTriggeredAbility(
new DamageTargetEffect(1, true, "that player"),
new DamageTargetEffect(1).withTargetDescription("that player"),
filter,
SetTargetPointer.PLAYER));
}

View file

@ -34,7 +34,7 @@ public final class ScaldingViper extends AdventureCard {
// Whenever an opponent casts a spell with mana value 3 or less, Scalding Viper deals 1 damage to that player.
this.addAbility(new SpellCastOpponentTriggeredAbility(
Zone.BATTLEFIELD, new DamageTargetEffect(1, true, "that player"),
Zone.BATTLEFIELD, new DamageTargetEffect(1).withTargetDescription("that player"),
filter, false, SetTargetPointer.PLAYER
));

View file

@ -23,7 +23,7 @@ public final class SearingBlood extends CardImpl {
this.getSpellAbility().addEffect(new DamageTargetEffect(2));
this.getSpellAbility().addEffect(new CreateDelayedTriggeredAbilityEffect(
new WhenTargetDiesDelayedTriggeredAbility(
new DamageTargetEffect(3, true, "the creature's controller"),
new DamageTargetEffect(3).withTargetDescription("the creature's controller"),
SetTargetPointer.PLAYER
)
));

View file

@ -14,7 +14,6 @@ import mage.constants.Zone;
import mage.filter.common.FilterCreatureCard;
import mage.filter.predicate.ObjectSourcePlayer;
import mage.filter.predicate.ObjectSourcePlayerPredicate;
import mage.game.Controllable;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.stack.Spell;
@ -22,6 +21,7 @@ import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
import mage.watchers.Watcher;
import mage.watchers.common.SpellsCastWatcher;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@ -108,8 +108,8 @@ class FirstCastCreatureSpellPredicate implements ObjectSourcePlayerPredicate<Car
class ShadowInTheWarpTriggeredAbility extends TriggeredAbilityImpl {
public ShadowInTheWarpTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(2, false));
ShadowInTheWarpTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(2));
}
private ShadowInTheWarpTriggeredAbility(final ShadowInTheWarpTriggeredAbility ability) {

View file

@ -41,7 +41,7 @@ public final class ShriekTreblemaker extends CardImpl {
// Sonic Blast -- Whenever a creature an opponent controls dies, Shriek deals 1 damage to that player.
this.addAbility(new DiesCreatureTriggeredAbility(
Zone.BATTLEFIELD,
new DamageTargetEffect(1, true, "that player"),
new DamageTargetEffect(1).withTargetDescription("that player"),
false,
StaticFilters.FILTER_OPPONENTS_PERMANENT_A_CREATURE,
SetTargetPointer.PLAYER)

View file

@ -1,6 +1,5 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.effects.Effect;
@ -13,6 +12,8 @@ import mage.game.Game;
import mage.target.common.TargetControlledCreaturePermanent;
import mage.watchers.common.AmountOfDamageAPlayerReceivedThisTurnWatcher;
import java.util.UUID;
/**
*
* @author MTGfan
@ -21,14 +22,13 @@ public final class Simulacrum extends CardImpl {
public Simulacrum(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{1}{B}");
// You gain life equal to the damage dealt to you this turn. Simulacrum deals damage to target creature you control equal to the damage dealt to you this turn.
this.getSpellAbility().addEffect(new GainLifeEffect(new SimulacrumAmount(), "You gain life equal to the damage dealt to you this turn."));
this.getSpellAbility().addEffect(new GainLifeEffect(SimulacrumAmount.instance, "You gain life equal to the damage dealt to you this turn."));
this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent());
Effect effect = new DamageTargetEffect(new SimulacrumAmount(), true, "target creature you control");
effect.setText(" {this} deals damage to target creature you control equal to the damage dealt to you this turn.");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addEffect(new DamageTargetEffect(SimulacrumAmount.instance)
.setText("{this} deals damage to target creature you control equal to the damage dealt to you this turn"));
this.getSpellAbility().addWatcher(new AmountOfDamageAPlayerReceivedThisTurnWatcher());
}
@ -42,12 +42,13 @@ public final class Simulacrum extends CardImpl {
}
}
class SimulacrumAmount implements DynamicValue {
enum SimulacrumAmount implements DynamicValue {
instance;
@Override
public int calculate(Game game, Ability sourceAbility, Effect effect) {
AmountOfDamageAPlayerReceivedThisTurnWatcher watcher = game.getState().getWatcher(AmountOfDamageAPlayerReceivedThisTurnWatcher.class);
if(watcher != null) {
if (watcher != null) {
return watcher.getAmountOfDamageReceivedThisTurn(sourceAbility.getControllerId());
}
return 0;
@ -55,7 +56,7 @@ class SimulacrumAmount implements DynamicValue {
@Override
public SimulacrumAmount copy() {
return new SimulacrumAmount();
return this;
}
@Override

View file

@ -30,7 +30,7 @@ public final class SkewerSlinger extends CardImpl {
// Whenever Skewer Slinger blocks or becomes blocked by a creature, Skewer Slinger deals 1 damage to that creature.
this.addAbility(new BlocksOrBlockedByCreatureSourceTriggeredAbility(
new DamageTargetEffect(1, true, "that creature")
new DamageTargetEffect(1).withTargetDescription("that creature")
));
}

View file

@ -25,7 +25,7 @@ public final class SomberwaldVigilante extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Somberwald Vigilante becomes blocked by a creature, Somberwald Vigilante deals 1 damage to that creature.
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(new DamageTargetEffect(1, true, "that creature"), false));
this.addAbility(new BecomesBlockedByCreatureTriggeredAbility(new DamageTargetEffect(1).withTargetDescription("that creature"), false));
}
private SomberwaldVigilante(final SomberwaldVigilante card) {

View file

@ -42,7 +42,7 @@ class SpellshockTriggeredAbility extends TriggeredAbilityImpl {
public SpellshockTriggeredAbility() {
super(Zone.BATTLEFIELD, new DamageTargetEffect(2, true, "that player"));
super(Zone.BATTLEFIELD, new DamageTargetEffect(2).withTargetDescription("that player"));
}
@ -76,4 +76,4 @@ class SpellshockTriggeredAbility extends TriggeredAbilityImpl {
public String getRule() {
return "Whenever a player casts a spell, {this} deals 2 damage to that player.";
}
}
}

View file

@ -39,14 +39,11 @@ public final class SpikedPitTrap extends CardImpl {
this.addAbility(ability);
// 1-9 | Spiked Pit Trap deals 5 damage to that creature.
effect.addTableEntry(1, 9, new DamageTargetEffect(
5, true, "that creature"
));
effect.addTableEntry(1, 9, new DamageTargetEffect(5).withTargetDescription("that creature"));
// 10-20 | Spike Pit Trap deals 5 damage to that creature. Create a Treasure token.
effect.addTableEntry(10, 20, new DamageTargetEffect(
5, true, "that creature."
), new CreateTokenEffect(new TreasureToken()));
effect.addTableEntry(10, 20, new DamageTargetEffect(5).withTargetDescription("that creature"),
new CreateTokenEffect(new TreasureToken()));
}
private SpikedPitTrap(final SpikedPitTrap card) {

View file

@ -26,7 +26,7 @@ public final class StructuralCollapse extends CardImpl {
.setText("target player sacrifices an artifact"));
this.getSpellAbility().addEffect(new SacrificeEffect(StaticFilters.FILTER_LANDS, 1, "Target player")
.setText("and a land of their choice"));
this.getSpellAbility().addEffect(new DamageTargetEffect(2, true, "that player"));
this.getSpellAbility().addEffect(new DamageTargetEffect(2).withTargetDescription("that player"));
this.getSpellAbility().addTarget(new TargetPlayer());
}

View file

@ -1,7 +1,5 @@
package mage.cards.s;
import java.util.UUID;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.SplitSecondAbility;
import mage.cards.CardImpl;
@ -9,6 +7,8 @@ import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.target.common.TargetAnyTarget;
import java.util.UUID;
/**
*
* @author LevelX2
@ -18,11 +18,11 @@ public final class SuddenShock extends CardImpl {
public SuddenShock(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{R}");
// Split second
this.addAbility(new SplitSecondAbility());
// Sudden Shock deals 2 damage to any target.
this.getSpellAbility().addEffect(new DamageTargetEffect(2, true));
this.getSpellAbility().addEffect(new DamageTargetEffect(2));
this.getSpellAbility().addTarget(new TargetAnyTarget());
}

View file

@ -28,7 +28,7 @@ public final class SulfuricVortex extends CardImpl {
// At the beginning of each player's upkeep, Sulfuric Vortex deals 2 damage to that player.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(TargetController.EACH_PLAYER, new DamageTargetEffect(2, true, "that player"), false));
this.addAbility(new BeginningOfUpkeepTriggeredAbility(TargetController.EACH_PLAYER, new DamageTargetEffect(2).withTargetDescription("that player"), false));
// If a player would gain life, that player gains no life instead.
this.addAbility(new SimpleStaticAbility(new SulfuricVortexReplacementEffect()));

View file

@ -1,4 +1,3 @@
package mage.cards.s;
import java.util.UUID;
@ -18,7 +17,7 @@ public final class Swelter extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.SORCERY},"{3}{R}");
// Swelter deals 2 damage to each of two target creatures.
this.getSpellAbility().addEffect(new DamageTargetEffect(2, true, "each of two target creatures"));
this.getSpellAbility().addEffect(new DamageTargetEffect(2).withTargetDescription("each of two target creatures"));
this.getSpellAbility().addTarget(new TargetCreaturePermanent(2, 2));
}

View file

@ -202,7 +202,7 @@ class TakklemaggotUpkeepAbility extends TriggeredAbilityImpl {
private final UUID playerId;
TakklemaggotUpkeepAbility(UUID playerId) {
super(Zone.BATTLEFIELD, new DamageTargetEffect(1, true, "that player")
super(Zone.BATTLEFIELD, new DamageTargetEffect(1).withTargetDescription("that player")
.setTargetPointer(new FixedTarget(playerId)), false);
this.playerId = playerId;
setTriggerPhrase("At the beginning of that player's upkeep, ");

View file

@ -39,7 +39,7 @@ public final class TitanHunter extends CardImpl {
// At the beginning of each player's end step, if no creatures died this turn, Titan Hunter deals 4 damage to that player.
this.addAbility(new BeginningOfEndStepTriggeredAbility(
TargetController.EACH_PLAYER,
new DamageTargetEffect(4, true, "that player"),
new DamageTargetEffect(4).withTargetDescription("that player"),
false, condition
).addHint(MorbidHint.instance));

View file

@ -32,7 +32,7 @@ public final class TovolarsMagehunter extends CardImpl {
// Whenever an opponent casts a spell, Tovolar's Magehunter deals 2 damage to that player.
this.addAbility(new SpellCastOpponentTriggeredAbility(
Zone.BATTLEFIELD, new DamageTargetEffect(2, true, "that player"),
Zone.BATTLEFIELD, new DamageTargetEffect(2).withTargetDescription("that player"),
StaticFilters.FILTER_SPELL_A, false, SetTargetPointer.PLAYER
));

View file

@ -18,7 +18,7 @@ public final class UnderworldDreams extends CardImpl {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{B}{B}{B}");
// Whenever an opponent draws a card, Underworld Dreams deals 1 damage to that player.
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(1, true, "that player"), false, true));
this.addAbility(new DrawCardOpponentTriggeredAbility(new DamageTargetEffect(1).withTargetDescription("that player"), false, true));
}
private UnderworldDreams(final UnderworldDreams card) {

View file

@ -41,7 +41,7 @@ public final class UrborgStalker extends CardImpl {
// At the beginning of each player's upkeep, if that player controls a nonblack, nonland permanent, Urborg Stalker deals 1 damage to that player.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
TargetController.EACH_PLAYER, new DamageTargetEffect(1, true, "that player"), false
TargetController.EACH_PLAYER, new DamageTargetEffect(1).withTargetDescription("that player"), false
).withInterveningIf(condition));
}

View file

@ -28,7 +28,7 @@ public final class UrzasRage extends CardImpl {
// Urza's Rage deals 3 damage to any target. If Urza's Rage was kicked, instead it deals 10 damage to that creature or player and the damage can't be prevented.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(
new DamageTargetEffect(10, false), new DamageTargetEffect(3),
new DamageTargetEffect(10).withCantBePrevented(), new DamageTargetEffect(3),
KickedCondition.ONCE, "{this} deals 3 damage to any target. If this spell was kicked, " +
"instead it deals 10 damage to that permanent or player and the damage can't be prevented."
));

View file

@ -25,7 +25,7 @@ public final class VengefulTracker extends CardImpl {
// Whenever an opponent sacrifices an artifact, Vengeful Tracker deals 2 damage to them.
this.addAbility(new SacrificePermanentTriggeredAbility(
Zone.BATTLEFIELD, new DamageTargetEffect(2, true, "them"),
Zone.BATTLEFIELD, new DamageTargetEffect(2).withTargetDescription("them"),
StaticFilters.FILTER_PERMANENT_ARTIFACT, TargetController.OPPONENT, SetTargetPointer.PLAYER, false
));
}

View file

@ -9,8 +9,6 @@ import mage.constants.Outcome;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.Target;
import mage.util.CardUtil;
import java.util.UUID;
@ -21,63 +19,37 @@ import java.util.UUID;
public class DamageTargetEffect extends OneShotEffect {
private final DynamicValue amount;
private final boolean preventable;
private String targetDescription;
private boolean preventable = true;
private String sourceName = "{this}";
public DamageTargetEffect(int amount) {
this(StaticValue.get(amount), true);
this(StaticValue.get(amount));
}
public DamageTargetEffect(int amount, String whoDealDamageName) {
this(StaticValue.get(amount), true);
this.sourceName = whoDealDamageName;
}
public DamageTargetEffect(int amount, boolean preventable) {
this(StaticValue.get(amount), preventable);
}
public DamageTargetEffect(int amount, boolean preventable, String targetDescription) {
this(StaticValue.get(amount), preventable, targetDescription);
}
public DamageTargetEffect(int amount, boolean preventable, String targetDescription, String whoDealDamageName) {
this(StaticValue.get(amount), preventable, targetDescription);
this(amount);
this.sourceName = whoDealDamageName;
}
public DamageTargetEffect(DynamicValue amount) {
this(amount, true);
super(Outcome.Damage);
this.amount = amount;
}
public DamageTargetEffect(DynamicValue amount, String whoDealDamageName) {
this(amount, true);
this(amount);
this.sourceName = whoDealDamageName;
}
public DamageTargetEffect(DynamicValue amount, boolean preventable) {
this(amount, preventable, "");
}
public DamageTargetEffect(DynamicValue amount, boolean preventable, String targetDescription) {
super(Outcome.Damage);
this.amount = amount;
this.preventable = preventable;
this.targetDescription = targetDescription;
}
protected DamageTargetEffect(final DamageTargetEffect effect) {
super(effect);
this.amount = effect.amount.copy();
this.preventable = effect.preventable;
this.targetDescription = effect.targetDescription;
this.sourceName = effect.sourceName;
}
@Override
public DamageTargetEffect withTargetDescription(String targetDescription) {
this.targetDescription = targetDescription;
public DamageTargetEffect withCantBePrevented() {
this.preventable = false;
return this;
}
@ -117,39 +89,11 @@ public class DamageTargetEffect extends OneShotEffect {
sb.append(' ');
}
sb.append("damage to ");
if (!targetDescription.isEmpty()) {
sb.append(targetDescription);
} else {
if (!mode.getTargets().isEmpty()) {
Target firstTarget = mode.getTargets().get(0);
String targetName = firstTarget.getTargetName();
if (targetName.contains("any")) {
sb.append(targetName);
} else {
if (firstTarget.getMinNumberOfTargets() == 0) {
int maxTargets = firstTarget.getMaxNumberOfTargets();
switch (maxTargets) {
case Integer.MAX_VALUE:
sb.append("any number of ");
break;
case 1:
sb.append("up to one ");
break;
default:
sb.append("each of up to ");
sb.append(CardUtil.numberToText(maxTargets));
sb.append(' ');
}
}
if (!targetName.contains("target ")) {
sb.append("target ");
}
sb.append(targetName);
}
} else {
sb.append("that target");
}
String targetDescription = getTargetPointer().describeTargets(mode.getTargets(), "that target");
if (targetDescription.startsWith("up to") && !targetDescription.startsWith("up to one")) {
sb.append("each of ");
}
sb.append(targetDescription);
if (!message.isEmpty()) {
if (message.equals("1")) {
sb.append(" equal to the number of ");

View file

@ -23,7 +23,7 @@ public final class InzervaMasterOfInsightsEmblem extends Emblem {
));
// Whenever an opponent draws a card, this emblem deals 1 damage to them
this.getAbilities().add(new DrawCardOpponentTriggeredAbility(
Zone.COMMAND, new DamageTargetEffect(1, true, "them")
Zone.COMMAND, new DamageTargetEffect(1)
.setText("this emblem deals 1 damage to them"), false, true
));
}

View file

@ -120,7 +120,9 @@ public class EachTargetPointer extends TargetPointerImpl {
@Override
public String describeTargets(Targets targets, String defaultDescription) {
if (targetDescription != null) return targetDescription;
if (targetDescription != null) {
return targetDescription;
}
if (targets.isEmpty()) {
return defaultDescription;
}

View file

@ -148,7 +148,9 @@ public abstract class NthTargetPointer extends TargetPointerImpl {
@Override
public String describeTargets(Targets targets, String defaultDescription) {
if (targetDescription != null) return targetDescription;
if (targetDescription != null) {
return targetDescription;
}
if (targets.size() <= this.targetIndex) {
// TODO: need research, is it used for non setup targets ?!
// Typical usage example: trigger sets fixed target pointer