Implemented "can block landwalk as though it didn't have landwalk" and related cards

This commit is contained in:
L_J 2018-03-10 11:52:25 +01:00 committed by GitHub
parent e768a10174
commit a2b0e5a39c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 914 additions and 8 deletions

View file

@ -30,6 +30,7 @@ package mage.abilities.keyword;
import mage.abilities.Ability;
import mage.abilities.EvasionAbility;
import mage.abilities.effects.RestrictionEffect;
import mage.constants.AsThoughEffectType;
import mage.constants.Duration;
import mage.filter.common.FilterLandPermanent;
import mage.game.Game;
@ -86,7 +87,25 @@ class LandwalkEffect extends RestrictionEffect {
@Override
public boolean canBeBlocked(Permanent attacker, Permanent blocker, Ability source, Game game) {
return !game.getBattlefield().contains(filter, blocker.getControllerId(), 1, game);
if (game.getBattlefield().contains(filter, blocker.getControllerId(), 1, game)
&& !game.getContinuousEffects().asThough(blocker.getId(), AsThoughEffectType.BLOCK_LANDWALK, source, blocker.getControllerId(), game)) {
switch (filter.getMessage()) {
case "plains":
return game.getContinuousEffects().asThough(blocker.getId(), AsThoughEffectType.BLOCK_PLAINSWALK, source, blocker.getControllerId(), game);
case "island":
return game.getContinuousEffects().asThough(blocker.getId(), AsThoughEffectType.BLOCK_ISLANDWALK, source, blocker.getControllerId(), game);
case "swamp":
return game.getContinuousEffects().asThough(blocker.getId(), AsThoughEffectType.BLOCK_SWAMPWALK, source, blocker.getControllerId(), game);
case "mountain":
return game.getContinuousEffects().asThough(blocker.getId(), AsThoughEffectType.BLOCK_MOUNTAINWALK, source, blocker.getControllerId(), game);
case "forest":
return game.getContinuousEffects().asThough(blocker.getId(), AsThoughEffectType.BLOCK_FORESTWALK, source, blocker.getControllerId(), game);
default:
return false;
}
}
return true;
}
@Override
@ -104,25 +123,25 @@ class LandwalkEffect extends RestrictionEffect {
StringBuilder sb = new StringBuilder();
sb.append(filter.getMessage()).append("walk");
if (withHintText) {
sb.append(" <i>(This creature can't be blocked as long as defending player controls a ");
sb.append(" <i>(This creature can't be blocked as long as defending player controls ");
switch (filter.getMessage()) {
case "swamp":
sb.append("Swamp");
sb.append("a Swamp");
break;
case "plains":
sb.append("Plains");
sb.append("a Plains");
break;
case "mountain":
sb.append("Mountain");
sb.append("a Mountain");
break;
case "forest":
sb.append("Forest");
sb.append("a Forest");
break;
case "island":
sb.append("Island");
sb.append("an Island");
break;
default:
sb.append(filter.getMessage());
sb.append("a " + filter.getMessage());
}
sb.append(".)</i>");

View file

@ -12,6 +12,12 @@ public enum AsThoughEffectType {
BLOCK_TAPPED,
BLOCK_SHADOW,
BLOCK_DRAGON,
BLOCK_LANDWALK,
BLOCK_PLAINSWALK,
BLOCK_ISLANDWALK,
BLOCK_SWAMPWALK,
BLOCK_MOUNTAINWALK,
BLOCK_FORESTWALK,
BE_BLOCKED,
PLAY_FROM_NOT_OWN_HAND_ZONE,
CAST_AS_INSTANT,