mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
blockedThisTurn: switch to LKI list
This commit is contained in:
@@ -12,6 +12,7 @@ import forge.game.ability.AbilityUtils;
|
||||
import forge.game.ability.SpellAbilityEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.card.CardUtil;
|
||||
import forge.game.combat.Combat;
|
||||
import forge.game.event.GameEventCombatChanged;
|
||||
import forge.game.spellability.SpellAbility;
|
||||
@@ -56,8 +57,8 @@ public class BlockEffect extends SpellAbilityEffect {
|
||||
combat.addBlocker(attacker, blocker);
|
||||
combat.orderAttackersForDamageAssignment(blocker);
|
||||
|
||||
blocker.addBlockedThisTurn(attacker);
|
||||
attacker.addBlockedByThisTurn(blocker);
|
||||
blocker.addBlockedThisTurn(CardUtil.getLKICopy(attacker));
|
||||
attacker.addBlockedByThisTurn(CardUtil.getLKICopy(blocker));
|
||||
|
||||
{
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
|
||||
@@ -108,8 +108,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
|
||||
// cards attached or otherwise linked to this card
|
||||
private CardCollection hauntedBy, devouredCards, exploitedCards, delvedCards, convokedCards, imprintedCards, encodedCards;
|
||||
private CardCollection mustBlockCards, gainControlTargets, chosenCards, blockedThisTurn, blockedByThisTurn;
|
||||
private CardCollection mustBlockCards, gainControlTargets, chosenCards;
|
||||
private CardCollection mergedCards;
|
||||
private List<Card> blockedThisTurn = Lists.newArrayList();
|
||||
private List<Card> blockedByThisTurn = Lists.newArrayList();
|
||||
|
||||
private CardCollection untilLeavesBattlefield = new CardCollection();
|
||||
|
||||
@@ -1289,30 +1291,24 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
||||
return count;
|
||||
}
|
||||
|
||||
public CardCollectionView getBlockedThisTurn() {
|
||||
return CardCollection.getView(blockedThisTurn);
|
||||
public List<Card> getBlockedThisTurn() {
|
||||
return blockedThisTurn;
|
||||
}
|
||||
public void addBlockedThisTurn(Card attacker) {
|
||||
if (blockedThisTurn == null) {
|
||||
blockedThisTurn = new CardCollection();
|
||||
}
|
||||
blockedThisTurn.add(attacker);
|
||||
}
|
||||
public void clearBlockedThisTurn() {
|
||||
blockedThisTurn = null;
|
||||
blockedThisTurn.clear();
|
||||
}
|
||||
|
||||
public CardCollectionView getBlockedByThisTurn() {
|
||||
return CardCollection.getView(blockedByThisTurn);
|
||||
public List<Card> getBlockedByThisTurn() {
|
||||
return blockedByThisTurn;
|
||||
}
|
||||
public void addBlockedByThisTurn(Card blocker) {
|
||||
if (blockedByThisTurn == null) {
|
||||
blockedByThisTurn = new CardCollection();
|
||||
}
|
||||
blockedByThisTurn.add(blocker);
|
||||
}
|
||||
public void clearBlockedByThisTurn() {
|
||||
blockedByThisTurn = null;
|
||||
blockedByThisTurn.clear();
|
||||
}
|
||||
|
||||
//MustBlockCards are cards that this Card must block if able in an upcoming combat.
|
||||
|
||||
@@ -1583,8 +1583,8 @@ public class CardProperty {
|
||||
} else if (property.startsWith("blockedByThisTurn")) {
|
||||
return !card.getBlockedByThisTurn().isEmpty();
|
||||
} else if (property.startsWith("blockedValidThisTurn ")) {
|
||||
CardCollectionView blocked = card.getBlockedThisTurn();
|
||||
if (blocked == null) {
|
||||
List<Card> blocked = card.getBlockedThisTurn();
|
||||
if (blocked.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String valid = property.split(" ")[1];
|
||||
@@ -1600,8 +1600,8 @@ public class CardProperty {
|
||||
}
|
||||
return false;
|
||||
} else if (property.startsWith("blockedByValidThisTurn ")) {
|
||||
CardCollectionView blocked = card.getBlockedByThisTurn();
|
||||
if (blocked == null) {
|
||||
List<Card> blocked = card.getBlockedByThisTurn();
|
||||
if (blocked.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
String valid = property.split(" ")[1];
|
||||
|
||||
@@ -34,6 +34,7 @@ import forge.game.ability.effects.SkipPhaseEffect;
|
||||
import forge.game.card.Card;
|
||||
import forge.game.card.CardCollection;
|
||||
import forge.game.card.CardLists;
|
||||
import forge.game.card.CardUtil;
|
||||
import forge.game.card.CardPredicates.Presets;
|
||||
import forge.game.card.CardZoneTable;
|
||||
import forge.game.card.CounterEnumType;
|
||||
@@ -795,8 +796,8 @@ public class PhaseHandler implements java.io.Serializable {
|
||||
|
||||
// Run this trigger once for each blocker
|
||||
for (final Card b : blockers) {
|
||||
b.addBlockedThisTurn(a);
|
||||
a.addBlockedByThisTurn(b);
|
||||
b.addBlockedThisTurn(CardUtil.getLKICopy(a));
|
||||
a.addBlockedByThisTurn(CardUtil.getLKICopy(b));
|
||||
|
||||
final Map<AbilityKey, Object> runParams = AbilityKey.newMap();
|
||||
runParams.put(AbilityKey.Attacker, a);
|
||||
|
||||
Reference in New Issue
Block a user