mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
"can be blocked only by creatures with defender" now also uses a common keyword
This commit is contained in:
@@ -3,7 +3,7 @@ ManaCost:2 U
|
|||||||
Types:Enchantment Aura
|
Types:Enchantment Aura
|
||||||
K:Enchant creature
|
K:Enchant creature
|
||||||
A:SP$ Attach | Cost$ 2 U | ValidTgts$ Creature | AILogic$ Pump
|
A:SP$ Attach | Cost$ 2 U | ValidTgts$ Creature | AILogic$ Pump
|
||||||
S:Mode$ Continuous | Affected$ Creature.enchanted+YouCtrl | AddPower$ 1 | AddToughness$ 1 | AddHiddenKeyword$ CARDNAME can't be blocked except by creatures with defender. | Description$ Creatures you control that are enchanted get +1/+1 and can't be blocked except by creatures with defender.
|
S:Mode$ Continuous | Affected$ Creature.enchanted+YouCtrl | AddPower$ 1 | AddToughness$ 1 | AddKeyword$ CantBeBlockedBy Creature.withoutDefender | Description$ Creatures you control that are enchanted get +1/+1 and can't be blocked except by creatures with defender.
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/infiltrators_magemark.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/infiltrators_magemark.jpg
|
||||||
Oracle:Enchant creature\nCreatures you control that are enchanted get +1/+1 and can't be blocked except by creatures with defender.
|
Oracle:Enchant creature\nCreatures you control that are enchanted get +1/+1 and can't be blocked except by creatures with defender.
|
||||||
SetInfo:GPT Common
|
SetInfo:GPT Common
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
Name:Noggle Bandit
|
Name:Noggle Bandit
|
||||||
ManaCost:1 UR UR
|
ManaCost:1 UR UR
|
||||||
Types:Creature Noggle Rogue
|
Types:Creature Noggle Rogue
|
||||||
Text:CARDNAME can't be blocked except by creatures with defender.
|
|
||||||
PT:2/2
|
PT:2/2
|
||||||
K:CantBeBlockedBy Creature.withoutDefender
|
K:CantBeBlockedBy Creature.withoutDefender
|
||||||
SVar:Picture:http://www.wizards.com/global/images/magic/general/noggle_bandit.jpg
|
SVar:Picture:http://www.wizards.com/global/images/magic/general/noggle_bandit.jpg
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ import forge.game.player.Player;
|
|||||||
import forge.game.zone.Zone;
|
import forge.game.zone.Zone;
|
||||||
import forge.game.zone.ZoneType;
|
import forge.game.zone.ZoneType;
|
||||||
import forge.util.Expressions;
|
import forge.util.Expressions;
|
||||||
|
import forge.util.Lang;
|
||||||
import forge.util.TextUtil;
|
import forge.util.TextUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2123,17 +2124,29 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
continue;
|
continue;
|
||||||
} else if (keyword.startsWith("CantBeBlockedBy")) {
|
} else if (keyword.startsWith("CantBeBlockedBy")) {
|
||||||
String expression = keyword.split(" ", 2)[1];
|
String expression = keyword.split(" ", 2)[1];
|
||||||
boolean hasNon = expression.contains("non");
|
boolean hasNon = expression.contains("non") || expression.contains("without");
|
||||||
sbLong.append(this.getName()).append(" cannot be blocked ");
|
sbLong.append(this.getName()).append(" cannot be blocked ");
|
||||||
if( hasNon ) sbLong.append("except ");
|
if( hasNon ) sbLong.append("except ");
|
||||||
sbLong.append("by ");
|
sbLong.append("by ");
|
||||||
String[] parts = TextUtil.split(expression, '.');
|
String[] parts = TextUtil.split(expression, '.');
|
||||||
|
List<String> partsAfterCreatures = new ArrayList<String>();
|
||||||
for(String part : parts) {
|
for(String part : parts) {
|
||||||
if( part.equalsIgnoreCase("creature"))
|
if( part.equalsIgnoreCase("creature"))
|
||||||
continue;
|
continue;
|
||||||
|
if(part.startsWith("with"))
|
||||||
|
{
|
||||||
|
int cutIdx = part.startsWith("without") ? 7 : 4;
|
||||||
|
partsAfterCreatures.add(StringUtils.capitalize(part.substring(cutIdx)));
|
||||||
|
}
|
||||||
|
else
|
||||||
sbLong.append(part.toLowerCase()).append(" ");
|
sbLong.append(part.toLowerCase()).append(" ");
|
||||||
|
|
||||||
}
|
}
|
||||||
sbLong.append("creatures");
|
sbLong.append("creatures");
|
||||||
|
if( !partsAfterCreatures.isEmpty() ) {
|
||||||
|
sbLong.append(" with ");
|
||||||
|
sbLong.append(Lang.joinHomogenous(partsAfterCreatures, null, hasNon ? "or" : "and"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -691,10 +691,6 @@ public class CombatUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attacker.hasKeyword("CARDNAME can't be blocked except by creatures with defender.") && !blocker.hasKeyword("Defender")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (attacker.hasKeyword("Horsemanship")) {
|
if (attacker.hasKeyword("Horsemanship")) {
|
||||||
if (!blocker.hasKeyword("Horsemanship")) {
|
if (!blocker.hasKeyword("Horsemanship")) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -36,8 +36,11 @@ public class Lang {
|
|||||||
return has1 ? (has2 ? s1 + " and " + s2 : s1) : (has2 ? s2 : "");
|
return has1 ? (has2 ? s1 + " and " + s2 : s1) : (has2 ? s2 : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T> String joinHomogenous(Collection<T> objects) { return joinHomogenous(objects, null); }
|
public static <T> String joinHomogenous(Collection<T> objects) { return joinHomogenous(objects, null, "and"); }
|
||||||
public static <T> String joinHomogenous(Collection<T> objects, Function<T, String> accessor) {
|
public static <T> String joinHomogenous(Collection<T> objects, Function<T, String> accessor) {
|
||||||
|
return joinHomogenous(objects, accessor, "and");
|
||||||
|
}
|
||||||
|
public static <T> String joinHomogenous(Collection<T> objects, Function<T, String> accessor, String lastUnion) {
|
||||||
int remaining = objects.size();
|
int remaining = objects.size();
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for(T obj : objects) {
|
for(T obj : objects) {
|
||||||
@@ -47,11 +50,12 @@ public class Lang {
|
|||||||
else
|
else
|
||||||
sb.append(obj);
|
sb.append(obj);
|
||||||
if( remaining > 1 ) sb.append(", ");
|
if( remaining > 1 ) sb.append(", ");
|
||||||
if( remaining == 1 ) sb.append(" and ");
|
if( remaining == 1 ) sb.append(" ").append(lastUnion).append(" ");
|
||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static <T> String joinVerb(List<T> subjects, String verb) {
|
public static <T> String joinVerb(List<T> subjects, String verb) {
|
||||||
// English is simple - just add (s) for multiple objects.
|
// English is simple - just add (s) for multiple objects.
|
||||||
return subjects.size() > 1 ? verb : verb + "s";
|
return subjects.size() > 1 ? verb : verb + "s";
|
||||||
|
|||||||
Reference in New Issue
Block a user