mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-14 17:58:01 +00:00
Embalm and Eternalize use Keyword and Refactor Copy
This commit is contained in:
@@ -72,7 +72,7 @@ public class CopyPermanentAi extends SpellAbilityAi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Embalm") || sa.hasParam("Eternalize")) {
|
if (sa.isEmbalm() || sa.isEternalize()) {
|
||||||
// E.g. Vizier of Many Faces: check to make sure it makes sense to make the token now
|
// E.g. Vizier of Many Faces: check to make sure it makes sense to make the token now
|
||||||
if (ComputerUtilCard.checkNeedsToPlayReqs(sa.getHostCard(), sa) != AiPlayDecision.WillPlay) {
|
if (ComputerUtilCard.checkNeedsToPlayReqs(sa.getHostCard(), sa) != AiPlayDecision.WillPlay) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -156,6 +156,13 @@ public abstract class CardTraitBase extends GameObject implements IHasCardView,
|
|||||||
this.keyword = kw;
|
this.keyword = kw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEmbalm() {
|
||||||
|
return isKeyword(Keyword.EMBALM);
|
||||||
|
}
|
||||||
|
public boolean isEternalize() {
|
||||||
|
return isKeyword(Keyword.ETERNALIZE);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* isSecondary.
|
* isSecondary.
|
||||||
|
|||||||
@@ -225,6 +225,10 @@ public class ForgeScript {
|
|||||||
return sa.isDash();
|
return sa.isDash();
|
||||||
} else if (property.equals("Disturb")) {
|
} else if (property.equals("Disturb")) {
|
||||||
return sa.isDisturb();
|
return sa.isDisturb();
|
||||||
|
} else if (property.equals("Embalm")) {
|
||||||
|
return sa.isEmbalm();
|
||||||
|
} else if (property.equals("Eternalize")) {
|
||||||
|
return sa.isEternalize();
|
||||||
} else if (property.equals("Flashback")) {
|
} else if (property.equals("Flashback")) {
|
||||||
return sa.isFlashback();
|
return sa.isFlashback();
|
||||||
} else if (property.equals("Jumpstart")) {
|
} else if (property.equals("Jumpstart")) {
|
||||||
|
|||||||
@@ -6303,12 +6303,12 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars {
|
|||||||
|
|
||||||
public final boolean isEmbalmed() {
|
public final boolean isEmbalmed() {
|
||||||
SpellAbility sa = getTokenSpawningAbility();
|
SpellAbility sa = getTokenSpawningAbility();
|
||||||
return sa != null && sa.hasParam("Embalm");
|
return sa != null && sa.isEmbalm();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final boolean isEternalized() {
|
public final boolean isEternalized() {
|
||||||
SpellAbility sa = getTokenSpawningAbility();
|
SpellAbility sa = getTokenSpawningAbility();
|
||||||
return sa != null && sa.hasParam("Eternalize");
|
return sa != null && sa.isEternalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final int getExertedThisTurn() {
|
public final int getExertedThisTurn() {
|
||||||
|
|||||||
@@ -571,6 +571,12 @@ public class CardFactory {
|
|||||||
for (Map.Entry<CardStateName, CardState> e : result.entrySet()) {
|
for (Map.Entry<CardStateName, CardState> e : result.entrySet()) {
|
||||||
final CardState originalState = out.getState(e.getKey());
|
final CardState originalState = out.getState(e.getKey());
|
||||||
final CardState state = e.getValue();
|
final CardState state = e.getValue();
|
||||||
|
|
||||||
|
// has Embalm Condition for extra changes of Vizier of Many Faces
|
||||||
|
if (sa.hasParam("Embalm") && !out.isEmbalmed()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// update the names for the states
|
// update the names for the states
|
||||||
if (sa.hasParam("KeepName")) {
|
if (sa.hasParam("KeepName")) {
|
||||||
state.setName(originalState.getName());
|
state.setName(originalState.getName());
|
||||||
@@ -638,7 +644,6 @@ public class CardFactory {
|
|||||||
state.setBaseLoyalty(String.valueOf(AbilityUtils.calculateAmount(host, sa.getParam("SetLoyalty"), sa)));
|
state.setBaseLoyalty(String.valueOf(AbilityUtils.calculateAmount(host, sa.getParam("SetLoyalty"), sa)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Planning a Vizier of Many Faces rework; always might come in handy
|
|
||||||
if (sa.hasParam("RemoveCost")) {
|
if (sa.hasParam("RemoveCost")) {
|
||||||
state.setManaCost(ManaCost.NO_COST);
|
state.setManaCost(ManaCost.NO_COST);
|
||||||
}
|
}
|
||||||
@@ -706,34 +711,20 @@ public class CardFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Special Rules for Embalm and Eternalize
|
// Special Rules for Embalm and Eternalize
|
||||||
if (sa.hasParam("Embalm") && out.isEmbalmed()) {
|
if (sa.isEmbalm() && sa.isIntrinsic()) {
|
||||||
state.addType("Zombie");
|
String name = TextUtil.fastReplace(
|
||||||
state.setColor(MagicColor.WHITE);
|
TextUtil.fastReplace(host.getName(), ",", ""),
|
||||||
state.setManaCost(ManaCost.NO_COST);
|
" ", "_").toLowerCase();
|
||||||
|
String set = host.getSetCode().toLowerCase();
|
||||||
if (sa.isIntrinsic()) {
|
state.setImageKey(ImageKeys.getTokenKey("embalm_" + name + "_" + set));
|
||||||
String name = TextUtil.fastReplace(
|
|
||||||
TextUtil.fastReplace(host.getName(), ",", ""),
|
|
||||||
" ", "_").toLowerCase();
|
|
||||||
String set = host.getSetCode().toLowerCase();
|
|
||||||
state.setImageKey(ImageKeys.getTokenKey("embalm_" + name + "_" + set));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("Eternalize") && out.isEternalized()) {
|
if (sa.isEternalize() && sa.isIntrinsic()) {
|
||||||
state.addType("Zombie");
|
String name = TextUtil.fastReplace(
|
||||||
state.setColor(MagicColor.BLACK);
|
TextUtil.fastReplace(host.getName(), ",", ""),
|
||||||
state.setManaCost(ManaCost.NO_COST);
|
" ", "_").toLowerCase();
|
||||||
state.setBasePower(4);
|
String set = host.getSetCode().toLowerCase();
|
||||||
state.setBaseToughness(4);
|
state.setImageKey(ImageKeys.getTokenKey("eternalize_" + name + "_" + set));
|
||||||
|
|
||||||
if (sa.isIntrinsic()) {
|
|
||||||
String name = TextUtil.fastReplace(
|
|
||||||
TextUtil.fastReplace(host.getName(), ",", ""),
|
|
||||||
" ", "_").toLowerCase();
|
|
||||||
String set = host.getSetCode().toLowerCase();
|
|
||||||
state.setImageKey(ImageKeys.getTokenKey("eternalize_" + name + "_" + set));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("GainTextOf") && originalState != null) {
|
if (sa.hasParam("GainTextOf") && originalState != null) {
|
||||||
@@ -748,35 +739,28 @@ public class CardFactory {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sa.hasParam("SetPower") || sa.hasParam("Eternalize")) {
|
if (sa.hasParam("SetPower") && sta.hasParam("SetPower"))
|
||||||
if (sta.hasParam("SetPower"))
|
state.removeStaticAbility(sta);
|
||||||
state.removeStaticAbility(sta);
|
|
||||||
|
if (sa.hasParam("SetToughness") && sta.hasParam("SetToughness"))
|
||||||
|
state.removeStaticAbility(sta);
|
||||||
|
|
||||||
|
// currently only Changeling and similar should be affected by that
|
||||||
|
// other cards using AddType$ ChosenType should not
|
||||||
|
if (sa.hasParam("SetCreatureTypes") && sta.hasParam("AddAllCreatureTypes")) {
|
||||||
|
state.removeStaticAbility(sta);
|
||||||
}
|
}
|
||||||
if (sa.hasParam("SetToughness") || sa.hasParam("Eternalize")) {
|
if ((sa.hasParam("SetColor") || sa.hasParam("SetColorByManaCost")) && sta.hasParam("SetColor")) {
|
||||||
if (sta.hasParam("SetToughness"))
|
state.removeStaticAbility(sta);
|
||||||
state.removeStaticAbility(sta);
|
|
||||||
}
|
|
||||||
if (sa.hasParam("SetCreatureTypes")) {
|
|
||||||
// currently only Changeling and similar should be affected by that
|
|
||||||
// other cards using AddType$ ChosenType should not
|
|
||||||
if (sta.hasParam("AddAllCreatureTypes")) {
|
|
||||||
state.removeStaticAbility(sta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (sa.hasParam("SetColor") || sa.hasParam("Embalm") || sa.hasParam("Eternalize")) {
|
|
||||||
if (sta.hasParam("SetColor")) {
|
|
||||||
state.removeStaticAbility(sta);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove some keywords
|
// remove some keywords
|
||||||
if (sa.hasParam("SetCreatureTypes")) {
|
if (sa.hasParam("SetCreatureTypes")) {
|
||||||
state.removeIntrinsicKeyword("Changeling");
|
state.removeIntrinsicKeyword(Keyword.CHANGELING);
|
||||||
}
|
}
|
||||||
if (sa.hasParam("SetColor") || sa.hasParam("Embalm") || sa.hasParam("Eternalize")
|
if (sa.hasParam("SetColor") || sa.hasParam("SetColorByManaCost")) {
|
||||||
|| sa.hasParam("SetColorByManaCost")) {
|
state.removeIntrinsicKeyword(Keyword.DEVOID);
|
||||||
state.removeIntrinsicKeyword("Devoid");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@@ -2832,7 +2832,8 @@ public class CardFactoryUtil {
|
|||||||
String costStr = kw[1];
|
String costStr = kw[1];
|
||||||
|
|
||||||
String effect = "AB$ CopyPermanent | Cost$ " + costStr + " ExileFromGrave<1/CARDNAME> " +
|
String effect = "AB$ CopyPermanent | Cost$ " + costStr + " ExileFromGrave<1/CARDNAME> " +
|
||||||
"| ActivationZone$ Graveyard | SorcerySpeed$ True | Embalm$ True " +
|
"| ActivationZone$ Graveyard | SorcerySpeed$ True " +
|
||||||
|
"| RemoveCost$ True | SetColor$ White | AddTypes$ Zombie" +
|
||||||
"| PrecostDesc$ Embalm | CostDesc$ " + ManaCostParser.parse(costStr) + " | Defined$ Self " +
|
"| PrecostDesc$ Embalm | CostDesc$ " + ManaCostParser.parse(costStr) + " | Defined$ Self " +
|
||||||
"| StackDescription$ Embalm - CARDNAME "+
|
"| StackDescription$ Embalm - CARDNAME "+
|
||||||
"| SpellDescription$ (" + inst.getReminderText() + ")" ;
|
"| SpellDescription$ (" + inst.getReminderText() + ")" ;
|
||||||
@@ -2968,7 +2969,8 @@ public class CardFactoryUtil {
|
|||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
sb.append("AB$ CopyPermanent | Cost$ ").append(costStr).append(" ExileFromGrave<1/CARDNAME>")
|
sb.append("AB$ CopyPermanent | Cost$ ").append(costStr).append(" ExileFromGrave<1/CARDNAME>")
|
||||||
.append(" | Defined$ Self | ActivationZone$ Graveyard | SorcerySpeed$ True | Eternalize$ True");
|
.append(" | Defined$ Self | ActivationZone$ Graveyard | SorcerySpeed$ True")
|
||||||
|
.append(" | RemoveCost$ True | SetColor$ Black | AddTypes$ Zombie | SetPower$ 4 | SetToughness$ 4");
|
||||||
|
|
||||||
sb.append(" | PrecostDesc$ Eternalize");
|
sb.append(" | PrecostDesc$ Eternalize");
|
||||||
if (!cost.isOnlyManaCost()) { //Something other than a mana cost
|
if (!cost.isOnlyManaCost()) { //Something other than a mana cost
|
||||||
@@ -2976,7 +2978,7 @@ public class CardFactoryUtil {
|
|||||||
} else {
|
} else {
|
||||||
sb.append(" ");
|
sb.append(" ");
|
||||||
}
|
}
|
||||||
// don't use SimpleString there because it does has "and" between cost i dont want that
|
// don't use SimpleString there because it does has "and" between cost i don't want that
|
||||||
costStr = cost.toString();
|
costStr = cost.toString();
|
||||||
// but now it has ": " at the end i want to remove
|
// but now it has ": " at the end i want to remove
|
||||||
sb.append("| CostDesc$ ").append(costStr, 0, costStr.length() - 2);
|
sb.append("| CostDesc$ ").append(costStr, 0, costStr.length() - 2);
|
||||||
|
|||||||
@@ -312,6 +312,9 @@ public class CardState extends GameObject implements IHasSVars {
|
|||||||
public final boolean removeIntrinsicKeyword(final KeywordInterface s) {
|
public final boolean removeIntrinsicKeyword(final KeywordInterface s) {
|
||||||
return intrinsicKeywords.remove(s);
|
return intrinsicKeywords.remove(s);
|
||||||
}
|
}
|
||||||
|
public final boolean removeIntrinsicKeyword(final Keyword k) {
|
||||||
|
return intrinsicKeywords.removeAll(k);
|
||||||
|
}
|
||||||
|
|
||||||
public final FCollectionView<SpellAbility> getSpellAbilities() {
|
public final FCollectionView<SpellAbility> getSpellAbilities() {
|
||||||
FCollection<SpellAbility> newCol = new FCollection<>(manaAbilities);
|
FCollection<SpellAbility> newCol = new FCollection<>(manaAbilities);
|
||||||
|
|||||||
@@ -190,12 +190,6 @@ public class TriggerSpellAbilityCastOrCopy extends Trigger {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasParam("EternalizeOrEmbalm")) {
|
|
||||||
if (!spellAbility.hasParam("Eternalize") && !spellAbility.hasParam("Embalm")) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// use numTargets instead?
|
// use numTargets instead?
|
||||||
if (hasParam("IsSingleTarget")) {
|
if (hasParam("IsSingleTarget")) {
|
||||||
Set<GameObject> targets = Sets.newHashSet();
|
Set<GameObject> targets = Sets.newHashSet();
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ ManaCost:2 U U
|
|||||||
Types:Creature Shapeshifter Cleric
|
Types:Creature Shapeshifter Cleric
|
||||||
PT:0/0
|
PT:0/0
|
||||||
K:ETBReplacement:Copy:DBCopy:Optional
|
K:ETBReplacement:Copy:DBCopy:Optional
|
||||||
SVar:DBCopy:DB$ Clone | Choices$ Creature.Other | Embalm$ True | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except if CARDNAME was embalmed, the token has no mana cost, it's white, and it's a Zombie in addition to its other types.
|
SVar:DBCopy:DB$ Clone | Choices$ Creature.Other | Embalm$ True | RemoveCost$ True | SetColor$ White | AddTypes$ Zombie | SpellDescription$ You may have CARDNAME enter the battlefield as a copy of any creature on the battlefield, except if CARDNAME was embalmed, the token has no mana cost, it's white, and it's a Zombie in addition to its other types.
|
||||||
K:Embalm:3 U U
|
K:Embalm:3 U U
|
||||||
SVar:NeedsToPlay:Creature
|
SVar:NeedsToPlay:Creature
|
||||||
DeckHas:Ability$Token
|
DeckHas:Ability$Token
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Types:Creature Human Cleric
|
|||||||
PT:2/4
|
PT:2/4
|
||||||
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ VizierSearch | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a creature card with eternalize or embalm, put that card into your graveyard, then shuffle.
|
T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ VizierSearch | TriggerDescription$ When CARDNAME enters the battlefield, you may search your library for a creature card with eternalize or embalm, put that card into your graveyard, then shuffle.
|
||||||
SVar:VizierSearch:DB$ ChangeZone | Origin$ Library | Destination$ Graveyard | ChangeNum$ 1 | ChangeType$ Creature.withEmbalm+YouCtrl,Creature.withEternalize+YouCtrl
|
SVar:VizierSearch:DB$ ChangeZone | Origin$ Library | Destination$ Graveyard | ChangeNum$ 1 | ChangeType$ Creature.withEmbalm+YouCtrl,Creature.withEternalize+YouCtrl
|
||||||
T:Mode$ AbilityCast | ValidCard$ Creature.YouOwn | ValidActivatingPlayer$ You | EternalizeOrEmbalm$ True | TriggerZones$ Battlefield | Execute$ TrigDraw | TriggerDescription$ Whenever you activate an eternalize or embalm ability, draw a card.
|
T:Mode$ AbilityCast | ValidCard$ Creature.YouOwn | ValidActivatingPlayer$ You | ValidSA$ Activated.Eternalize,Activated.Embalm | TriggerZones$ Battlefield | Execute$ TrigDraw | TriggerDescription$ Whenever you activate an eternalize or embalm ability, draw a card.
|
||||||
SVar:TrigDraw:DB$ Draw | NumCards$ 1
|
SVar:TrigDraw:DB$ Draw | NumCards$ 1
|
||||||
AI:RemoveDeck:Random
|
AI:RemoveDeck:Random
|
||||||
DeckNeeds:Keyword$Eternalize|Embalm
|
DeckNeeds:Keyword$Eternalize|Embalm
|
||||||
|
|||||||
Reference in New Issue
Block a user