mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 12:18:00 +00:00
Merge branch 'replacementEffectString' into 'master'
ReplacementEffect: add HostCard Name to toString for Human GUI See merge request core-developers/forge!2834
This commit is contained in:
@@ -1988,7 +1988,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
StringBuilder replacementEffects = new StringBuilder();
|
||||
for (final ReplacementEffect replacementEffect : state.getReplacementEffects()) {
|
||||
if (!replacementEffect.isSecondary()) {
|
||||
String text = replacementEffect.toString();
|
||||
String text = replacementEffect.getDescription();
|
||||
if (text.contains("enters the battlefield")) {
|
||||
sb.append(text).append("\r\n");
|
||||
} else {
|
||||
@@ -2349,7 +2349,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
// Replacement effects
|
||||
for (final ReplacementEffect replacementEffect : state.getReplacementEffects()) {
|
||||
if (!replacementEffect.isSecondary()) {
|
||||
sb.append(replacementEffect.toString()).append("\r\n");
|
||||
sb.append(replacementEffect.getDescription()).append("\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,13 +210,7 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
|
||||
this.layer = layer0;
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return a String
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
public String getDescription() {
|
||||
if (hasParam("Description") && !this.isSuppressed()) {
|
||||
String desc = AbilityUtils.applyDescriptionTextChangeEffects(getParam("Description"), this);
|
||||
if (desc.contains("CARDNAME")) {
|
||||
@@ -228,6 +222,16 @@ public abstract class ReplacementEffect extends TriggerReplacementBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @return a String
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return getHostCard().toString() + " - " + getDescription();
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public final Object clone() {
|
||||
|
||||
@@ -260,7 +260,7 @@ public class ReplacementHandler {
|
||||
chosenRE.setHasRun(false);
|
||||
hasRun.remove(chosenRE);
|
||||
chosenRE.setOtherChoices(null);
|
||||
String message = chosenRE.toString();
|
||||
String message = chosenRE.getDescription();
|
||||
if ( !StringUtils.isEmpty(message))
|
||||
if (chosenRE.getHostCard() != null) {
|
||||
message = TextUtil.fastReplace(message, "CARDNAME", chosenRE.getHostCard().getName());
|
||||
@@ -336,7 +336,7 @@ public class ReplacementHandler {
|
||||
}
|
||||
|
||||
Card cardForUi = host.getCardForUi();
|
||||
String effectDesc = TextUtil.fastReplace(replacementEffect.toString(), "CARDNAME", CardTranslation.getTranslatedName(cardForUi.getName()));
|
||||
String effectDesc = TextUtil.fastReplace(replacementEffect.getDescription(), "CARDNAME", CardTranslation.getTranslatedName(cardForUi.getName()));
|
||||
final String question = replacementEffect instanceof ReplaceDiscard
|
||||
? Localizer.getInstance().getMessage("lblApplyCardReplacementEffectToCardConfirm", CardTranslation.getTranslatedName(cardForUi.getName()), runParams.get(AbilityKey.Card).toString(), effectDesc)
|
||||
: Localizer.getInstance().getMessage("lblApplyReplacementEffectOfCardConfirm", CardTranslation.getTranslatedName(cardForUi.getName()), effectDesc);
|
||||
|
||||
Reference in New Issue
Block a user