mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Modified handling of CheckSVar in Trigger.java to be consistent with the other abilities.
Moved handling of Remembered and Imprint list in calculateAmount outside of the ability if statement
This commit is contained in:
@@ -1159,20 +1159,6 @@ public class AbilityFactory {
|
||||
SpellAbility root = ability.getRootSpellAbility();
|
||||
list = new CardList();
|
||||
list.add((Card) root.getTriggeringObject(calcX[0].substring(9)));
|
||||
} else if (calcX[0].startsWith("Remembered")) {
|
||||
// Add whole Remembered list to handlePaid
|
||||
list = new CardList();
|
||||
for (Object o : card.getRemembered()) {
|
||||
if (o instanceof Card) {
|
||||
list.add(AllZoneUtil.getCardState((Card) o));
|
||||
}
|
||||
}
|
||||
} else if (calcX[0].startsWith("Imprinted")) {
|
||||
// Add whole Imprinted list to handlePaid
|
||||
list = new CardList();
|
||||
for (Card c : card.getImprinted()) {
|
||||
list.add(AllZoneUtil.getCardState(c));
|
||||
}
|
||||
} else if (calcX[0].startsWith("TriggerCount")) {
|
||||
// TriggerCount is similar to a regular Count, but just pulls Integer Values from Trigger objects
|
||||
String[] l = calcX[1].split("/");
|
||||
@@ -1181,10 +1167,32 @@ public class AbilityFactory {
|
||||
|
||||
return CardFactoryUtil.doXMath(count, m, card) * multiplier;
|
||||
} else {
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return CardFactoryUtil.handlePaid(list, calcX[1], card) * multiplier;
|
||||
|
||||
} else if (calcX[0].startsWith("Remembered")) {
|
||||
// Add whole Remembered list to handlePaid
|
||||
CardList list = new CardList();
|
||||
for (Object o : card.getRemembered()) {
|
||||
if (o instanceof Card) {
|
||||
list.add(AllZoneUtil.getCardState((Card) o));
|
||||
}
|
||||
}
|
||||
|
||||
return CardFactoryUtil.handlePaid(list, calcX[1], card) * multiplier;
|
||||
|
||||
} else if (calcX[0].startsWith("Imprinted")) {
|
||||
// Add whole Imprinted list to handlePaid
|
||||
CardList list = new CardList();
|
||||
for (Card c : card.getImprinted()) {
|
||||
list.add(AllZoneUtil.getCardState(c));
|
||||
}
|
||||
|
||||
return CardFactoryUtil.handlePaid(list, calcX[1], card) * multiplier;
|
||||
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import forge.AllZone;
|
||||
import forge.AllZoneUtil;
|
||||
import forge.CardList;
|
||||
import forge.Player;
|
||||
import forge.card.abilityFactory.AbilityFactory;
|
||||
import forge.card.cardFactory.CardFactoryUtil;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
|
||||
@@ -414,33 +415,21 @@ public abstract class Trigger {
|
||||
|
||||
}
|
||||
|
||||
if(mapParams.containsKey("CheckSVar")) {
|
||||
String SVarName = mapParams.get("CheckSVar");
|
||||
String operator = "GE";
|
||||
String operand = "1";
|
||||
|
||||
if(mapParams.containsKey("SVarCompare"))
|
||||
{
|
||||
operator = mapParams.get("SVarCompare").substring(0,2);
|
||||
operand = mapParams.get("SVarCompare").substring(2);
|
||||
if (mapParams.containsKey("CheckSVar")) {
|
||||
int sVar = AbilityFactory.calculateAmount(AllZoneUtil.getCardState(hostCard), mapParams.get("CheckSVar"), null);
|
||||
String comparator = "GE1";
|
||||
if (mapParams.containsKey("SVarCompare")) {
|
||||
comparator = mapParams.get("SVarCompare");
|
||||
}
|
||||
|
||||
int sVarResult = CardFactoryUtil.xCount(hostCard, hostCard.getSVar(SVarName));
|
||||
int operandResult = 0;
|
||||
try {
|
||||
operandResult = Integer.parseInt(operand);
|
||||
}
|
||||
catch ( Exception e) {
|
||||
operandResult = CardFactoryUtil.xCount(hostCard, hostCard.getSVar(operand));
|
||||
}
|
||||
|
||||
if(!AllZoneUtil.compare(sVarResult,operator,operandResult))
|
||||
{
|
||||
String svarOperator = comparator.substring(0, 2);
|
||||
String svarOperand = comparator.substring(2);
|
||||
int operandValue = AbilityFactory.calculateAmount(AllZoneUtil.getCardState(hostCard), svarOperand, null);
|
||||
if (!AllZoneUtil.compare(sVar, svarOperator, operandValue)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user