Buyback as ReplacementEffect

Soulfire Grand Master as Effects without Keyword
This commit is contained in:
Hanmac
2017-10-03 11:17:07 +00:00
parent cf53d03104
commit 039dfb63ea
4 changed files with 49 additions and 16 deletions

View File

@@ -2020,11 +2020,6 @@ public class Card extends GameEntity implements Comparable<Card> {
final Cost cost = new Cost(n[2], false);
sb.append("Splice onto ").append(n[1]).append(" ").append(cost.toSimpleString());
sb.append(" (" + Keyword.getInstance(keyword).getReminderText() + ")").append("\r\n");
} else if (keyword.startsWith("Buyback")) {
final Cost cost = new Cost(keyword.substring(8), false);
sb.append("Buyback ").append(cost.toSimpleString());
sb.append(" (You may pay an additional cost as you cast CARDNAME. If you do, put CARDNAME back into your hand as it resolves.)");
sb.append("\r\n");
} else if (keyword.startsWith("Entwine")) {
final String[] n = keyword.split(":");
final Cost cost = new Cost(n[1], false);

View File

@@ -2018,6 +2018,9 @@ public class CardFactoryUtil {
else if (keyword.startsWith("Dash")) {
addSpellAbility(keyword, card, null);
}
else if (keyword.startsWith("Buyback")) {
addReplacementEffect(keyword, card, null);
}
else if (keyword.startsWith("Awaken")) {
addSpellAbility(keyword, card, null);
}
@@ -3402,6 +3405,45 @@ public class CardFactoryUtil {
if (!intrinsic) {
kws.addReplacement(re);
}
} else if (keyword.startsWith("Buyback")) {
final Cost cost = new Cost(keyword.substring(8), false);
StringBuilder sb = new StringBuilder();
sb.append("Event$ Moved | ValidCard$ Card.Self | Origin$ Stack | Destination$ Graveyard | Fizzle$ False ");
sb.append("ValidStackSa$ Spell.Buyback | Description$ Buyback");
sb.append( cost.isOnlyManaCost() ? " " : "");
sb.append(cost.toSimpleString());
if (!cost.isOnlyManaCost()) {
sb.append(".");
}
sb.append(" (");
sb.append(Keyword.getInstance(keyword).getReminderText());
sb.append(")");
String repeffstr = sb.toString();
String abReturn = "DB$ ChangeZone | Defined$ Self | Origin$ Stack | Destination$ Hand";
SpellAbility saReturn = AbilityFactory.getAbility(abReturn, card);
if (!intrinsic) {
saReturn.setIntrinsic(false);
}
ReplacementEffect re = ReplacementHandler.parseReplacement(repeffstr, card, intrinsic);
re.setLayer(ReplacementLayer.Other);
re.setOverridingAbility(saReturn);
ReplacementEffect cardre = card.addReplacementEffect(re);
if (!intrinsic) {
kws.addReplacement(cardre);
}
} else if (keyword.startsWith("Devour")) {
final String[] k = keyword.split(":");

View File

@@ -62,7 +62,6 @@ import forge.game.spellability.Spell;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.SpellAbilityStackInstance;
import forge.game.spellability.TargetChoices;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerType;
import forge.game.trigger.WrappedAbility;
import forge.util.TextUtil;
@@ -582,12 +581,6 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
if (source.isCopiedSpell() || sa.isAbility()) {
// do nothing
}
else if ((source.hasKeyword("Move CARDNAME to your hand as it resolves") || sa.isBuyBackAbility()) && !fizzle) {
// Handle cards that need to be moved differently
// TODO: replacement effects: Rebound, Buyback and Soulfire Grand Master
source.removeAllExtrinsicKeyword("Move CARDNAME to your hand as it resolves");
game.getAction().moveToHand(source, sa, Maps.newHashMap());
}
else if (sa.isFlashBackAbility()) {
game.getAction().exile(source, sa, Maps.newHashMap());
sa.setFlashBackAbility(false);
@@ -595,8 +588,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
else if (sa.isAftermath()) {
game.getAction().exile(source, sa, Maps.newHashMap());
}
else if (!source.isCopiedSpell() &&
(source.isInstant() || source.isSorcery() || fizzle) &&
else if ((source.isInstant() || source.isSorcery() || fizzle) &&
source.isInZone(ZoneType.Stack)) {
// If Spell and still on the Stack then let it goto the graveyard or replace its own movement
Map<String, Object> params = Maps.newHashMap();

View File

@@ -4,9 +4,13 @@ Types:Creature Human Monk
PT:2/2
K:Lifelink
S:Mode$ Continuous | AddKeyword$ Lifelink | Affected$ Instant.YouCtrl,Sorcery.YouCtrl | AffectedZone$ Stack | Description$ Instant and sorcery spells you control have lifelink.
A:AB$ Effect | Cost$ 2 UR UR | Name$ Soulfire Grand Master effect | Triggers$ SpellCastTrig | SVars$ Buybacked,ExileSelf | SpellDescription$ The next time you cast an instant or sorcery spell from your hand this turn, put that card into your hand instead of into your graveyard as it resolves.
A:AB$ Effect | Cost$ 2 UR UR | Name$ Soulfire Grand Master effect | Triggers$ SpellCastTrig | SVars$ Buybacked,MoveToHandReplace,ReplaceHand,ExileSelf | SpellDescription$ The next time you cast an instant or sorcery spell from your hand this turn, put that card into your hand instead of into your graveyard as it resolves.
SVar:SpellCastTrig:Mode$ SpellCast | ValidCard$ Sorcery.YouOwn+wasCastFromHand,Instant.YouOwn+wasCastFromHand | ValidActivatingPlayer$ You | Execute$ Buybacked | Static$ True | TriggerDescription$ The next time you cast an instant or sorcery spell from your hand this turn, put that card into your hand instead of into your graveyard as it resolves.
SVar:Buybacked:DB$ Pump | Defined$ TriggeredCard | PumpZone$ Stack | KW$ HIDDEN Move CARDNAME to your hand as it resolves | SubAbility$ ExileSelf
SVar:Buybacked:DB$ Effect | ReplacementEffects$ MoveToHandReplace |SVars$ MoveToHandReplace,ReplaceHand,ExileSelf | RememberObjects$ TriggeredCard | SubAbility$ ExileSelf | SpellDescription$ Put that card into your hand instead of into your graveyard as it resolves.
SVar:MoveToHandReplace:Event$ Moved | ValidCard$ Card.IsRemembered | Origin$ Stack | Destination$ Graveyard | Fizzle$ False | ReplaceWith$ ReplaceHand | Description$ Put that card into your hand instead of into your graveyard as it resolves.
SVar:ReplaceHand:DB$ ChangeZone | Defined$ Remembered | Origin$ Stack | Destination$ Hand | SubAbility$ ExileSelf
SVar:ExileSelf:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile
SVar:Picture:http://www.wizards.com/global/images/magic/general/soulfire_grand_master.jpg
Oracle:Lifelink\nInstant and sorcery spells you control have lifelink.\n{2}{U/R}{U/R}: The next time you cast an instant or sorcery spell from your hand this turn, put that card into your hand instead of into your graveyard as it resolves.