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();
|
SpellAbility root = ability.getRootSpellAbility();
|
||||||
list = new CardList();
|
list = new CardList();
|
||||||
list.add((Card) root.getTriggeringObject(calcX[0].substring(9)));
|
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")) {
|
} else if (calcX[0].startsWith("TriggerCount")) {
|
||||||
// TriggerCount is similar to a regular Count, but just pulls Integer Values from Trigger objects
|
// TriggerCount is similar to a regular Count, but just pulls Integer Values from Trigger objects
|
||||||
String[] l = calcX[1].split("/");
|
String[] l = calcX[1].split("/");
|
||||||
@@ -1181,10 +1167,32 @@ public class AbilityFactory {
|
|||||||
|
|
||||||
return CardFactoryUtil.doXMath(count, m, card) * multiplier;
|
return CardFactoryUtil.doXMath(count, m, card) * multiplier;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return CardFactoryUtil.handlePaid(list, calcX[1], card) * multiplier;
|
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 {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import forge.AllZone;
|
|||||||
import forge.AllZoneUtil;
|
import forge.AllZoneUtil;
|
||||||
import forge.CardList;
|
import forge.CardList;
|
||||||
import forge.Player;
|
import forge.Player;
|
||||||
|
import forge.card.abilityFactory.AbilityFactory;
|
||||||
import forge.card.cardFactory.CardFactoryUtil;
|
import forge.card.cardFactory.CardFactoryUtil;
|
||||||
import forge.card.spellability.SpellAbility;
|
import forge.card.spellability.SpellAbility;
|
||||||
|
|
||||||
@@ -414,33 +415,21 @@ public abstract class Trigger {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mapParams.containsKey("CheckSVar")) {
|
if (mapParams.containsKey("CheckSVar")) {
|
||||||
String SVarName = mapParams.get("CheckSVar");
|
int sVar = AbilityFactory.calculateAmount(AllZoneUtil.getCardState(hostCard), mapParams.get("CheckSVar"), null);
|
||||||
String operator = "GE";
|
String comparator = "GE1";
|
||||||
String operand = "1";
|
if (mapParams.containsKey("SVarCompare")) {
|
||||||
|
comparator = mapParams.get("SVarCompare");
|
||||||
if(mapParams.containsKey("SVarCompare"))
|
|
||||||
{
|
|
||||||
operator = mapParams.get("SVarCompare").substring(0,2);
|
|
||||||
operand = mapParams.get("SVarCompare").substring(2);
|
|
||||||
}
|
}
|
||||||
|
String svarOperator = comparator.substring(0, 2);
|
||||||
int sVarResult = CardFactoryUtil.xCount(hostCard, hostCard.getSVar(SVarName));
|
String svarOperand = comparator.substring(2);
|
||||||
int operandResult = 0;
|
int operandValue = AbilityFactory.calculateAmount(AllZoneUtil.getCardState(hostCard), svarOperand, null);
|
||||||
try {
|
if (!AllZoneUtil.compare(sVar, svarOperator, operandValue)) {
|
||||||
operandResult = Integer.parseInt(operand);
|
|
||||||
}
|
|
||||||
catch ( Exception e) {
|
|
||||||
operandResult = CardFactoryUtil.xCount(hostCard, hostCard.getSVar(operand));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!AllZoneUtil.compare(sVarResult,operator,operandResult))
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user