mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
- TargetRestrictions: correctly process validTgts definitions such as Zombie.attacking for the purpose of canTgtCreature. Fixes, for instance, the AI using Accursed Horde to give indestructible to opponent's attacking zombies.
This commit is contained in:
@@ -21,6 +21,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import forge.util.TextUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -413,10 +414,16 @@ public class TargetRestrictions {
|
||||
*/
|
||||
public final boolean canTgtCreature() {
|
||||
for (final String s : this.validTgts) {
|
||||
if ((s.contains("Creature") || CardType.isACreatureType(s) || s.startsWith("Permanent"))
|
||||
if ((s.contains("Creature") || s.startsWith("Permanent"))
|
||||
&& !s.contains("nonCreature")) {
|
||||
return true;
|
||||
}
|
||||
String[] tgtParams = TextUtil.split(s, '.');
|
||||
for (String param : tgtParams) {
|
||||
if (CardType.isACreatureType(param)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user