Handle the text of GainAbilityAllEffect in the standard way

This commit is contained in:
LoneFox 2016-01-01 12:10:00 +02:00
parent b9a77520eb
commit a58a2a3215

View file

@ -33,6 +33,7 @@ import java.util.UUID;
import mage.MageObject; import mage.MageObject;
import mage.MageObjectReference; import mage.MageObjectReference;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.TriggeredAbility; import mage.abilities.TriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.effects.ContinuousEffectImpl; import mage.abilities.effects.ContinuousEffectImpl;
@ -77,7 +78,6 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
this.ability = ability; this.ability = ability;
this.filter = filter; this.filter = filter;
this.excludeSource = excludeSource; this.excludeSource = excludeSource;
setText();
} }
public GainAbilityAllEffect(final GainAbilityAllEffect effect) { public GainAbilityAllEffect(final GainAbilityAllEffect effect) {
@ -141,8 +141,13 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
return true; return true;
} }
private void setText() { public String getText(Mode mode) {
if(staticText != null && !staticText.isEmpty()) {
return staticText;
}
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
boolean quotes = (ability instanceof SimpleActivatedAbility) || (ability instanceof TriggeredAbility); boolean quotes = (ability instanceof SimpleActivatedAbility) || (ability instanceof TriggeredAbility);
if (excludeSource) { if (excludeSource) {
sb.append("Other "); sb.append("Other ");
@ -171,6 +176,6 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
if (duration.toString().length() > 0) { if (duration.toString().length() > 0) {
sb.append(" ").append(duration.toString()); sb.append(" ").append(duration.toString());
} }
staticText = sb.toString(); return sb.toString();
} }
} }