* Duegar Hedge-Mage - Set triggered abilities to optional.

This commit is contained in:
LevelX2 2015-08-03 12:23:16 +02:00
parent 8dca887fad
commit 22c1631587
37 changed files with 202 additions and 196 deletions

View file

@ -71,13 +71,13 @@ public class BudokaPupil extends CardImpl {
this.flipCardName = "Ichiga, Who Topples Oaks";
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Budoka Pupil.
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// At the beginning of the end step, if there are two or more ki counters on Budoka Pupil, you may flip it.
this.addAbility(new ConditionalTriggeredAbility(
new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new FlipSourceEffect(new IchigaWhoTopplesOaks())),
new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new FlipSourceEffect(new IchigaWhoTopplesOaks()), true),
new SourceHasCounterCondition(CounterType.KI, 2, Integer.MAX_VALUE),
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it.", true));
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it."));
}
public BudokaPupil(final BudokaPupil card) {
@ -107,7 +107,7 @@ class IchigaWhoTopplesOaks extends Token {
// Remove a ki counter from Ichiga, Who Topples Oaks: Target creature gets +2/+2 until end of turn.
Ability ability = new SimpleActivatedAbility(
Zone.BATTLEFIELD,
new BoostTargetEffect(2,2, Duration.EndOfTurn),
new BoostTargetEffect(2, 2, Duration.EndOfTurn),
new RemoveCountersSourceCost(CounterType.KI.createInstance()));
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(ability);

View file

@ -70,13 +70,13 @@ public class CallowJushi extends CardImpl {
this.flipCardName = "Jaraku the Interloper";
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Callow Jushi.
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// At the beginning of the end step, if there are two or more ki counters on Callow Jushi, you may flip it.
this.addAbility(new ConditionalTriggeredAbility(
new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new FlipSourceEffect(new JarakuTheInterloper())),
new SourceHasCounterCondition(CounterType.KI, 2, Integer.MAX_VALUE),
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it.", true));
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it."));
}
public CallowJushi(final CallowJushi card) {

View file

@ -70,13 +70,13 @@ public class CunningBandit extends CardImpl {
this.flipCardName = "Azamuki, Treachery Incarnate";
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Cunning Bandit.
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// At the beginning of the end step, if there are two or more ki counters on Cunning Bandit, you may flip it.
this.addAbility(new ConditionalTriggeredAbility(
new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new FlipSourceEffect(new AzamukiTreacheryIncarnate())),
new SourceHasCounterCondition(CounterType.KI, 2, Integer.MAX_VALUE),
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it.", true));
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it."));
}
public CunningBandit(final CunningBandit card) {

View file

@ -27,16 +27,14 @@
* or implied, of BetaSteward_at_googlemail.com.
*
*/
package mage.sets.betrayersofkamigawa;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.*;
import mage.abilities.common.OnEventTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.common.SpellCastControllerTriggeredAbility;
import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.decorator.ConditionalTriggeredAbility;
@ -45,15 +43,16 @@ import mage.abilities.effects.common.PreventDamageToTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.common.FilterSpiritOrArcaneCard;
import mage.game.events.GameEvent;
import mage.game.permanent.token.Token;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
* @author LevelX2
*/
@ -79,9 +78,9 @@ public class FaithfulSquire extends CardImpl {
this.addAbility(new ConditionalTriggeredAbility(
new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new FlipSourceEffect(new KaisoMemoryOfLoyalty())),
new SourceHasCounterCondition(CounterType.KI, 2, Integer.MAX_VALUE),
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it.", true));
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it."));
}
}
public FaithfulSquire(final FaithfulSquire card) {
super(card);

View file

@ -70,14 +70,14 @@ public class HiredMuscle extends CardImpl {
this.flipCard = true;
this.flipCardName = "Scarmaker";
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Hired Muscle.
// Whenever you cast a Spirit or Arcane spell, you may put a ki counter on Hired Muscle.
this.addAbility(new SpellCastControllerTriggeredAbility(new AddCountersSourceEffect(CounterType.KI.createInstance()), filter, true));
// At the beginning of the end step, if there are two or more ki counters on Hired Muscle, you may flip it.
this.addAbility(new ConditionalTriggeredAbility(
new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new FlipSourceEffect(new Scarmaker())),
new SourceHasCounterCondition(CounterType.KI, 2, Integer.MAX_VALUE),
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it.", true));
"At the beginning of the end step, if there are two or more ki counters on {this}, you may flip it."));
}
public HiredMuscle(final HiredMuscle card) {

View file

@ -28,10 +28,6 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.OnEventTriggeredAbility;
@ -42,6 +38,10 @@ import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.FlipSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.common.FilterEnchantmentPermanent;
import mage.filter.predicate.Predicate;
import mage.filter.predicate.mageobject.SubtypePredicate;
@ -72,8 +72,7 @@ public class KitsuneMystic extends CardImpl {
// At the beginning of the end step, if Kitsune Mystic is enchanted by two or more Auras, flip it.
this.addAbility(new ConditionalTriggeredAbility(
new OnEventTriggeredAbility(GameEvent.EventType.END_TURN_STEP_PRE, "beginning of the end step", true, new FlipSourceEffect(new AutumnTailKitsuneSage())),
new EnchantedCondition(2),"At the beginning of the end step, if {this} is enchanted by two or more Auras, flip it.", false
));
new EnchantedCondition(2), "At the beginning of the end step, if {this} is enchanted by two or more Auras, flip it."));
}
public KitsuneMystic(final KitsuneMystic card) {

View file

@ -60,8 +60,8 @@ public class DuergarHedgeMage extends CardImpl {
filter2.add(new SubtypePredicate("Plains"));
filter3.add(new CardTypePredicate(CardType.ENCHANTMENT));
}
private String rule1 = "When {this} enters the battlefield, if you control two or more Mountains, you may destroy target artifact.";
private String rule2 = "When {this} enters the battlefield, if you control two or more Plains, you may destroy target enchantment.";
private final String rule1 = "When {this} enters the battlefield, if you control two or more Mountains, you may destroy target artifact.";
private final String rule2 = "When {this} enters the battlefield, if you control two or more Plains, you may destroy target enchantment.";
public DuergarHedgeMage(UUID ownerId) {
super(ownerId, 195, "Duergar Hedge-Mage", Rarity.UNCOMMON, new CardType[]{CardType.CREATURE}, "{2}{R/W}");

View file

@ -63,10 +63,10 @@ public class SunDroplet extends CardImpl {
// Whenever you're dealt damage, put that many charge counters on Sun Droplet.
this.addAbility(new SunDropletTriggeredAbility());
// At the beginning of each upkeep, you may remove a charge counter from Sun Droplet. If you do, you gain 1 life.
Effect effect = new DoIfCostPaid(new GainLifeEffect(1),new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(1)));
Effect effect = new DoIfCostPaid(new GainLifeEffect(1), new RemoveCountersSourceCost(CounterType.CHARGE.createInstance(1)));
this.addAbility(new ConditionalTriggeredAbility(new BeginningOfUpkeepTriggeredAbility(effect, TargetController.ANY, false),
new SourceHasCounterCondition(CounterType.CHARGE, 1),
"At the beginning of each upkeep, you may remove a charge counter from Sun Droplet. If you do, you gain 1 life", false));
"At the beginning of each upkeep, you may remove a charge counter from Sun Droplet. If you do, you gain 1 life"));
}
public SunDroplet(final SunDroplet card) {

View file

@ -47,18 +47,18 @@ import mage.target.common.TargetCardInYourGraveyard;
/**
*
* @author jeffwadsworth
*
*/
public class HagHedgeMage extends CardImpl {
private final static FilterLandPermanent filter = new FilterLandPermanent();
private final static FilterLandPermanent filter2 = new FilterLandPermanent();
static {
filter.add(new SubtypePredicate("Swamp"));
filter2.add(new SubtypePredicate("Forest"));
}
private String rule = "When {this} enters the battlefield, if you control two or more Swamps, you may have target player discard a card.";
private String rule2 = "When {this} enters the battlefield, if you control two or more Forests, you may put target card from your graveyard on top of your library.";
@ -72,12 +72,12 @@ public class HagHedgeMage extends CardImpl {
this.toughness = new MageInt(2);
// When Hag Hedge-Mage enters the battlefield, if you control two or more Swamps, you may have target player discard a card.
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(1), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule, true);
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(1), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule);
ability.addTarget(new TargetPlayer());
this.addAbility(ability);
// When Hag Hedge-Mage enters the battlefield, if you control two or more Forests, you may put target card from your graveyard on top of your library.
Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new PutOnLibraryTargetEffect(true), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2, true);
Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new PutOnLibraryTargetEffect(true), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2);
ability2.addTarget(new TargetCardInYourGraveyard());
this.addAbility(ability2);
}

View file

@ -56,7 +56,6 @@ public class HelixPinnacle extends CardImpl {
super(ownerId, 68, "Helix Pinnacle", Rarity.RARE, new CardType[]{CardType.ENCHANTMENT}, "{G}");
this.expansionSetCode = "EVE";
// Shroud
this.addAbility(ShroudAbility.getInstance());
@ -64,12 +63,12 @@ public class HelixPinnacle extends CardImpl {
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD,
new AddCountersSourceEffect(CounterType.TOWER.createInstance(), new ManacostVariableValue(), true),
new ManaCostsImpl("{X}")));
// At the beginning of your upkeep, if there are 100 or more tower counters on Helix Pinnacle, you win the game.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new WinGameSourceControllerEffect(), TargetController.YOU, false),
new SourceHasCounterCondition(CounterType.TOWER, 100),
rule, false ));
rule));
}

View file

@ -48,18 +48,18 @@ import mage.target.TargetPlayer;
/**
*
* @author jeffwadsworth
*
*/
public class NoggleHedgeMage extends CardImpl {
private final static FilterLandPermanent filter = new FilterLandPermanent();
private final static FilterLandPermanent filter2 = new FilterLandPermanent();
static {
filter.add(new SubtypePredicate("Island"));
filter2.add(new SubtypePredicate("Mountain"));
}
private String rule = "When {this} enters the battlefield, if you control two or more Islands, you may tap two target permanents.";
private String rule2 = "When {this} enters the battlefield, if you control two or more Mountains, you may have {this} deal 2 damage to target player.";
@ -73,12 +73,12 @@ public class NoggleHedgeMage extends CardImpl {
this.toughness = new MageInt(2);
// When Noggle Hedge-Mage enters the battlefield, if you control two or more Islands, you may tap two target permanents.
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule, true);
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new TapTargetEffect(), true), new PermanentsOnTheBattlefieldCondition(filter, CountType.MORE_THAN, 1), rule);
ability.addTarget(new TargetPermanent(2, new FilterPermanent()));
this.addAbility(ability);
// When Noggle Hedge-Mage enters the battlefield, if you control two or more Mountains, you may have Noggle Hedge-Mage deal 2 damage to target player.
Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2, true);
Ability ability2 = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2), true), new PermanentsOnTheBattlefieldCondition(filter2, CountType.MORE_THAN, 1), rule2);
ability2.addTarget(new TargetPlayer());
this.addAbility(ability2);
}

View file

@ -71,8 +71,7 @@ public class FlamewakePhoenix extends CardImpl {
new DoIfCostPaid(new ReturnToBattlefieldUnderOwnerControlSourceEffect(), new ManaCostsImpl("{R")),
TargetController.YOU, false, false),
FerociousCondition.getInstance(),
"<i>Ferocious</i> &mdash; At the beginning of combat on your turn, if you control a creature with power 4 or greater, you may pay {R}. If you do, return {this} from your graveyard to the battlefield.",
false
"<i>Ferocious</i> &mdash; At the beginning of combat on your turn, if you control a creature with power 4 or greater, you may pay {R}. If you do, return {this} from your graveyard to the battlefield."
));
}

View file

@ -76,8 +76,8 @@ public class FrontierSiege extends CardImpl {
this.expansionSetCode = "FRF";
// As Frontier Siege enters the battlefield, choose Khans or Dragons.
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?","Khans", "Dragons"),null, true,
"As {this} enters the battlefield, choose Khans or Dragons.",""));
this.addAbility(new EntersBattlefieldAbility(new ChooseModeEffect("Khans or Dragons?", "Khans", "Dragons"), null, true,
"As {this} enters the battlefield, choose Khans or Dragons.", ""));
// * Khans - At the beginning of each of your main phases, add {G}{G} to your mana pool.
this.addAbility(new ConditionalTriggeredAbility(
@ -89,7 +89,7 @@ public class FrontierSiege extends CardImpl {
Ability ability2 = new ConditionalTriggeredAbility(
new EntersBattlefieldControlledTriggeredAbility(Zone.BATTLEFIELD, new FrontierSiegeFightEffect(), filter, true, SetTargetPointer.PERMANENT, ""),
new ModeChoiceSourceCondition("Dragons"),
ruleTrigger2, true);
ruleTrigger2);
ability2.addTarget(new TargetCreaturePermanent(filter2));
this.addAbility(ability2);
@ -108,7 +108,7 @@ public class FrontierSiege extends CardImpl {
class FrontierSiegeKhansTriggeredAbility extends TriggeredAbilityImpl {
public FrontierSiegeKhansTriggeredAbility() {
super(Zone.BATTLEFIELD, new AddManaToManaPoolSourceControllerEffect(new Mana(0,2,0,0,0,0,0)), false);
super(Zone.BATTLEFIELD, new AddManaToManaPoolSourceControllerEffect(new Mana(0, 2, 0, 0, 0, 0, 0)), false);
}

View file

@ -68,7 +68,7 @@ public class ScreechingBat extends CardImpl {
// At the beginning of your upkeep, you may pay {2}{B}{B}. If you do, transform Screeching Bat.
this.addAbility(new TransformAbility());
this.addAbility(new ConditionalTriggeredAbility(new ScreechingBatBeginningOfUpkeepTriggeredAbility(), new TransformedCondition(true), "", true));
this.addAbility(new ConditionalTriggeredAbility(new ScreechingBatBeginningOfUpkeepTriggeredAbility(), new TransformedCondition(true), ""));
}
public ScreechingBat(final ScreechingBat card) {
@ -84,7 +84,7 @@ public class ScreechingBat extends CardImpl {
class ScreechingBatBeginningOfUpkeepTriggeredAbility extends TriggeredAbilityImpl {
public ScreechingBatBeginningOfUpkeepTriggeredAbility() {
super(Zone.BATTLEFIELD, new ScreechingBatTransformSourceEffect());
super(Zone.BATTLEFIELD, new ScreechingBatTransformSourceEffect(), true);
}
public ScreechingBatBeginningOfUpkeepTriggeredAbility(final ScreechingBatBeginningOfUpkeepTriggeredAbility ability) {

View file

@ -27,14 +27,13 @@
*/
package mage.sets.innistrad;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.cards.CardImpl;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.condition.common.TransformedCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
/**
* @author nantuko
@ -54,7 +53,7 @@ public class StalkingVampire extends CardImpl {
this.toughness = new MageInt(5);
// At the beginning of your upkeep, you may pay {2}{B}{B}. If you do, transform Stalking Vampire.
this.addAbility(new ConditionalTriggeredAbility(new ScreechingBatBeginningOfUpkeepTriggeredAbility(), new TransformedCondition(), "", true));
this.addAbility(new ConditionalTriggeredAbility(new ScreechingBatBeginningOfUpkeepTriggeredAbility(), new TransformedCondition(), ""));
}
public StalkingVampire(final StalkingVampire card) {

View file

@ -56,8 +56,8 @@ public class MarduHeartPiercer extends CardImpl {
this.toughness = new MageInt(3);
// <em>Raid</em> - When Mardu Heart-Piercer enters the battlefield, if you attacked with a creature this turn, Mardu Heart-Piercer deals 2 damage to target creature or player.
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2)), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, {this} deals 2 damage to target creature or player.", false);
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DamageTargetEffect(2)), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, {this} deals 2 damage to target creature or player.");
ability.addTarget(new TargetCreatureOrPlayer());
this.addAbility(ability, new PlayerAttackedWatcher());
}

View file

@ -55,8 +55,8 @@ public class MarduHordechief extends CardImpl {
this.toughness = new MageInt(3);
// <i>Raid</i> - When Mardu Hordechief enters the battlefield, if you attacked with a creature this turn, put a 1/1 white Warrior creature token onto the battlefield
this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new MarduHordechiefToken())), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, put a 1/1 white Warrior creature token onto the battlefield.", false),
this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new MarduHordechiefToken())), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, put a 1/1 white Warrior creature token onto the battlefield."),
new PlayerAttackedWatcher());
}
@ -82,4 +82,4 @@ class MarduHordechiefToken extends Token {
power = new MageInt(1);
toughness = new MageInt(1);
}
}
}

View file

@ -58,10 +58,10 @@ public class MarduSkullhunter extends CardImpl {
// Mardu Skullhunter enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
// <em>Raid</em> - When Mardu Skullhunter enters the battlefield, if you attacked with a creature this turn, target opponent discards a card.
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(1)), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, target opponent discards a card.", false);
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new DiscardTargetEffect(1)), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, target opponent discards a card.");
ability.addTarget(new TargetOpponent());
this.addAbility(ability, new PlayerAttackedWatcher());
}

View file

@ -55,8 +55,8 @@ public class MarduWarshrieker extends CardImpl {
this.toughness = new MageInt(3);
// <em>Raid</em> - When Mardu Warshrieker enters the battlefield, if you attacked with a creature this turn, add {R}{W}{B} to your mana pool.
this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new AddManaToManaPoolSourceControllerEffect(new Mana(1,0,0,1,1,0,0))), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, add {R}{W}{B} to your mana pool.", false),
this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new AddManaToManaPoolSourceControllerEffect(new Mana(1, 0, 0, 1, 1, 0, 0))), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, add {R}{W}{B} to your mana pool."),
new PlayerAttackedWatcher());
}

View file

@ -65,8 +65,8 @@ public class TimelyHordemate extends CardImpl {
this.toughness = new MageInt(2);
// <i>Raid</i> - When Timely Hordemate enters the battlefield, if you attacked this turn, return target creature card with converted mana cost 2 or less from your graveyard to the battlefield.
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect()), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, return target creature card with converted mana cost 2 or less from your graveyard to the battlefield.", false);
Ability ability = new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new ReturnFromGraveyardToBattlefieldTargetEffect()), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, return target creature card with converted mana cost 2 or less from your graveyard to the battlefield.");
ability.addTarget(new TargetCardInYourGraveyard(filter));
this.addAbility(ability, new PlayerAttackedWatcher());

View file

@ -60,10 +60,10 @@ public class WingmateRoc extends CardImpl {
// Flying
this.addAbility(FlyingAbility.getInstance());
// <em>Raid</em> - When Wingmate Roc enters the battlefield, if you attacked with a creature this turn, put a 3/4 white Bird creature token with flying onto the battlefield.
this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new WingmateRocToken())), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, put a 3/4 white Bird creature token with flying onto the battlefield.", false),
this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new WingmateRocToken())), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, put a 3/4 white Bird creature token with flying onto the battlefield."),
new PlayerAttackedWatcher());
// Whenever Wingmate Roc attacks, you gain 1 life for each attacking creature.

View file

@ -52,12 +52,11 @@ public class LandTax extends CardImpl {
// At the beginning of your upkeep, if an opponent controls more lands than you, you may search your library for up to three basic land cards, reveal them, and put them into your hand. If you do, shuffle your library.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 3, new FilterBasicLandCard()), true),TargetController.YOU, true),
new BeginningOfUpkeepTriggeredAbility(new SearchLibraryPutInHandEffect(new TargetCardInLibrary(0, 3, new FilterBasicLandCard()), true), TargetController.YOU, true),
new OpponentControllsMoreCondition(new FilterLandPermanent("lands")),
"At the beginning of your upkeep, if an opponent controls more lands than you, you may search your library for up to three basic land cards, reveal them, and put them into your hand. If you do, shuffle your library",
true
"At the beginning of your upkeep, if an opponent controls more lands than you, you may search your library for up to three basic land cards, reveal them, and put them into your hand. If you do, shuffle your library"
));
}
public LandTax(final LandTax card) {

View file

@ -62,14 +62,14 @@ public class ManaVault extends CardImpl {
// At the beginning of your upkeep, you may pay {4}. If you do, untap Mana Vault.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(
Zone.BATTLEFIELD,
new DoIfCostPaid(new UntapSourceEffect(), new GenericManaCost(4),"Pay {4} to untap {this}?"),
new DoIfCostPaid(new UntapSourceEffect(), new GenericManaCost(4), "Pay {4} to untap {this}?"),
TargetController.YOU,
false));
// At the beginning of your draw step, if Mana Vault is tapped, it deals 1 damage to you.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfDrawTriggeredAbility(Zone.BATTLEFIELD, new DamageControllerEffect(1), TargetController.YOU, false),
SourceTappedCondition.getInstance(),
"At the beginning of your draw step, if {this} is tapped, it deals 1 damage to you.", false));
"At the beginning of your draw step, if {this} is tapped, it deals 1 damage to you."));
// {tap}: Add {3} to your mana pool.
this.addAbility(new SimpleManaAbility(Zone.BATTLEFIELD, Mana.ColorlessMana(3), new TapSourceCost()));
}

View file

@ -58,13 +58,12 @@ public class EyesOfTheWisent extends CardImpl {
this.expansionSetCode = "LRW";
this.subtype.add("Elemental");
// Whenever an opponent casts a blue spell during your turn, you may put a 4/4 green Elemental creature token onto the battlefield.
this.addAbility(new ConditionalTriggeredAbility(
new SpellCastOpponentTriggeredAbility(new CreateTokenEffect(new EyesOfTheWisentElementalToken()), filter, true),
new MyTurnCondition(),
"Whenever an opponent casts a blue spell during your turn, you may put a 4/4 green Elemental creature token onto the battlefield.",
true));
"Whenever an opponent casts a blue spell during your turn, you may put a 4/4 green Elemental creature token onto the battlefield."
));
}
public EyesOfTheWisent(final EyesOfTheWisent card) {
@ -89,4 +88,4 @@ class EyesOfTheWisentElementalToken extends Token {
toughness = new MageInt(4);
}
}
}

View file

@ -61,7 +61,7 @@ public class NetherSpirit extends CardImpl {
// At the beginning of your upkeep, if Nether Spirit is the only creature card in your graveyard, you may return Nether Spirit to the battlefield.
TriggeredAbility ability = new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD, new ReturnSourceFromGraveyardToBattlefieldEffect(), TargetController.YOU, true);
this.addAbility(new ConditionalTriggeredAbility(ability, new NetherSpiritCondition(), "At the beginning of your upkeep, if Nether Spirit is the only creature card in your graveyard, you may return Nether Spirit to the battlefield.", true));
this.addAbility(new ConditionalTriggeredAbility(ability, new NetherSpiritCondition(), "At the beginning of your upkeep, if {this} is the only creature card in your graveyard, you may return {this} to the battlefield."));
}
public NetherSpirit(final NetherSpirit card) {
@ -75,7 +75,7 @@ public class NetherSpirit extends CardImpl {
}
class NetherSpiritCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());

View file

@ -28,9 +28,6 @@
package mage.sets.ravnica;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -41,10 +38,12 @@ import mage.abilities.decorator.ConditionalActivatedAbility;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldEffect;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.FlyingAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.PhaseStep;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
@ -70,12 +69,12 @@ public class FiremaneAngel extends CardImpl {
// At the beginning of your upkeep, if Firemane Angel is in your graveyard or on the battlefield, you may gain 1 life.
Ability ability = new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(Zone.ALL, new GainLifeEffect(1), TargetController.YOU, true),
SourceOnBattelfieldOrGraveyardCondition.getInstance(),
"At the beginning of your upkeep, if {this} is in your graveyard or on the battlefield, you may gain 1 life", true);
SourceOnBattelfieldOrGraveyardCondition.getInstance(),
"At the beginning of your upkeep, if {this} is in your graveyard or on the battlefield, you may gain 1 life");
this.addAbility(ability);
// {6}{R}{R}{W}{W}: Return Firemane Angel from your graveyard to the battlefield. Activate this ability only during your upkeep.
this.addAbility(new ConditionalActivatedAbility(Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToBattlefieldEffect(), new ManaCostsImpl("{6}{R}{R}{W}{W}"), new IsStepCondition(PhaseStep.UPKEEP), null));
this.addAbility(new ConditionalActivatedAbility(Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToBattlefieldEffect(), new ManaCostsImpl("{6}{R}{R}{W}{W}"), new IsStepCondition(PhaseStep.UPKEEP), null));
}
public FiremaneAngel(final FiremaneAngel card) {
@ -98,8 +97,8 @@ class SourceOnBattelfieldOrGraveyardCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
return (game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD) ||
game.getState().getZone(source.getSourceId()).equals(Zone.BATTLEFIELD));
return (game.getState().getZone(source.getSourceId()).equals(Zone.GRAVEYARD)
|| game.getState().getZone(source.getSourceId()).equals(Zone.BATTLEFIELD));
}
@Override
@ -107,5 +106,4 @@ class SourceOnBattelfieldOrGraveyardCondition implements Condition {
return "if {this} is in your graveyard or on the battlefield";
}
}
}

View file

@ -53,7 +53,6 @@ public class DeathOfAThousandStings extends CardImpl {
this.expansionSetCode = "SOK";
this.subtype.add("Arcane");
// Target player loses 1 life and you gain 1 life.
this.getSpellAbility().addEffect(new LoseLifeTargetEffect(1));
this.getSpellAbility().addTarget(new TargetPlayer());
@ -64,10 +63,10 @@ public class DeathOfAThousandStings extends CardImpl {
// At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return Death of a Thousand Stings from your graveyard to your hand.
Ability ability = new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(Zone.GRAVEYARD,
new ReturnSourceFromGraveyardToHandEffect(),
TargetController.YOU, true),
new ReturnSourceFromGraveyardToHandEffect(),
TargetController.YOU, true),
new MoreCardsInHandThanOpponentsCondition(),
"At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return {this} from your graveyard to your hand.", true);
"At the beginning of your upkeep, if you have more cards in hand than each opponent, you may return {this} from your graveyard to your hand.");
this.addAbility(ability);
}

View file

@ -58,9 +58,8 @@ public class LavabornMuse extends CardImpl {
// At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Lavaborn Muse deals 3 damage to him or her.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(3), TargetController.OPPONENT, false, true),
new CardsInActivePlayersHandCondition(),
"At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, {this} deals 3 damage to him or her.",
false));
new CardsInActivePlayersHandCondition(),
"At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, {this} deals 3 damage to him or her."));
}
public LavabornMuse(final LavabornMuse card) {
@ -83,4 +82,3 @@ class CardsInActivePlayersHandCondition implements Condition {
return player != null && player.getHand().size() <= 2;
}
}

View file

@ -73,7 +73,7 @@ public class DeepSeaKraken extends CardImpl {
// Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it.
this.addAbility(new ConditionalTriggeredAbility(
new SpellCastAllTriggeredAbility(Zone.EXILED, new RemoveCounterSourceEffect(CounterType.TIME.createInstance()), filter, false, SetTargetPointer.NONE), SuspendedCondition.getInstance(),
"Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it.", false));
"Whenever an opponent casts a spell, if Deep-Sea Kraken is suspended, remove a time counter from it."));
}
public DeepSeaKraken(final DeepSeaKraken card) {

View file

@ -28,15 +28,15 @@
package mage.sets.worldwake;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.MageInt;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.condition.common.PermanentsOnTheBattlefieldCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.filter.FilterPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
@ -64,7 +64,7 @@ public class ShorelineSalvager extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Shoreline Salvager deals combat damage to a player, if you control an Island, you may draw a card.
this.addAbility(new ConditionalTriggeredAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1), true), new PermanentsOnTheBattlefieldCondition(filter), rule, true));
this.addAbility(new ConditionalTriggeredAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new DrawCardSourceControllerEffect(1), true), new PermanentsOnTheBattlefieldCondition(filter), rule));
}
public ShorelineSalvager(final ShorelineSalvager card) {

View file

@ -29,21 +29,21 @@ package mage.sets.zendikar;
import java.util.UUID;
import mage.abilities.Ability;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.abilities.common.BeginningOfEndStepTriggeredAbility;
import mage.abilities.common.PutCardIntoGraveFromAnywhereAllTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.condition.common.OpponentLostLifeCondition;
import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.LoseLifeTargetEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.SetTargetPointer;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.counters.CounterType;
import mage.filter.FilterCard;
@ -69,7 +69,7 @@ public class BloodchiefAscension extends CardImpl {
new PutCardIntoGraveFromAnywhereAllTriggeredAbility(
new LoseLifeTargetEffect(2), true, new FilterCard("a card"), TargetController.OPPONENT, SetTargetPointer.PLAYER),
new SourceHasCounterCondition(CounterType.QUEST, 3),
"Whenever a card is put into an opponent's graveyard from anywhere, if Bloodchief Ascension has three or more quest counters on it, you may have that player lose 2 life. If you do, you gain 2 life", true);
"Whenever a card is put into an opponent's graveyard from anywhere, if {this} has three or more quest counters on it, you may have that player lose 2 life. If you do, you gain 2 life");
ability.addEffect(new GainLifeEffect(2));
this.addAbility(ability);

View file

@ -30,11 +30,9 @@ package mage.sets.zendikar;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
@ -42,9 +40,7 @@ import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
*
@ -64,9 +60,9 @@ public class HellfireMongrel extends CardImpl {
// At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, Hellfire Mongrel deals 2 damage to him or her.
this.addAbility(new ConditionalTriggeredAbility(
new BeginningOfUpkeepTriggeredAbility(Zone.BATTLEFIELD, new DamageTargetEffect(2), TargetController.OPPONENT, false, true),
new CardsInActivePlayersHandCondition(),
"At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, {this} deals 2 damage to him or her.",
false));
new CardsInActivePlayersHandCondition(),
"At the beginning of each opponent's upkeep, if that player has two or fewer cards in hand, {this} deals 2 damage to him or her."
));
}
public HellfireMongrel(final HellfireMongrel card) {

View file

@ -61,7 +61,7 @@ public class LuminarchAscension extends CardImpl {
this.expansionSetCode = "ZEN";
// At the beginning of each opponent's end step, if you didn't lose life this turn, you may put a quest counter on Luminarch Ascension.
this.addAbility(new ConditionalTriggeredAbility(new LuminarchAscensionTriggeredAbility(), YouLostNoLifeThisTurnCondition.getInstance(), rule, true));
this.addAbility(new ConditionalTriggeredAbility(new LuminarchAscensionTriggeredAbility(), YouLostNoLifeThisTurnCondition.getInstance(), rule));
// {1}{W}: Put a 4/4 white Angel creature token with flying onto the battlefield. Activate this ability only if Luminarch Ascension has four or more quest counters on it.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new AngelToken()), new ManaCostsImpl("{1}{W}"));

View file

@ -1,31 +1,30 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities;
import java.util.UUID;
@ -39,19 +38,25 @@ import mage.game.events.GameEvent;
public interface TriggeredAbility extends Ability {
void trigger(Game game, UUID controllerId);
/**
* This check for the relevant event types is called at first to prevent further actions if
* the current event is ignored from this triggered ability
* This check for the relevant event types is called at first to prevent
* further actions if the current event is ignored from this triggered
* ability
*
* @param event
* @param game
* @return
*/
boolean checkEventType(GameEvent event, Game game);
boolean checkTrigger(GameEvent event, Game game);
boolean checkInterveningIfClause(Game game);
boolean isOptional();
@Override
TriggeredAbility copy();
}

View file

@ -84,7 +84,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
}*/
@Override
public boolean resolve(Game game) {
if (optional) {
if (isOptional()) {
MageObject object = game.getObject(getSourceId());
Player player = game.getPlayer(this.getControllerId());
if (player != null) {
@ -124,7 +124,7 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
StringBuilder sb = new StringBuilder();
if (!superRule.isEmpty()) {
String ruleLow = superRule.toLowerCase();
if (optional) {
if (isOptional()) {
if (ruleLow.startsWith("you ")) {
if (!ruleLow.startsWith("you may")) {
StringBuilder newRule = new StringBuilder(superRule);
@ -197,4 +197,9 @@ public abstract class TriggeredAbilityImpl extends AbilityImpl implements Trigge
return super.isInUseableZone(game, source, event);
}
@Override
public boolean isOptional() {
return optional;
}
}

View file

@ -1,31 +1,30 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.abilities.common;
import mage.abilities.TriggeredAbilityImpl;
@ -58,13 +57,17 @@ public class OnEventTriggeredAbility extends TriggeredAbilityImpl {
}
public OnEventTriggeredAbility(EventType eventType, String eventName, boolean allPlayers, Effect effect) {
this(eventType, eventName, allPlayers, effect, false);
}
public OnEventTriggeredAbility(EventType eventType, String eventName, boolean allPlayers, Effect effect, boolean optional) {
super(Zone.BATTLEFIELD, effect);
this.eventType = eventType;
this.eventName = eventName;
this.allPlayers = allPlayers;
}
public OnEventTriggeredAbility(OnEventTriggeredAbility ability) {
public OnEventTriggeredAbility(final OnEventTriggeredAbility ability) {
super(ability);
this.eventType = ability.eventType;
this.eventName = ability.eventName;
@ -78,7 +81,7 @@ public class OnEventTriggeredAbility extends TriggeredAbilityImpl {
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (allPlayers || event.getPlayerId().equals(this.controllerId) ) {
if (allPlayers || event.getPlayerId().equals(this.controllerId)) {
return true;
}
return false;

View file

@ -21,16 +21,20 @@ public class ConditionalTriggeredAbility extends TriggeredAbilityImpl {
protected Condition condition;
protected String text;
/**
* Triggered ability with a condition. Set the optionality for the trigger
* ability itself.
*
* @param ability
* @param condition
* @param text if null or empty, the rule text of the triggered ability
* itself is used.
*/
public ConditionalTriggeredAbility(TriggeredAbility ability, Condition condition, String text) {
this(ability, condition, text, false);
}
public ConditionalTriggeredAbility(TriggeredAbility ability, Condition condition, String text, boolean optional) {
super(ability.getZone(), null);
this.ability = ability;
this.modes = ability.getModes();
this.condition = condition;
this.optional = optional;
this.text = text;
}
@ -86,4 +90,9 @@ public class ConditionalTriggeredAbility extends TriggeredAbilityImpl {
return ability.getEffects(game, effectType);
}
@Override
public boolean isOptional() {
return ability.isOptional();
}
}