mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
added AttacksAloneControlledTriggeredAbility
This commit is contained in:
parent
63016b99d6
commit
62fa79cfd8
16 changed files with 138 additions and 310 deletions
|
@ -1,6 +1,6 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AttacksAloneControlledTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.dynamicvalue.common.CardTypesInGraveyardCount;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
|
@ -12,12 +12,8 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.common.FilterCreaturePermanent;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -35,7 +31,12 @@ public final class AltarOfTheGoyf extends CardImpl {
|
|||
this.subtype.add(SubType.LHURGOYF);
|
||||
|
||||
// Whenever a creature you control attacks alone, it gets +X/+X until end of turn, where X is the number of card types among cards in all graveyard.
|
||||
this.addAbility(new AltarOfTheGoyfAbility());
|
||||
this.addAbility(new AttacksAloneControlledTriggeredAbility(new BoostTargetEffect(
|
||||
CardTypesInGraveyardCount.ALL,
|
||||
CardTypesInGraveyardCount.ALL,
|
||||
Duration.EndOfTurn, true
|
||||
).setText("it gets +X/+X until end of turn, where X is " +
|
||||
"the number of card types among cards in all graveyards.")).addHint(CardTypesInGraveyardHint.ALL));
|
||||
|
||||
// Lhurgoyf creatures you control have trample.
|
||||
this.addAbility(new SimpleStaticAbility(new GainAbilityControlledEffect(
|
||||
|
@ -52,43 +53,3 @@ public final class AltarOfTheGoyf extends CardImpl {
|
|||
return new AltarOfTheGoyf(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AltarOfTheGoyfAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public AltarOfTheGoyfAbility() {
|
||||
super(Zone.BATTLEFIELD, new BoostTargetEffect(
|
||||
CardTypesInGraveyardCount.ALL, CardTypesInGraveyardCount.ALL, Duration.EndOfTurn, true
|
||||
), false);
|
||||
this.addHint(CardTypesInGraveyardHint.ALL);
|
||||
}
|
||||
|
||||
public AltarOfTheGoyfAbility(final AltarOfTheGoyfAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AltarOfTheGoyfAbility copy() {
|
||||
return new AltarOfTheGoyfAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.isActivePlayer(this.controllerId) && game.getCombat().attacksAlone()) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0), game));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature you control attacks alone, " +
|
||||
"it gets +X/+X until end of turn, " +
|
||||
"where X is the number of card types among cards in all graveyards.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,32 +1,33 @@
|
|||
|
||||
package mage.cards.a;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksAloneControlledTriggeredAbility;
|
||||
import mage.abilities.effects.common.TapTargetEffect;
|
||||
import mage.abilities.keyword.ExaltedAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.target.common.TargetCreaturePermanent;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author North
|
||||
*/
|
||||
public final class AngelicBenediction extends CardImpl {
|
||||
|
||||
public AngelicBenediction(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{W}");
|
||||
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
|
||||
|
||||
// Exalted
|
||||
this.addAbility(new ExaltedAbility());
|
||||
|
||||
// Whenever a creature you control attacks alone, you may tap target creature.
|
||||
this.addAbility(new AngelicBenedictionTriggeredAbility());
|
||||
Ability ability = new AttacksAloneControlledTriggeredAbility(
|
||||
new TapTargetEffect(), false, true
|
||||
);
|
||||
ability.addTarget(new TargetCreaturePermanent());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
private AngelicBenediction(final AngelicBenediction card) {
|
||||
|
@ -38,40 +39,3 @@ public final class AngelicBenediction extends CardImpl {
|
|||
return new AngelicBenediction(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AngelicBenedictionTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public AngelicBenedictionTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new TapTargetEffect(), true);
|
||||
this.addTarget(new TargetCreaturePermanent());
|
||||
}
|
||||
|
||||
public AngelicBenedictionTriggeredAbility(final AngelicBenedictionTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AngelicBenedictionTriggeredAbility copy() {
|
||||
return new AngelicBenedictionTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.isActivePlayer(this.controllerId)) {
|
||||
if (game.getCombat().attacksAlone()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature you control attacks alone, you may tap target creature";
|
||||
}
|
||||
}
|
|
@ -1,18 +1,13 @@
|
|||
package mage.cards.a;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AttacksAloneControlledTriggeredAbility;
|
||||
import mage.abilities.dynamicvalue.common.CreaturesYouControlCount;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||
import mage.abilities.hint.common.CreaturesYouControlHint;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
|
@ -25,7 +20,11 @@ public final class AngelicExaltation extends CardImpl {
|
|||
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{W}");
|
||||
|
||||
// Whenever a creature you control attacks alone, it gets +X/+X until end of turn, where X is the number of creatures you control.
|
||||
this.addAbility(new AngelicExaltationAbility().addHint(CreaturesYouControlHint.instance));
|
||||
this.addAbility(new AttacksAloneControlledTriggeredAbility(new BoostTargetEffect(
|
||||
CreaturesYouControlCount.instance,
|
||||
CreaturesYouControlCount.instance,
|
||||
Duration.EndOfTurn, true
|
||||
).setText("it gets +X/+X until end of turn, where X is the number of creatures you control")).addHint(CreaturesYouControlHint.instance));
|
||||
}
|
||||
|
||||
private AngelicExaltation(final AngelicExaltation card) {
|
||||
|
@ -37,45 +36,3 @@ public final class AngelicExaltation extends CardImpl {
|
|||
return new AngelicExaltation(this);
|
||||
}
|
||||
}
|
||||
|
||||
class AngelicExaltationAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public AngelicExaltationAbility() {
|
||||
super(Zone.BATTLEFIELD, new BoostTargetEffect(CreaturesYouControlCount.instance, CreaturesYouControlCount.instance, Duration.EndOfTurn, true), false);
|
||||
}
|
||||
|
||||
public AngelicExaltationAbility(final AngelicExaltationAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AngelicExaltationAbility copy() {
|
||||
return new AngelicExaltationAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.isActivePlayer(this.controllerId)) {
|
||||
if (game.getCombat().attacksAlone()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature you control attacks alone, " +
|
||||
"it gets +X/+X until end of turn, " +
|
||||
"where X is the number of creatures you control.";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
package mage.cards.b;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.common.AttacksAloneControlledTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.keyword.ExaltedAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
@ -13,14 +11,10 @@ import mage.cards.CardSetInfo;
|
|||
import mage.constants.CardType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Loki
|
||||
*/
|
||||
public final class BattlegraceAngel extends CardImpl {
|
||||
|
@ -39,7 +33,9 @@ public final class BattlegraceAngel extends CardImpl {
|
|||
this.addAbility(new ExaltedAbility());
|
||||
|
||||
// Whenever a creature you control attacks alone, it gains lifelink until end of turn.
|
||||
this.addAbility(new BattlegraceAngelAbility());
|
||||
this.addAbility(new AttacksAloneControlledTriggeredAbility(new GainAbilityTargetEffect(
|
||||
LifelinkAbility.getInstance(), Duration.EndOfTurn
|
||||
).setText("it gains lifelink until end of turn")));
|
||||
}
|
||||
|
||||
public BattlegraceAngel(final BattlegraceAngel card) {
|
||||
|
@ -52,43 +48,3 @@ public final class BattlegraceAngel extends CardImpl {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class BattlegraceAngelAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public BattlegraceAngelAbility() {
|
||||
super(Zone.BATTLEFIELD, new GainAbilityTargetEffect(LifelinkAbility.getInstance(), Duration.EndOfTurn), false);
|
||||
}
|
||||
|
||||
public BattlegraceAngelAbility(final BattlegraceAngelAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BattlegraceAngelAbility copy() {
|
||||
return new BattlegraceAngelAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.isActivePlayer(this.controllerId)) {
|
||||
if (game.getCombat().attacksAlone()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature you control attacks alone, it gains lifelink until end of turn.";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package mage.cards.g;
|
|||
import java.util.UUID;
|
||||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.AttacksAloneTriggeredAbility;
|
||||
import mage.abilities.common.AttacksAloneSourceTriggeredAbility;
|
||||
import mage.abilities.common.EntersBattlefieldAbility;
|
||||
import mage.abilities.condition.common.KickedCondition;
|
||||
import mage.abilities.dynamicvalue.common.SourcePermanentPowerCount;
|
||||
|
@ -42,7 +42,7 @@ public final class GrunnTheLonelyKing extends CardImpl {
|
|||
SourcePermanentPowerCount power = new SourcePermanentPowerCount();
|
||||
Effect effect = new BoostSourceEffect(power, SourcePermanentToughnessValue.getInstance(), Duration.EndOfTurn, true);
|
||||
effect.setText("double its power and toughness until end of turn");
|
||||
this.addAbility(new AttacksAloneTriggeredAbility(effect));
|
||||
this.addAbility(new AttacksAloneSourceTriggeredAbility(effect));
|
||||
}
|
||||
|
||||
private GrunnTheLonelyKing(final GrunnTheLonelyKing card) {
|
||||
|
|
|
@ -4,7 +4,7 @@ package mage.cards.l;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksAloneTriggeredAbility;
|
||||
import mage.abilities.common.AttacksAloneSourceTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
|
||||
|
@ -31,7 +31,7 @@ public final class LunkErrant extends CardImpl {
|
|||
// Whenever Lunk Errant attacks alone, it gets +1/+1 and gains trample until end of turn.
|
||||
Effect effect = new BoostSourceEffect(1, 1, Duration.EndOfTurn);
|
||||
effect.setText("it gets +1/+1");
|
||||
Ability ability = new AttacksAloneTriggeredAbility(effect);
|
||||
Ability ability = new AttacksAloneSourceTriggeredAbility(effect);
|
||||
effect = new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn);
|
||||
effect.setText("and gains trample until end of turn");
|
||||
ability.addEffect(effect);
|
||||
|
|
|
@ -3,7 +3,7 @@ package mage.cards.m;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.AttacksAloneTriggeredAbility;
|
||||
import mage.abilities.common.AttacksAloneSourceTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
|
||||
import mage.abilities.keyword.HorsemanshipAbility;
|
||||
|
@ -34,7 +34,7 @@ public final class MaChaoWesternWarrior extends CardImpl {
|
|||
// Whenever Ma Chao, Western Warrior attacks alone, it can't be blocked this combat.
|
||||
Effect effect = new CantBeBlockedSourceEffect(Duration.EndOfCombat);
|
||||
effect.setText("it can't be blocked this combat");
|
||||
this.addAbility(new AttacksAloneTriggeredAbility(effect));
|
||||
this.addAbility(new AttacksAloneSourceTriggeredAbility(effect));
|
||||
}
|
||||
|
||||
private MaChaoWesternWarrior(final MaChaoWesternWarrior card) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package mage.cards.n;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.AttacksAloneTriggeredAbility;
|
||||
import mage.abilities.common.AttacksAloneSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.SacrificeEffect;
|
||||
import mage.abilities.keyword.ExaltedAbility;
|
||||
import mage.abilities.keyword.FlyingAbility;
|
||||
|
@ -33,7 +33,7 @@ public final class NefaroxOverlordOfGrixis extends CardImpl {
|
|||
// Exalted
|
||||
this.addAbility(new ExaltedAbility());
|
||||
// Whenever Nefarox, Overlord of Grixis attacks alone, defending player sacrifices a creature.
|
||||
this.addAbility(new AttacksAloneTriggeredAbility(new SacrificeEffect(
|
||||
this.addAbility(new AttacksAloneSourceTriggeredAbility(new SacrificeEffect(
|
||||
StaticFilters.FILTER_CONTROLLED_CREATURE_SHORT_TEXT, 1, "defending player")));
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ package mage.cards.q;
|
|||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.AttacksAloneTriggeredAbility;
|
||||
import mage.abilities.common.AttacksAloneSourceTriggeredAbility;
|
||||
import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
|
@ -42,7 +42,7 @@ public final class QuiGonJinn extends CardImpl {
|
|||
// When Qui-Gon Jinn attacks alone, it gets +2/+2 and lifelink until end of turn.
|
||||
Effect effect = new BoostSourceEffect(2, 2, Duration.EndOfTurn);
|
||||
effect.setText("it gets +2/+2");
|
||||
Ability abitity = new AttacksAloneTriggeredAbility(effect);
|
||||
Ability abitity = new AttacksAloneSourceTriggeredAbility(effect);
|
||||
effect = new GainAbilitySourceEffect(LifelinkAbility.getInstance());
|
||||
effect.setText("and lifelink until end of turn");
|
||||
abitity.addEffect(effect);
|
||||
|
|
|
@ -1,25 +1,20 @@
|
|||
package mage.cards.r;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.common.AttacksAloneControlledTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||
import mage.abilities.keyword.DoubleStrikeAbility;
|
||||
import mage.abilities.keyword.ExaltedAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.SubType;
|
||||
import mage.constants.SuperType;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public final class RafiqOfTheMany extends CardImpl {
|
||||
|
@ -37,7 +32,9 @@ public final class RafiqOfTheMany extends CardImpl {
|
|||
this.addAbility(new ExaltedAbility());
|
||||
|
||||
// Whenever a creature you control attacks alone, it gains double strike until end of turn.
|
||||
this.addAbility(new RafiqOfTheManyAbility());
|
||||
this.addAbility(new AttacksAloneControlledTriggeredAbility(new GainAbilityTargetEffect(
|
||||
DoubleStrikeAbility.getInstance(), Duration.EndOfTurn
|
||||
).setText("it gains double strike until end of turn")));
|
||||
}
|
||||
|
||||
private RafiqOfTheMany(final RafiqOfTheMany card) {
|
||||
|
@ -50,43 +47,3 @@ public final class RafiqOfTheMany extends CardImpl {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
class RafiqOfTheManyAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public RafiqOfTheManyAbility() {
|
||||
super(Zone.BATTLEFIELD, new GainAbilityTargetEffect(DoubleStrikeAbility.getInstance(), Duration.EndOfTurn));
|
||||
}
|
||||
|
||||
public RafiqOfTheManyAbility(final RafiqOfTheManyAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RafiqOfTheManyAbility copy() {
|
||||
return new RafiqOfTheManyAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.isActivePlayer(this.controllerId)) {
|
||||
if (game.getCombat().attacksAlone()) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature you control attacks alone, it gains double strike until end of turn.";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package mage.cards.r;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.AttacksAloneTriggeredAbility;
|
||||
import mage.abilities.common.AttacksAloneSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -24,7 +24,7 @@ public final class RecklessOgre extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Whenever Reckless Ogre attacks alone, it gets +3/+0 until end of turn.
|
||||
this.addAbility(new AttacksAloneTriggeredAbility(new BoostSourceEffect(3, 0, Duration.EndOfTurn).setText("it gets +3/+0 until end of turn")));
|
||||
this.addAbility(new AttacksAloneSourceTriggeredAbility(new BoostSourceEffect(3, 0, Duration.EndOfTurn).setText("it gets +3/+0 until end of turn")));
|
||||
}
|
||||
|
||||
private RecklessOgre(final RecklessOgre card) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package mage.cards.r;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.AttacksAloneTriggeredAbility;
|
||||
import mage.abilities.common.AttacksAloneSourceTriggeredAbility;
|
||||
import mage.abilities.effects.common.continuous.BoostSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
|
@ -24,7 +24,7 @@ public final class RogueKavu extends CardImpl {
|
|||
this.toughness = new MageInt(1);
|
||||
|
||||
// Whenever Rogue Kavu attacks alone, it gets +2/+0 until end of turn.
|
||||
this.addAbility(new AttacksAloneTriggeredAbility(new BoostSourceEffect(2, 0, Duration.EndOfTurn)));
|
||||
this.addAbility(new AttacksAloneSourceTriggeredAbility(new BoostSourceEffect(2, 0, Duration.EndOfTurn)));
|
||||
}
|
||||
|
||||
private RogueKavu(final RogueKavu card) {
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
package mage.cards.s;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.AttacksAloneControlledTriggeredAbility;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.keyword.ExaltedAbility;
|
||||
import mage.cards.Card;
|
||||
|
@ -17,14 +15,13 @@ import mage.constants.Zone;
|
|||
import mage.filter.FilterCard;
|
||||
import mage.filter.predicate.card.AuraCardCanAttachToPermanentId;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jeffwadsworth
|
||||
*/
|
||||
public final class SovereignsOfLostAlara extends CardImpl {
|
||||
|
@ -40,7 +37,7 @@ public final class SovereignsOfLostAlara extends CardImpl {
|
|||
this.addAbility(new ExaltedAbility());
|
||||
|
||||
// Whenever a creature you control attacks alone, you may search your library for an Aura card that could enchant that creature, put it onto the battlefield attached to that creature, then shuffle your library.
|
||||
this.addAbility(new CreatureControlledAttacksAloneTriggeredAbility());
|
||||
this.addAbility(new AttacksAloneControlledTriggeredAbility(new SovereignsOfLostAlaraEffect()));
|
||||
}
|
||||
|
||||
private SovereignsOfLostAlara(final SovereignsOfLostAlara card) {
|
||||
|
@ -53,43 +50,6 @@ public final class SovereignsOfLostAlara extends CardImpl {
|
|||
}
|
||||
}
|
||||
|
||||
class CreatureControlledAttacksAloneTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public CreatureControlledAttacksAloneTriggeredAbility() {
|
||||
super(Zone.BATTLEFIELD, new SovereignsOfLostAlaraEffect(), true);
|
||||
}
|
||||
|
||||
public CreatureControlledAttacksAloneTriggeredAbility(final CreatureControlledAttacksAloneTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CreatureControlledAttacksAloneTriggeredAbility copy() {
|
||||
return new CreatureControlledAttacksAloneTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (game.isActivePlayer(this.controllerId)) {
|
||||
if (game.getCombat().attacksAlone()) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(game.getCombat().getAttackers().get(0), game));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever a creature you control attacks alone, " ;
|
||||
}
|
||||
}
|
||||
|
||||
class SovereignsOfLostAlaraEffect extends OneShotEffect {
|
||||
|
||||
public SovereignsOfLostAlaraEffect() {
|
||||
|
@ -109,7 +69,7 @@ class SovereignsOfLostAlaraEffect extends OneShotEffect {
|
|||
FilterCard filter = new FilterCard("aura that could enchant the lone attacking creature");
|
||||
filter.add(SubType.AURA.getPredicate());
|
||||
filter.add(new AuraCardCanAttachToPermanentId(attackingCreature.getId()));
|
||||
if (controller.chooseUse(Outcome.Benefit, "Do you want to search your library?", source, game)) {
|
||||
if (controller.chooseUse(Outcome.Benefit, "Search your library?", source, game)) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary(filter);
|
||||
target.setNotTarget(true);
|
||||
if (controller.searchLibrary(target, source, game)) {
|
||||
|
|
|
@ -3,7 +3,7 @@ package mage.cards.y;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.common.AttacksAloneTriggeredAbility;
|
||||
import mage.abilities.common.AttacksAloneSourceTriggeredAbility;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.combat.CantBeBlockedSourceEffect;
|
||||
import mage.cards.CardImpl;
|
||||
|
@ -28,7 +28,7 @@ public final class YuanShaosInfantry extends CardImpl {
|
|||
// Whenever Yuan Shao's Infantry attacks alone, Yuan Shao's Infantry can't be blocked this combat.
|
||||
Effect effect = new CantBeBlockedSourceEffect(Duration.EndOfCombat);
|
||||
effect.setText("{this} can't be blocked this combat");
|
||||
this.addAbility(new AttacksAloneTriggeredAbility(effect));
|
||||
this.addAbility(new AttacksAloneSourceTriggeredAbility(effect));
|
||||
}
|
||||
|
||||
private YuanShaosInfantry(final YuanShaosInfantry card) {
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
package mage.abilities.common;
|
||||
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.StaticFilters;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
* @author TheElk801
|
||||
*/
|
||||
public class AttacksAloneControlledTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
private final FilterPermanent filter;
|
||||
private final boolean setTargetPointer;
|
||||
|
||||
public AttacksAloneControlledTriggeredAbility(Effect effect) {
|
||||
this(effect, false);
|
||||
}
|
||||
|
||||
public AttacksAloneControlledTriggeredAbility(Effect effect, boolean optional) {
|
||||
this(effect, false, optional);
|
||||
}
|
||||
|
||||
public AttacksAloneControlledTriggeredAbility(Effect effect, boolean setTargetPointer, boolean optional) {
|
||||
this(effect, StaticFilters.FILTER_CONTROLLED_A_CREATURE, setTargetPointer, optional);
|
||||
}
|
||||
|
||||
public AttacksAloneControlledTriggeredAbility(Effect effect, FilterPermanent filter, boolean setTargetPointer, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
this.filter = filter;
|
||||
this.setTargetPointer = setTargetPointer;
|
||||
}
|
||||
|
||||
private AttacksAloneControlledTriggeredAbility(final AttacksAloneControlledTriggeredAbility ability) {
|
||||
super(ability);
|
||||
this.filter = ability.filter;
|
||||
this.setTargetPointer = ability.setTargetPointer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttacksAloneControlledTriggeredAbility copy() {
|
||||
return new AttacksAloneControlledTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.DECLARED_ATTACKERS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (!game.getCombat().attacksAlone()) {
|
||||
return false;
|
||||
}
|
||||
Permanent permanent = game.getPermanent(game.getCombat().getAttackers().get(0));
|
||||
if (permanent == null || !filter.match(permanent, getSourceId(), getControllerId(), game)) {
|
||||
return false;
|
||||
}
|
||||
if (setTargetPointer) {
|
||||
this.getEffects().setTargetPointer(new FixedTarget(permanent, game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTriggerPhrase() {
|
||||
return "Whenever " + filter.getMessage() + " attacks alone, ";
|
||||
}
|
||||
}
|
|
@ -7,7 +7,6 @@ import mage.abilities.TriggeredAbilityImpl;
|
|||
import mage.abilities.effects.Effect;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent.EventType;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
|
@ -15,19 +14,19 @@ import mage.target.targetpointer.FixedTarget;
|
|||
*
|
||||
* @author LoneFox
|
||||
*/
|
||||
public class AttacksAloneTriggeredAbility extends TriggeredAbilityImpl {
|
||||
public class AttacksAloneSourceTriggeredAbility extends TriggeredAbilityImpl {
|
||||
|
||||
public AttacksAloneTriggeredAbility(Effect effect) {
|
||||
public AttacksAloneSourceTriggeredAbility(Effect effect) {
|
||||
super(Zone.BATTLEFIELD, effect);
|
||||
}
|
||||
|
||||
public AttacksAloneTriggeredAbility(final AttacksAloneTriggeredAbility ability) {
|
||||
public AttacksAloneSourceTriggeredAbility(final AttacksAloneSourceTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttacksAloneTriggeredAbility copy() {
|
||||
return new AttacksAloneTriggeredAbility(this);
|
||||
public AttacksAloneSourceTriggeredAbility copy() {
|
||||
return new AttacksAloneSourceTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
Loading…
Reference in a new issue