mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
refactor: use setter method and private field
This commit is contained in:
parent
577a3708fc
commit
f3fccfbd8a
29 changed files with 31 additions and 31 deletions
|
|
@ -47,7 +47,7 @@ class HiddenPredatorsStateTriggeredAbility extends StateTriggeredAbility {
|
|||
|
||||
public HiddenPredatorsStateTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new HiddenPredatorsToken(), null, Duration.Custom));
|
||||
this.replaceRuleText = false;
|
||||
this.withRuleTextReplacement(false);
|
||||
setTriggerPhrase("When an opponent controls a creature with power 4 or greater, if {this} is an enchantment, ");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class LurkingJackalsStateTriggeredAbility extends StateTriggeredAbility {
|
|||
public LurkingJackalsStateTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new LurkingJackalsToken(), null, Duration.Custom));
|
||||
setTriggerPhrase("When an opponent has 10 or less life, if {this} is an enchantment, ");
|
||||
this.replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
private LurkingJackalsStateTriggeredAbility(final LurkingJackalsStateTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ public final class OpalAvenger extends CardImpl {
|
|||
|
||||
class OpalAvengerStateTriggeredAbility extends StateTriggeredAbility {
|
||||
|
||||
public OpalAvengerStateTriggeredAbility() {
|
||||
OpalAvengerStateTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new OpalAvengerToken(), null, Duration.Custom));
|
||||
this.replaceRuleText = false;
|
||||
this.withRuleTextReplacement(false);
|
||||
setTriggerPhrase("When you have 10 or less life, if {this} is an enchantment, ");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ class VeiledCrocodileStateTriggeredAbility extends StateTriggeredAbility {
|
|||
|
||||
public VeiledCrocodileStateTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new VeilCrocodileToken(), null, Duration.Custom));
|
||||
this.replaceRuleText = false;
|
||||
this.withRuleTextReplacement(false);
|
||||
setTriggerPhrase("When a player has no cards in hand, if {this} is an enchantment, ");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class ZhurTaaDruidAbility extends TriggeredAbilityImpl {
|
|||
ZhurTaaDruidAbility() {
|
||||
super(Zone.BATTLEFIELD, new DamagePlayersEffect(1, TargetController.OPPONENT));
|
||||
setTriggerPhrase("Whenever you tap {this} for mana, ");
|
||||
this.replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
private ZhurTaaDruidAbility(final ZhurTaaDruidAbility ability) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
|||
private boolean leavesTheBattlefieldTrigger;
|
||||
private boolean triggersOnceEachTurn = false;
|
||||
private boolean doOnlyOnceEachTurn = false;
|
||||
protected boolean replaceRuleText = false; // if true, replace "{this}" with "it" in effect text
|
||||
private boolean replaceRuleText = false; // if true, replace "{this}" with "it" in effect text
|
||||
private GameEvent triggerEvent = null;
|
||||
private String triggerPhrase = null;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class AttacksAloneSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public AttacksAloneSourceTriggeredAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, effect);
|
||||
setTriggerPhrase("Whenever {this} attacks alone, ");
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
}
|
||||
|
||||
protected AttacksAloneSourceTriggeredAbility(final AttacksAloneSourceTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class AttacksAndIsNotBlockedTriggeredAbility extends TriggeredAbilityImpl
|
|||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
setTriggerPhrase("Whenever {this} attacks and isn't blocked, ");
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
}
|
||||
|
||||
protected AttacksAndIsNotBlockedTriggeredAbility(final AttacksAndIsNotBlockedTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class AttacksOrBlocksTriggeredAbility extends TriggeredAbilityImpl {
|
|||
} else {
|
||||
setTriggerPhrase("Whenever {this} attacks or blocks, ");
|
||||
}
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
}
|
||||
|
||||
protected AttacksOrBlocksTriggeredAbility(final AttacksOrBlocksTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class AttacksTriggeredAbility extends TriggeredAbilityImpl {
|
|||
this.text = text;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
setTriggerPhrase("Whenever {this} attacks, ");
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
}
|
||||
|
||||
protected AttacksTriggeredAbility(final AttacksTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class BecomesBlockedByCreatureTriggeredAbility extends TriggeredAbilityIm
|
|||
public BecomesBlockedByCreatureTriggeredAbility(Effect effect, FilterCreaturePermanent filter, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.filter = filter;
|
||||
this.replaceRuleText = false;
|
||||
this.withRuleTextReplacement(false);
|
||||
setTriggerPhrase("Whenever {this} becomes blocked by " + CardUtil.addArticle(filter.getMessage()) + ", ");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class BecomesBlockedSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
setTriggerPhrase(getWhen() + "{this} becomes blocked, ");
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
}
|
||||
|
||||
protected BecomesBlockedSourceTriggeredAbility(final BecomesBlockedSourceTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class BecomesPlottedSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public BecomesPlottedSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.EXILED, effect, optional);
|
||||
setTriggerPhrase("When {this} becomes plotted, ");
|
||||
replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
public BecomesPlottedSourceTriggeredAbility(Effect effect) {
|
||||
|
|
@ -42,4 +42,4 @@ public class BecomesPlottedSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class BecomesTappedSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public BecomesTappedSourceTriggeredAbility(Effect effect, boolean isOptional) {
|
||||
super(Zone.BATTLEFIELD, effect, isOptional);
|
||||
setTriggerPhrase("Whenever {this} becomes tapped, ");
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
}
|
||||
|
||||
protected BecomesTappedSourceTriggeredAbility(final BecomesTappedSourceTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public class BecomesTargetSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
this.filter = filter;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
setTriggerPhrase(getWhen() + "{this} becomes the target of " + filter.getMessage() + ", ");
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
}
|
||||
|
||||
protected BecomesTargetSourceTriggeredAbility(final BecomesTargetSourceTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility extends Triggered
|
|||
public BlocksOrBecomesBlockedByOneOrMoreTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, String rule) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.filter = filter;
|
||||
this.replaceRuleText = false;
|
||||
this.withRuleTextReplacement(false);
|
||||
this.rule = rule;
|
||||
setTriggerPhrase("Whenever {this} blocks or becomes blocked by one or more " + (filter != null ? filter.getMessage() : "creatures") + ", ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ public class BlocksSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public BlocksSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
setTriggerPhrase("Whenever {this} blocks, ");
|
||||
this.replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
protected BlocksSourceTriggeredAbility(final BlocksSourceTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class CycleTriggeredAbility extends ZoneChangeTriggeredAbility {
|
|||
|
||||
public CycleTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.ALL, effect, "When you cycle {this}, ", optional);
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
}
|
||||
|
||||
public CycleTriggeredAbility(Effect effect) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class DealsCombatDamageToAPlayerTriggeredAbility extends TriggeredAbility
|
|||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
setTriggerPhrase(getWhen() + "{this} deals combat damage to a player, ");
|
||||
this.replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
protected DealsCombatDamageToAPlayerTriggeredAbility(final DealsCombatDamageToAPlayerTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class DealsCombatDamageTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public DealsCombatDamageTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
setTriggerPhrase(getWhen() + "{this} deals combat damage, ");
|
||||
this.replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
protected DealsCombatDamageTriggeredAbility(final DealsCombatDamageTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class DealtDamageToSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
this.setAbilityWord(AbilityWord.ENRAGE);
|
||||
}
|
||||
setTriggerPhrase("Whenever {this} is dealt damage, ");
|
||||
this.replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
protected DealtDamageToSourceTriggeredAbility(final DealtDamageToSourceTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class DiesSourceTriggeredAbility extends ZoneChangeTriggeredAbility {
|
|||
|
||||
public DiesSourceTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, Zone.GRAVEYARD, effect, "When {this} dies, ", optional);
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
}
|
||||
|
||||
public DiesSourceTriggeredAbility(Effect effect) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class EntersBattlefieldTriggeredAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public EntersBattlefieldTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.ALL, effect, optional); // Zone.All because a creature with trigger can be put into play and be sacrificed during the resolution of an effect (discard Obstinate Baloth with Smallpox)
|
||||
this.replaceRuleText = true; // default true to replace "{this}" with "it"
|
||||
this.withRuleTextReplacement(true); // default true to replace "{this}" with "it"
|
||||
setTriggerPhrase("When {this} enters the battlefield, ");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class SourcePhaseInTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public SourcePhaseInTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
setTriggerPhrase("Whenever {this} phases in, ");
|
||||
this.replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
protected SourcePhaseInTriggeredAbility(final SourcePhaseInTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class TurnedFaceUpSourceTriggeredAbility extends TriggeredAbilityImpl {
|
|||
this.setWorksFaceDown(true);
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
setTriggerPhrase("When {this} is turned face up, ");
|
||||
this.replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
protected TurnedFaceUpSourceTriggeredAbility(final TurnedFaceUpSourceTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public class HeroicAbility extends TriggeredAbilityImpl {
|
|||
if (isHeroic) {
|
||||
this.setAbilityWord(AbilityWord.HEROIC);
|
||||
}
|
||||
this.replaceRuleText = false;
|
||||
this.withRuleTextReplacement(false);
|
||||
setTriggerPhrase("Whenever you cast a spell that targets {this}, ");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public class InspiredAbility extends TriggeredAbilityImpl {
|
|||
setAbilityWord(AbilityWord.INSPIRED);
|
||||
}
|
||||
setTriggerPhrase("Whenever {this} becomes untapped, ");
|
||||
this.replaceRuleText = true;
|
||||
this.withRuleTextReplacement(true);
|
||||
}
|
||||
|
||||
protected InspiredAbility(final InspiredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class PackTacticsAbility extends TriggeredAbilityImpl {
|
|||
|
||||
public PackTacticsAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, effect, false);
|
||||
this.replaceRuleText = false;
|
||||
this.withRuleTextReplacement(false);
|
||||
this.setAbilityWord(AbilityWord.PACK_TACTICS);
|
||||
setTriggerPhrase("Whenever {this} attacks, if you attacked with creatures with total power 6 or greater this combat, ");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public class OrTriggeredAbility extends TriggeredAbilityImpl {
|
|||
public OrTriggeredAbility(Zone zone, Effect effect, boolean optional, String ruleTrigger, TriggeredAbility... abilities) {
|
||||
super(zone, effect, optional);
|
||||
this.ruleTrigger = ruleTrigger;
|
||||
this.replaceRuleText = false;
|
||||
this.withRuleTextReplacement(false);
|
||||
Collections.addAll(this.triggeredAbilities, abilities);
|
||||
for (TriggeredAbility ability : triggeredAbilities) {
|
||||
//Remove useless data
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue