mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Merge branch 'remove-svars' into 'master'
Remove Svars param from Effect See merge request core-developers/forge!4152
This commit is contained in:
@@ -506,7 +506,9 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView,
|
||||
|
||||
@Override
|
||||
public Map<String, String> getSVars() {
|
||||
return sVars;
|
||||
Map<String, String> res = new HashMap<>(getSVarFallback().getSVars());
|
||||
res.putAll(sVars);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -457,6 +457,7 @@ public abstract class SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
eff.setOwner(controller);
|
||||
eff.setSVars(sa.getSVars());
|
||||
|
||||
eff.setImageKey(image);
|
||||
if (eff.getType().hasType(CardType.CoreType.Emblem)) {
|
||||
|
||||
@@ -15,7 +15,6 @@ import forge.game.zone.ZoneType;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
@@ -29,7 +28,6 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
@Override
|
||||
public void resolve(final SpellAbility sa) {
|
||||
final Card host = sa.getHostCard();
|
||||
final Map<String, String> svars = host.getSVars();
|
||||
|
||||
// AF specific sa
|
||||
Integer power = null;
|
||||
@@ -80,8 +78,8 @@ public class AnimateAllEffect extends AnimateEffectBase {
|
||||
// allow SVar substitution for keywords
|
||||
for (int i = 0; i < keywords.size(); i++) {
|
||||
final String k = keywords.get(i);
|
||||
if (svars.containsKey(k)) {
|
||||
keywords.add(svars.get(k));
|
||||
if (host.hasSVar(k)) {
|
||||
keywords.add(host.getSVar(k));
|
||||
keywords.remove(k);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class AnimateEffect extends AnimateEffectBase {
|
||||
@@ -23,7 +22,6 @@ public class AnimateEffect extends AnimateEffectBase {
|
||||
@Override
|
||||
public void resolve(final SpellAbility sa) {
|
||||
final Card source = sa.getHostCard();
|
||||
final Map<String, String> svars = source.getSVars();
|
||||
|
||||
String animateRemembered = null;
|
||||
|
||||
@@ -85,8 +83,8 @@ public class AnimateEffect extends AnimateEffectBase {
|
||||
// allow SVar substitution for keywords
|
||||
for (int i = 0; i < keywords.size(); i++) {
|
||||
final String k = keywords.get(i);
|
||||
if (svars.containsKey(k)) {
|
||||
keywords.add(svars.get(k));
|
||||
if (source.hasSVar(k)) {
|
||||
keywords.add(source.getSVar(k));
|
||||
keywords.remove(k);
|
||||
}
|
||||
}
|
||||
@@ -178,7 +176,6 @@ public class AnimateEffect extends AnimateEffectBase {
|
||||
@Override
|
||||
protected String getStackDescription(SpellAbility sa) {
|
||||
final Card host = sa.getHostCard();
|
||||
final Map<String, String> svars = host.getSVars();
|
||||
|
||||
Integer power = null;
|
||||
if (sa.hasParam("Power")) {
|
||||
@@ -200,8 +197,8 @@ public class AnimateEffect extends AnimateEffectBase {
|
||||
}
|
||||
// allow SVar substitution for keywords
|
||||
for (int i = 0; i < keywords.size(); i++) {
|
||||
final String k = keywords.get(i);
|
||||
if (svars.containsKey(k)) {
|
||||
final String k = keywords.get(i);
|
||||
if (sa.hasSVar(k)) {
|
||||
keywords.add("\"" + k + "\"");
|
||||
keywords.remove(k);
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ public class ControlGainEffect extends SpellAbilityEffect {
|
||||
@Override
|
||||
public void run() {
|
||||
doLoseControl(c, hostCard, bTapOnLose, tStamp);
|
||||
c.getSVars().remove("SacMe");
|
||||
c.removeSVar("SacMe");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -48,7 +48,6 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
|
||||
String[] effectAbilities = null;
|
||||
String[] effectTriggers = null;
|
||||
String[] effectSVars = null;
|
||||
String[] effectKeywords = null;
|
||||
String[] effectStaticAbilities = null;
|
||||
String[] effectReplacementEffects = null;
|
||||
@@ -74,10 +73,6 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
effectReplacementEffects = sa.getParam("ReplacementEffects").split(",");
|
||||
}
|
||||
|
||||
if (sa.hasParam("SVars")) {
|
||||
effectSVars = sa.getParam("SVars").split(",");
|
||||
}
|
||||
|
||||
if (sa.hasParam("Keywords")) {
|
||||
effectKeywords = sa.getParam("Keywords").split(",");
|
||||
}
|
||||
@@ -146,14 +141,7 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
eff.setSetCode(sa.getHostCard().getSetCode());
|
||||
eff.setRarity(sa.getHostCard().getRarity());
|
||||
|
||||
// Grant SVars first in order to give references to granted abilities
|
||||
if (effectSVars != null) {
|
||||
for (final String s : effectSVars) {
|
||||
eff.setSVar(s, AbilityUtils.getSVar(sa, s));
|
||||
}
|
||||
}
|
||||
|
||||
// Abilities, triggers and SVars work the same as they do for Token
|
||||
// Abilities and triggers work the same as they do for Token
|
||||
// Grant abilities
|
||||
if (effectAbilities != null) {
|
||||
for (final String s : effectAbilities) {
|
||||
@@ -177,9 +165,10 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
if (effectStaticAbilities != null) {
|
||||
for (final String s : effectStaticAbilities) {
|
||||
final StaticAbility addedStaticAbility = eff.addStaticAbility(AbilityUtils.getSVar(sa, s));
|
||||
if (addedStaticAbility != null) //prevent npe casting adventure card spell
|
||||
if (addedStaticAbility != null) { //prevent npe casting adventure card spell
|
||||
addedStaticAbility.putParam("EffectZone", "Command");
|
||||
addedStaticAbility.setIntrinsic(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +177,7 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
for (final String s : effectReplacementEffects) {
|
||||
final String actualReplacement = AbilityUtils.getSVar(sa, s);
|
||||
|
||||
final ReplacementEffect parsedReplacement = ReplacementHandler.parseReplacement(actualReplacement, eff, true, sa);
|
||||
final ReplacementEffect parsedReplacement = ReplacementHandler.parseReplacement(actualReplacement, eff, true, eff.getCurrentState());
|
||||
parsedReplacement.setActiveZone(EnumSet.of(ZoneType.Command));
|
||||
parsedReplacement.setIntrinsic(true);
|
||||
eff.addReplacementEffect(parsedReplacement);
|
||||
|
||||
@@ -120,7 +120,7 @@ public class SetStateEffect extends SpellAbilityEffect {
|
||||
// If want to Transform, and host is trying to transform self, skip if not in alignment
|
||||
boolean skip = gameCard.getTransformedTimestamp() != Long.parseLong(sa.getSVar("StoredTransform"));
|
||||
// Clear SVar from SA so it doesn't get reused accidentally
|
||||
sa.getSVars().remove("StoredTransform");
|
||||
sa.removeSVar("StoredTransform");
|
||||
if (skip) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -73,5 +73,4 @@ public class StoreSVarEffect extends SpellAbilityEffect {
|
||||
root = root.getSubAbility();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4024,7 +4024,7 @@ public class CardFactoryUtil {
|
||||
// Epic does modify existing SA, and does not add new one
|
||||
|
||||
// Add the Epic effect as a subAbility
|
||||
String dbStr = "DB$ Effect | Triggers$ EpicTrigger | SVars$ EpicCopy | StaticAbilities$ EpicCantBeCast | Duration$ Permanent | Epic$ True";
|
||||
String dbStr = "DB$ Effect | Triggers$ EpicTrigger | StaticAbilities$ EpicCantBeCast | Duration$ Permanent | Epic$ True";
|
||||
|
||||
final AbilitySub newSA = (AbilitySub) AbilityFactory.getAbility(dbStr, card);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user