Merge branch 'master' of git.cardforge.org:core-developers/forge into agetian-master

This commit is contained in:
Agetian
2019-03-09 17:36:32 +03:00
4 changed files with 45 additions and 2 deletions

View File

@@ -89,6 +89,8 @@ public final class GameActionUtil {
} }
if (lkicheck) { if (lkicheck) {
// double freeze tracker, so it doesn't update view
game.getTracker().freeze();
CardCollection preList = new CardCollection(source); CardCollection preList = new CardCollection(source);
game.getAction().checkStaticAbilities(false, Sets.newHashSet(source), preList); game.getAction().checkStaticAbilities(false, Sets.newHashSet(source), preList);
} }
@@ -164,6 +166,10 @@ public final class GameActionUtil {
// reset static abilities // reset static abilities
if (lkicheck) { if (lkicheck) {
game.getAction().checkStaticAbilities(false); game.getAction().checkStaticAbilities(false);
// clear delayed changes, this check should not have updated the view
game.getTracker().clearDelayed();
// need to unfreeze tracker
game.getTracker().unfreeze();
} }
} }

View File

@@ -493,6 +493,8 @@ public class TokenEffect extends SpellAbilityEffect {
lki.setLastKnownZone(tok.getController().getZone(ZoneType.Battlefield)); lki.setLastKnownZone(tok.getController().getZone(ZoneType.Battlefield));
// double freeze tracker, so it doesn't update view
game.getTracker().freeze();
CardCollection preList = new CardCollection(lki); CardCollection preList = new CardCollection(lki);
game.getAction().checkStaticAbilities(false, Sets.newHashSet(lki), preList); game.getAction().checkStaticAbilities(false, Sets.newHashSet(lki), preList);
@@ -505,6 +507,10 @@ public class TokenEffect extends SpellAbilityEffect {
// reset static abilities // reset static abilities
game.getAction().checkStaticAbilities(false); game.getAction().checkStaticAbilities(false);
// clear delayed changes, this check should not have updated the view
game.getTracker().clearDelayed();
// need to unfreeze tracker
game.getTracker().unfreeze();
if (!canAttach) { if (!canAttach) {
// Token can't attach to it // Token can't attach to it

View File

@@ -5561,19 +5561,48 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
abilities.removeAll(toRemove); abilities.removeAll(toRemove);
if (getState(CardStateName.Original).getType().isLand()) { if (getState(CardStateName.Original).getType().isLand() && !getLastKnownZone().is(ZoneType.Battlefield)) {
LandAbility la = new LandAbility(this, player, null); LandAbility la = new LandAbility(this, player, null);
if (la.canPlay()) { if (la.canPlay()) {
abilities.add(la); abilities.add(la);
} }
Card source = this;
boolean lkicheck = false;
// if Card is Facedown, need to check if MayPlay still applies
if (isFaceDown()) {
lkicheck = true;
source = CardUtil.getLKICopy(source);
// TODO need to be changed with CloneRewrite and FaceDownState?
source.turnFaceUp(false, false);
source.getCurrentState().copyFrom(getState(CardStateName.Original), true);
}
if (lkicheck) {
// double freeze tracker, so it doesn't update view
game.getTracker().freeze();
CardCollection preList = new CardCollection(source);
game.getAction().checkStaticAbilities(false, Sets.newHashSet(source), preList);
}
// extra for MayPlay // extra for MayPlay
for (CardPlayOption o : this.mayPlay(player)) { for (CardPlayOption o : source.mayPlay(player)) {
la = new LandAbility(this, player, o.getAbility()); la = new LandAbility(this, player, o.getAbility());
if (la.canPlay()) { if (la.canPlay()) {
abilities.add(la); abilities.add(la);
} }
} }
// reset static abilities
if (lkicheck) {
game.getAction().checkStaticAbilities(false);
// clear delayed changes, this check should not have updated the view
game.getTracker().clearDelayed();
// need to unfreeze tracker
game.getTracker().unfreeze();
}
} }
return abilities; return abilities;

View File

@@ -143,6 +143,8 @@ public abstract class Spell extends SpellAbility implements java.io.Serializable
// reset static abilities // reset static abilities
if (lkicheck) { if (lkicheck) {
game.getAction().checkStaticAbilities(false); game.getAction().checkStaticAbilities(false);
// clear delayed changes, this check should not have updated the view
game.getTracker().clearDelayed();
game.getTracker().unfreeze(); game.getTracker().unfreeze();
} }