mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 02:38:02 +00:00
EffectEffect.java - add NoteCounterDefined$ param
This commit is contained in:
@@ -24,6 +24,7 @@ import forge.game.zone.ZoneType;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -53,6 +54,7 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
String[] effectReplacementEffects = null;
|
||||
FCollection<GameObject> rememberList = null;
|
||||
String effectImprinted = null;
|
||||
String noteCounterDefined = null;
|
||||
List<Player> effectOwner = null;
|
||||
boolean imprintOnHost = false;
|
||||
|
||||
@@ -101,6 +103,10 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
effectImprinted = sa.getParam("ImprintCards");
|
||||
}
|
||||
|
||||
if (sa.hasParam("NoteCounterDefined")) {
|
||||
noteCounterDefined = sa.getParam("NoteCounterDefined");
|
||||
}
|
||||
|
||||
String name = sa.getParam("Name");
|
||||
if (name == null) {
|
||||
name = hostCard.getName() + "'s Effect";
|
||||
@@ -224,6 +230,13 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
// Note counters on defined
|
||||
if (noteCounterDefined != null) {
|
||||
for (final Card c : AbilityUtils.getDefinedCards(hostCard, noteCounterDefined, sa)) {
|
||||
noteCounters(c, eff);
|
||||
}
|
||||
}
|
||||
|
||||
// Set Chosen Color(s)
|
||||
if (hostCard.hasChosenColor()) {
|
||||
eff.setChosenColors(Lists.newArrayList(hostCard.getChosenColors()));
|
||||
@@ -324,4 +337,12 @@ public class EffectEffect extends SpellAbilityEffect {
|
||||
}
|
||||
}
|
||||
|
||||
private void noteCounters(Card notee, Card source) {
|
||||
for(Map.Entry<CounterType, Integer> counter : notee.getCounters().entrySet()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("NoteCounters").append(counter.getKey().getName());
|
||||
source.setSVar(sb.toString(), counter.getValue().toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user