mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
CardFactoryUtil: moved Amplify to ReplacementEffect
This commit is contained in:
@@ -1472,15 +1472,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
final String[] upkeepCostParams = keyword.split(":");
|
||||
sbLong.append(upkeepCostParams.length > 2 ? "- " + upkeepCostParams[2] : ManaCostParser.parse(upkeepCostParams[1]));
|
||||
sbLong.append("\r\n");
|
||||
} else if (keyword.startsWith("Amplify")) {
|
||||
sbLong.append("Amplify ");
|
||||
final String[] ampParams = keyword.split(":");
|
||||
final String magnitude = ampParams[1];
|
||||
sbLong.append(magnitude);
|
||||
sbLong.append(" (As this creature enters the battlefield, put a +1/+1 counter on it for each ");
|
||||
sbLong.append(TextUtil.fastReplace(ampParams[2], ",", " and/or ")).append(" card you reveal in your hand.)");
|
||||
sbLong.append("\r\n");
|
||||
} else if (keyword.startsWith("Alternative Cost")) {
|
||||
} else if (keyword.startsWith("Alternative Cost")) {
|
||||
sbLong.append("Has alternative cost.");
|
||||
} else if (keyword.startsWith("AlternateAdditionalCost")) {
|
||||
final String costString1 = keyword.split(":")[1];
|
||||
@@ -1569,12 +1561,13 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
sbLong.append(keyword);
|
||||
sbLong.append(" (" + Keyword.getInstance("Offering:"+ offeringType).getReminderText() + ")");
|
||||
} else if (keyword.startsWith("Equip") || keyword.startsWith("Fortify") || keyword.startsWith("Outlast")
|
||||
|| keyword.startsWith("Unearth") || keyword.startsWith("Scavenge") || keyword.startsWith("Ninjutsu")
|
||||
|| keyword.startsWith("Unearth") || keyword.startsWith("Scavenge")
|
||||
|| 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.startsWith("Embalm")
|
||||
|| keyword.startsWith("Level up") || keyword.equals("Prowess") || keyword.startsWith("Eternalize")
|
||||
|| keyword.startsWith("Reinforce") || keyword.startsWith("Champion")
|
||||
|| keyword.startsWith("Amplify") || keyword.startsWith("Ninjutsu")
|
||||
|| keyword.startsWith("Cycling") || keyword.startsWith("TypeCycling")) {
|
||||
// keyword parsing takes care of adding a proper description
|
||||
} else if (keyword.startsWith("CantBeBlockedBy")) {
|
||||
|
||||
@@ -2201,40 +2201,7 @@ public class CardFactoryUtil {
|
||||
addTriggerAbility(keyword, card, null);
|
||||
}
|
||||
else if (keyword.startsWith("Amplify")) {
|
||||
// find position of Amplify keyword
|
||||
final int ampPos = card.getKeywordPosition("Amplify");
|
||||
final String[] ampString = card.getKeywords().get(ampPos).split(":");
|
||||
final String amplifyMagnitude = ampString[1];
|
||||
final String suffix = !amplifyMagnitude.equals("1") ? "s" : "";
|
||||
final String ampTypes = ampString[2];
|
||||
String[] refinedTypes = ampTypes.split(",");
|
||||
final StringBuilder types = new StringBuilder();
|
||||
for (int i = 0; i < refinedTypes.length; i++) {
|
||||
types.append("Card.").append(refinedTypes[i]).append("+YouCtrl");
|
||||
if (i + 1 != refinedTypes.length) {
|
||||
types.append(",");
|
||||
}
|
||||
}
|
||||
// Setup ETB replacement effects
|
||||
final String actualRep = "Event$ Moved | Destination$ Battlefield | ValidCard$ Card.Self |"
|
||||
+ " ReplaceWith$ AmplifyReveal | Secondary$ True | Description$ As this creature "
|
||||
+ "enters the battlefield, put " + amplifyMagnitude + " +1/+1 counter" + suffix
|
||||
+ " on it for each " + TextUtil.fastReplace(ampTypes, ",", " and/or ")
|
||||
+ " card you reveal in your hand.)";
|
||||
final String abString = "DB$ Reveal | AnyNumber$ True | RevealValid$ "
|
||||
+ types.toString() + " | RememberRevealed$ True | SubAbility$ Amplify";
|
||||
final String dbString = "DB$ PutCounter | Defined$ ReplacedCard | CounterType$ P1P1 | "
|
||||
+ "CounterNum$ AmpMagnitude | References$ Revealed,AmpMagnitude | SubAbility$"
|
||||
+ " AmplifyMoveToPlay | ETB$ True";
|
||||
final String moveToPlay = "DB$ ChangeZone | Origin$ All | Destination$ Battlefield | "
|
||||
+ "Defined$ ReplacedCard | Hidden$ True | SubAbility$ DBCleanup";
|
||||
card.addReplacementEffect(ReplacementHandler.parseReplacement(actualRep, card, true));
|
||||
card.setSVar("AmplifyReveal", abString);
|
||||
card.setSVar("AmplifyMoveToPlay", moveToPlay);
|
||||
card.setSVar("Amplify", dbString);
|
||||
card.setSVar("DBCleanup", "DB$ Cleanup | ClearRemembered$ True");
|
||||
card.setSVar("AmpMagnitude", "SVar$Revealed/Times." + amplifyMagnitude);
|
||||
card.setSVar("Revealed", "Remembered$Amount");
|
||||
addReplacementEffect(keyword, card, null);
|
||||
}
|
||||
else if (keyword.startsWith("Equip")) {
|
||||
addSpellAbility(keyword, card, null);
|
||||
@@ -3364,6 +3331,59 @@ public class CardFactoryUtil {
|
||||
if (!intrinsic) {
|
||||
kws.addReplacement(re);
|
||||
}
|
||||
} else if (keyword.startsWith("Amplify")) {
|
||||
final String[] ampString = keyword.split(":");
|
||||
final String amplifyMagnitude = ampString[1];
|
||||
final String ampTypes = ampString[2];
|
||||
String[] refinedTypes = ampTypes.split(",");
|
||||
final StringBuilder types = new StringBuilder();
|
||||
for (int i = 0; i < refinedTypes.length; i++) {
|
||||
types.append("Card.").append(refinedTypes[i]).append("+YouCtrl");
|
||||
if (i + 1 != refinedTypes.length) {
|
||||
types.append(",");
|
||||
}
|
||||
}
|
||||
|
||||
// Setup ETB replacement effects
|
||||
final String actualRep = "Event$ Moved | Destination$ Battlefield | ValidCard$ Card.Self |"
|
||||
+ " | Description$ Amplify " + amplifyMagnitude + " ("
|
||||
+ Keyword.getInstance(keyword).getReminderText() + ")";
|
||||
|
||||
final String abString = "DB$ Reveal | AnyNumber$ True | RevealValid$ "
|
||||
+ types.toString() + " | RememberRevealed$ True";
|
||||
|
||||
SpellAbility saReveal = AbilityFactory.getAbility(abString, card);
|
||||
|
||||
final String dbString = "DB$ PutCounter | Defined$ ReplacedCard | CounterType$ P1P1 | "
|
||||
+ "CounterNum$ AmpMagnitude | ETB$ True";
|
||||
|
||||
AbilitySub saPut = (AbilitySub) AbilityFactory.getAbility(dbString, card);
|
||||
|
||||
saPut.setSVar("AmpMagnitude", "SVar$Revealed/Times." + amplifyMagnitude);
|
||||
saPut.setSVar("Revealed", "Remembered$Amount");
|
||||
|
||||
String dbClean = "DB$ Cleanup | ClearRemembered$ True";
|
||||
AbilitySub saCleanup = (AbilitySub) AbilityFactory.getAbility(dbClean, card);
|
||||
|
||||
saPut.setSubAbility(saCleanup);
|
||||
setupETBReplacementAbility(saCleanup);
|
||||
|
||||
saReveal.setSubAbility(saPut);
|
||||
|
||||
if (!intrinsic) {
|
||||
saReveal.setIntrinsic(false);
|
||||
}
|
||||
|
||||
ReplacementEffect re = ReplacementHandler.parseReplacement(actualRep, card, intrinsic);
|
||||
|
||||
re.setLayer(ReplacementLayer.Other);
|
||||
|
||||
re.setOverridingAbility(saReveal);
|
||||
ReplacementEffect cardre = card.addReplacementEffect(re);
|
||||
|
||||
if (!intrinsic) {
|
||||
kws.addReplacement(cardre);
|
||||
}
|
||||
} else if (keyword.startsWith("Bloodthirst")) {
|
||||
final String numCounters = keyword.split(":")[1];
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public enum Keyword {
|
||||
AFFINITY(KeywordWithType.class, false, "This spell costs you {1} less to cast for each %s you control."),
|
||||
AFFLICT(KeywordWithAmount.class, false, "Whenever this creature becomes blocked, defending player loses %d life."),
|
||||
AFTERMATH(SimpleKeyword.class, false, "Cast this spell only from your graveyard. Then exile it."),
|
||||
AMPLIFY(KeywordWithAmountAndType.class, false, "As this creature enters the battlefield, put %d +1/+1 counter on it for each %s card you reveal in your hand."),
|
||||
AMPLIFY(KeywordWithAmountAndType.class, false, "As this creature enters the battlefield, put {%d:+1/+1 counter} on it for each %s card you reveal in your hand."),
|
||||
ANNIHILATOR(KeywordWithAmount.class, false, "Whenever this creature attacks, defending player sacrifices {%d:permanent}."),
|
||||
AURA_SWAP(KeywordWithCost.class, false, "%s: You may exchange this Aura with an Aura card in your hand."),
|
||||
AWAKEN(KeywordWithCostAndAmount.class, true, "If you cast this spell for %s, also put {%d:+1/+1 counter} on target land you control and it becomes a 0/0 Elemental creature with haste. It's still a land."),
|
||||
|
||||
Reference in New Issue
Block a user