As Foretold: fix the cmc check

This commit is contained in:
Hanmac
2019-09-20 16:20:35 +02:00
parent 1e7ed84522
commit b7b1c3a437
3 changed files with 33 additions and 39 deletions

View File

@@ -114,6 +114,38 @@ public final class GameActionUtil {
}
source.setState(CardStateName.Adventure, false);
// need to reset CMC
source.setLKICMC(-1);
source.setLKICMC(source.getCMC());
lkicheck = true;
} else if (source.isSplitCard() && (sa.isLeftSplit() || sa.isRightSplit())) {
if (!source.isLKI()) {
source = CardUtil.getLKICopy(source);
}
if (sa.isLeftSplit()) {
if (!source.hasState(CardStateName.LeftSplit)) {
source.addAlternateState(CardStateName.LeftSplit, false);
source.getState(CardStateName.LeftSplit).copyFrom(
sa.getHostCard().getState(CardStateName.LeftSplit), true);
}
source.setState(CardStateName.LeftSplit, false);
}
if (sa.isRightSplit()) {
if (!source.hasState(CardStateName.RightSplit)) {
source.addAlternateState(CardStateName.RightSplit, false);
source.getState(CardStateName.RightSplit).copyFrom(
sa.getHostCard().getState(CardStateName.RightSplit), true);
}
source.setState(CardStateName.RightSplit, false);
}
// need to reset CMC
source.setLKICMC(-1);
source.setLKICMC(source.getCMC());
lkicheck = true;
}
@@ -146,20 +178,6 @@ public final class GameActionUtil {
newSA = sa.copyWithManaCostReplaced(activator, o.getAltManaCost());
newSA.setBasicSpell(false);
changedManaCost = true;
if (host.hasSVar("AsForetoldSplitCMCHack")) {
// TODO: This is a temporary workaround for As Foretold interaction with split cards, better solution needed.
if (sa.isLeftSplit()) {
int leftCMC = sa.getHostCard().getCMC(Card.SplitCMCMode.LeftSplitCMC);
if (leftCMC > host.getCounters(CounterType.TIME)) {
continue;
}
} else if (sa.isRightSplit()) {
int rightCMC = sa.getHostCard().getCMC(Card.SplitCMCMode.RightSplitCMC);
if (rightCMC > host.getCounters(CounterType.TIME)) {
continue;
}
}
}
} else {
newSA = sa.copy(activator);
}

View File

@@ -111,28 +111,6 @@ public class CardProperty {
if (!card.isAdventureCard()) {
return false;
}
} else if (property.startsWith("leftcmc") || property.startsWith("rightcmc")) {
int x;
int y = 0;
String rhs = "";
if (property.startsWith("leftcmc")) {
rhs = property.substring(9);
y = card.getCMC(Card.SplitCMCMode.LeftSplitCMC);
} else if (property.startsWith("rightcmc")) {
rhs = property.substring(10);
y = card.getCMC(Card.SplitCMCMode.RightSplitCMC);
}
try {
x = Integer.parseInt(rhs);
} catch (final NumberFormatException e) {
x = AbilityUtils.calculateAmount(source, rhs, spellAbility);
}
if (!Expressions.compare(y, property, x)) {
return false;
}
} else if (property.startsWith("YouCtrl")) {
if (!controller.equals(sourceController)) {
return false;

View File

@@ -3,9 +3,7 @@ ManaCost:2 U
Types:Enchantment
T:Mode$ Phase | Phase$ Upkeep | ValidPlayer$ You | TriggerZones$ Battlefield | Execute$ TrigPutCounter | TriggerDescription$ At the beginning of your upkeep, put a time counter on CARDNAME.
SVar:TrigPutCounter:DB$ PutCounter | Defined$ Self | CounterType$ TIME | CounterNum$ 1
S:Mode$ Continuous | MayPlay$ True | MayPlayAltManaCost$ 0 | MayPlayLimit$ 1 | MayPlayDontGrantZonePermissions$ True | Affected$ Card.YouCtrl+NotSplit+nonLand+cmcLEX | AffectedZone$ Hand,Graveyard,Library,Exile,Command | Description$ Once each turn, you may pay {0} rather than pay the mana cost for a spell you cast with converted mana cost X or less, where X is the number of time counters on CARDNAME.
S:Mode$ Continuous | MayPlay$ True | MayPlayAltManaCost$ 0 | MayPlayLimit$ 1 | MayPlayDontGrantZonePermissions$ True | Affected$ Card.YouCtrl+Split+nonLand+leftcmcLEX,Card.YouCtrl+Split+nonLand+rightcmcLEX | AffectedZone$ Hand,Graveyard,Library,Exile,Command | Secondary$ True
S:Mode$ Continuous | MayPlay$ True | MayPlayAltManaCost$ 0 | MayPlayLimit$ 1 | MayPlayDontGrantZonePermissions$ True | Affected$ Card.YouCtrl+nonLand+cmcLEX | AffectedZone$ Hand,Graveyard,Library,Exile,Command | Description$ Once each turn, you may pay {0} rather than pay the mana cost for a spell you cast with converted mana cost X or less, where X is the number of time counters on CARDNAME.
SVar:X:Count$CardCounters.TIME
SVar:AsForetoldSplitCMCHack:TRUE
SVar:Picture:http://www.wizards.com/global/images/magic/general/as_foretold.jpg
Oracle:At the beginning of your upkeep, put a time counter on As Foretold.\nOnce each turn, you may pay {0} rather than pay the mana cost for a spell you cast with converted mana cost X or less, where X is the number of time counters on As Foretold.