mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Merge branch 'retrace' into 'master'
Fix Wrenn and Six Emblem not allowing to retrace adventures See merge request core-developers/forge!5694
This commit is contained in:
@@ -366,7 +366,25 @@ public final class GameActionUtil {
|
|||||||
if (sa == null || !sa.isSpell()) {
|
if (sa == null || !sa.isSpell()) {
|
||||||
return costs;
|
return costs;
|
||||||
}
|
}
|
||||||
final Card source = sa.getHostCard();
|
|
||||||
|
Card source = sa.getHostCard();
|
||||||
|
final Game game = source.getGame();
|
||||||
|
boolean lkicheck = false;
|
||||||
|
|
||||||
|
Card newHost = ((Spell)sa).getAlternateHost(source);
|
||||||
|
if (newHost != null) {
|
||||||
|
source = newHost;
|
||||||
|
lkicheck = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lkicheck) {
|
||||||
|
// double freeze tracker, so it doesn't update view
|
||||||
|
game.getTracker().freeze();
|
||||||
|
source.clearStaticChangedCardKeywords(false);
|
||||||
|
CardCollection preList = new CardCollection(source);
|
||||||
|
game.getAction().checkStaticAbilities(false, Sets.newHashSet(source), preList);
|
||||||
|
}
|
||||||
|
|
||||||
for (KeywordInterface inst : source.getKeywords()) {
|
for (KeywordInterface inst : source.getKeywords()) {
|
||||||
final String keyword = inst.getOriginal();
|
final String keyword = inst.getOriginal();
|
||||||
if (keyword.startsWith("Buyback")) {
|
if (keyword.startsWith("Buyback")) {
|
||||||
@@ -409,6 +427,16 @@ public final class GameActionUtil {
|
|||||||
|
|
||||||
// Surge while having OptionalCost is none of them
|
// Surge while having OptionalCost is none of them
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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 costs;
|
return costs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
|
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
|
import forge.card.CardStateName;
|
||||||
import forge.card.mana.ManaCost;
|
import forge.card.mana.ManaCost;
|
||||||
import forge.game.Game;
|
import forge.game.Game;
|
||||||
import forge.game.GameActionUtil;
|
import forge.game.GameActionUtil;
|
||||||
@@ -83,14 +84,20 @@ public class HumanPlay {
|
|||||||
sa.setActivatingPlayer(p);
|
sa.setActivatingPlayer(p);
|
||||||
boolean flippedToCast = sa.isSpell() && source.isFaceDown();
|
boolean flippedToCast = sa.isSpell() && source.isFaceDown();
|
||||||
|
|
||||||
source.setSplitStateToPlayAbility(sa);
|
|
||||||
sa = chooseOptionalAdditionalCosts(p, sa);
|
sa = chooseOptionalAdditionalCosts(p, sa);
|
||||||
if (sa == null) {
|
if (sa == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final CardStateName oldState = source.getCurrentStateName();
|
||||||
|
source.setSplitStateToPlayAbility(sa);
|
||||||
|
|
||||||
// extra play check
|
// extra play check
|
||||||
if (sa.isSpell() && !sa.canPlay()) {
|
if (sa.isSpell() && !sa.canPlay()) {
|
||||||
|
// in case human won't pay optional cost
|
||||||
|
if (source.getCurrentStateName() != oldState) {
|
||||||
|
source.setState(oldState, true);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,7 +150,7 @@ public class HumanPlay {
|
|||||||
|
|
||||||
final SpellAbility choosen = c.getAbilityToPlay(original.getHostCard(), abilities);
|
final SpellAbility choosen = c.getAbilityToPlay(original.getHostCard(), abilities);
|
||||||
|
|
||||||
List<OptionalCostValue> list = GameActionUtil.getOptionalCostValues(choosen);
|
List<OptionalCostValue> list = GameActionUtil.getOptionalCostValues(choosen);
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
list = c.chooseOptionalCosts(choosen, list);
|
list = c.chooseOptionalCosts(choosen, list);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user