mirror of
https://github.com/magefree/mage.git
synced 2026-01-10 12:52:06 -08:00
Fix Tanglewalker
This commit is contained in:
parent
6540b9d161
commit
7c4fecb950
1 changed files with 30 additions and 12 deletions
|
|
@ -3,19 +3,19 @@ package mage.cards.t;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.DefendingPlayerControlsSourceAttackingCondition;
|
||||
import mage.abilities.decorator.ConditionalRestrictionEffect;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedAllEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.filter.common.FilterControlledCreaturePermanent;
|
||||
import mage.filter.common.FilterLandPermanent;
|
||||
import mage.filter.predicate.ObjectSourcePlayer;
|
||||
import mage.filter.predicate.ObjectSourcePlayerPredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
|
@ -24,10 +24,10 @@ import java.util.UUID;
|
|||
*/
|
||||
public final class Tanglewalker extends CardImpl {
|
||||
|
||||
private static final FilterPermanent filter = new FilterLandPermanent();
|
||||
private static final FilterPermanent filter = new FilterControlledCreaturePermanent();
|
||||
|
||||
static {
|
||||
filter.add(CardType.ARTIFACT.getPredicate());
|
||||
filter.add(TanglewalkerPredicate.instance);
|
||||
}
|
||||
|
||||
public Tanglewalker(UUID ownerId, CardSetInfo setInfo) {
|
||||
|
|
@ -38,11 +38,8 @@ public final class Tanglewalker extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Each creature you control can't be blocked as long as defending player controls an artifact land.
|
||||
Effect effect = new ConditionalRestrictionEffect(
|
||||
new CantBeBlockedAllEffect(StaticFilters.FILTER_CONTROLLED_CREATURES, Duration.WhileOnBattlefield),
|
||||
new DefendingPlayerControlsSourceAttackingCondition(filter));
|
||||
effect.setText("Each creature you control can't be blocked as long as defending player controls an artifact land");
|
||||
this.addAbility(new SimpleStaticAbility(effect));
|
||||
this.addAbility(new SimpleStaticAbility(new CantBeBlockedAllEffect(filter, Duration.WhileOnBattlefield)
|
||||
.setText("Each creature you control can't be blocked as long as defending player controls an artifact land")));
|
||||
}
|
||||
|
||||
private Tanglewalker(final Tanglewalker card) {
|
||||
|
|
@ -54,3 +51,24 @@ public final class Tanglewalker extends CardImpl {
|
|||
return new Tanglewalker(this);
|
||||
}
|
||||
}
|
||||
|
||||
enum TanglewalkerPredicate implements ObjectSourcePlayerPredicate<Permanent> {
|
||||
instance; // Each creature must independently evaluate if the player it's attacking has an artifact land
|
||||
|
||||
private static final FilterPermanent filter = new FilterLandPermanent();
|
||||
|
||||
static {
|
||||
filter.add(CardType.ARTIFACT.getPredicate());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(ObjectSourcePlayer<Permanent> input, Game game) {
|
||||
UUID defendingPlayer = game.getCombat().getDefendingPlayerId(input.getObject().getId(), game);
|
||||
return defendingPlayer != null && game.getBattlefield().countAll(filter, defendingPlayer, game) > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue