Merge branch 'tawnos' into 'master'

Fix Tawnos's Coffin

See merge request core-developers/forge!3546
This commit is contained in:
Michael Kamensky
2021-01-01 07:25:26 +00:00
3 changed files with 28 additions and 8 deletions

View File

@@ -28,9 +28,9 @@ public class CountersNoteEffect extends SpellAbilityEffect {
GameEntityCounterTable table = new GameEntityCounterTable();
for (Card c : getDefinedCardsOrTargeted(sa)) {
if (mode.equals(MODE_STORE)) {
noteCounters(c, c);
noteCounters(c, source);
} else if (mode.equals(MODE_LOAD)) {
loadCounters(c, c, p, table);
loadCounters(c, source, p, table);
}
}
table.triggerCountersPutAll(game);

View File

@@ -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());
}
}
}