This commit is contained in:
Jeff Wadsworth 2021-11-01 09:13:48 -05:00
parent 5c68c81ee6
commit 9506147356

View file

@ -66,7 +66,7 @@ public final class Nihiloor extends CardImpl {
class NihiloorControlEffect extends OneShotEffect { class NihiloorControlEffect extends OneShotEffect {
private static final FilterPermanent filter private static final FilterControlledCreaturePermanent filter
= new FilterControlledCreaturePermanent("untapped creatured you control"); = new FilterControlledCreaturePermanent("untapped creatured you control");
static { static {
@ -74,6 +74,7 @@ class NihiloorControlEffect extends OneShotEffect {
} }
private static final class NihiloorPredicate implements Predicate<Permanent> { private static final class NihiloorPredicate implements Predicate<Permanent> {
private final Permanent permanent; private final Permanent permanent;
private final UUID playerId; private final UUID playerId;
@ -85,15 +86,16 @@ class NihiloorControlEffect extends OneShotEffect {
@Override @Override
public boolean apply(Permanent input, Game game) { public boolean apply(Permanent input, Game game) {
return input.isControlledBy(playerId) return input.isControlledBy(playerId)
&& input.isCreature(game)
&& input.getPower().getValue() <= permanent.getPower().getValue(); && input.getPower().getValue() <= permanent.getPower().getValue();
} }
} }
NihiloorControlEffect() { NihiloorControlEffect() {
super(Outcome.Benefit); super(Outcome.Benefit);
staticText = "for each opponent, tap up to one untapped creature you control. When you do, " + staticText = "for each opponent, tap up to one untapped creature you control. When you do, "
"gain control of target creature that player controls with power less than " + + "gain control of target creature that player controls with power less than "
"or equal to the tapped creature's power for as long as you control {this}"; + "or equal to the tapped creature's power for as long as you control {this}";
} }
private NihiloorControlEffect(final NihiloorControlEffect effect) { private NihiloorControlEffect(final NihiloorControlEffect effect) {
@ -125,13 +127,13 @@ class NihiloorControlEffect extends OneShotEffect {
} }
FilterPermanent filter2 = new FilterPermanent( FilterPermanent filter2 = new FilterPermanent(
"creature controlled by " + opponent.getName() "creature controlled by " + opponent.getName()
+ " with power " + permanent.getPower().getValue() + " or less" + " with power " + permanent.getPower().getValue() + " or less"
); );
filter2.add(new NihiloorPredicate(permanent, playerId)); filter2.add(new NihiloorPredicate(permanent, playerId));
ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility( ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(
new GainControlTargetEffect(Duration.Custom, true), new GainControlTargetEffect(Duration.Custom, true),
false, "gain control of target creature that player controls with " + false, "gain control of target creature that player controls with "
"power less than or equal to the tapped creature's power for as long as you control {this}" + "power less than or equal to the tapped creature's power for as long as you control {this}"
); );
ability.addTarget(new TargetPermanent(filter2)); ability.addTarget(new TargetPermanent(filter2));
game.fireReflexiveTriggeredAbility(ability, source); game.fireReflexiveTriggeredAbility(ability, source);
@ -159,7 +161,8 @@ class NihiloorLoseLifeEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(game.getControllerId(getTargetPointer().getFirst(game, source))); Player owner = game.getPlayer(game.getOwnerId(getTargetPointer().getFirst(game, source)));
return player != null && player.loseLife(2, game, source, false) > 0; return owner != null
&& owner.loseLife(2, game, source, false) > 0;
} }
} }