- Refactored BlocksOrBecomesBlockedTriggeredAbility to BlocksOrBecomesBlockedSourceTriggeredAbility

This commit is contained in:
jeffwadsworth 2020-06-29 11:45:26 -05:00
parent fd3ee45a1e
commit a4d659176e
42 changed files with 173 additions and 82 deletions

View file

@ -4,7 +4,7 @@ package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -39,7 +39,7 @@ public final class Abomination extends CardImpl {
// Whenever Abomination blocks or becomes blocked by a green or white creature, destroy that creature at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect()), true);
effect.setText("destroy that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, filter, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, filter, false));
}
public Abomination(final Abomination card) {

View file

@ -5,7 +5,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BecomesColorTargetEffect;
import mage.cards.CardImpl;
@ -29,7 +29,7 @@ public final class AislingLeprechaun extends CardImpl {
// Whenever Aisling Leprechaun blocks or becomes blocked by a creature, that creature becomes green.
Effect effect = new BecomesColorTargetEffect(ObjectColor.GREEN, Duration.EndOfGame);
effect.setText("that creature becomes green");
Ability ability = new BlocksOrBecomesBlockedTriggeredAbility(effect, false);
Ability ability = new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, false);
this.addAbility(ability);
}

View file

@ -3,7 +3,7 @@ package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -25,7 +25,7 @@ public final class AshmouthHound extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Ashmouth Hound blocks or becomes blocked by a creature, Ashmouth Hound deals 1 damage to that creature.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new DamageTargetEffect(1, true, "that creature"), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new DamageTargetEffect(1, true, "that creature"), false));
}
public AshmouthHound(final AshmouthHound card) {

View file

@ -4,7 +4,7 @@ package mage.cards.a;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DamageTargetControllerEffect;
import mage.abilities.effects.common.DamageTargetEffect;
@ -27,7 +27,7 @@ public final class AssembledAlphas extends CardImpl {
this.toughness = new MageInt(5);
// Whenever Assembled Alphas blocks or becomes blocked by a creature, Assembled Alphas deals 3 damage to that creature and 3 damage to that creature's controller.
Ability ability = new BlocksOrBecomesBlockedTriggeredAbility(
Ability ability = new BlocksOrBecomesBlockedSourceTriggeredAbility(
new DamageTargetEffect(3, true, "that creature"), StaticFilters.FILTER_PERMANENT_CREATURE, false, null, true);
Effect effect = new DamageTargetControllerEffect(3);

View file

@ -3,7 +3,7 @@ package mage.cards.b;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -24,7 +24,7 @@ public final class Brushwagg extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Brushwagg blocks or becomes blocked, it gets -2/+2 until end of turn.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new BoostSourceEffect(-2, 2, Duration.EndOfTurn), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(-2, 2, Duration.EndOfTurn), false));
}
public Brushwagg(final Brushwagg card) {

View file

@ -4,7 +4,7 @@ package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
@ -28,7 +28,7 @@ public final class ChubToad extends CardImpl {
// Whenever Chub Toad blocks or becomes blocked, it gets +2/+2 until end of turn.
Effect effect = new BoostSourceEffect(+2, +2, Duration.EndOfTurn);
effect.setText("it gets +2/+2 until end of turn");
Ability ability = new BlocksOrBecomesBlockedTriggeredAbility(effect, false);
Ability ability = new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, false);
this.addAbility(ability);
}

View file

@ -3,7 +3,7 @@ package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -41,7 +41,7 @@ public final class Cockatrice extends CardImpl {
// Whenever Cockatrice blocks or becomes blocked by a non-Wall creature, destroy that creature at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect()), true);
effect.setText("destroy that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, filter, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, filter, false));
}
public Cockatrice(final Cockatrice card) {

View file

@ -3,7 +3,7 @@ package mage.cards.c;
import mage.MageInt;
import mage.MageObjectReference;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.OneShotEffect;
@ -44,7 +44,7 @@ public final class CorrosiveOoze extends CardImpl {
// Whenever Corrosive Ooze blocks or becomes blocked by an equipped creature, destroy all Equipment attached to that creature at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new CorrosiveOozeEffect()), true);
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, filter, false), new CorrosiveOozeCombatWatcher());
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, filter, false), new CorrosiveOozeCombatWatcher());
}
public CorrosiveOoze(final CorrosiveOoze card) {

View file

@ -4,7 +4,7 @@ package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -39,7 +39,7 @@ public final class Deathgazer extends CardImpl {
// Whenever Deathgazer blocks or becomes blocked by a nonblack creature, destroy that creature at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect()), true);
effect.setText("destroy that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, filter, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, filter, false));
}

View file

@ -4,7 +4,7 @@ package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -38,7 +38,7 @@ public final class DreadSpecter extends CardImpl {
// Whenever Dread Specter blocks or becomes blocked by a nonblack creature, destroy that creature at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect()), true);
effect.setText("destroy that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, filter, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, filter, false));
}
public DreadSpecter(final DreadSpecter card) {

View file

@ -3,7 +3,7 @@ package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -25,7 +25,7 @@ public final class Dromosaur extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Dromosaur blocks or becomes blocked by a creature, it gets +2/-2 until end of turn.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new BoostSourceEffect(2, -2, Duration.EndOfTurn), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(2, -2, Duration.EndOfTurn), false));
}
public Dromosaur(final Dromosaur card) {

View file

@ -4,7 +4,7 @@ package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.cards.CardImpl;
@ -30,7 +30,7 @@ public final class EngulfingSlagwurm extends CardImpl {
this.toughness = new MageInt(7);
// Whenever Engulfing Slagwurm blocks or becomes blocked by a creature, destroy that creature. You gain life equal to that creature's toughness.
Ability ability = new BlocksOrBecomesBlockedTriggeredAbility(new DestroyTargetEffect(), false);
Ability ability = new BlocksOrBecomesBlockedSourceTriggeredAbility(new DestroyTargetEffect(), false);
ability.addEffect(new EngulfingSlagwurmEffect());
this.addAbility(ability);
}

View file

@ -3,7 +3,7 @@ package mage.cards.e;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
@ -27,7 +27,7 @@ public final class EscapedNull extends CardImpl {
this.toughness = new MageInt(2);
this.addAbility(LifelinkAbility.getInstance());
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new BoostSourceEffect(5, 0, Duration.EndOfTurn), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(5, 0, Duration.EndOfTurn), false));
}
public EscapedNull(final EscapedNull card) {

View file

@ -4,7 +4,7 @@ package mage.cards.f;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.keyword.FlyingAbility;
@ -32,7 +32,7 @@ public final class FlailingDrake extends CardImpl {
// Whenever Flailing Drake blocks or becomes blocked by a creature, that creature gets +1/+1 until end of turn.
Effect effect = new BoostTargetEffect(+1, +1, Duration.EndOfTurn);
effect.setText("that creature gets +1/+1 until end of turn");
Ability ability = new BlocksOrBecomesBlockedTriggeredAbility(effect, new FilterCreaturePermanent("a creature"), false, null, true);
Ability ability = new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, new FilterCreaturePermanent("a creature"), false, null, true);
this.addAbility(ability);
}

View file

@ -5,7 +5,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.condition.common.TwoOrMoreSpellsWereCastLastTurnCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
@ -36,7 +36,7 @@ public final class FlameheartWerewolf extends CardImpl {
this.transformable = true;
// Whenever Flameheart Werewolf blocks or becomes blocked by a creature, Flameheart Werewolf deals 2 damage to that creature.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new DamageTargetEffect(2, true, "that creature"),
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new DamageTargetEffect(2, true, "that creature"),
StaticFilters.FILTER_PERMANENT_CREATURE, false, null, true));
// At the beginning of each upkeep, if a player cast two or more spells last turn, transform Flameheart Werewolf.

View file

@ -4,7 +4,7 @@ package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.keyword.FirstStrikeAbility;
import mage.abilities.keyword.VigilanceAbility;
@ -40,7 +40,7 @@ public final class GhostHounds extends CardImpl {
this.addAbility(VigilanceAbility.getInstance());
// Whenever Ghost Hounds blocks or becomes blocked by a white creature, Ghost Hounds gains first strike until end of turn.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), filter, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), filter, false));
}

View file

@ -2,7 +2,7 @@ package mage.cards.g;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.ControlsPermanentsControllerTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.SacrificeSourceEffect;
@ -43,7 +43,7 @@ public final class GiantShark extends CardImpl {
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new CantAttackUnlessDefenderControllsPermanent(filter)));
// Whenever Giant Shark blocks or becomes blocked by a creature that has been dealt damage this turn, Giant Shark gets +2/+0 and gains trample until end of turn.
Ability ability = new BlocksOrBecomesBlockedTriggeredAbility(new BoostSourceEffect(2, 0, Duration.EndOfTurn).setText("{this} gets +2/+0"), filter2, false);
Ability ability = new BlocksOrBecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(2, 0, Duration.EndOfTurn).setText("{this} gets +2/+0"), filter2, false);
ability.addEffect(new GainAbilitySourceEffect(TrampleAbility.getInstance(), Duration.EndOfTurn).setText("and gains trample until end of turn"));
this.addAbility(ability);

View file

@ -3,7 +3,7 @@ package mage.cards.g;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.GainLifeEffect;
import mage.abilities.effects.common.continuous.BoostEnchantedEffect;
@ -37,7 +37,7 @@ public final class GiftOfTheWoods extends CardImpl {
// Whenever enchanted creature blocks or becomes blocked, it gets +0/+3 until
// end of turn and you gain 1 life.
Ability ability2 = new BlocksOrBecomesBlockedTriggeredAbility(
Ability ability2 = new BlocksOrBecomesBlockedSourceTriggeredAbility(
new BoostEnchantedEffect(0, 3, Duration.EndOfTurn), false);
ability2.addEffect(new GainLifeEffect(1).concatBy("and"));
this.addAbility(ability2);

View file

@ -4,7 +4,7 @@ package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.ContinuousEffectImpl;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -27,7 +27,7 @@ public final class GoblinCadets extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Goblin Cadets blocks or becomes blocked, target opponent gains control of it.
Ability ability = new BlocksOrBecomesBlockedTriggeredAbility(new GoblinCadetsChangeControlEffect(), false);
Ability ability = new BlocksOrBecomesBlockedSourceTriggeredAbility(new GoblinCadetsChangeControlEffect(), false);
ability.addTarget(new TargetOpponent());
this.addAbility(ability);

View file

@ -3,7 +3,7 @@ package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -24,7 +24,7 @@ public final class GoblinEliteInfantry extends CardImpl {
this.power = new MageInt(2);
this.toughness = new MageInt(2);
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new BoostSourceEffect(-1, -1, Duration.EndOfTurn), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(-1, -1, Duration.EndOfTurn), false));
}
public GoblinEliteInfantry(final GoblinEliteInfantry card) {

View file

@ -3,7 +3,7 @@ package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.DoUnlessControllerPaysEffect;
@ -37,7 +37,7 @@ public final class GoblinFlotilla extends CardImpl {
// At the beginning of each combat, unless you pay {R}, whenever Goblin Flotilla blocks or becomes blocked by a creature this combat, that creature gains first strike until end of turn.
Effect effect = new DoUnlessControllerPaysEffect(
new GainAbilitySourceEffect(
new BlocksOrBecomesBlockedTriggeredAbility(
new BlocksOrBecomesBlockedSourceTriggeredAbility(
new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(),
Duration.EndOfTurn,
"Blocks or Blocked by Goblin Flotilla"),

View file

@ -4,7 +4,7 @@ package mage.cards.g;
import java.util.UUID;
import mage.MageInt;
import mage.ObjectColor;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
@ -40,7 +40,7 @@ public final class GorgonRecluse extends CardImpl {
// Whenever Gorgon Recluse blocks or becomes blocked by a nonblack creature, destroy that creature at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect()), true);
effect.setText("destroy that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, filter, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, filter, false));
// Madness {B}{B}
this.addAbility(new MadnessAbility(this, new ManaCostsImpl("{B}{B}")));

View file

@ -3,7 +3,7 @@ package mage.cards.i;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -24,7 +24,7 @@ public final class InfernoElemental extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Inferno Elemental blocks or becomes blocked by a creature, Inferno Elemental deals 3 damage to that creature.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new DamageTargetEffect(3, true, "that creature"), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new DamageTargetEffect(3, true, "that creature"), false));
}
public InfernoElemental(final InfernoElemental card) {

View file

@ -4,7 +4,7 @@ package mage.cards.k;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffectImpl;
@ -38,7 +38,7 @@ public final class KarnSilverGolem extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Karn, Silver Golem blocks or becomes blocked, it gets -4/+4 until end of turn.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new BoostSourceEffect(-4, +4, Duration.EndOfTurn), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(-4, +4, Duration.EndOfTurn), false));
// {1}: Target noncreature artifact becomes an artifact creature with power and toughness each equal to its converted mana cost until end of turn.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new KarnSilverGolemEffect(), new ManaCostsImpl("{1"));

View file

@ -6,7 +6,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbility;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.condition.common.NoSpellsWereCastLastTurnCondition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
@ -36,7 +36,7 @@ public final class KessigForgemaster extends CardImpl {
this.secondSideCardClazz = mage.cards.f.FlameheartWerewolf.class;
// Whenever Kessig Forgemaster blocks or becomes blocked by a creature, Kessig Forgemaster deals 1 damage to that creature.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new DamageTargetEffect(1, true, "that creature"),
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new DamageTargetEffect(1, true, "that creature"),
StaticFilters.FILTER_PERMANENT_CREATURE, false, null, true));
// At the beginning of each upkeep, if no spells were cast last turn, transform Kessig Forgemaster.

View file

@ -2,7 +2,7 @@ package mage.cards.l;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.CantBeRegeneratedTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
@ -25,7 +25,7 @@ public final class LimDulsCohort extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Lim-Dûl's Cohort blocks or becomes blocked by a creature, that creature can't be regenerated this turn.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(
new CantBeRegeneratedTargetEffect(Duration.EndOfTurn),
new FilterCreaturePermanent(),
false,

View file

@ -3,7 +3,7 @@ package mage.cards.m;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.AttachEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
@ -61,7 +61,7 @@ public final class MammothHarness extends CardImpl {
}
}
class MammothHarnessTriggeredAbility extends BlocksOrBecomesBlockedTriggeredAbility {
class MammothHarnessTriggeredAbility extends BlocksOrBecomesBlockedSourceTriggeredAbility {
public MammothHarnessTriggeredAbility() {
super(new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn), StaticFilters.FILTER_PERMANENT_CREATURE, false, null, false);

View file

@ -1,7 +1,7 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.DestroyTargetEffect;
import mage.abilities.effects.common.continuous.BoostEquippedEffect;
@ -44,7 +44,7 @@ public final class MirrorShield extends CardImpl {
ability.addEffect(new GainAbilityAttachedEffect(
HexproofAbility.getInstance(), AttachmentType.EQUIPMENT
).setText("and has hexproof"));
ability.addEffect(new GainAbilityAttachedEffect(new BlocksOrBecomesBlockedTriggeredAbility(
ability.addEffect(new GainAbilityAttachedEffect(new BlocksOrBecomesBlockedSourceTriggeredAbility(
new DestroyTargetEffect(), filter, false, rule + "", true
), AttachmentType.EQUIPMENT).setText("and \"" + rule + "\""));
this.addAbility(ability);

View file

@ -2,7 +2,7 @@ package mage.cards.o;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.constants.SubType;
import mage.cards.CardImpl;
@ -24,7 +24,7 @@ public final class OrneryGoblin extends CardImpl {
this.toughness = new MageInt(1);
// Whenever Ornery Goblin blocks or becomes blocked by a creature, Ornery Goblin deals 1 damage to that creature.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(
new DamageTargetEffect(1, true, "that creature"), false
));
}

View file

@ -3,7 +3,7 @@ package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -24,7 +24,7 @@ public final class RagingGorilla extends CardImpl {
this.toughness = new MageInt(3);
// Whenever Raging Gorilla blocks or becomes blocked, it gets +2/-2 until end of turn.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new BoostSourceEffect(2, -2, Duration.EndOfTurn), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(2, -2, Duration.EndOfTurn), false));
}
public RagingGorilla(final RagingGorilla card) {

View file

@ -3,7 +3,7 @@ package mage.cards.r;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -38,7 +38,7 @@ public final class RockBasilisk extends CardImpl {
Effect effect = new CreateDelayedTriggeredAbilityEffect(
new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect()), true);
effect.setText("destroy that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, filter, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, filter, false));
}
public RockBasilisk(final RockBasilisk card) {

View file

@ -3,7 +3,7 @@ package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -29,7 +29,7 @@ public final class SawtoothOgre extends CardImpl {
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(
new DamageTargetEffect(1)), true)
.setText("{this} deals 1 damage to that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, false));
}
public SawtoothOgre(final SawtoothOgre card) {

View file

@ -4,7 +4,7 @@ package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.SetPowerToughnessSourceEffect;
@ -37,7 +37,7 @@ public final class ShapeStealer extends CardImpl {
// each one in succession. The first trigger put on the stack will be the last to resolve,
// so that will set Shape Stealer's final power and toughness.
// Whenever Shape Stealer blocks or becomes blocked by a creature, change Shape Stealer's base power and toughness to that creature's power and toughness until end of turn.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new ShapeStealerEffect(), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new ShapeStealerEffect(), false));
}
public ShapeStealer(final ShapeStealer card) {

View file

@ -3,7 +3,7 @@ package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.common.continuous.BoostSourceEffect;
import mage.abilities.keyword.WitherAbility;
import mage.cards.CardImpl;
@ -28,7 +28,7 @@ public final class SlinkingGiant extends CardImpl {
this.addAbility(WitherAbility.getInstance());
// Whenever Slinking Giant blocks or becomes blocked, it gets -3/-0 until end of turn.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new BoostSourceEffect(-3, 0, Duration.EndOfTurn), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new BoostSourceEffect(-3, 0, Duration.EndOfTurn), false));
}
public SlinkingGiant(final SlinkingGiant card) {

View file

@ -4,7 +4,7 @@ package mage.cards.s;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.OneShotEffect;
@ -39,7 +39,7 @@ public final class SpittingSlug extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Spitting Slug blocks or becomes blocked, you may pay {1}{G}. If you do, Spitting Slug gains first strike until end of turn. Otherwise, each creature blocking or blocked by Spitting Slug gains first strike until end of turn.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(
new DoIfCostPaid(new GainAbilitySourceEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn),
new SpittingSlugEffect(),
new ManaCostsImpl("{1}{G}")).setText("you may pay {1}{G}. If you do, {this} gains first strike until end of turn. Otherwise, each creature blocking or blocked by {this} gains first strike until end of turn"),

View file

@ -3,7 +3,7 @@ package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.continuous.LoseAbilityTargetEffect;
import mage.abilities.keyword.FirstStrikeAbility;
@ -31,7 +31,7 @@ public final class TalruumChampion extends CardImpl {
// Whenever Talruum Champion blocks or becomes blocked by a creature, that creature loses first strike until end of turn.
Effect effect = new LoseAbilityTargetEffect(FirstStrikeAbility.getInstance(), Duration.EndOfTurn);
effect.setText("that creature loses first strike until end of turn");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, false));
}
public TalruumChampion(final TalruumChampion card) {

View file

@ -3,7 +3,7 @@ package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -30,7 +30,7 @@ public final class TangleAsp extends CardImpl {
// Whenever Tangle Asp blocks or becomes blocked by a creature, destroy that creature at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect()), true);
effect.setText("destroy that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, false));
}
public TangleAsp(final TangleAsp card) {

View file

@ -3,7 +3,7 @@ package mage.cards.t;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -37,7 +37,7 @@ public final class ThicketBasilisk extends CardImpl {
// Whenever Thicket Basilisk blocks or becomes blocked by a non-Wall creature, destroy that creature at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect()), true);
effect.setText("destroy that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, filter, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, filter, false));
}
public ThicketBasilisk(final ThicketBasilisk card) {

View file

@ -6,7 +6,7 @@ import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
@ -30,7 +30,7 @@ public final class TreefolkMystic extends CardImpl {
this.toughness = new MageInt(4);
// Whenever Treefolk Mystic blocks or becomes blocked by a creature, destroy all Auras attached to that creature.
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(new TreefolkMysticEffect(), false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(new TreefolkMysticEffect(), false));
}
public TreefolkMystic(final TreefolkMystic card) {

View file

@ -3,7 +3,7 @@ package mage.cards.v;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.delayed.AtTheEndOfCombatDelayedTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect;
@ -32,7 +32,7 @@ public final class VenomousDragonfly extends CardImpl {
// Whenever Venomous Dragonfly blocks or becomes blocked by a creature, destroy that creature at end of combat.
Effect effect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(new DestroyTargetEffect()));
effect.setText("destroy that creature at end of combat");
this.addAbility(new BlocksOrBecomesBlockedTriggeredAbility(effect, false));
this.addAbility(new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, false));
}
public VenomousDragonfly(final VenomousDragonfly card) {

View file

@ -4,7 +4,7 @@ package mage.cards.w;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.BlocksOrBecomesBlockedTriggeredAbility;
import mage.abilities.common.BlocksOrBecomesBlockedSourceTriggeredAbility;
import mage.abilities.common.DealsDamageToOpponentTriggeredAbility;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.RemoveAllCountersSourceEffect;
@ -34,7 +34,7 @@ public final class WitherscaleWurm extends CardImpl {
// Whenever Witherscale Wurm blocks or becomes blocked by a creature, that creature gains wither until end of turn.
Effect effect = new GainAbilityTargetEffect(WitherAbility.getInstance(), Duration.EndOfTurn);
effect.setText("that creature gains wither until end of turn");
Ability ability = new BlocksOrBecomesBlockedTriggeredAbility(effect, new FilterCreaturePermanent("a creature"), false, null, true);
Ability ability = new BlocksOrBecomesBlockedSourceTriggeredAbility(effect, new FilterCreaturePermanent("a creature"), false, null, true);
this.addAbility(ability);
// Whenever Witherscale Wurm deals damage to an opponent, remove all -1/-1 counters from it.

View file

@ -0,0 +1,91 @@
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 North, Loki
*/
public class BlocksOrBecomesBlockedSourceTriggeredAbility extends TriggeredAbilityImpl {
protected FilterPermanent filter;
protected String rule;
protected boolean setTargetPointer;
public BlocksOrBecomesBlockedSourceTriggeredAbility(Effect effect, boolean optional) {
this(effect, StaticFilters.FILTER_PERMANENT_CREATURE, optional, null, true);
}
public BlocksOrBecomesBlockedSourceTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional) {
this(effect, filter, optional, null, true);
}
public BlocksOrBecomesBlockedSourceTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, String rule) {
this(effect, filter, optional, rule, true);
}
public BlocksOrBecomesBlockedSourceTriggeredAbility(Effect effect, FilterPermanent filter, boolean optional, String rule, boolean setTargetPointer) {
super(Zone.BATTLEFIELD, effect, optional);
this.filter = filter;
this.rule = rule;
this.setTargetPointer = setTargetPointer;
}
public BlocksOrBecomesBlockedSourceTriggeredAbility(final BlocksOrBecomesBlockedSourceTriggeredAbility ability) {
super(ability);
this.filter = ability.filter;
this.rule = ability.rule;
this.setTargetPointer = ability.setTargetPointer;
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.BLOCKER_DECLARED;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
if (event.getSourceId().equals(this.getSourceId())) {
Permanent blocked = game.getPermanent(event.getTargetId());
if (blocked != null && filter.match(blocked, game)) {
if (setTargetPointer) {
this.getEffects().setTargetPointer(new FixedTarget(blocked, game));
}
return true;
}
}
if (event.getTargetId().equals(this.getSourceId())) {
Permanent blocker = game.getPermanent(event.getSourceId());
if (blocker != null && filter.match(blocker, game)) {
if (setTargetPointer) {
this.getEffects().setTargetPointer(new FixedTarget(blocker, game));
}
return true;
}
}
return false;
}
@Override
public String getRule() {
if (rule != null) {
return rule;
}
return "Whenever {this} blocks or becomes blocked" + (setTargetPointer ? " by a " + filter.getMessage() : "") + ", " + super.getRule();
}
@Override
public BlocksOrBecomesBlockedSourceTriggeredAbility copy() {
return new BlocksOrBecomesBlockedSourceTriggeredAbility(this);
}
}