mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38: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();
|
StringBuilder replacementEffects = new StringBuilder();
|
||||||
for (final ReplacementEffect replacementEffect : state.getReplacementEffects()) {
|
for (final ReplacementEffect replacementEffect : state.getReplacementEffects()) {
|
||||||
if (!replacementEffect.isSecondary()) {
|
if (!replacementEffect.isSecondary()) {
|
||||||
String text = replacementEffect.toString();
|
String text = replacementEffect.getDescription();
|
||||||
if (text.contains("enters the battlefield")) {
|
if (text.contains("enters the battlefield")) {
|
||||||
sb.append(text).append("\r\n");
|
sb.append(text).append("\r\n");
|
||||||
} else {
|
} else {
|
||||||
@@ -2349,7 +2349,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
|||||||
// Replacement effects
|
// Replacement effects
|
||||||
for (final ReplacementEffect replacementEffect : state.getReplacementEffects()) {
|
for (final ReplacementEffect replacementEffect : state.getReplacementEffects()) {
|
||||||
if (!replacementEffect.isSecondary()) {
|
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;
|
this.layer = layer0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public String getDescription() {
|
||||||
* To string.
|
|
||||||
*
|
|
||||||
* @return a String
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
if (hasParam("Description") && !this.isSuppressed()) {
|
if (hasParam("Description") && !this.isSuppressed()) {
|
||||||
String desc = AbilityUtils.applyDescriptionTextChangeEffects(getParam("Description"), this);
|
String desc = AbilityUtils.applyDescriptionTextChangeEffects(getParam("Description"), this);
|
||||||
if (desc.contains("CARDNAME")) {
|
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} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public final Object clone() {
|
public final Object clone() {
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ public class ReplacementHandler {
|
|||||||
chosenRE.setHasRun(false);
|
chosenRE.setHasRun(false);
|
||||||
hasRun.remove(chosenRE);
|
hasRun.remove(chosenRE);
|
||||||
chosenRE.setOtherChoices(null);
|
chosenRE.setOtherChoices(null);
|
||||||
String message = chosenRE.toString();
|
String message = chosenRE.getDescription();
|
||||||
if ( !StringUtils.isEmpty(message))
|
if ( !StringUtils.isEmpty(message))
|
||||||
if (chosenRE.getHostCard() != null) {
|
if (chosenRE.getHostCard() != null) {
|
||||||
message = TextUtil.fastReplace(message, "CARDNAME", chosenRE.getHostCard().getName());
|
message = TextUtil.fastReplace(message, "CARDNAME", chosenRE.getHostCard().getName());
|
||||||
@@ -336,7 +336,7 @@ public class ReplacementHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Card cardForUi = host.getCardForUi();
|
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
|
final String question = replacementEffect instanceof ReplaceDiscard
|
||||||
? Localizer.getInstance().getMessage("lblApplyCardReplacementEffectToCardConfirm", CardTranslation.getTranslatedName(cardForUi.getName()), runParams.get(AbilityKey.Card).toString(), effectDesc)
|
? Localizer.getInstance().getMessage("lblApplyCardReplacementEffectToCardConfirm", CardTranslation.getTranslatedName(cardForUi.getName()), runParams.get(AbilityKey.Card).toString(), effectDesc)
|
||||||
: Localizer.getInstance().getMessage("lblApplyReplacementEffectOfCardConfirm", CardTranslation.getTranslatedName(cardForUi.getName()), effectDesc);
|
: Localizer.getInstance().getMessage("lblApplyReplacementEffectOfCardConfirm", CardTranslation.getTranslatedName(cardForUi.getName()), effectDesc);
|
||||||
|
|||||||
Reference in New Issue
Block a user