mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
* Gain abilities - fixed wrong text with quotes;
This commit is contained in:
parent
3e8dbbd894
commit
ba86bf0c15
12 changed files with 75 additions and 50 deletions
|
|
@ -60,6 +60,7 @@ public class GainAbilityAllEffect extends ContinuousEffectImpl {
|
|||
ability.newId(); // This is needed if the effect is copied e.g. by a clone so the ability can be added multiple times to permanents
|
||||
this.filter = effect.filter.copy();
|
||||
this.excludeSource = effect.excludeSource;
|
||||
this.forceQuotes = effect.forceQuotes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import mage.filter.StaticFilters;
|
|||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
|
@ -24,6 +23,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
|||
protected CompoundAbility ability;
|
||||
protected boolean excludeSource;
|
||||
protected FilterPermanent filter;
|
||||
protected boolean forceQuotes = false;
|
||||
|
||||
public GainAbilityControlledEffect(Ability ability, Duration duration) {
|
||||
this(ability, duration, StaticFilters.FILTER_PERMANENT);
|
||||
|
|
@ -60,7 +60,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
|||
this.ability = effect.ability.copy();
|
||||
this.filter = effect.filter.copy();
|
||||
this.excludeSource = effect.excludeSource;
|
||||
|
||||
this.forceQuotes = effect.forceQuotes;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -139,7 +139,7 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
|||
sb.append(filter.getMessage()).append(" you control ");
|
||||
if (duration == Duration.WhileOnBattlefield || duration == Duration.EndOfGame) {
|
||||
sb.append("have ");
|
||||
if (gainedAbility.startsWith("Whenever ") || gainedAbility.startsWith("{T}")) {
|
||||
if (forceQuotes || gainedAbility.startsWith("When") || gainedAbility.startsWith("{T}")) {
|
||||
gainedAbility = '"' + gainedAbility + '"';
|
||||
}
|
||||
} else {
|
||||
|
|
@ -149,7 +149,16 @@ public class GainAbilityControlledEffect extends ContinuousEffectImpl {
|
|||
if (!duration.toString().isEmpty() && duration != Duration.EndOfGame) {
|
||||
sb.append(' ').append(duration.toString());
|
||||
}
|
||||
staticText = sb.toString() + ".";
|
||||
staticText = sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add quotes to gains abilities (by default static abilities don't have it)
|
||||
*/
|
||||
public GainAbilityControlledEffect withForceQuotes() {
|
||||
this.forceQuotes = true;
|
||||
setText();
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue