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

@ -46,11 +46,17 @@ import mage.target.Target;
public class DamageMultiEffect extends OneShotEffect {
protected DynamicValue amount;
private String sourceName = "{source}";
public DamageMultiEffect(int amount) {
this(new StaticValue(amount));
}
public DamageMultiEffect(int amount, String whoDealDamageName) {
this(new StaticValue(amount));
this.sourceName = whoDealDamageName;
}
public DamageMultiEffect(DynamicValue amount) {
super(Outcome.Damage);
this.amount = amount;
@ -59,6 +65,7 @@ public class DamageMultiEffect extends OneShotEffect {
public DamageMultiEffect(final DamageMultiEffect effect) {
super(effect);
this.amount = effect.amount;
this.sourceName = effect.sourceName;
}
@Override
@ -90,6 +97,14 @@ public class DamageMultiEffect extends OneShotEffect {
if (staticText != null && !staticText.isEmpty()) {
return staticText;
}
return "{source} deals " + amount.toString() + " damage divided as you choose among any number of target " + mode.getTargets().get(0).getTargetName();
return this.sourceName + " deals " + amount.toString() + " damage divided as you choose among any number of target " + mode.getTargets().get(0).getTargetName();
}
public String getSourceName() {
return sourceName;
}
public void setSourceName(String sourceName) {
this.sourceName = sourceName;
}
}