diff --git a/Mage.Sets/src/mage/cards/a/ArcadesTheStrategist.java b/Mage.Sets/src/mage/cards/a/ArcadesTheStrategist.java index 028bc5bfca..0dbc363239 100644 --- a/Mage.Sets/src/mage/cards/a/ArcadesTheStrategist.java +++ b/Mage.Sets/src/mage/cards/a/ArcadesTheStrategist.java @@ -1,43 +1,36 @@ package mage.cards.a; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.EntersBattlefieldControlledTriggeredAbility; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.common.DrawCardSourceControllerEffect; import mage.abilities.effects.common.combat.CanAttackAsThoughItDidntHaveDefenderAllEffect; +import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessEffect; import mage.abilities.keyword.DefenderAbility; -import mage.constants.SubType; -import mage.constants.SuperType; import mage.abilities.keyword.FlyingAbility; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.CardType; -import mage.constants.Duration; -import mage.constants.Layer; -import mage.constants.Outcome; -import mage.constants.SubLayer; -import mage.constants.Zone; +import mage.constants.*; import mage.filter.common.FilterControlledCreaturePermanent; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.AbilityPredicate; -import mage.filter.predicate.permanent.ControllerIdPredicate; -import mage.game.Game; + +import java.util.UUID; /** - * * @author TheElk801 */ public final class ArcadesTheStrategist extends CardImpl { private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("creature with defender"); + private static final FilterCreaturePermanent filter2 = new FilterCreaturePermanent(); static { filter.add(new AbilityPredicate(DefenderAbility.class)); + filter2.add(new AbilityPredicate(DefenderAbility.class)); } public ArcadesTheStrategist(UUID ownerId, CardSetInfo setInfo) { @@ -61,14 +54,14 @@ public final class ArcadesTheStrategist extends CardImpl { )); // Each creature you control with defender assigns combat damage equal to its toughness rather than its power and can attack as though it didn't have defender. - Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new ArcadesTheStrategistCombatDamageRuleEffect()); + Ability ability = new SimpleStaticAbility(Zone.BATTLEFIELD, new CombatDamageByToughnessEffect(filter2, true).setText("Each creature you control with defender assigns combat damage equal to its toughness rather than its power")); ability.addEffect(new CanAttackAsThoughItDidntHaveDefenderAllEffect( Duration.WhileOnBattlefield, filter ).setText("and can attack as though it didn't have defender")); this.addAbility(ability); } - public ArcadesTheStrategist(final ArcadesTheStrategist card) { + private ArcadesTheStrategist(final ArcadesTheStrategist card) { super(card); } @@ -77,41 +70,3 @@ public final class ArcadesTheStrategist extends CardImpl { return new ArcadesTheStrategist(this); } } - -class ArcadesTheStrategistCombatDamageRuleEffect extends ContinuousEffectImpl { - - public ArcadesTheStrategistCombatDamageRuleEffect() { - super(Duration.WhileOnBattlefield, Outcome.Detriment); - staticText = "Each creature you control with defender assigns combat damage equal to its toughness rather than its power"; - } - - public ArcadesTheStrategistCombatDamageRuleEffect(final ArcadesTheStrategistCombatDamageRuleEffect effect) { - super(effect); - } - - @Override - public ArcadesTheStrategistCombatDamageRuleEffect copy() { - return new ArcadesTheStrategistCombatDamageRuleEffect(this); - } - - @Override - public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - // Change the rule - FilterCreaturePermanent filter = new FilterCreaturePermanent(); - filter.add(new ControllerIdPredicate(source.getControllerId())); - filter.add(new AbilityPredicate(DefenderAbility.class)); - game.getCombat().setUseToughnessForDamage(true); - game.getCombat().addUseToughnessForDamageFilter(filter); - return true; - } - - @Override - public boolean apply(Game game, Ability source) { - return false; - } - - @Override - public boolean hasLayer(Layer layer) { - return layer == Layer.RulesEffects; - } -} diff --git a/Mage.Sets/src/mage/cards/a/AssaultFormation.java b/Mage.Sets/src/mage/cards/a/AssaultFormation.java index 8895519cf3..645fec98a5 100644 --- a/Mage.Sets/src/mage/cards/a/AssaultFormation.java +++ b/Mage.Sets/src/mage/cards/a/AssaultFormation.java @@ -1,26 +1,27 @@ package mage.cards.a; -import java.util.UUID; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.costs.mana.ManaCostsImpl; -import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.common.combat.CanAttackAsThoughItDidntHaveDefenderTargetEffect; import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessEffect; import mage.abilities.keyword.DefenderAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Zone; +import mage.filter.StaticFilters; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.mageobject.AbilityPredicate; -import mage.filter.predicate.permanent.ControllerIdPredicate; -import mage.game.Game; import mage.target.common.TargetCreaturePermanent; +import java.util.UUID; + /** - * * @author LevelX2 */ public final class AssaultFormation extends CardImpl { @@ -32,10 +33,10 @@ public final class AssaultFormation extends CardImpl { } public AssaultFormation(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{1}{G}"); + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{G}"); // Each creature you control assigns combat damage equal to its toughness rather than its power. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AssaultFormationCombatDamageRuleEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CombatDamageByToughnessEffect(StaticFilters.FILTER_PERMANENT_CREATURE, true))); // {G}: Target creature with defender can attack this turn as though it didn't have defender. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CanAttackAsThoughItDidntHaveDefenderTargetEffect(Duration.EndOfTurn), new ManaCostsImpl("{G}")); @@ -43,11 +44,11 @@ public final class AssaultFormation extends CardImpl { this.addAbility(ability); // {2}{G}: Creatures you control get +0/+1 until end of turn. - this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostControlledEffect(0,1,Duration.EndOfTurn), new ManaCostsImpl("{2}{G}"))); + this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostControlledEffect(0, 1, Duration.EndOfTurn), new ManaCostsImpl("{2}{G}"))); } - public AssaultFormation(final AssaultFormation card) { + private AssaultFormation(final AssaultFormation card) { super(card); } @@ -56,40 +57,3 @@ public final class AssaultFormation extends CardImpl { return new AssaultFormation(this); } } - -class AssaultFormationCombatDamageRuleEffect extends ContinuousEffectImpl { - - public AssaultFormationCombatDamageRuleEffect() { - super(Duration.WhileOnBattlefield, Outcome.Detriment); - staticText = "Each creature you control assigns combat damage equal to its toughness rather than its power"; - } - - public AssaultFormationCombatDamageRuleEffect(final AssaultFormationCombatDamageRuleEffect effect) { - super(effect); - } - - @Override - public AssaultFormationCombatDamageRuleEffect copy() { - return new AssaultFormationCombatDamageRuleEffect(this); - } - - @Override - public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - // Change the rule - FilterCreaturePermanent filter = new FilterCreaturePermanent(); - filter.add(new ControllerIdPredicate(source.getControllerId())); - game.getCombat().setUseToughnessForDamage(true); - game.getCombat().addUseToughnessForDamageFilter(filter); - return true; - } - - @Override - public boolean apply(Game game, Ability source) { - return false; - } - - @Override - public boolean hasLayer(Layer layer) { - return layer == Layer.RulesEffects; - } -} diff --git a/Mage.Sets/src/mage/cards/b/BelligerentBrontodon.java b/Mage.Sets/src/mage/cards/b/BelligerentBrontodon.java index a5de154190..e6243b73c8 100644 --- a/Mage.Sets/src/mage/cards/b/BelligerentBrontodon.java +++ b/Mage.Sets/src/mage/cards/b/BelligerentBrontodon.java @@ -1,21 +1,19 @@ package mage.cards.b; -import java.util.UUID; - import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; -import mage.filter.common.FilterCreaturePermanent; -import mage.filter.predicate.permanent.ControllerIdPredicate; -import mage.game.Game; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.Zone; +import mage.filter.StaticFilters; + +import java.util.UUID; /** - * * @author TheElk801 */ public final class BelligerentBrontodon extends CardImpl { @@ -28,10 +26,10 @@ public final class BelligerentBrontodon extends CardImpl { this.toughness = new MageInt(6); // Each creature you control assigns combat damage equal to its toughness rather than its power. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BelligerentBrontodonCombatDamageRuleEffect())); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CombatDamageByToughnessEffect(StaticFilters.FILTER_PERMANENT_CREATURE, true))); } - public BelligerentBrontodon(final BelligerentBrontodon card) { + private BelligerentBrontodon(final BelligerentBrontodon card) { super(card); } @@ -40,40 +38,3 @@ public final class BelligerentBrontodon extends CardImpl { return new BelligerentBrontodon(this); } } - -class BelligerentBrontodonCombatDamageRuleEffect extends ContinuousEffectImpl { - - public BelligerentBrontodonCombatDamageRuleEffect() { - super(Duration.WhileOnBattlefield, Outcome.Detriment); - staticText = "Each creature you control assigns combat damage equal to its toughness rather than its power"; - } - - public BelligerentBrontodonCombatDamageRuleEffect(final BelligerentBrontodonCombatDamageRuleEffect effect) { - super(effect); - } - - @Override - public BelligerentBrontodonCombatDamageRuleEffect copy() { - return new BelligerentBrontodonCombatDamageRuleEffect(this); - } - - @Override - public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - // Change the rule - FilterCreaturePermanent filter = new FilterCreaturePermanent(); - filter.add(new ControllerIdPredicate(source.getControllerId())); - game.getCombat().setUseToughnessForDamage(true); - game.getCombat().addUseToughnessForDamageFilter(filter); - return true; - } - - @Override - public boolean apply(Game game, Ability source) { - return false; - } - - @Override - public boolean hasLayer(Layer layer) { - return layer == Layer.RulesEffects; - } -} diff --git a/Mage.Sets/src/mage/cards/d/DoranTheSiegeTower.java b/Mage.Sets/src/mage/cards/d/DoranTheSiegeTower.java index 03c4f0c6f1..984b2342ec 100644 --- a/Mage.Sets/src/mage/cards/d/DoranTheSiegeTower.java +++ b/Mage.Sets/src/mage/cards/d/DoranTheSiegeTower.java @@ -1,19 +1,20 @@ package mage.cards.d; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ContinuousEffectImpl; +import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.SubType; +import mage.constants.SuperType; +import mage.constants.Zone; import mage.filter.StaticFilters; -import mage.game.Game; + +import java.util.UUID; /** - * * 613.10. Some continuous effects affect game rules rather than objects. For * example, effects may modify a player's maximum hand size, or say that a * creature must attack this turn if able. These effects are applied after all @@ -22,7 +23,6 @@ import mage.game.Game; * in rule 601.2e. All other such effects are applied in timestamp order. See * also the rules for timestamp order and dependency (rules 613.6 and 613.7) * - * * @author LevelX2 */ public final class DoranTheSiegeTower extends CardImpl { @@ -37,10 +37,15 @@ public final class DoranTheSiegeTower extends CardImpl { this.toughness = new MageInt(5); // Each creature assigns combat damage equal to its toughness rather than its power. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new DoranTheSiegeTowerCombatDamageRuleEffect())); + this.addAbility(new SimpleStaticAbility( + Zone.BATTLEFIELD, + new CombatDamageByToughnessEffect( + StaticFilters.FILTER_PERMANENT_CREATURE, false + ) + )); } - public DoranTheSiegeTower(final DoranTheSiegeTower card) { + private DoranTheSiegeTower(final DoranTheSiegeTower card) { super(card); } @@ -49,38 +54,3 @@ public final class DoranTheSiegeTower extends CardImpl { return new DoranTheSiegeTower(this); } } - -class DoranTheSiegeTowerCombatDamageRuleEffect extends ContinuousEffectImpl { - - public DoranTheSiegeTowerCombatDamageRuleEffect() { - super(Duration.WhileOnBattlefield, Outcome.Detriment); - staticText = "Each creature assigns combat damage equal to its toughness rather than its power"; - } - - public DoranTheSiegeTowerCombatDamageRuleEffect(final DoranTheSiegeTowerCombatDamageRuleEffect effect) { - super(effect); - } - - @Override - public DoranTheSiegeTowerCombatDamageRuleEffect copy() { - return new DoranTheSiegeTowerCombatDamageRuleEffect(this); - } - - @Override - public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { - // Change the rule - game.getCombat().setUseToughnessForDamage(true); - game.getCombat().addUseToughnessForDamageFilter(StaticFilters.FILTER_PERMANENT_CREATURES); - return true; - } - - @Override - public boolean apply(Game game, Ability source) { - return false; - } - - @Override - public boolean hasLayer(Layer layer) { - return layer == Layer.RulesEffects; - } -} diff --git a/Mage.Sets/src/mage/cards/h/HighAlert.java b/Mage.Sets/src/mage/cards/h/HighAlert.java new file mode 100644 index 0000000000..c846241de8 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HighAlert.java @@ -0,0 +1,60 @@ +package mage.cards.h; + +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.UntapTargetEffect; +import mage.abilities.effects.common.combat.CanAttackAsThoughItDidntHaveDefenderAllEffect; +import mage.abilities.effects.common.ruleModifying.CombatDamageByToughnessEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.target.common.TargetCreaturePermanent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class HighAlert extends CardImpl { + + public HighAlert(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{W}{U}"); + + + // Each creature you control assigns combat damage equal to its toughness rather than its power. + this.addAbility(new SimpleStaticAbility( + Zone.BATTLEFIELD, + new CombatDamageByToughnessEffect( + StaticFilters.FILTER_PERMANENT_CREATURE, true + ) + )); + + // Creatures you control can attack as though they didn't have defender. + this.addAbility(new SimpleStaticAbility( + Zone.BATTLEFIELD, + new CanAttackAsThoughItDidntHaveDefenderAllEffect( + Duration.WhileOnBattlefield, + StaticFilters.FILTER_CONTROLLED_CREATURES + ) + )); + + // {2}{W}{U}: Untap target creature. + Ability ability = new SimpleActivatedAbility(new UntapTargetEffect(), new ManaCostsImpl("{2}{W}{U}")); + ability.addTarget(new TargetCreaturePermanent()); + this.addAbility(ability); + } + + private HighAlert(final HighAlert card) { + super(card); + } + + @Override + public HighAlert copy() { + return new HighAlert(this); + } +} diff --git a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java index 1b8ff75125..ac67287d56 100644 --- a/Mage.Sets/src/mage/sets/RavnicaAllegiance.java +++ b/Mage.Sets/src/mage/sets/RavnicaAllegiance.java @@ -66,6 +66,7 @@ public final class RavnicaAllegiance extends ExpansionSet { cards.add(new SetCardInfo("Gruul Spellbreaker", 179, Rarity.RARE, mage.cards.g.GruulSpellbreaker.class)); cards.add(new SetCardInfo("Gutterbones", 76, Rarity.RARE, mage.cards.g.Gutterbones.class)); cards.add(new SetCardInfo("Hallowed Fountain", 251, Rarity.RARE, mage.cards.h.HallowedFountain.class)); + cards.add(new SetCardInfo("High Alert", 182, Rarity.UNCOMMON, mage.cards.h.HighAlert.class)); cards.add(new SetCardInfo("Hydroid Krasis", 183, Rarity.MYTHIC, mage.cards.h.HydroidKrasis.class)); cards.add(new SetCardInfo("Imperious Oligarch", 184, Rarity.COMMON, mage.cards.i.ImperiousOligarch.class)); cards.add(new SetCardInfo("Incubation // Incongruity", 226, Rarity.UNCOMMON, mage.cards.i.IncubationIncongruity.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CombatDamageByToughnessEffect.java b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CombatDamageByToughnessEffect.java new file mode 100644 index 0000000000..3afcf0161f --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/ruleModifying/CombatDamageByToughnessEffect.java @@ -0,0 +1,62 @@ + +package mage.abilities.effects.common.ruleModifying; + +import mage.abilities.Ability; +import mage.abilities.effects.ContinuousEffectImpl; +import mage.constants.Duration; +import mage.constants.Layer; +import mage.constants.Outcome; +import mage.constants.SubLayer; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.permanent.ControllerIdPredicate; +import mage.game.Game; + +/** + * @author TheElk801 + */ +public class CombatDamageByToughnessEffect extends ContinuousEffectImpl { + + private final FilterCreaturePermanent filter; + private final boolean onlyControlled; + + public CombatDamageByToughnessEffect(FilterCreaturePermanent filter, boolean onlyControlled) { + super(Duration.WhileOnBattlefield, Outcome.Detriment); + this.filter = filter; + this.onlyControlled = onlyControlled; + staticText = "Each " + filter.getMessage() + (onlyControlled ? " you control" : "") + + " assigns combat damage equal to its toughness rather than its power"; + } + + public CombatDamageByToughnessEffect(final CombatDamageByToughnessEffect effect) { + super(effect); + this.filter = effect.filter; + this.onlyControlled = effect.onlyControlled; + } + + @Override + public CombatDamageByToughnessEffect copy() { + return new CombatDamageByToughnessEffect(this); + } + + @Override + public boolean apply(Layer layer, SubLayer sublayer, Ability source, Game game) { + // Change the rule + FilterCreaturePermanent filterPermanent = filter.copy(); + if (onlyControlled) { + filterPermanent.add(new ControllerIdPredicate(source.getControllerId())); + } + game.getCombat().setUseToughnessForDamage(true); + game.getCombat().addUseToughnessForDamageFilter(filterPermanent); + return true; + } + + @Override + public boolean apply(Game game, Ability source) { + return false; + } + + @Override + public boolean hasLayer(Layer layer) { + return layer == Layer.RulesEffects; + } +}