From 7212b02e53158f34c941cb445d2dd24c2aa76362 Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 19 Apr 2018 11:19:48 -0400 Subject: [PATCH] initial changes, creation of branch, detailed in #4799 --- Mage.Sets/src/mage/cards/a/AbunaAcolyte.java | 8 ++++---- Mage.Sets/src/mage/cards/a/AbunasChant.java | 7 +++---- Mage.Sets/src/mage/cards/l/LightningBolt.java | 4 ++-- Mage.Sets/src/mage/cards/o/OrcishVandal.java | 10 ++++++---- Mage.Sets/src/mage/cards/r/RushingTideZubera.java | 11 +++++------ Mage.Sets/src/mage/cards/s/SanctumGuardian.java | 8 ++++---- Mage.Sets/src/mage/cards/s/SuqAtaFirewalker.java | 4 ++-- Mage.Sets/src/mage/cards/w/WizardsLightning.java | 5 +++-- .../abilities/effects/common/DamageTargetEffect.java | 7 ++++++- .../effects/common/PreventDamageToTargetEffect.java | 11 ++++++++--- Mage/src/main/java/mage/players/PlayerImpl.java | 2 +- 11 files changed, 44 insertions(+), 33 deletions(-) diff --git a/Mage.Sets/src/mage/cards/a/AbunaAcolyte.java b/Mage.Sets/src/mage/cards/a/AbunaAcolyte.java index 6bd01b808c..f7792d86aa 100644 --- a/Mage.Sets/src/mage/cards/a/AbunaAcolyte.java +++ b/Mage.Sets/src/mage/cards/a/AbunaAcolyte.java @@ -41,7 +41,7 @@ import mage.constants.SubType; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.CardTypePredicate; -import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.TargetAnyTarget; import mage.target.common.TargetCreaturePermanent; /** @@ -57,14 +57,14 @@ public class AbunaAcolyte extends CardImpl { } public AbunaAcolyte(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); this.subtype.add(SubType.CAT); this.subtype.add(SubType.CLERIC); this.power = new MageInt(1); this.toughness = new MageInt(1); Ability ability1 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, 1), new TapSourceCost()); - ability1.addTarget(new TargetCreatureOrPlayer()); + ability1.addTarget(new TargetAnyTarget()); Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventDamageToTargetEffect(Duration.EndOfTurn, 2), new TapSourceCost()); ability2.addTarget(new TargetCreaturePermanent(filter)); this.addAbility(ability1); @@ -80,4 +80,4 @@ public class AbunaAcolyte extends CardImpl { return new AbunaAcolyte(this); } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/a/AbunasChant.java b/Mage.Sets/src/mage/cards/a/AbunasChant.java index 16ab5f19c4..3f655de839 100644 --- a/Mage.Sets/src/mage/cards/a/AbunasChant.java +++ b/Mage.Sets/src/mage/cards/a/AbunasChant.java @@ -36,7 +36,7 @@ import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.Duration; -import mage.target.common.TargetCreaturePermanent; +import mage.target.common.TargetAnyTarget; /** * @@ -45,8 +45,7 @@ import mage.target.common.TargetCreaturePermanent; public class AbunasChant extends CardImpl { public AbunasChant(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{3}{W}"); - + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{W}"); // Choose one - this.getSpellAbility().getModes().setMinModes(1); @@ -56,7 +55,7 @@ public class AbunasChant extends CardImpl { //or prevent the next 5 damage that would be dealt to target creature this turn. Mode mode = new Mode(); mode.getEffects().add(new PreventDamageToTargetEffect(Duration.EndOfTurn, 5)); - mode.getTargets().add(new TargetCreaturePermanent()); + mode.getTargets().add(new TargetAnyTarget()); this.getSpellAbility().getModes().addMode(mode); // Entwine {2} this.addAbility(new EntwineAbility("{2}")); diff --git a/Mage.Sets/src/mage/cards/l/LightningBolt.java b/Mage.Sets/src/mage/cards/l/LightningBolt.java index f053bac4a7..c37dc16e37 100644 --- a/Mage.Sets/src/mage/cards/l/LightningBolt.java +++ b/Mage.Sets/src/mage/cards/l/LightningBolt.java @@ -33,7 +33,7 @@ import mage.abilities.effects.common.DamageTargetEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.TargetAnyTarget; /** * @@ -44,7 +44,7 @@ public class LightningBolt extends CardImpl { public LightningBolt(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{R}"); - this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); + this.getSpellAbility().addTarget(new TargetAnyTarget()); this.getSpellAbility().addEffect(new DamageTargetEffect(3)); } diff --git a/Mage.Sets/src/mage/cards/o/OrcishVandal.java b/Mage.Sets/src/mage/cards/o/OrcishVandal.java index f261299255..ba8db220e1 100644 --- a/Mage.Sets/src/mage/cards/o/OrcishVandal.java +++ b/Mage.Sets/src/mage/cards/o/OrcishVandal.java @@ -41,23 +41,25 @@ import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.CardTypePredicate; import mage.target.common.TargetControlledPermanent; -import mage.target.common.TargetCreatureOrPlayer; import java.util.UUID; +import mage.target.common.TargetAnyTarget; + /** * * @author themattfiles */ public class OrcishVandal extends CardImpl { + private static final FilterControlledPermanent filter = new FilterControlledPermanent("an artifact"); static { filter.add(new CardTypePredicate(CardType.ARTIFACT)); } - + public OrcishVandal(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{R}"); - + this.subtype.add(SubType.ORC); this.subtype.add(SubType.WARRIOR); this.power = new MageInt(1); @@ -65,7 +67,7 @@ public class OrcishVandal extends CardImpl { // {t}, Sacrifice an artifact: Orcish Vandal deals 2 damage to any target. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), new TapSourceCost()); - ability.addTarget(new TargetCreatureOrPlayer()); + ability.addTarget(new TargetAnyTarget()); ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(filter))); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/r/RushingTideZubera.java b/Mage.Sets/src/mage/cards/r/RushingTideZubera.java index cbad26db52..d428266ff6 100644 --- a/Mage.Sets/src/mage/cards/r/RushingTideZubera.java +++ b/Mage.Sets/src/mage/cards/r/RushingTideZubera.java @@ -41,7 +41,6 @@ import mage.constants.SubType; import mage.constants.Zone; import mage.game.Game; import mage.game.permanent.Permanent; -import mage.target.common.TargetCreatureOrPlayer; /** * @@ -50,7 +49,7 @@ import mage.target.common.TargetCreatureOrPlayer; public class RushingTideZubera extends CardImpl { public RushingTideZubera(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); this.subtype.add(SubType.ZUBERA); this.subtype.add(SubType.SPIRIT); @@ -58,9 +57,8 @@ public class RushingTideZubera extends CardImpl { this.toughness = new MageInt(3); // When Rushing-Tide Zubera dies, if 4 or more damage was dealt to it this turn, draw three cards. - Ability ability = new ConditionalTriggeredAbility(new DiesTriggeredAbility(new DrawCardSourceControllerEffect(3)),new RushingTideZuberaCondition(), + Ability ability = new ConditionalTriggeredAbility(new DiesTriggeredAbility(new DrawCardSourceControllerEffect(3)), new RushingTideZuberaCondition(), "When {this} dies, if 4 or more damage was dealt to it this turn, draw three cards."); - ability.addTarget(new TargetCreatureOrPlayer()); this.addAbility(ability); } @@ -75,12 +73,13 @@ public class RushingTideZubera extends CardImpl { } class RushingTideZuberaCondition implements Condition { + @Override public boolean apply(Game game, Ability source) { Permanent permanent = game.getPermanent(source.getSourceId()); if (permanent == null) { permanent = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD); - } + } return permanent.getDamage() > 3; } -} \ No newline at end of file +} diff --git a/Mage.Sets/src/mage/cards/s/SanctumGuardian.java b/Mage.Sets/src/mage/cards/s/SanctumGuardian.java index a7f2611e36..e7a9e1881d 100644 --- a/Mage.Sets/src/mage/cards/s/SanctumGuardian.java +++ b/Mage.Sets/src/mage/cards/s/SanctumGuardian.java @@ -39,7 +39,7 @@ import mage.constants.CardType; import mage.constants.SubType; import mage.constants.Duration; import mage.constants.Zone; -import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.TargetAnyTarget; /** * @@ -48,7 +48,7 @@ import mage.target.common.TargetCreatureOrPlayer; public class SanctumGuardian extends CardImpl { public SanctumGuardian(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{W}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}{W}"); this.subtype.add(SubType.HUMAN); this.subtype.add(SubType.CLERIC); this.power = new MageInt(1); @@ -56,8 +56,8 @@ public class SanctumGuardian extends CardImpl { // Sacrifice Sanctum Guardian: The next time a source of your choice would deal damage to target creature or player this turn, prevent that damage. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PreventNextDamageFromChosenSourceToTargetEffect(Duration.EndOfTurn), - new SacrificeSourceCost()); - ability.addTarget(new TargetCreatureOrPlayer()); + new SacrificeSourceCost()); + ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/s/SuqAtaFirewalker.java b/Mage.Sets/src/mage/cards/s/SuqAtaFirewalker.java index b193dabb4e..d23824c811 100644 --- a/Mage.Sets/src/mage/cards/s/SuqAtaFirewalker.java +++ b/Mage.Sets/src/mage/cards/s/SuqAtaFirewalker.java @@ -44,7 +44,7 @@ import mage.constants.Zone; import mage.filter.FilterObject; import mage.filter.FilterStackObject; import mage.filter.predicate.mageobject.ColorPredicate; -import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.TargetAnyTarget; /** * @@ -71,7 +71,7 @@ public class SuqAtaFirewalker extends CardImpl { //{T}: Suq'Ata Firewalker deals 1 damage to target creature or player. SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new DamageTargetEffect(1), new TapSourceCost()); - ability.addTarget(new TargetCreatureOrPlayer()); + ability.addTarget(new TargetAnyTarget()); this.addAbility(ability); } diff --git a/Mage.Sets/src/mage/cards/w/WizardsLightning.java b/Mage.Sets/src/mage/cards/w/WizardsLightning.java index 1359355031..6650944062 100644 --- a/Mage.Sets/src/mage/cards/w/WizardsLightning.java +++ b/Mage.Sets/src/mage/cards/w/WizardsLightning.java @@ -40,7 +40,8 @@ import mage.constants.SubType; import mage.constants.Zone; import mage.filter.common.FilterControlledPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; -import mage.target.common.TargetCreatureOrPlayer; +import mage.target.common.TargetAnyTarget; + /** * * @author Will @@ -62,7 +63,7 @@ public class WizardsLightning extends CardImpl { this.addAbility(ability); // Wizard's Lightning deals 3 damage to any target. - this.getSpellAbility().addTarget(new TargetCreatureOrPlayer()); + this.getSpellAbility().addTarget(new TargetAnyTarget()); this.getSpellAbility().addEffect(new DamageTargetEffect(3)); } diff --git a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java index 2ba553547d..335fdc169f 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/DamageTargetEffect.java @@ -187,7 +187,12 @@ public class DamageTargetEffect extends OneShotEffect { if (!targetDescription.isEmpty()) { sb.append(targetDescription); } else { - sb.append("target ").append(mode.getTargets().get(0).getTargetName()); + String targetName = mode.getTargets().get(0).getTargetName(); + if (targetName.contains("any")) { + sb.append(targetName); + } else { + sb.append("target ").append(targetName); + } } if (!message.isEmpty()) { if (message.equals("1")) { diff --git a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java index aa07e5bdd0..af82bbf0a8 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/PreventDamageToTargetEffect.java @@ -82,11 +82,16 @@ public class PreventDamageToTargetEffect extends PreventionEffectImpl { } StringBuilder sb = new StringBuilder(); if (amountToPrevent == Integer.MAX_VALUE) { - sb.append("prevent all damage that would be dealt to target "); + sb.append("prevent all damage that would be dealt to "); } else { - sb.append("prevent the next ").append(amountToPrevent).append(" damage that would be dealt to target "); + sb.append("prevent the next ").append(amountToPrevent).append(" damage that would be dealt to "); + } + String targetName = mode.getTargets().get(0).getTargetName(); + if (targetName.contains("any")) { + sb.append(targetName); + } else { + sb.append("target ").append(targetName); } - sb.append(mode.getTargets().get(0).getTargetName()); if (!duration.toString().isEmpty()) { sb.append(' '); if (duration == Duration.EndOfTurn) { diff --git a/Mage/src/main/java/mage/players/PlayerImpl.java b/Mage/src/main/java/mage/players/PlayerImpl.java index dbd55c6c2f..c237718ee6 100644 --- a/Mage/src/main/java/mage/players/PlayerImpl.java +++ b/Mage/src/main/java/mage/players/PlayerImpl.java @@ -440,7 +440,7 @@ public abstract class PlayerImpl implements Player, Serializable { this.canLoseLife = true; this.topCardRevealed = false; this.payManaMode = false; - this.setLife(game.getLife(), game, UUID.randomUUID()); + this.setLife(game.getLife(), game, (UUID) null); this.setReachedNextTurnAfterLeaving(false); this.castSourceIdWithAlternateMana = null;