forked from External/mage
* Added Norn's Decree Also added a couple of helper classes: - A triggered ability for when players attack - A triggered ability for the controller taking combat damage from one or more creatures (will be used in Starscream, Power Hungry) - A condition for when an attacked player is poisoned * Fixed rules comment issue * Fixed issue with incorrect logic in CombatDamageDealtToYouTriggeredAbility
30 lines
No EOL
874 B
Java
30 lines
No EOL
874 B
Java
|
|
package mage.abilities.condition.common;
|
|
|
|
import mage.abilities.Ability;
|
|
import mage.abilities.condition.Condition;
|
|
import mage.counters.CounterType;
|
|
import mage.game.Game;
|
|
import mage.watchers.common.PlayerAttackedStepWatcher;
|
|
|
|
/**
|
|
* A condition which checks whether any players being attacked are poisoned
|
|
* (have one or more poison counters on them)
|
|
*
|
|
* @author alexander-novo
|
|
*/
|
|
public enum AttackedPlayersPoisonedCondition implements Condition {
|
|
|
|
instance;
|
|
|
|
@Override
|
|
public boolean apply(Game game, Ability source) {
|
|
return game.getCombat().getDefenders().stream().map(defender -> game.getPlayer(defender))
|
|
.anyMatch(player -> player != null && player.getCounters().containsKey(CounterType.POISON));
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return "one or more players being attacked are poisoned";
|
|
}
|
|
} |