- Added Righteous Indignation and Insubordination

This commit is contained in:
jeffwadsworth 2020-08-10 17:13:00 -05:00
parent bbefed9b6d
commit d3ba7d4dd5
5 changed files with 184 additions and 28 deletions

View file

@ -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;
/**
@ -68,7 +65,7 @@ public final class Aggression extends CardImpl {
new AtTheBeginOfNextEndStepDelayedTriggeredAbility(
new DestroyAttachedToEffect("enchanted"),
TargetController.CONTROLLER_ATTACHED_TO),
DidNotAttackedThisTurnEnchantedCondition.instance,
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;
}
}

View file

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

View file

@ -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.";
}
}

View file

@ -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));

View file

@ -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;
}
}