mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 19:58:00 +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")) {
|
||||
return !card.getBlockedByThisTurn().isEmpty();
|
||||
} else if (property.startsWith("blockedValidThisTurn ")) {
|
||||
if (card.getBlockedThisTurn() == null) {
|
||||
CardCollectionView blocked = card.getBlockedThisTurn();
|
||||
if (blocked == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String valid = property.split(" ")[1];
|
||||
for(Card c : card.getBlockedThisTurn()) {
|
||||
for(Card c : blocked) {
|
||||
if (c.isValid(valid, card.getController(), source, spellAbility)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for(Card c : AbilityUtils.getDefinedCards(source, valid, spellAbility)) {
|
||||
if (blocked.contains(c)) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
return false;
|
||||
} else if (property.startsWith("blockedByValidThisTurn ")) {
|
||||
if (card.getBlockedByThisTurn() == null) {
|
||||
CardCollectionView blocked = card.getBlockedByThisTurn();
|
||||
if (blocked == null) {
|
||||
return false;
|
||||
}
|
||||
String valid = property.split(" ")[1];
|
||||
for(Card c : card.getBlockedByThisTurn()) {
|
||||
for(Card c : blocked) {
|
||||
if (c.isValid(valid, card.getController(), source, spellAbility)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for(Card c : AbilityUtils.getDefinedCards(source, valid, spellAbility)) {
|
||||
if (blocked.contains(c)) {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
return false;
|
||||
} else if (property.startsWith("blockedBySourceThisTurn")) {
|
||||
return source.getBlockedByThisTurn().contains(card);
|
||||
@@ -1779,4 +1790,4 @@ public class CardProperty {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user