- 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

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