foul-magics/Mage/src/main/java/mage/abilities/condition/common/AttackedPlayersPoisonedCondition.java
Alexander Novotny 9a5fa9c8b0
Added Norn's Decree (#10281)
* 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
2023-06-05 22:14:54 -04:00

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