forked from External/mage
Reworking triggered ability text generation to allow for ability words and flavor words to be added more easily (#8010)
* refactor all instances of getRule in triggered abilities using new getTriggerPrefix method * updated triggered ability rules generation * renamed method * fixed a test failure * some more refactoring * simplified some instances of ability word usage
This commit is contained in:
parent
0a31110164
commit
ca80806400
398 changed files with 946 additions and 989 deletions
|
|
@ -4,6 +4,7 @@ package mage.abilities.abilityword;
|
|||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
|
@ -21,6 +22,7 @@ public class ConstellationAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public ConstellationAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
setAbilityWord(AbilityWord.CONSTELLATION);
|
||||
}
|
||||
|
||||
public ConstellationAbility(Effect effect, boolean optional) {
|
||||
|
|
@ -57,9 +59,8 @@ public class ConstellationAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "<i>Constellation</i> — Whenever "
|
||||
+ (thisOr ? "{this} or another" : "an")
|
||||
+ " enchantment enters the battlefield under your control, " + super.getRule();
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever " + (thisOr ? "{this} or another" : "an")
|
||||
+ " enchantment enters the battlefield under your control, ";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ package mage.abilities.abilityword;
|
|||
import mage.abilities.ActivatedAbilityImpl;
|
||||
import mage.abilities.costs.common.DiscardTargetCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.mageobject.AnotherCardPredicate;
|
||||
|
|
@ -12,22 +13,22 @@ import mage.filter.predicate.mageobject.NamePredicate;
|
|||
import mage.target.common.TargetCardInHand;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author emerald000
|
||||
*/
|
||||
|
||||
public class GrandeurAbility extends ActivatedAbilityImpl {
|
||||
|
||||
|
||||
protected final String cardName;
|
||||
|
||||
public GrandeurAbility(Effect effect, String cardName) {
|
||||
super(Zone.BATTLEFIELD, effect);
|
||||
this.cardName = cardName;
|
||||
|
||||
|
||||
FilterCard filter = new FilterCard("another card named " + cardName);
|
||||
filter.add(new NamePredicate(cardName));
|
||||
filter.add(new AnotherCardPredicate());
|
||||
this.addCost(new DiscardTargetCost(new TargetCardInHand(filter)));
|
||||
setAbilityWord(AbilityWord.GRANDEUR);
|
||||
}
|
||||
|
||||
public GrandeurAbility(final GrandeurAbility ability) {
|
||||
|
|
@ -39,9 +40,4 @@ public class GrandeurAbility extends ActivatedAbilityImpl {
|
|||
public GrandeurAbility copy() {
|
||||
return new GrandeurAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return new StringBuilder("<i>Grandeur</i> — ").append(super.getRule()).toString();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import mage.abilities.effects.OneShotEffect;
|
|||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.AbilityWord;
|
||||
import mage.constants.EffectType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
|
|
@ -25,6 +26,7 @@ public class KinshipAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public KinshipAbility(Effect kinshipEffect) {
|
||||
super(Zone.BATTLEFIELD, new KinshipBaseEffect(kinshipEffect), true);
|
||||
this.setAbilityWord(AbilityWord.KINSHIP);
|
||||
}
|
||||
|
||||
public KinshipAbility(final KinshipAbility ability) {
|
||||
|
|
@ -56,8 +58,8 @@ public class KinshipAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return new StringBuilder("<i>Kinship</i> — At the beginning of your upkeep, ").append(super.getRule()).toString();
|
||||
public String getTriggerPhrase() {
|
||||
return "At the beginning of your upkeep, ";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,7 @@ import mage.abilities.SpellAbility;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.cost.CostModificationEffectImpl;
|
||||
import mage.constants.CostModificationType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.constants.*;
|
||||
import mage.game.Game;
|
||||
import mage.target.Target;
|
||||
import mage.util.ManaUtil;
|
||||
|
|
@ -25,6 +22,7 @@ public class StriveAbility extends SimpleStaticAbility {
|
|||
super(Zone.STACK, new StriveCostIncreasingEffect(new ManaCostsImpl(manaString)));
|
||||
setRuleAtTheTop(true);
|
||||
this.striveCost = manaString;
|
||||
setAbilityWord(AbilityWord.STRIVE);
|
||||
}
|
||||
|
||||
public StriveAbility(final StriveAbility ability) {
|
||||
|
|
@ -39,7 +37,7 @@ public class StriveAbility extends SimpleStaticAbility {
|
|||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return new StringBuilder("<i>Strive</i> — this spell costs ").append(striveCost).append(" more to cast for each target beyond the first.").toString();
|
||||
return new StringBuilder("this spell costs ").append(striveCost).append(" more to cast for each target beyond the first.").toString();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue