some more text improvements (#11258)

* text on Eldrazi Spawn token

* refactor: return Ability instead of void

* cleanup assigning null to staticText

* cleanup Mimic cycle and GainAbilitySourceEffect

adjust Groundling Pouncer

* remove hardcoded rule param from SpellCastControllerTriggeredAbility

* fix #11257
This commit is contained in:
xenohedron 2023-10-05 22:04:02 -04:00 committed by GitHub
parent cd6c5aa7ac
commit c8e2282a79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 97 additions and 160 deletions

View file

@ -442,7 +442,7 @@ public interface Ability extends Controllable, Serializable {
*
* @param ruleVisible
*/
void setRuleVisible(boolean ruleVisible);
Ability setRuleVisible(boolean ruleVisible);
/**
* Returns true if the additional costs of the abilitiy should be visible on

View file

@ -1080,7 +1080,9 @@ public abstract class AbilityImpl implements Ability {
@Override
public Ability setRuleAtTheTop(boolean ruleAtTheTop) {
this.ruleAtTheTop = ruleAtTheTop;
if (!(this instanceof MageSingleton)) {
this.ruleAtTheTop = ruleAtTheTop;
}
return this;
}
@ -1090,10 +1092,11 @@ public abstract class AbilityImpl implements Ability {
}
@Override
public void setRuleVisible(boolean ruleVisible) {
public Ability setRuleVisible(boolean ruleVisible) {
if (!(this instanceof MageSingleton)) { // prevent to change singletons
this.ruleVisible = ruleVisible;
}
return this;
}
@Override

View file

@ -17,7 +17,6 @@ import mage.target.targetpointer.FixedTarget;
public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
protected final FilterSpell filter;
protected final String rule;
// If either the cast spell or the card must be set as TargetPointer of effects.
protected final SetTargetPointer setTargetPointer;
@ -40,33 +39,27 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
public SpellCastControllerTriggeredAbility(Zone zone, Effect effect, FilterSpell filter,
boolean optional, SetTargetPointer setTargetPointer) {
this(zone, effect, filter, optional, setTargetPointer, null, null);
this(zone, effect, filter, optional, setTargetPointer, null);
}
public SpellCastControllerTriggeredAbility(Zone zone, Effect effect, FilterSpell filter,
boolean optional, SetTargetPointer setTargetPointer,
String rule, Zone fromZone) {
Zone fromZone) {
super(zone, effect, optional);
this.filter = filter == null ? StaticFilters.FILTER_SPELL_A : filter;
this.setTargetPointer = setTargetPointer;
this.rule = rule;
this.fromZone = fromZone == null ? Zone.ALL : fromZone;
makeTriggerPhrase();
}
public static SpellCastControllerTriggeredAbility createWithFromZone(Effect effect, FilterSpell filter, boolean optional, Zone fromZone) {
return new SpellCastControllerTriggeredAbility(Zone.BATTLEFIELD, effect, filter, optional, SetTargetPointer.NONE, null, fromZone);
}
public static SpellCastControllerTriggeredAbility createWithRule(Effect effect, FilterSpell filter, boolean optional, String rule) {
return new SpellCastControllerTriggeredAbility(Zone.BATTLEFIELD, effect, filter, optional, SetTargetPointer.NONE, rule, null);
return new SpellCastControllerTriggeredAbility(Zone.BATTLEFIELD, effect, filter, optional, SetTargetPointer.NONE, fromZone);
}
protected SpellCastControllerTriggeredAbility(final SpellCastControllerTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.rule = ability.rule;
this.setTargetPointer = ability.setTargetPointer;
this.fromZone = ability.fromZone;
}
@ -103,11 +96,6 @@ public class SpellCastControllerTriggeredAbility extends TriggeredAbilityImpl {
return true;
}
@Override
public String getRule() {
return rule != null ? rule : super.getRule();
}
@Override
public SpellCastControllerTriggeredAbility copy() {
return new SpellCastControllerTriggeredAbility(this);

View file

@ -25,7 +25,6 @@ public class AddCreatureTypeAdditionEffect extends ContinuousEffectImpl {
super(effect);
this.subType = effect.subType;
this.giveBlackColor = effect.giveBlackColor;
updateText();
}
private void updateText() {

View file

@ -18,12 +18,10 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl {
protected Ability ability;
// shall a card gain the ability (otherwise permanent)
private boolean onCard;
private final boolean onCard;
/**
* Add ability with Duration.WhileOnBattlefield
*
* @param ability
*/
public GainAbilitySourceEffect(Ability ability) {
this(ability, Duration.WhileOnBattlefield);
@ -34,19 +32,11 @@ public class GainAbilitySourceEffect extends ContinuousEffectImpl {
}
public GainAbilitySourceEffect(Ability ability, Duration duration, boolean onCard) {
this(ability, duration, onCard, false);
staticText = "{this} gains " + ability.getRule()
+ (duration.toString().isEmpty() ? "" : ' ' + duration.toString());
}
public GainAbilitySourceEffect(Ability ability, Duration duration, boolean onCard, boolean noStaticText) {
super(duration, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
this.ability = ability;
this.onCard = onCard;
if (noStaticText) {
staticText = null;
}
this.staticText = "{this} gains " + ability.getRule()
+ (duration.toString().isEmpty() ? "" : ' ' + duration.toString());
this.generateGainAbilityDependencies(ability, null);
}

View file

@ -20,10 +20,10 @@ public final class EldraziSpawnToken extends TokenImpl {
subtype.add(SubType.SPAWN);
power = new MageInt(0);
toughness = new MageInt(1);
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1), new SacrificeSourceCost()));
addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(1), new SacrificeSourceCost().setText("Sacrifice this creature")));
}
protected EldraziSpawnToken(final EldraziSpawnToken token) {
private EldraziSpawnToken(final EldraziSpawnToken token) {
super(token);
}

View file

@ -485,8 +485,9 @@ public class StackAbility extends StackObjectImpl implements Ability {
}
@Override
public void setRuleVisible(boolean ruleVisible) {
public Ability setRuleVisible(boolean ruleVisible) {
this.ability.setRuleVisible(ruleVisible);
return this;
}
@Override