mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
CardProperty: extend blockedValidThisTurn and blockedByValidThisTurn using defined
This commit is contained in:
committed by
Michael Kamensky
parent
db396e6b5c
commit
4f0deea15f
@@ -1518,27 +1518,38 @@ public class CardProperty {
|
|||||||
} else if (property.startsWith("blockedByThisTurn")) {
|
} else if (property.startsWith("blockedByThisTurn")) {
|
||||||
return !card.getBlockedByThisTurn().isEmpty();
|
return !card.getBlockedByThisTurn().isEmpty();
|
||||||
} else if (property.startsWith("blockedValidThisTurn ")) {
|
} else if (property.startsWith("blockedValidThisTurn ")) {
|
||||||
if (card.getBlockedThisTurn() == null) {
|
CardCollectionView blocked = card.getBlockedThisTurn();
|
||||||
|
if (blocked == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String valid = property.split(" ")[1];
|
String valid = property.split(" ")[1];
|
||||||
for(Card c : card.getBlockedThisTurn()) {
|
for(Card c : blocked) {
|
||||||
if (c.isValid(valid, card.getController(), source, spellAbility)) {
|
if (c.isValid(valid, card.getController(), source, spellAbility)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(Card c : AbilityUtils.getDefinedCards(source, valid, spellAbility)) {
|
||||||
|
if (blocked.contains(c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
return false;
|
return false;
|
||||||
} else if (property.startsWith("blockedByValidThisTurn ")) {
|
} else if (property.startsWith("blockedByValidThisTurn ")) {
|
||||||
if (card.getBlockedByThisTurn() == null) {
|
CardCollectionView blocked = card.getBlockedByThisTurn();
|
||||||
|
if (blocked == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
String valid = property.split(" ")[1];
|
String valid = property.split(" ")[1];
|
||||||
for(Card c : card.getBlockedByThisTurn()) {
|
for(Card c : blocked) {
|
||||||
if (c.isValid(valid, card.getController(), source, spellAbility)) {
|
if (c.isValid(valid, card.getController(), source, spellAbility)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for(Card c : AbilityUtils.getDefinedCards(source, valid, spellAbility)) {
|
||||||
|
if (blocked.contains(c)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
return false;
|
return false;
|
||||||
} else if (property.startsWith("blockedBySourceThisTurn")) {
|
} else if (property.startsWith("blockedBySourceThisTurn")) {
|
||||||
return source.getBlockedByThisTurn().contains(card);
|
return source.getBlockedByThisTurn().contains(card);
|
||||||
@@ -1779,4 +1790,4 @@ public class CardProperty {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user