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