Fixed wrong ability texts with duplicated card name (see #4335)

This commit is contained in:
Oleg Agafonov 2018-01-04 20:48:41 +04:00
parent 3d53d28f5e
commit 56949414d1
5 changed files with 95 additions and 6 deletions

View file

@ -51,11 +51,17 @@ public class DamageTargetEffect extends OneShotEffect {
protected boolean preventable;
protected String targetDescription;
protected boolean useOnlyTargetPointer;
protected String sourceName = "{source}";
public DamageTargetEffect(int amount) {
this(new StaticValue(amount), true);
}
public DamageTargetEffect(int amount, String whoDealDamageName) {
this(new StaticValue(amount), true);
this.sourceName = whoDealDamageName;
}
public DamageTargetEffect(int amount, boolean preventable) {
this(new StaticValue(amount), preventable);
}
@ -64,10 +70,20 @@ public class DamageTargetEffect extends OneShotEffect {
this(new StaticValue(amount), preventable, targetDescription);
}
public DamageTargetEffect(int amount, boolean preventable, String targetDescription, String whoDealDamageName) {
this(new StaticValue(amount), preventable, targetDescription);
this.sourceName = whoDealDamageName;
}
public DamageTargetEffect(DynamicValue amount) {
this(amount, true);
}
public DamageTargetEffect(DynamicValue amount, String whoDealDamageName) {
this(amount, true);
this.sourceName = whoDealDamageName;
}
public DamageTargetEffect(DynamicValue amount, boolean preventable) {
this(amount, preventable, "");
}
@ -102,6 +118,15 @@ public class DamageTargetEffect extends OneShotEffect {
this.preventable = effect.preventable;
this.targetDescription = effect.targetDescription;
this.useOnlyTargetPointer = effect.useOnlyTargetPointer;
this.sourceName = effect.sourceName;
}
public String getSourceName() {
return sourceName;
}
public void setSourceName(String sourceName) {
this.sourceName = sourceName;
}
@Override
@ -149,7 +174,7 @@ public class DamageTargetEffect extends OneShotEffect {
}
StringBuilder sb = new StringBuilder();
String message = amount.getMessage();
sb.append("{source} deals ");
sb.append(this.sourceName).append(" deals ");
if (message.isEmpty() || !message.equals("1")) {
sb.append(amount);
}