foul-magics/Mage/src/main/java/mage/abilities/condition/common/OpponentHasNoCardsInHandCondition.java
Oleg Agafonov 2252648f01 * Added card hints to Avatar of Might, Avatar of Will, Avatar of Woe, Dusk Feaster, Rekindled Flame;
* Refactor: removed custom spell cost reduction effects;
2020-06-27 05:36:04 +04:00

36 lines
889 B
Java

package mage.abilities.condition.common;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.game.Game;
import mage.players.Player;
import java.util.UUID;
/**
* @author JayDi85
*/
public enum OpponentHasNoCardsInHandCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null) {
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(playerId);
if (opponent != null && opponent.getHand().isEmpty()) {
return true;
}
}
}
return false;
}
@Override
public String toString() {
return "an opponent has no cards in hand";
}
}