mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Fix non* targeting restrictions (e.g. nonland)
This commit is contained in:
@@ -199,6 +199,10 @@ public final class CardType implements Comparable<CardType>, CardTypeView {
|
|||||||
if (subtypes.contains(t)) {
|
if (subtypes.contains(t)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
char firstChar = t.charAt(0);
|
||||||
|
if (Character.isLowerCase(firstChar)) {
|
||||||
|
t = Character.toUpperCase(firstChar) + t.substring(1); //ensure string is proper case for enum types
|
||||||
|
}
|
||||||
CoreType type = stringToCoreType.get(t);
|
CoreType type = stringToCoreType.get(t);
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
return hasType(type);
|
return hasType(type);
|
||||||
|
|||||||
@@ -292,7 +292,6 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final boolean checkOtherRestrictions(final Card c, final SpellAbility sa, final Player activator) {
|
public final boolean checkOtherRestrictions(final Card c, final SpellAbility sa, final Player activator) {
|
||||||
|
|
||||||
final Game game = activator.getGame();
|
final Game game = activator.getGame();
|
||||||
|
|
||||||
if (this.getCardsInHand() != -1) {
|
if (this.getCardsInHand() != -1) {
|
||||||
@@ -398,7 +397,6 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
|||||||
if (!Expressions.compare(svarValue, this.getsVarOperator(), operandValue)) {
|
if (!Expressions.compare(svarValue, this.getsVarOperator(), operandValue)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getsVarToCheck() != null) {
|
if (this.getsVarToCheck() != null) {
|
||||||
@@ -408,7 +406,6 @@ public class SpellAbilityRestriction extends SpellAbilityVariables {
|
|||||||
if (!Expressions.compare(svarValue, this.getsVarOperator(), operandValue)) {
|
if (!Expressions.compare(svarValue, this.getsVarOperator(), operandValue)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,9 +104,8 @@ public final class InputSelectTargets extends InputSyncronizedBase {
|
|||||||
if (!tgt.isUniqueTargets() && targetDepth.containsKey(card)) {
|
if (!tgt.isUniqueTargets() && targetDepth.containsKey(card)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// leave this in temporarily, there some seriously wrong things going on here
|
//If the card is not a valid target
|
||||||
// Can be targeted doesn't check if the target is a valid type, only if a card is generally "targetable"
|
|
||||||
if (!card.canBeTargetedBy(sa)) {
|
if (!card.canBeTargetedBy(sa)) {
|
||||||
showMessage(sa.getHostCard() + " - Cannot target this card (Shroud? Protection? Restrictions).");
|
showMessage(sa.getHostCard() + " - Cannot target this card (Shroud? Protection? Restrictions).");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user