forked from External/mage
[LCI] Implement Preacher of the Schism
This commit is contained in:
parent
f4ef2bbd88
commit
ee60325c07
6 changed files with 216 additions and 60 deletions
|
|
@ -0,0 +1,36 @@
|
|||
package mage.abilities.condition.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.other.PlayerWithTheMostLifePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* @author Susucr
|
||||
*/
|
||||
public enum SourceAttackingPlayerWithMostLifeCondition implements Condition {
|
||||
instance;
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
UUID defenderId = game.getCombat().getDefenderId(source.getSourceId());
|
||||
if (defenderId == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Player attackedPlayer = game.getPlayer(defenderId);
|
||||
return PlayerWithTheMostLifePredicate.instance.apply(
|
||||
new ObjectSourcePlayer<>(attackedPlayer, source.getControllerId(), source),
|
||||
game
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{this} is attacking the player with the most life or tied for most life";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue