Cleanup: replace custom code with common classes, text fixes to abilities (#10304)

* Use common FirstCombatPhaseCondition on Raiyuu, Storm's Edge

* Use common ReturnFromExileForSourceEffect on Parallax Wave

* Use common exile effects on Prowling Geistcatcher (attempt to fix #9981)

* Fix text: Fading ability

* Fix text: Endangered Armodon

* Fix text: Nemata, Primeval Warden

* Fix text: Capitalization on alternative/additional costs other than mana
This commit is contained in:
xenohedron 2023-05-09 10:01:48 -04:00 committed by GitHub
parent 550d719498
commit 4c13b42dee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 41 additions and 111 deletions

View file

@ -2,6 +2,7 @@ package mage.abilities.costs;
import mage.abilities.costs.mana.ManaCost;
import mage.game.Game;
import mage.util.CardUtil;
/**
* Alternative costs
@ -62,7 +63,7 @@ public class AlternativeCostImpl<T extends AlternativeCostImpl<T>> extends Costs
@Override
public String getReminderText() {
if (reminderText != null && !reminderText.isEmpty()) {
return "<i>(" + reminderText.replace("{cost}", this.getText(true)) + ")</i>";
return "<i>(" + reminderText.replace("{cost}", CardUtil.getTextWithFirstCharLowerCase(this.getText(true))) + ")</i>";
}
return "";
}

View file

@ -1,6 +1,7 @@
package mage.abilities.costs;
import mage.abilities.costs.mana.VariableManaCost;
import mage.util.CardUtil;
/**
* @author LevelX2
@ -44,8 +45,8 @@ public class OptionalAdditionalCostImpl extends CostsImpl<Cost> implements Optio
}
/**
* Returns the complete text for the addional cost or if onlyCost is true
* only the pure text fore the included native cost
* Returns the complete text for the additional cost or if onlyCost is true
* only the pure text for the included native cost
*
* @param onlyCost
* @return
@ -55,7 +56,7 @@ public class OptionalAdditionalCostImpl extends CostsImpl<Cost> implements Optio
if (onlyCost) {
return getText();
} else {
return name + delimiter + getText();
return name + delimiter + getText() + (delimiter.equals("&mdash;") ? "." : "");
}
}
@ -68,7 +69,7 @@ public class OptionalAdditionalCostImpl extends CostsImpl<Cost> implements Optio
public String getReminderText() {
String replace = "";
if (reminderText != null && !reminderText.isEmpty()) {
replace = reminderText.replace("{cost}", this.getText(true));
replace = reminderText.replace("{cost}", CardUtil.getTextWithFirstCharLowerCase(this.getText(true)));
}
return replace;
}

View file

@ -6,11 +6,13 @@ import mage.abilities.common.EntersBattlefieldAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.Card;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.util.CardUtil;
/*
* 702.31. Fading
@ -31,10 +33,20 @@ public class FadingAbility extends EntersBattlefieldAbility {
Ability ability = new BeginningOfUpkeepTriggeredAbility(new FadingEffect(), TargetController.YOU, false);
ability.setRuleVisible(false);
addSubAbility(ability);
String cardTypeName;
if (card.getCardType().contains(CardType.CREATURE)) {
cardTypeName = "creature";
} else if (card.getCardType().contains(CardType.ARTIFACT)) {
cardTypeName = "artifact";
} else if (card.getCardType().contains(CardType.ENCHANTMENT)) {
cardTypeName = "enchantment";
} else {
cardTypeName = "permanent";
}
ruleText = "Fading " + fadeCounter
+ (shortRuleText ? ""
: " <i>(This permanent enters the battlefield with " + fadeCounter + " fade counters on it."
+ " At the beginning of your upkeep, remove a fade counter from this permanent. If you can't, sacrifice the permanent.)</i>");
: " <i>(This " + cardTypeName + " enters the battlefield with " + CardUtil.numberToText(fadeCounter) + " fade counters on it."
+ " At the beginning of your upkeep, remove a fade counter from it. If you can't, sacrifice it.)</i>");
}
public FadingAbility(final FadingAbility ability) {
@ -57,7 +69,7 @@ class FadingEffect extends OneShotEffect {
FadingEffect() {
super(Outcome.Sacrifice);
staticText = "remove a fade counter from this permanent. If you can't, sacrifice the permanent";
staticText = "remove a fade counter from {this}. If you can't, sacrifice it";
}
FadingEffect(final FadingEffect effect) {

View file

@ -103,7 +103,7 @@ public class KickerAbility extends StaticAbility implements OptionalAdditionalSo
public final OptionalAdditionalCost addKickerCost(Cost cost) {
OptionalAdditionalCost newCost = new OptionalAdditionalCostImpl(
keywordText, "-", reminderText, cost);
keywordText, "&mdash;", reminderText, cost);
addKickerCostAndSetup(newCost);
return newCost;
}