CopyPermanentEffect: add Embalm

This commit is contained in:
Hanmac
2017-04-08 11:05:14 +00:00
parent c2bc999c56
commit 5592139454
4 changed files with 35 additions and 4 deletions

View File

@@ -6,8 +6,11 @@ import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import forge.ImageKeys;
import forge.StaticData;
import forge.card.CardRulesPredicates;
import forge.card.MagicColor;
import forge.card.mana.ManaCost;
import forge.game.Game;
import forge.game.GameEntity;
import forge.game.ability.AbilityUtils;
@@ -21,7 +24,6 @@ import forge.game.combat.Combat;
import forge.game.event.GameEventCombatChanged;
import forge.game.player.Player;
import forge.game.spellability.SpellAbility;
import forge.game.spellability.TargetRestrictions;
import forge.game.staticability.StaticAbility;
import forge.game.trigger.Trigger;
import forge.game.trigger.TriggerHandler;
@@ -102,7 +104,6 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
}
List<Card> tgtCards = getTargetCards(sa);
final TargetRestrictions tgt = sa.getTargetRestrictions();
if (sa.hasParam("ValidSupportedCopy")) {
List<PaperCard> cards = Lists.newArrayList(StaticData.instance().getCommonCards().getUniqueCards());
@@ -154,7 +155,7 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
hostCard.clearClones();
for (final Card c : tgtCards) {
if ((tgt == null) || c.canBeTargetedBy(sa)) {
if (!sa.usesTargeting() || c.canBeTargetedBy(sa)) {
int multiplier = numCopies;
@@ -243,6 +244,14 @@ public class CopyPermanentEffect extends SpellAbilityEffect {
addSelfTrigger(sa, sa.getParam("AtEOTTrig"), copy);
}
if (sa.hasParam("Embalm")) {
copy.addType("Zombie");
copy.setColor(MagicColor.WHITE);
copy.setManaCost(ManaCost.NO_COST);
String name = copy.getName().replace(",", "").replace(" ", "_").toLowerCase();
copy.setImageKey(ImageKeys.getTokenKey("embalm_" + name));
}
copy.updateStateForView();
// Temporarily register triggers of an object created with CopyPermanent

View File

@@ -1500,7 +1500,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|| keyword.startsWith("Unearth") || keyword.startsWith("Scavenge") || keyword.startsWith("Ninjutsu")
|| keyword.startsWith("Evoke") || keyword.startsWith("Bestow") || keyword.startsWith("Dash")
|| keyword.startsWith("Surge") || keyword.startsWith("Transmute") || keyword.startsWith("Suspend")
|| keyword.equals("Undaunted") || keyword.startsWith("Monstrosity")
|| keyword.equals("Undaunted") || keyword.startsWith("Monstrosity") || keyword.startsWith("Embalm")
|| keyword.startsWith("Cycling") || keyword.startsWith("TypeCycling")) {
// keyword parsing takes care of adding a proper description
} else if (keyword.startsWith("CantBeBlockedBy")) {

View File

@@ -2225,6 +2225,9 @@ public class CardFactoryUtil {
else if (keyword.startsWith("Emerge")) {
addSpellAbility(keyword, card, null);
}
else if (keyword.startsWith("Embalm")) {
addSpellAbility(keyword, card, null);
}
else if (keyword.startsWith("Entwine")) {
addSpellAbility(keyword, card, null);
}
@@ -3612,6 +3615,24 @@ public class CardFactoryUtil {
kws.addSpellAbility(newSA);
}
card.addSpellAbility(newSA);
} else if (keyword.startsWith("Embalm")) {
final String[] kw = keyword.split(":");
String costStr = kw[1];
String effect = "AB$ CopyPermanent | Cost$ " + costStr + " ExileFromGrave<1/CARDNAME> " +
"| ActivationZone$ Graveyard | SorcerySpeed$ True | Embalm$ True " +
"| PrecostDesc$ Embalm | CostDesc$ " + ManaCostParser.parse(costStr) + " | Defined$ Self " +
"| StackDescription$ Embalm - CARDNAME "+
"| SpellDescription$ (" + Keyword.getInstance(keyword).getReminderText() + ")" ;
final SpellAbility sa = AbilityFactory.getAbility(effect, card);
sa.setIntrinsic(intrinsic);
if (!intrinsic) {
sa.setTemporary(true);
//sa.setOriginalHost(hostCard);
kws.addSpellAbility(sa);
}
card.addSpellAbility(sa);
} else if (keyword.startsWith("Entwine")) {
final String[] kw = keyword.split(":");
String costStr = kw[1];

View File

@@ -39,6 +39,7 @@ public enum Keyword {
DOUBLE_STRIKE(SimpleKeyword.class, true, "This creature deals both first-strike and regular combat damage."),
DREDGE(KeywordWithAmount.class, true, "If you would draw a card, you may instead put %d cards from the top of your library into your graveyard and return this card from your graveyard to your hand."),
ECHO(KeywordWithCost.class, false, "At the beginning of your upkeep, if this permanent came under your control since the beginning of your last upkeep, sacrifice it unless you pay %s."),
EMBALM(KeywordWithCost.class, false, "Create a token that's a copy of it, except it's a white Zombie in addition to is other types with no mana cost. Embalm only as a sorcery."),
EMERGE(KeywordWithCost.class, true, "You may cast this spell by sacrificing a creature and paying the emerge cost reduced by that creature's converted mana cost."),
ENCHANT(KeywordWithType.class, false, "Target a %s as you play this. This card enters the battlefield attached to that %s."),
ENTWINE(KeywordWithCost.class, true, "You may choose all modes of this spell instead of just one. If you do, you pay an additional %s."),