mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
Fix World rule (#7397)
This commit is contained in:
@@ -2024,7 +2024,7 @@ public class GameAction {
|
||||
}
|
||||
|
||||
private boolean handleWorldRule(CardCollection noRegCreats) {
|
||||
final List<Card> worlds = CardLists.getType(game.getCardsIn(ZoneType.Battlefield), "World");
|
||||
final List<Card> worlds = CardLists.filter(game.getCardsIn(ZoneType.Battlefield), c -> c.getType().hasSupertype(Supertype.World));
|
||||
if (worlds.size() <= 1) {
|
||||
return false;
|
||||
}
|
||||
@@ -2033,7 +2033,7 @@ public class GameAction {
|
||||
long ts = 0;
|
||||
|
||||
for (final Card crd : worlds) {
|
||||
long crdTs = crd.getGameTimestamp();
|
||||
long crdTs = crd.getWorldTimestamp();
|
||||
if (crdTs > ts) {
|
||||
ts = crdTs;
|
||||
toKeep.clear();
|
||||
|
||||
@@ -129,6 +129,8 @@ public class CloneEffect extends SpellAbilityEffect {
|
||||
cloneTargets.remove(cardToCopy);
|
||||
}
|
||||
|
||||
final long ts = game.getNextTimestamp();
|
||||
|
||||
for (Card tgtCard : cloneTargets) {
|
||||
if (sa.hasParam("CloneZone") &&
|
||||
!tgtCard.isInZone(ZoneType.smartValueOf(sa.getParam("CloneZone")))) {
|
||||
@@ -141,7 +143,6 @@ public class CloneEffect extends SpellAbilityEffect {
|
||||
|
||||
game.getTriggerHandler().clearActiveTriggers(tgtCard, null);
|
||||
|
||||
final long ts = game.getNextTimestamp();
|
||||
tgtCard.addCloneState(CardFactory.getCloneStates(cardToCopy, tgtCard, sa), ts);
|
||||
tgtCard.updateRooms();
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import forge.GameCommand;
|
||||
import forge.StaticData;
|
||||
import forge.card.*;
|
||||
import forge.card.CardDb.CardArtPreference;
|
||||
import forge.card.CardType.Supertype;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.mana.ManaCostParser;
|
||||
import forge.game.*;
|
||||
@@ -251,6 +252,7 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
|
||||
private PlayerCollection targetedFromThisTurn = new PlayerCollection();
|
||||
|
||||
private long worldTimestamp = -1;
|
||||
private long bestowTimestamp = -1;
|
||||
private long transformedTimestamp = 0;
|
||||
private long prototypeTimestamp = -1;
|
||||
@@ -4484,11 +4486,13 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
public final void addCloneState(CardCloneStates states, final long timestamp) {
|
||||
clonedStates.put(timestamp, states);
|
||||
updateCloneState(true);
|
||||
updateWorldTimestamp(timestamp);
|
||||
}
|
||||
|
||||
public final boolean removeCloneState(final long timestamp) {
|
||||
if (clonedStates.remove(timestamp) != null) {
|
||||
updateCloneState(true);
|
||||
updateWorldTimestamp(timestamp);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -6958,6 +6962,17 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
|
||||
return equals(c) && c.getGameTimestamp() == gameTimestamp;
|
||||
}
|
||||
|
||||
public long getWorldTimestamp() {
|
||||
return worldTimestamp;
|
||||
}
|
||||
public void updateWorldTimestamp(long ts) {
|
||||
if (!getType().hasSupertype(Supertype.World)) {
|
||||
worldTimestamp = -1;
|
||||
} else if (worldTimestamp == -1) {
|
||||
worldTimestamp = ts;
|
||||
}
|
||||
}
|
||||
|
||||
public String getProtectionKey() {
|
||||
String protectKey = "";
|
||||
boolean pR = false; boolean pG = false; boolean pB = false; boolean pU = false; boolean pW = false;
|
||||
|
||||
@@ -104,6 +104,12 @@ public class CardZoneTable extends ForwardingTable<ZoneType, ZoneType, CardColle
|
||||
return;
|
||||
}
|
||||
if (!isEmpty()) {
|
||||
for (Card c : allCards()) {
|
||||
if (c.isInPlay()) {
|
||||
c.updateWorldTimestamp(game.getTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
// this should still refresh for empty battlefield
|
||||
if (lastStateBattlefield != CardCollection.EMPTY) {
|
||||
game.getTriggerHandler().resetActiveTriggers(false);
|
||||
|
||||
Reference in New Issue
Block a user