mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Merge branch 'landwalkFix' into 'master'
CombatUtil: fix Basic Landwalk abilities See merge request core-developers/forge!1348
This commit is contained in:
@@ -43,7 +43,6 @@ import forge.util.TextUtil;
|
||||
import forge.util.collect.FCollection;
|
||||
import forge.util.collect.FCollectionView;
|
||||
import forge.util.maps.MapToAmount;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.List;
|
||||
@@ -525,7 +524,7 @@ public class CombatUtil {
|
||||
IGNORE_LANDWALK_KEYWORDS[i] = "May be blocked as though it doesn't have " + landwalk + ".";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static boolean isUnblockableFromLandwalk(final Card attacker, final Player defendingPlayer) {
|
||||
//May be blocked as though it doesn't have landwalk. (Staff of the Ages)
|
||||
if (attacker.hasKeyword("May be blocked as though it doesn't have landwalk.")) {
|
||||
@@ -534,6 +533,7 @@ public class CombatUtil {
|
||||
|
||||
List<String> walkTypes = Lists.newArrayList();
|
||||
|
||||
// handle basic landwalk and snow basic landwalk
|
||||
for (int i = 0; i < LANDWALK_KEYWORDS.length; i++) {
|
||||
final String basic = MagicColor.Constant.BASIC_LANDS.get(i);
|
||||
final String landwalk = LANDWALK_KEYWORDS[i];
|
||||
@@ -553,19 +553,24 @@ public class CombatUtil {
|
||||
String keyword = inst.getOriginal();
|
||||
if (keyword.equals("Legendary landwalk")) {
|
||||
walkTypes.add("Land.Legendary");
|
||||
} else if (keyword.equals("Desertwalk")) {
|
||||
walkTypes.add("Desert");
|
||||
} else if (keyword.equals("Nonbasic landwalk")) {
|
||||
walkTypes.add("Land.nonBasic");
|
||||
} else if (keyword.equals("Snow landwalk")) {
|
||||
walkTypes.add("Land.Snow");
|
||||
} else if (keyword.endsWith("walk")) {
|
||||
final String landtype = TextUtil.fastReplace(keyword, "walk", "");
|
||||
String landtype = TextUtil.fastReplace(keyword, "walk", "");
|
||||
String valid = landtype;
|
||||
|
||||
// substract Snow type
|
||||
if (landtype.startsWith("Snow ")) {
|
||||
walkTypes.add(landtype.substring(5) + ".Snow");
|
||||
} else if (CardType.isALandType(landtype)) {
|
||||
landtype = landtype.substring(5);
|
||||
valid = landtype + ".Snow";
|
||||
}
|
||||
|
||||
// basic land types are handled before
|
||||
if (CardType.isALandType(landtype) && !CardType.isABasicLandType(landtype)) {
|
||||
if (!walkTypes.contains(landtype)) {
|
||||
walkTypes.add(landtype);
|
||||
walkTypes.add(valid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -575,10 +580,10 @@ public class CombatUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
final String valid = StringUtils.join(walkTypes, ",");
|
||||
final String[] valid = walkTypes.toArray(new String[0]);
|
||||
final CardCollectionView defendingLands = defendingPlayer.getCardsIn(ZoneType.Battlefield);
|
||||
for (final Card c : defendingLands) {
|
||||
if (c.isValid(valid.split(","), defendingPlayer, attacker, null)) {
|
||||
if (c.isValid(valid, defendingPlayer, attacker, null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user