use of mage.watchers.common.CastSpellYourLastTurnWatcher in project mage by magefree.
the class ArboriaEffect method canAttack.
@Override
public boolean canAttack(Permanent attacker, UUID defenderId, Ability source, Game game, boolean canUseChooseDialogs) {
if (defenderId == null) {
return true;
}
CastSpellYourLastTurnWatcher watcher = game.getState().getWatcher(CastSpellYourLastTurnWatcher.class);
if (watcher != null && watcher.getAmountOfSpellsCastOnPlayersTurn(defenderId) > 0) {
return true;
}
PermanentsEnteredBattlefieldYourLastTurnWatcher watcher2 = game.getState().getWatcher(PermanentsEnteredBattlefieldYourLastTurnWatcher.class);
if (watcher2 != null && watcher2.getPermanentsEnteringOnPlayersLastTurn(game, defenderId) != null) {
for (Permanent permanent : watcher2.getPermanentsEnteringOnPlayersLastTurn(game, defenderId)) {
if (permanent != null && !(permanent instanceof PermanentToken)) {
return true;
}
}
}
return false;
}
Aggregations