forked from External/mage
[ACR] Implement Overpowering Attack (#13398)
* [ACR] Implement Overpowering Attack * Replaced UntapAllThatAttackedEffect with filtered UntapAllEffect * Add MyTurnCondition to Overpowering Attack
This commit is contained in:
parent
8267d7d770
commit
cd8cb6afe5
7 changed files with 102 additions and 59 deletions
|
|
@ -1,48 +0,0 @@
|
|||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.MageObjectReference;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.constants.Outcome;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class UntapAllThatAttackedEffect extends OneShotEffect {
|
||||
|
||||
public UntapAllThatAttackedEffect() {
|
||||
super(Outcome.Benefit);
|
||||
staticText = "Untap all creatures that attacked this turn";
|
||||
}
|
||||
|
||||
protected UntapAllThatAttackedEffect(final UntapAllThatAttackedEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UntapAllThatAttackedEffect copy() {
|
||||
return new UntapAllThatAttackedEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
|
||||
if (watcher != null) {
|
||||
Set<MageObjectReference> attackedThisTurn = watcher.getAttackedThisTurnCreatures();
|
||||
for (MageObjectReference mor : attackedThisTurn) {
|
||||
Permanent permanent = mor.getPermanent(game);
|
||||
if (permanent != null && permanent.isCreature(game)) {
|
||||
permanent.untap(game);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package mage.filter.predicate.permanent;
|
||||
|
||||
import mage.filter.predicate.Predicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.watchers.common.AttackedThisTurnWatcher;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author balazskristof
|
||||
*/
|
||||
public enum AttackedThisTurnPredicate implements Predicate<Permanent> {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Permanent input, Game game) {
|
||||
AttackedThisTurnWatcher watcher = game.getState().getWatcher(AttackedThisTurnWatcher.class);
|
||||
return watcher != null && watcher.checkIfAttacked(input, game);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "attacked this turn";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue