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(); GameEntityCounterTable table = new GameEntityCounterTable();
for (Card c : getDefinedCardsOrTargeted(sa)) { for (Card c : getDefinedCardsOrTargeted(sa)) {
if (mode.equals(MODE_STORE)) { if (mode.equals(MODE_STORE)) {
noteCounters(c, c); noteCounters(c, source);
} else if (mode.equals(MODE_LOAD)) { } else if (mode.equals(MODE_LOAD)) {
loadCounters(c, c, p, table); loadCounters(c, source, p, table);
} }
} }
table.triggerCountersPutAll(game); table.triggerCountersPutAll(game);

View File

@@ -24,6 +24,7 @@ import forge.game.zone.ZoneType;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import java.util.Map;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@@ -53,6 +54,7 @@ public class EffectEffect extends SpellAbilityEffect {
String[] effectReplacementEffects = null; String[] effectReplacementEffects = null;
FCollection<GameObject> rememberList = null; FCollection<GameObject> rememberList = null;
String effectImprinted = null; String effectImprinted = null;
String noteCounterDefined = null;
List<Player> effectOwner = null; List<Player> effectOwner = null;
boolean imprintOnHost = false; boolean imprintOnHost = false;
@@ -101,6 +103,10 @@ public class EffectEffect extends SpellAbilityEffect {
effectImprinted = sa.getParam("ImprintCards"); effectImprinted = sa.getParam("ImprintCards");
} }
if (sa.hasParam("NoteCounterDefined")) {
noteCounterDefined = sa.getParam("NoteCounterDefined");
}
String name = sa.getParam("Name"); String name = sa.getParam("Name");
if (name == null) { if (name == null) {
name = hostCard.getName() + "'s Effect"; 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) // Set Chosen Color(s)
if (hostCard.hasChosenColor()) { if (hostCard.hasChosenColor()) {
eff.setChosenColors(Lists.newArrayList(hostCard.getChosenColors())); 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());
}
}
} }

View File

@@ -2,16 +2,15 @@ Name:Tawnos's Coffin
ManaCost:4 ManaCost:4
Types:Artifact Types:Artifact
K:You may choose not to untap CARDNAME during your untap step. K:You may choose not to untap CARDNAME during your untap step.
A:AB$ Pump | Cost$ 3 T | ValidTgts$ Creature | ImprintCards$ Targeted | SubAbility$ RecordCounters | StackDescription$ SpellDescription | SpellDescription$ Exile target creature and all Auras attached to it. Note the number and kind of counters that were on that creature. When CARDNAME leaves the battlefield or becomes untapped, return that exiled card to the battlefield under its owner's control tapped with the noted number and kind of counters on it. If you do, return the other exiled cards to the battlefield under their owner's control attached to that permanent. A:AB$ Pump | Cost$ 3 T | ValidTgts$ Creature | ImprintCards$ Targeted | SubAbility$ DBRememberAura | StackDescription$ SpellDescription | SpellDescription$ Exile target creature and all Auras attached to it. Note the number and kind of counters that were on that creature. When CARDNAME leaves the battlefield or becomes untapped, return that exiled card to the battlefield under its owner's control tapped with the noted number and kind of counters on it. If you do, return the other exiled cards to the battlefield under their owner's control attached to that permanent.
SVar:RecordCounters:DB$ NoteCounters | Mode$ Store | Defined$ Imprinted | SubAbility$ DBRememberAura
SVar:DBRememberAura:DB$ PumpAll | ValidCards$ Aura.AttachedTo Creature.IsImprinted | RememberAllPumped$ True | StackDescription$ None | SubAbility$ DBEffect SVar:DBRememberAura:DB$ PumpAll | ValidCards$ Aura.AttachedTo Creature.IsImprinted | RememberAllPumped$ True | StackDescription$ None | SubAbility$ DBEffect
SVar:DBEffect:DB$ Effect | Triggers$ LeavesPlay,Untap | SVars$ RestoreCounters,TrigReturn,TrigAuraReturn,ExileSelf | References$ LeavesPlay,Untap | ImprintCards$ ParentTarget | RememberObjects$ Remembered | SubAbility$ DBExile SVar:DBEffect:DB$ Effect | Triggers$ LeavesPlay,Untap | SVars$ RestoreCounters,TrigReturn,TrigAuraReturn,ExileSelf | ImprintCards$ ParentTarget | RememberObjects$ Remembered | NoteCounterDefined$ Imprinted | SubAbility$ DBExile
SVar:DBExile:DB$ ChangeZoneAll | Origin$ Battlefield | Destination$ Exile | ChangeType$ Card.IsRemembered,Card.IsImprinted | SubAbility$ DBCleanup SVar:DBExile:DB$ ChangeZoneAll | Origin$ Battlefield | Destination$ Exile | ChangeType$ Card.IsRemembered,Card.IsImprinted | SubAbility$ DBCleanup
SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True | ClearImprinted$ True
SVar:LeavesPlay:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.EffectSource | Execute$ RestoreCounters | TriggerController$ TriggeredCardController | TriggerDescription$ When EFFECTSOURCE leaves the battlefield or becomes untapped, return that exiled card to the battlefield under its owner's control tapped with the noted number and kind of counters on it. If you do, return the other exiled cards to the battlefield under their owner's control attached to that permanent. SVar:LeavesPlay:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | ValidCard$ Card.EffectSource | Execute$ RestoreCounters | TriggerController$ TriggeredCardController | TriggerDescription$ When EFFECTSOURCE leaves the battlefield or becomes untapped, return that exiled card to the battlefield under its owner's control tapped with the noted number and kind of counters on it. If you do, return the other exiled cards to the battlefield under their owner's control attached to that permanent.
SVar:Untap:Mode$ Untaps | ValidCard$ Card.EffectSource | Execute$ RestoreCounters | TriggerController$ TriggeredCardController | Secondary$ True | TriggerDescription$ When EFFECTSOURCE leaves the battlefield or becomes untapped, return that exiled card to the battlefield under its owner's control tapped with the noted number and kind of counters on it. If you do, return the other exiled cards to the battlefield under their owner's control attached to that permanent. SVar:Untap:Mode$ Untaps | ValidCard$ Card.EffectSource | Execute$ TrigReturn | TriggerController$ TriggeredCardController | Secondary$ True | TriggerDescription$ When EFFECTSOURCE leaves the battlefield or becomes untapped, return that exiled card to the battlefield under its owner's control tapped with the noted number and kind of counters on it. If you do, return the other exiled cards to the battlefield under their owner's control attached to that permanent.
SVar:RestoreCounters:DB$ NoteCounters | Mode$ Load | Defined$ Imprinted | SubAbility$ TrigReturn SVar:TrigReturn:DB$ ChangeZone | Defined$ Imprinted | Origin$ Exile | Destination$ Battlefield | Tapped$ True | SubAbility$ RestoreCounters
SVar:TrigReturn:DB$ ChangeZone | Defined$ Imprinted | Origin$ Exile | Destination$ Battlefield | Tapped$ True | SubAbility$ TrigAuraReturn SVar:RestoreCounters:DB$ NoteCounters | Mode$ Load | Defined$ Imprinted | SubAbility$ TrigAuraReturn
SVar:TrigAuraReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Battlefield | AttachedTo$ Valid Creature.IsImprinted | SubAbility$ ExileSelf SVar:TrigAuraReturn:DB$ ChangeZone | Defined$ Remembered | Origin$ Exile | Destination$ Battlefield | AttachedTo$ Valid Creature.IsImprinted | SubAbility$ ExileSelf
SVar:ExileSelf:DB$ ChangeZone | Origin$ Command | Destination$ Exile | Defined$ Self SVar:ExileSelf:DB$ ChangeZone | Origin$ Command | Destination$ Exile | Defined$ Self
AI:RemoveDeck:All AI:RemoveDeck:All