diff --git a/Mage.Sets/src/mage/cards/a/Aggression.java b/Mage.Sets/src/mage/cards/a/Aggression.java index 6da304a221..7490ecea13 100644 --- a/Mage.Sets/src/mage/cards/a/Aggression.java +++ b/Mage.Sets/src/mage/cards/a/Aggression.java @@ -1,12 +1,11 @@ package mage.cards.a; import java.util.UUID; -import mage.MageObjectReference; import mage.constants.SubType; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; -import mage.abilities.condition.Condition; +import mage.abilities.condition.common.DidNotAttackThisTurnEnchantedCondition; import mage.abilities.decorator.ConditionalTriggeredAbility; import mage.abilities.effects.common.AttachEffect; import mage.abilities.effects.common.DestroyAttachedToEffect; @@ -24,8 +23,6 @@ import mage.constants.TargetController; import mage.constants.Zone; import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.Predicates; -import mage.game.Game; -import mage.game.permanent.Permanent; import mage.watchers.common.AttackedThisTurnWatcher; /** @@ -33,9 +30,9 @@ import mage.watchers.common.AttackedThisTurnWatcher; * @author jeffwadsworth */ public final class Aggression extends CardImpl { - + private static final FilterCreaturePermanent filter = new FilterCreaturePermanent(); - + static { filter.add(Predicates.not(SubType.WALL.getPredicate())); } @@ -66,10 +63,10 @@ public final class Aggression extends CardImpl { // At the beginning of the end step of enchanted creature's controller, destroy that creature if it didn't attack this turn. this.addAbility(new ConditionalTriggeredAbility( new AtTheBeginOfNextEndStepDelayedTriggeredAbility( - new DestroyAttachedToEffect("enchanted"), - TargetController.CONTROLLER_ATTACHED_TO), - DidNotAttackedThisTurnEnchantedCondition.instance, - "At the beginning of the end step of enchanted creature's controller, destroy that creature if it didn't attack this turn."), + new DestroyAttachedToEffect("enchanted"), + TargetController.CONTROLLER_ATTACHED_TO), + DidNotAttackThisTurnEnchantedCondition.instance, + "At the beginning of the end step of enchanted creature's controller, destroy that creature if it didn't attack this turn."), new AttackedThisTurnWatcher()); } @@ -83,21 +80,3 @@ public final class Aggression extends CardImpl { return new Aggression(this); } } - -enum DidNotAttackedThisTurnEnchantedCondition implements Condition { - instance; - - @Override - public boolean apply(Game game, Ability source) { - Permanent auraPermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); - if (auraPermanent != null) { - Permanent enchantedPermanent = game.getPermanent(auraPermanent.getAttachedTo()); - AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class); - return enchantedPermanent != null - && watcher != null - && !watcher.getAttackedThisTurnCreatures().contains( - new MageObjectReference(enchantedPermanent, game)); - } - return false; - } -} diff --git a/Mage.Sets/src/mage/cards/i/Insubordination.java b/Mage.Sets/src/mage/cards/i/Insubordination.java new file mode 100644 index 0000000000..0ccf786040 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/Insubordination.java @@ -0,0 +1,57 @@ +package mage.cards.i; + +import java.util.UUID; +import mage.constants.SubType; +import mage.target.common.TargetCreaturePermanent; +import mage.abilities.Ability; +import mage.abilities.common.delayed.AtTheBeginOfNextEndStepDelayedTriggeredAbility; +import mage.abilities.condition.common.DidNotAttackThisTurnEnchantedCondition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.AttachEffect; +import mage.abilities.effects.common.DamageAttachedControllerEffect; +import mage.constants.Outcome; +import mage.target.TargetPermanent; +import mage.abilities.keyword.EnchantAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetController; +import mage.watchers.common.AttackedThisTurnWatcher; + +/** + * + * @author jeffwadsworth + */ +public final class Insubordination extends CardImpl { + + public Insubordination(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{B}{B}"); + + this.subtype.add(SubType.AURA); + + // Enchant creature + TargetPermanent auraTarget = new TargetCreaturePermanent(); + this.getSpellAbility().addTarget(auraTarget); + this.getSpellAbility().addEffect(new AttachEffect(Outcome.BoostCreature)); + Ability ability = new EnchantAbility(auraTarget.getTargetName()); + this.addAbility(ability); + + // At the beginning of the end step of enchanted creature's controller, Insubordination deals 2 damage to that player unless that creature attacked this turn. + this.addAbility(new ConditionalTriggeredAbility( + new AtTheBeginOfNextEndStepDelayedTriggeredAbility( + new DamageAttachedControllerEffect(2), + TargetController.CONTROLLER_ATTACHED_TO), + DidNotAttackThisTurnEnchantedCondition.instance, + "At the beginning of the end step of enchanted creature's controller, {this} deals 2 damage to that player unless that creature attacked this turn."), + new AttackedThisTurnWatcher()); + } + + private Insubordination(final Insubordination card) { + super(card); + } + + @Override + public Insubordination copy() { + return new Insubordination(this); + } +} diff --git a/Mage.Sets/src/mage/cards/r/RighteousIndignation.java b/Mage.Sets/src/mage/cards/r/RighteousIndignation.java new file mode 100644 index 0000000000..71b831b150 --- /dev/null +++ b/Mage.Sets/src/mage/cards/r/RighteousIndignation.java @@ -0,0 +1,82 @@ +package mage.cards.r; + +import java.util.UUID; +import mage.ObjectColor; +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Zone; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.GameEvent.EventType; +import mage.game.permanent.Permanent; +import mage.target.targetpointer.FixedTarget; + +/** + * + * @author jeffwadsworth + */ +public final class RighteousIndignation extends CardImpl { + + public RighteousIndignation(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{W}"); + + // Whenever a creature blocks a black or red creature, the blocking creature gets +1/+1 until end of turn. + this.addAbility(new RighteousIndignationTriggeredAbility()); + + } + + private RighteousIndignation(final RighteousIndignation card) { + super(card); + } + + @Override + public RighteousIndignation copy() { + return new RighteousIndignation(this); + } +} + +class RighteousIndignationTriggeredAbility extends TriggeredAbilityImpl { + + public RighteousIndignationTriggeredAbility() { + super(Zone.BATTLEFIELD, new BoostTargetEffect(1, 1, Duration.EndOfTurn)); + } + + public RighteousIndignationTriggeredAbility(final RighteousIndignationTriggeredAbility ability) { + super(ability); + } + + @Override + public RighteousIndignationTriggeredAbility copy() { + return new RighteousIndignationTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == EventType.BLOCKER_DECLARED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + Permanent blocker = game.getPermanent(event.getSourceId()); + Permanent blocked = game.getPermanentOrLKIBattlefield(event.getTargetId()); + if (blocker != null) { + if (blocked != null) { + if (blocked.getColor(game).contains(ObjectColor.BLACK) + || blocked.getColor(game).contains(ObjectColor.RED)) { + getEffects().get(0).setTargetPointer(new FixedTarget(blocker.getId())); + return true; + } + } + } + return false; + } + + @Override + public String getRule() { + return "Whenever a creature blocks a black or red creature, the blocking creature gets +1/+1 until end of turn."; + } +} diff --git a/Mage.Sets/src/mage/sets/MercadianMasques.java b/Mage.Sets/src/mage/sets/MercadianMasques.java index 8e7691b903..29b0ff53b5 100644 --- a/Mage.Sets/src/mage/sets/MercadianMasques.java +++ b/Mage.Sets/src/mage/sets/MercadianMasques.java @@ -169,6 +169,7 @@ public final class MercadianMasques extends ExpansionSet { cards.add(new SetCardInfo("Ignoble Soldier", 22, Rarity.UNCOMMON, mage.cards.i.IgnobleSoldier.class)); cards.add(new SetCardInfo("Indentured Djinn", 85, Rarity.UNCOMMON, mage.cards.i.IndenturedDjinn.class)); cards.add(new SetCardInfo("Instigator", 140, Rarity.RARE, mage.cards.i.Instigator.class)); + cards.add(new SetCardInfo("Insubordination", 141, Rarity.COMMON, mage.cards.i.Insubordination.class)); cards.add(new SetCardInfo("Intimidation", 142, Rarity.UNCOMMON, mage.cards.i.Intimidation.class)); cards.add(new SetCardInfo("Invigorate", 254, Rarity.COMMON, mage.cards.i.Invigorate.class)); cards.add(new SetCardInfo("Inviolability", 23, Rarity.COMMON, mage.cards.i.Inviolability.class)); @@ -259,6 +260,7 @@ public final class MercadianMasques extends ExpansionSet { cards.add(new SetCardInfo("Reverent Mantra", 44, Rarity.RARE, mage.cards.r.ReverentMantra.class)); cards.add(new SetCardInfo("Revive", 262, Rarity.UNCOMMON, mage.cards.r.Revive.class)); cards.add(new SetCardInfo("Righteous Aura", 45, Rarity.UNCOMMON, mage.cards.r.RighteousAura.class)); + cards.add(new SetCardInfo("Righteous Indignation", 46, Rarity.UNCOMMON, mage.cards.r.RighteousIndignation.class)); cards.add(new SetCardInfo("Rishadan Airship", 91, Rarity.COMMON, mage.cards.r.RishadanAirship.class)); cards.add(new SetCardInfo("Rishadan Brigand", 92, Rarity.RARE, mage.cards.r.RishadanBrigand.class)); cards.add(new SetCardInfo("Rishadan Cutpurse", 93, Rarity.COMMON, mage.cards.r.RishadanCutpurse.class)); diff --git a/Mage/src/main/java/mage/abilities/condition/common/DidNotAttackThisTurnEnchantedCondition.java b/Mage/src/main/java/mage/abilities/condition/common/DidNotAttackThisTurnEnchantedCondition.java new file mode 100644 index 0000000000..178a5a1660 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/condition/common/DidNotAttackThisTurnEnchantedCondition.java @@ -0,0 +1,36 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package mage.abilities.condition.common; + +import mage.MageObjectReference; +import mage.abilities.Ability; +import mage.abilities.condition.Condition; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.watchers.common.AttackedThisTurnWatcher; + +/** + * + * @author jeffwadsworth + */ +public enum DidNotAttackThisTurnEnchantedCondition implements Condition { + + instance; + + @Override + public boolean apply(Game game, Ability source) { + Permanent auraPermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); + if (auraPermanent != null) { + Permanent enchantedPermanent = game.getPermanent(auraPermanent.getAttachedTo()); + AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class); + return enchantedPermanent != null + && watcher != null + && !watcher.getAttackedThisTurnCreatures().contains( + new MageObjectReference(enchantedPermanent, game)); + } + return false; + } +}