mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +00:00
Merge branch '1778-untilhostleavesplay-missing-a-check-on-hostage-taker' into 'master'
Resolve "UntilHostLeavesPlay missing a check on Hostage Taker" Closes #1778 See merge request core-developers/forge!4259
This commit is contained in:
@@ -19,6 +19,7 @@ import forge.game.GameEntity;
|
|||||||
import forge.game.GameObject;
|
import forge.game.GameObject;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
import forge.game.card.CardCollection;
|
import forge.game.card.CardCollection;
|
||||||
|
import forge.game.card.CardCollectionView;
|
||||||
import forge.game.card.CardFactoryUtil;
|
import forge.game.card.CardFactoryUtil;
|
||||||
import forge.game.card.CardZoneTable;
|
import forge.game.card.CardZoneTable;
|
||||||
import forge.game.combat.Combat;
|
import forge.game.combat.Combat;
|
||||||
@@ -634,10 +635,19 @@ public abstract class SpellAbilityEffect {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
CardZoneTable untilTable = new CardZoneTable();
|
CardZoneTable untilTable = new CardZoneTable();
|
||||||
|
CardCollectionView untilCards = hostCard.getUntilLeavesBattlefield();
|
||||||
|
// if the list is empty, then the table doesn't need to be checked anymore
|
||||||
|
if (untilCards.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (Table.Cell<ZoneType, ZoneType, CardCollection> cell : triggerList.cellSet()) {
|
for (Table.Cell<ZoneType, ZoneType, CardCollection> cell : triggerList.cellSet()) {
|
||||||
for (Card c : cell.getValue()) {
|
for (Card c : cell.getValue()) {
|
||||||
|
// check if card is still in the until host leaves play list
|
||||||
|
if (!untilCards.contains(c)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// better check if card didn't changed zones again?
|
// better check if card didn't changed zones again?
|
||||||
Card newCard = c.getZone().getCards().get(c);
|
Card newCard = game.getCardState(c, null);
|
||||||
if (newCard == null || !newCard.equalsWithTimestamp(c)) {
|
if (newCard == null || !newCard.equalsWithTimestamp(c)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7077,6 +7077,10 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
return edition.getBorderColor();
|
return edition.getBorderColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final CardCollectionView getUntilLeavesBattlefield() {
|
||||||
|
return CardCollection.getView(untilLeavesBattlefield);
|
||||||
|
}
|
||||||
|
|
||||||
public final void addUntilLeavesBattlefield(final Card c) {
|
public final void addUntilLeavesBattlefield(final Card c) {
|
||||||
untilLeavesBattlefield = view.addCard(untilLeavesBattlefield, c, TrackableProperty.UntilLeavesBattlefield);
|
untilLeavesBattlefield = view.addCard(untilLeavesBattlefield, c, TrackableProperty.UntilLeavesBattlefield);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user