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

This commit is contained in:
Oleg Agafonov 2018-01-05 02:21:16 +04:00
parent adae3e22bc
commit bc75f82524
27 changed files with 53 additions and 29 deletions

View file

@ -44,6 +44,7 @@ import mage.players.Player;
public class DamagePlayersEffect extends OneShotEffect {
private DynamicValue amount;
private TargetController controller;
private String sourceName = "{source}";
public DamagePlayersEffect(int amount) {
this(Outcome.Damage, new StaticValue(amount));
@ -53,6 +54,13 @@ public class DamagePlayersEffect extends OneShotEffect {
this(Outcome.Damage, new StaticValue(amount), controller);
}
public DamagePlayersEffect(int amount, TargetController controller, String whoDealDamageName) {
this(Outcome.Damage, new StaticValue(amount), controller);
this.sourceName = whoDealDamageName;
setText(); // TODO: replace to @Override public String getText()
}
public DamagePlayersEffect(Outcome outcome, DynamicValue amount) {
this(outcome, amount, TargetController.ANY);
}
@ -69,6 +77,7 @@ public class DamagePlayersEffect extends OneShotEffect {
super(effect);
this.amount = effect.amount;
this.controller = effect.controller;
this.sourceName = effect.sourceName;
}
@Override
@ -103,7 +112,7 @@ public class DamagePlayersEffect extends OneShotEffect {
private void setText()
{
StringBuilder sb = new StringBuilder("{source} deals ").append(amount.toString());
StringBuilder sb = new StringBuilder().append(this.sourceName).append(" deals ").append(amount.toString());
switch (controller) {
case ANY:
sb.append(" damage to each player");