mirror of
https://github.com/magefree/mage.git
synced 2026-01-26 13:19:18 -08:00
refactor: end step triggered abilities (#13047)
* simplify BeginningOfEndStepTriggeredAbility * more simplifications * move to common class * find and replace to common class * simplify again * align parameter order * package reorg * simplify BeginningOfCombatTriggeredAbility constructors * simplify BeginningOfFirstMainTriggeredAbility constructors * text fixes * update docs
This commit is contained in:
parent
587a68a837
commit
5b0eba7068
675 changed files with 1426 additions and 1979 deletions
|
|
@ -250,13 +250,15 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
|
|||
|
||||
if (interveningIfCondition != null) {
|
||||
String conditionText = interveningIfCondition.toString();
|
||||
if (replaceRuleText && triggerPhrase != null && triggerPhrase.contains("{this}")) {
|
||||
conditionText = conditionText.replace("{this}", "it");
|
||||
if (!conditionText.isEmpty()) { // e.g. CaseSolveAbility
|
||||
if (replaceRuleText && triggerPhrase != null && triggerPhrase.contains("{this}")) {
|
||||
conditionText = conditionText.replace("{this}", "it");
|
||||
}
|
||||
if (!conditionText.startsWith("if ")) {
|
||||
sb.append("if ");
|
||||
}
|
||||
sb.append(conditionText).append(", ");
|
||||
}
|
||||
if (!conditionText.startsWith("if ")) {
|
||||
sb.append("if ");
|
||||
}
|
||||
sb.append(conditionText).append(", ");
|
||||
}
|
||||
|
||||
String superRule = super.getRule(true);
|
||||
|
|
|
|||
|
|
@ -1,155 +0,0 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
public class BeginningOfEndStepTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final TargetController targetController;
|
||||
private final Condition interveningIfClauseCondition;
|
||||
|
||||
public BeginningOfEndStepTriggeredAbility(Effect effect, TargetController targetController, boolean isOptional) {
|
||||
this(effect, targetController, null, isOptional);
|
||||
}
|
||||
|
||||
public BeginningOfEndStepTriggeredAbility(Effect effect, TargetController targetController, Condition interveningIfClauseCondition, boolean isOptional) {
|
||||
this(Zone.BATTLEFIELD, effect, targetController, interveningIfClauseCondition, isOptional);
|
||||
}
|
||||
|
||||
public BeginningOfEndStepTriggeredAbility(Zone zone, Effect effect, TargetController targetController, Condition interveningIfClauseCondition, boolean isOptional) {
|
||||
super(zone, effect, isOptional);
|
||||
this.targetController = targetController;
|
||||
this.interveningIfClauseCondition = interveningIfClauseCondition;
|
||||
setTriggerPhrase(generateTriggerPhrase());
|
||||
}
|
||||
|
||||
protected BeginningOfEndStepTriggeredAbility(final BeginningOfEndStepTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.targetController = ability.targetController;
|
||||
this.interveningIfClauseCondition = ability.interveningIfClauseCondition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeginningOfEndStepTriggeredAbility copy() {
|
||||
return new BeginningOfEndStepTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
switch (targetController) {
|
||||
case YOU:
|
||||
boolean yours = event.getPlayerId().equals(this.controllerId);
|
||||
if (yours && getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return yours;
|
||||
case OPPONENT:
|
||||
if (game.getPlayer(this.controllerId).hasOpponent(event.getPlayerId(), game)) {
|
||||
if (getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case ANY:
|
||||
case EACH_PLAYER:
|
||||
case NEXT:
|
||||
if (getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
case CONTROLLER_ATTACHED_TO:
|
||||
Permanent attachment = game.getPermanent(sourceId);
|
||||
if (attachment == null || attachment.getAttachedTo() == null) {
|
||||
break;
|
||||
}
|
||||
Permanent attachedTo = game.getPermanent(attachment.getAttachedTo());
|
||||
if (attachedTo == null || !attachedTo.isControlledBy(event.getPlayerId())) {
|
||||
break;
|
||||
}
|
||||
if (getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
case ENCHANTED:
|
||||
Permanent permanent = getSourcePermanentIfItStillExists(game);
|
||||
if (permanent == null || !game.isActivePlayer(permanent.getAttachedTo())) {
|
||||
break;
|
||||
}
|
||||
if (getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
case MONARCH:
|
||||
if (!event.getPlayerId().equals(game.getMonarchId())) {
|
||||
break;
|
||||
}
|
||||
if (getTargets().isEmpty()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(event.getPlayerId()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkInterveningIfClause(Game game) {
|
||||
if (interveningIfClauseCondition != null) {
|
||||
return interveningIfClauseCondition.apply(game, this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String generateTriggerPhrase() {
|
||||
switch (targetController) {
|
||||
case YOU:
|
||||
return "At the beginning of your end step, " + generateConditionString();
|
||||
case NEXT:
|
||||
return "At the beginning of the end step, " + generateConditionString();
|
||||
case OPPONENT:
|
||||
return "At the beginning of each opponent's end step, " + generateConditionString();
|
||||
case ANY:
|
||||
return "At the beginning of each end step, " + generateConditionString();
|
||||
case EACH_PLAYER:
|
||||
return "At the beginning of each player's end step, " + generateConditionString();
|
||||
case CONTROLLER_ATTACHED_TO:
|
||||
return "At the beginning of the end step of enchanted permanent's controller, " + generateConditionString();
|
||||
case ENCHANTED:
|
||||
return "At the beginning of enchanted player's end step, " + generateConditionString();
|
||||
case MONARCH:
|
||||
return "At the beginning of the monarch's end step, " + generateConditionString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private String generateConditionString() {
|
||||
if (interveningIfClauseCondition == null) {
|
||||
if (getZone() == Zone.GRAVEYARD) {
|
||||
return "if {this} is in your graveyard, ";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
String clauseText = interveningIfClauseCondition.toString();
|
||||
if (clauseText.startsWith("if")) {
|
||||
// Fixes punctuation on multiple sentence if-then construction
|
||||
// see -- Colfenor's Urn
|
||||
if (clauseText.endsWith(".")) {
|
||||
return clauseText + " ";
|
||||
}
|
||||
return clauseText + ", ";
|
||||
}
|
||||
return "if " + clauseText + ", ";
|
||||
}
|
||||
}
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
/**
|
||||
* Beginning of controlled end step triggered ability
|
||||
*
|
||||
* @author Loki
|
||||
*/
|
||||
public class BeginningOfYourEndStepTriggeredAbility extends TriggeredAbilityImpl {
|
||||
public BeginningOfYourEndStepTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(Zone.BATTLEFIELD, effect, optional);
|
||||
}
|
||||
|
||||
public BeginningOfYourEndStepTriggeredAbility(Zone zone, Effect effect, boolean optional) {
|
||||
super(zone, effect, optional);
|
||||
setTriggerPhrase("At the beginning of your end step, ");
|
||||
}
|
||||
|
||||
protected BeginningOfYourEndStepTriggeredAbility(final BeginningOfYourEndStepTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeginningOfYourEndStepTriggeredAbility copy() {
|
||||
return new BeginningOfYourEndStepTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
return event.getPlayerId().equals(this.controllerId);
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import mage.abilities.decorator.ConditionalReplacementEffect;
|
|||
import mage.abilities.decorator.ConditionalTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -114,8 +115,8 @@ public class CaseAbility extends SimpleStaticAbility {
|
|||
class CaseSolveAbility extends BeginningOfEndStepTriggeredAbility {
|
||||
|
||||
CaseSolveAbility(Condition condition) {
|
||||
super(new SolveEffect(), TargetController.YOU,
|
||||
new CompoundCondition(condition, SolvedSourceCondition.UNSOLVED), false);
|
||||
super(TargetController.YOU, new SolveEffect(),
|
||||
false, new CompoundCondition(condition, SolvedSourceCondition.UNSOLVED));
|
||||
withFlavorWord("To solve"); // TODO: technically this shouldn't be italicized
|
||||
setTriggerPhrase(CardUtil.getTextWithFirstCharUpperCase(trimIf(condition.toString())));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mage.abilities.keyword;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
|
|
@ -47,8 +47,8 @@ public class ImpendingAbility extends AlternativeSourceCostsImpl {
|
|||
), "").setRuleVisible(false));
|
||||
this.addSubAbility(new SimpleStaticAbility(new ImpendingAbilityTypeEffect()).setRuleVisible(false));
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(
|
||||
new RemoveCounterSourceEffect(CounterType.TIME.createInstance()),
|
||||
TargetController.YOU, ImpendingCondition.instance, false
|
||||
TargetController.YOU, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()),
|
||||
false, ImpendingCondition.instance
|
||||
);
|
||||
ability.addEffect(new ConditionalOneShotEffect(
|
||||
new AddContinuousEffectToGame(new ImpendingAbilityRemoveEffect()),
|
||||
|
|
|
|||
|
|
@ -32,9 +32,6 @@ public abstract class AtStepTriggeredAbility extends TriggeredAbilityImpl {
|
|||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
// implementing classes must add copy constructor
|
||||
// implementing classes must override checksEventType
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (checkTargetController(event, game)) {
|
||||
|
|
@ -51,7 +48,6 @@ public abstract class AtStepTriggeredAbility extends TriggeredAbilityImpl {
|
|||
case NOT_YOU:
|
||||
return !isControlledBy(event.getPlayerId());
|
||||
case ANY:
|
||||
case ACTIVE:
|
||||
case NEXT:
|
||||
case EACH_PLAYER:
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,13 @@ import mage.game.events.GameEvent;
|
|||
|
||||
public class BeginningOfCombatTriggeredAbility extends AtStepTriggeredAbility {
|
||||
|
||||
/**
|
||||
* At the beginning of combat on your turn (optional = false)
|
||||
*/
|
||||
public BeginningOfCombatTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* At the beginning of combat on your turn
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,77 @@
|
|||
package mage.abilities.triggers;
|
||||
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
|
||||
public class BeginningOfEndStepTriggeredAbility extends AtStepTriggeredAbility {
|
||||
|
||||
/**
|
||||
* At the beginning of your end step (optional = false)
|
||||
*/
|
||||
public BeginningOfEndStepTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* At the beginning of your end step
|
||||
*/
|
||||
public BeginningOfEndStepTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(TargetController.YOU, effect, optional);
|
||||
}
|
||||
|
||||
public BeginningOfEndStepTriggeredAbility(TargetController targetController, Effect effect, boolean optional) {
|
||||
this(targetController, effect, optional, null);
|
||||
}
|
||||
|
||||
public BeginningOfEndStepTriggeredAbility(TargetController targetController, Effect effect, boolean optional, Condition interveningIfClauseCondition) {
|
||||
this(Zone.BATTLEFIELD, targetController, effect, optional, interveningIfClauseCondition);
|
||||
}
|
||||
|
||||
public BeginningOfEndStepTriggeredAbility(Zone zone, TargetController targetController, Effect effect, boolean optional, Condition interveningIfClauseCondition) {
|
||||
super(zone, targetController, effect, optional);
|
||||
this.withInterveningIf(interveningIfClauseCondition);
|
||||
}
|
||||
|
||||
protected BeginningOfEndStepTriggeredAbility(final BeginningOfEndStepTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BeginningOfEndStepTriggeredAbility copy() {
|
||||
return new BeginningOfEndStepTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.END_TURN_STEP_PRE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String generateTriggerPhrase() {
|
||||
switch (targetController) {
|
||||
case YOU:
|
||||
return "At the beginning of your end step, ";
|
||||
case NEXT:
|
||||
return "At the beginning of the end step, ";
|
||||
case OPPONENT:
|
||||
return "At the beginning of each opponent's end step, ";
|
||||
case ANY:
|
||||
return "At the beginning of each end step, ";
|
||||
case EACH_PLAYER:
|
||||
return "At the beginning of each player's end step, ";
|
||||
case CONTROLLER_ATTACHED_TO:
|
||||
return "At the beginning of the end step of enchanted permanent's controller, ";
|
||||
case ENCHANTED:
|
||||
return "At the beginning of enchanted player's end step, ";
|
||||
case MONARCH:
|
||||
return "At the beginning of the monarch's end step, ";
|
||||
default:
|
||||
throw new UnsupportedOperationException("Unsupported TargetController in BeginningOfEndStepTriggeredAbility: " + targetController);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -11,6 +11,13 @@ import mage.game.events.GameEvent;
|
|||
*/
|
||||
public class BeginningOfFirstMainTriggeredAbility extends AtStepTriggeredAbility {
|
||||
|
||||
/**
|
||||
* At the beginning of your first main phase (optional = false)
|
||||
*/
|
||||
public BeginningOfFirstMainTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* At the beginning of your first main phase
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package mage.designations;
|
|||
|
||||
import mage.MageObject;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.BecomesMonarchTargetEffect;
|
||||
import mage.abilities.effects.common.DrawCardTargetEffect;
|
||||
import mage.constants.TargetController;
|
||||
|
|
@ -38,7 +38,7 @@ public class Monarch extends Designation {
|
|||
class MonarchDrawTriggeredAbility extends BeginningOfEndStepTriggeredAbility {
|
||||
|
||||
public MonarchDrawTriggeredAbility() {
|
||||
super(Zone.ALL, new DrawCardTargetEffect(1), TargetController.ANY, null, false);
|
||||
super(Zone.ALL, TargetController.ANY, new DrawCardTargetEffect(1), false, null);
|
||||
}
|
||||
|
||||
protected MonarchDrawTriggeredAbility(final MonarchDrawTriggeredAbility ability) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -16,8 +16,8 @@ public final class AjaniAdversaryOfTyrantsEmblem extends Emblem {
|
|||
public AjaniAdversaryOfTyrantsEmblem() {
|
||||
super("Emblem Ajani");
|
||||
this.getAbilities().add(new BeginningOfEndStepTriggeredAbility(
|
||||
Zone.COMMAND, new CreateTokenEffect(new CatToken2(), 3),
|
||||
TargetController.YOU, null, false
|
||||
Zone.COMMAND, TargetController.YOU, new CreateTokenEffect(new CatToken2(), 3),
|
||||
false, null
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -16,8 +16,8 @@ public final class DomriChaosBringerEmblem extends Emblem {
|
|||
public DomriChaosBringerEmblem() {
|
||||
super("Emblem Domri");
|
||||
this.getAbilities().add(new BeginningOfEndStepTriggeredAbility(
|
||||
Zone.COMMAND, new CreateTokenEffect(new RedGreenBeastToken()),
|
||||
TargetController.ANY, null, false
|
||||
Zone.COMMAND, TargetController.ANY, new CreateTokenEffect(new RedGreenBeastToken()),
|
||||
false, null
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.common.BeginningOfYourEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.command.Emblem;
|
||||
|
|
@ -15,7 +16,7 @@ public class GarrukUnleashedEmblem extends Emblem {
|
|||
super("Emblem Garruk");
|
||||
Effect effect = new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(StaticFilters.FILTER_CARD_CREATURE), false)
|
||||
.setText("search your library for a creature card, put it onto the battlefield, then shuffle");
|
||||
this.getAbilities().add(new BeginningOfYourEndStepTriggeredAbility(Zone.COMMAND, effect, true));
|
||||
this.getAbilities().add(new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, TargetController.YOU, effect, true, null));
|
||||
}
|
||||
|
||||
private GarrukUnleashedEmblem(final GarrukUnleashedEmblem card) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -20,7 +20,7 @@ public final class KioraEmblem extends Emblem {
|
|||
|
||||
public KioraEmblem() {
|
||||
super("Emblem Kiora");
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new Kraken99Token()), TargetController.YOU, null, false);
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, TargetController.YOU, new CreateTokenEffect(new Kraken99Token()), false, null);
|
||||
this.getAbilities().add(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
|
|
@ -21,8 +21,8 @@ public final class LilianaTheLastHopeEmblem extends Emblem {
|
|||
// "At the beginning of your end step, create X 2/2 black Zombie creature tokens, where X is two plus the number of Zombies you control."
|
||||
public LilianaTheLastHopeEmblem() {
|
||||
super("Emblem Liliana");
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new CreateTokenEffect(new ZombieToken(), LilianaZombiesCount.instance),
|
||||
TargetController.YOU, null, false);
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, TargetController.YOU, new CreateTokenEffect(new ZombieToken(), LilianaZombiesCount.instance),
|
||||
false, null);
|
||||
this.getAbilities().add(ability);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.triggers.BeginningOfDrawTriggeredAbility;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.discard.DiscardHandControllerEffect;
|
||||
import mage.constants.TargetController;
|
||||
|
|
@ -17,7 +17,7 @@ public final class SarkhanTheDragonspeakerEmblem extends Emblem {
|
|||
super("Emblem Sarkhan");
|
||||
|
||||
this.getAbilities().add(new BeginningOfDrawTriggeredAbility(Zone.COMMAND, TargetController.YOU, new DrawCardSourceControllerEffect(2).setText("draw two additional cards"), false));
|
||||
this.getAbilities().add(new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new DiscardHandControllerEffect(), TargetController.YOU, null, false));
|
||||
this.getAbilities().add(new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, TargetController.YOU, new DiscardHandControllerEffect(), false, null));
|
||||
}
|
||||
|
||||
private SarkhanTheDragonspeakerEmblem(final SarkhanTheDragonspeakerEmblem card) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package mage.game.command.emblems;
|
||||
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
|
||||
import mage.constants.TargetController;
|
||||
import mage.constants.Zone;
|
||||
|
|
@ -18,9 +18,9 @@ public final class TezzeretArtificeMasterEmblem extends Emblem {
|
|||
super("Emblem Tezzeret");
|
||||
this.getAbilities().add(new BeginningOfEndStepTriggeredAbility(
|
||||
Zone.COMMAND,
|
||||
new SearchLibraryPutInPlayEffect(
|
||||
TargetController.YOU, new SearchLibraryPutInPlayEffect(
|
||||
new TargetCardInLibrary(new FilterPermanentCard())
|
||||
), TargetController.YOU, null, false
|
||||
), false, null
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package mage.game.command.planes;
|
|||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.MainPhaseStackEmptyCondition;
|
||||
|
|
@ -37,7 +37,7 @@ public class AcademyAtTolariaWestPlane extends Plane {
|
|||
this.setPlaneType(Planes.PLANE_ACADEMY_AT_TOLARIA_WEST);
|
||||
|
||||
// At the beginning of your end step, if you have 0 cards in hand, draw seven cards
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, new DrawCardsActivePlayerEffect(7), TargetController.ANY, HellbentAPCondition.instance, false);
|
||||
Ability ability = new BeginningOfEndStepTriggeredAbility(Zone.COMMAND, TargetController.ANY, new DrawCardsActivePlayerEffect(7), false, HellbentAPCondition.instance);
|
||||
this.getAbilities().add(ability);
|
||||
|
||||
// Active player can roll the planar die: Whenever you roll {CHAOS}, discard your hand
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ import mage.abilities.hint.ConditionHint;
|
|||
import mage.abilities.hint.Hint;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.TargetController;
|
||||
import mage.counters.CounterType;
|
||||
|
||||
/**
|
||||
|
|
@ -32,8 +31,7 @@ public final class AshiokWickedManipulatorNightmareToken extends TokenImpl {
|
|||
|
||||
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||
new BeginningOfCombatTriggeredAbility(
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance()),
|
||||
false
|
||||
new AddCountersSourceEffect(CounterType.P1P1.createInstance())
|
||||
),
|
||||
WasCardExiledThisTurnCondition.instance,
|
||||
"At the beginning of combat on your turn, if a card was put into exile "
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
|
|
@ -25,7 +25,7 @@ public final class LightningRagerToken extends TokenImpl {
|
|||
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
this.addAbility(HasteAbility.getInstance());
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(new SacrificeSourceEffect(), TargetController.NEXT, false));
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(TargetController.NEXT, new SacrificeSourceEffect(), false));
|
||||
}
|
||||
|
||||
private LightningRagerToken(final LightningRagerToken token) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package mage.game.permanent.token;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||
import mage.abilities.effects.common.SacrificeSourceEffect;
|
||||
import mage.abilities.keyword.HasteAbility;
|
||||
import mage.abilities.keyword.TrampleAbility;
|
||||
|
|
@ -24,7 +24,7 @@ public final class SparkElementalToken extends TokenImpl {
|
|||
|
||||
this.addAbility(TrampleAbility.getInstance());
|
||||
this.addAbility(HasteAbility.getInstance());
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(new SacrificeSourceEffect(), TargetController.ANY, false));
|
||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(TargetController.ANY, new SacrificeSourceEffect(), false));
|
||||
}
|
||||
|
||||
private SparkElementalToken(final SparkElementalToken token) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue