forked from External/mage
[TLA] Implement Obsessive Pursuit
This commit is contained in:
parent
26488bf6e2
commit
04af8e94ab
6 changed files with 106 additions and 49 deletions
74
Mage.Sets/src/mage/cards/o/ObsessivePursuit.java
Normal file
74
Mage.Sets/src/mage/cards/o/ObsessivePursuit.java
Normal file
|
|
@ -0,0 +1,74 @@
|
||||||
|
package mage.cards.o;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.AttacksWithCreaturesTriggeredAbility;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.abilities.decorator.ConditionalOneShotEffect;
|
||||||
|
import mage.abilities.dynamicvalue.common.PermanentsSacrificedThisTurnCount;
|
||||||
|
import mage.abilities.effects.common.AddContinuousEffectToGame;
|
||||||
|
import mage.abilities.effects.common.CreateTokenEffect;
|
||||||
|
import mage.abilities.effects.common.LoseLifeSourceControllerEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
||||||
|
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||||
|
import mage.abilities.keyword.LifelinkAbility;
|
||||||
|
import mage.abilities.meta.OrTriggeredAbility;
|
||||||
|
import mage.abilities.triggers.BeginningOfUpkeepTriggeredAbility;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.counters.CounterType;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.token.ClueArtifactToken;
|
||||||
|
import mage.target.common.TargetAttackingCreature;
|
||||||
|
import mage.watchers.common.PermanentsSacrificedWatcher;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class ObsessivePursuit extends CardImpl {
|
||||||
|
|
||||||
|
public ObsessivePursuit(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{B}");
|
||||||
|
|
||||||
|
// When this enchantment enters and at the beginning of your upkeep, you lose 1 life and create a Clue token.
|
||||||
|
Ability ability = new OrTriggeredAbility(
|
||||||
|
Zone.BATTLEFIELD, new LoseLifeSourceControllerEffect(1),
|
||||||
|
new EntersBattlefieldTriggeredAbility(null), new BeginningOfUpkeepTriggeredAbility(null)
|
||||||
|
).setTriggerPhrase("When {this} enters and at the beginning of your upkeep, ");
|
||||||
|
ability.addEffect(new CreateTokenEffect(new ClueArtifactToken()).concatBy("and"));
|
||||||
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
// Whenever you attack, put X +1/+1 counters on target attacking creature, where X is the number of permanents you've sacrificed this turn. If X is three or greater, that creature gains lifelink until end of turn.
|
||||||
|
ability = new AttacksWithCreaturesTriggeredAbility(new AddCountersTargetEffect(
|
||||||
|
CounterType.P1P1.createInstance(), PermanentsSacrificedThisTurnCount.YOU
|
||||||
|
), 1).addHint(PermanentsSacrificedThisTurnCount.YOU.getHint());
|
||||||
|
ability.addEffect(new ConditionalOneShotEffect(
|
||||||
|
new AddContinuousEffectToGame(new GainAbilityTargetEffect(LifelinkAbility.getInstance())),
|
||||||
|
ObsessivePursuitCondition.instance, "If X is three or greater, that creature gains lifelink until end of turn"
|
||||||
|
));
|
||||||
|
ability.addTarget(new TargetAttackingCreature());
|
||||||
|
this.addAbility(ability, new PermanentsSacrificedWatcher());
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObsessivePursuit(final ObsessivePursuit card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ObsessivePursuit copy() {
|
||||||
|
return new ObsessivePursuit(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ObsessivePursuitCondition implements Condition {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
return PermanentsSacrificedThisTurnCount.YOU.calculate(game, source, null) >= 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,7 +12,6 @@ import mage.abilities.effects.CreateTokenCopySourceEffect;
|
||||||
import mage.abilities.effects.common.continuous.AddCardTypeSourceEffect;
|
import mage.abilities.effects.common.continuous.AddCardTypeSourceEffect;
|
||||||
import mage.abilities.hint.Hint;
|
import mage.abilities.hint.Hint;
|
||||||
import mage.abilities.hint.ValueHint;
|
import mage.abilities.hint.ValueHint;
|
||||||
import mage.abilities.hint.common.PermanentsSacrificedThisTurnHint;
|
|
||||||
import mage.abilities.keyword.CrewAbility;
|
import mage.abilities.keyword.CrewAbility;
|
||||||
import mage.abilities.keyword.FlyingAbility;
|
import mage.abilities.keyword.FlyingAbility;
|
||||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||||
|
|
@ -59,7 +58,7 @@ public final class PhoenixFleetAirship extends CardImpl {
|
||||||
// At the beginning of your end step, if you sacrificed a permanent this turn, create a token that's a copy of this Vehicle.
|
// At the beginning of your end step, if you sacrificed a permanent this turn, create a token that's a copy of this Vehicle.
|
||||||
this.addAbility(new BeginningOfEndStepTriggeredAbility(new CreateTokenCopySourceEffect())
|
this.addAbility(new BeginningOfEndStepTriggeredAbility(new CreateTokenCopySourceEffect())
|
||||||
.withInterveningIf(PhoenixFleetAirshipCondition.instance)
|
.withInterveningIf(PhoenixFleetAirshipCondition.instance)
|
||||||
.addHint(PermanentsSacrificedThisTurnHint.instance), new PermanentsSacrificedWatcher());
|
.addHint(PermanentsSacrificedThisTurnCount.YOU.getHint()), new PermanentsSacrificedWatcher());
|
||||||
|
|
||||||
// As long as you control eight or more permanents named Phoenix Fleet Airship, this Vehicle is an artifact creature.
|
// As long as you control eight or more permanents named Phoenix Fleet Airship, this Vehicle is an artifact creature.
|
||||||
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
this.addAbility(new SimpleStaticAbility(new ConditionalContinuousEffect(
|
||||||
|
|
@ -87,7 +86,7 @@ enum PhoenixFleetAirshipCondition implements Condition {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
return PermanentsSacrificedThisTurnCount.instance.calculate(game, source, null) > 0;
|
return PermanentsSacrificedThisTurnCount.YOU.calculate(game, source, null) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ import mage.abilities.dynamicvalue.common.PermanentsSacrificedThisTurnCount;
|
||||||
import mage.abilities.effects.common.DestroyTargetEffect;
|
import mage.abilities.effects.common.DestroyTargetEffect;
|
||||||
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
|
import mage.abilities.effects.common.combat.CantBeBlockedByCreaturesSourceEffect;
|
||||||
import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect;
|
import mage.abilities.effects.common.cost.SpellCostReductionSourceEffect;
|
||||||
import mage.abilities.hint.common.PermanentsSacrificedThisTurnHint;
|
|
||||||
import mage.abilities.keyword.HasteAbility;
|
import mage.abilities.keyword.HasteAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
|
|
@ -23,13 +22,12 @@ import mage.watchers.common.PermanentsSacrificedWatcher;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Susucr
|
* @author Susucr
|
||||||
*/
|
*/
|
||||||
public final class TheBalrogDurinsBane extends CardImpl {
|
public final class TheBalrogDurinsBane extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCreaturePermanent filterNonLegendary
|
private static final FilterCreaturePermanent filterNonLegendary
|
||||||
= new FilterCreaturePermanent("except by legendary creatures");
|
= new FilterCreaturePermanent("except by legendary creatures");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filterNonLegendary.add(Predicates.not(SuperType.LEGENDARY.getPredicate()));
|
filterNonLegendary.add(Predicates.not(SuperType.LEGENDARY.getPredicate()));
|
||||||
|
|
@ -37,7 +35,7 @@ public final class TheBalrogDurinsBane extends CardImpl {
|
||||||
|
|
||||||
public TheBalrogDurinsBane(UUID ownerId, CardSetInfo setInfo) {
|
public TheBalrogDurinsBane(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{R}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{5}{B}{R}");
|
||||||
|
|
||||||
this.supertype.add(SuperType.LEGENDARY);
|
this.supertype.add(SuperType.LEGENDARY);
|
||||||
this.subtype.add(SubType.AVATAR);
|
this.subtype.add(SubType.AVATAR);
|
||||||
this.subtype.add(SubType.DEMON);
|
this.subtype.add(SubType.DEMON);
|
||||||
|
|
@ -46,12 +44,12 @@ public final class TheBalrogDurinsBane extends CardImpl {
|
||||||
|
|
||||||
// This spell costs {1} less to cast for each permanent sacrificed this turn.
|
// This spell costs {1} less to cast for each permanent sacrificed this turn.
|
||||||
this.addAbility(
|
this.addAbility(
|
||||||
new SimpleStaticAbility(
|
new SimpleStaticAbility(
|
||||||
Zone.ALL,
|
Zone.ALL,
|
||||||
new SpellCostReductionSourceEffect(PermanentsSacrificedThisTurnCount.instance)
|
new SpellCostReductionSourceEffect(PermanentsSacrificedThisTurnCount.ALL)
|
||||||
.setText("this spell costs {1} less to cast for each permanent sacrificed this turn")
|
.setText("this spell costs {1} less to cast for each permanent sacrificed this turn")
|
||||||
).addHint(PermanentsSacrificedThisTurnHint.instance).setRuleAtTheTop(true),
|
).addHint(PermanentsSacrificedThisTurnCount.ALL.getHint()).setRuleAtTheTop(true),
|
||||||
new PermanentsSacrificedWatcher()
|
new PermanentsSacrificedWatcher()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Haste
|
// Haste
|
||||||
|
|
@ -59,7 +57,7 @@ public final class TheBalrogDurinsBane extends CardImpl {
|
||||||
|
|
||||||
// The Balrog, Durin's Bane can't be blocked except by legendary creatures.
|
// The Balrog, Durin's Bane can't be blocked except by legendary creatures.
|
||||||
this.addAbility(new SimpleEvasionAbility((new CantBeBlockedByCreaturesSourceEffect(
|
this.addAbility(new SimpleEvasionAbility((new CantBeBlockedByCreaturesSourceEffect(
|
||||||
filterNonLegendary, Duration.WhileOnBattlefield
|
filterNonLegendary, Duration.WhileOnBattlefield
|
||||||
))));
|
))));
|
||||||
|
|
||||||
// When The Balrog dies, destroy target artifact or creature an opponent controls.
|
// When The Balrog dies, destroy target artifact or creature an opponent controls.
|
||||||
|
|
|
||||||
|
|
@ -269,6 +269,8 @@ public final class AvatarTheLastAirbender extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("North Pole Gates", 274, Rarity.COMMON, mage.cards.n.NorthPoleGates.class));
|
cards.add(new SetCardInfo("North Pole Gates", 274, Rarity.COMMON, mage.cards.n.NorthPoleGates.class));
|
||||||
cards.add(new SetCardInfo("North Pole Patrol", 65, Rarity.UNCOMMON, mage.cards.n.NorthPolePatrol.class));
|
cards.add(new SetCardInfo("North Pole Patrol", 65, Rarity.UNCOMMON, mage.cards.n.NorthPolePatrol.class));
|
||||||
cards.add(new SetCardInfo("Northern Air Temple", 111, Rarity.UNCOMMON, mage.cards.n.NorthernAirTemple.class));
|
cards.add(new SetCardInfo("Northern Air Temple", 111, Rarity.UNCOMMON, mage.cards.n.NorthernAirTemple.class));
|
||||||
|
cards.add(new SetCardInfo("Obsessive Pursuit", 112, Rarity.RARE, mage.cards.o.ObsessivePursuit.class, NON_FULL_USE_VARIOUS));
|
||||||
|
cards.add(new SetCardInfo("Obsessive Pursuit", 340, Rarity.RARE, mage.cards.o.ObsessivePursuit.class, NON_FULL_USE_VARIOUS));
|
||||||
cards.add(new SetCardInfo("Octopus Form", 66, Rarity.COMMON, mage.cards.o.OctopusForm.class));
|
cards.add(new SetCardInfo("Octopus Form", 66, Rarity.COMMON, mage.cards.o.OctopusForm.class));
|
||||||
cards.add(new SetCardInfo("Omashu City", 275, Rarity.COMMON, mage.cards.o.OmashuCity.class));
|
cards.add(new SetCardInfo("Omashu City", 275, Rarity.COMMON, mage.cards.o.OmashuCity.class));
|
||||||
cards.add(new SetCardInfo("Origin of Metalbending", 187, Rarity.COMMON, mage.cards.o.OriginOfMetalbending.class));
|
cards.add(new SetCardInfo("Origin of Metalbending", 187, Rarity.COMMON, mage.cards.o.OriginOfMetalbending.class));
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ package mage.abilities.dynamicvalue.common;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.dynamicvalue.DynamicValue;
|
import mage.abilities.dynamicvalue.DynamicValue;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.hint.Hint;
|
||||||
|
import mage.abilities.hint.ValueHint;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.watchers.common.PermanentsSacrificedWatcher;
|
import mage.watchers.common.PermanentsSacrificedWatcher;
|
||||||
|
|
||||||
|
|
@ -11,20 +13,27 @@ import mage.watchers.common.PermanentsSacrificedWatcher;
|
||||||
* @author Susucr
|
* @author Susucr
|
||||||
*/
|
*/
|
||||||
public enum PermanentsSacrificedThisTurnCount implements DynamicValue {
|
public enum PermanentsSacrificedThisTurnCount implements DynamicValue {
|
||||||
instance;
|
ALL(true),
|
||||||
|
YOU(false);
|
||||||
|
private final boolean all;
|
||||||
|
private final Hint hint;
|
||||||
|
|
||||||
|
PermanentsSacrificedThisTurnCount(boolean all) {
|
||||||
|
this.all = all;
|
||||||
|
this.hint = new ValueHint("Permanents " + (all ? "" : "you ") + "sacrificed this turn", this);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||||
PermanentsSacrificedWatcher watcher = game.getState().getWatcher(PermanentsSacrificedWatcher.class);
|
PermanentsSacrificedWatcher watcher = game.getState().getWatcher(PermanentsSacrificedWatcher.class);
|
||||||
if (watcher != null) {
|
return this.all
|
||||||
return watcher.getThisTurnSacrificedPermanents();
|
? watcher.getThisTurnSacrificedPermanents()
|
||||||
}
|
: watcher.getThisTurnSacrificedPermanents(sourceAbility.getControllerId()).size();
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PermanentsSacrificedThisTurnCount copy() {
|
public PermanentsSacrificedThisTurnCount copy() {
|
||||||
return PermanentsSacrificedThisTurnCount.instance;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -34,7 +43,10 @@ public enum PermanentsSacrificedThisTurnCount implements DynamicValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return "permanents sacrificed this turn";
|
return "the number of permanents " + (this.all ? "" : "you've ") + "sacrificed this turn";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Hint getHint() {
|
||||||
|
return hint;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
package mage.abilities.hint.common;
|
|
||||||
|
|
||||||
import mage.abilities.Ability;
|
|
||||||
import mage.abilities.dynamicvalue.common.PermanentsSacrificedThisTurnCount;
|
|
||||||
import mage.abilities.hint.Hint;
|
|
||||||
import mage.abilities.hint.ValueHint;
|
|
||||||
import mage.game.Game;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Susucr
|
|
||||||
*/
|
|
||||||
public enum PermanentsSacrificedThisTurnHint implements Hint {
|
|
||||||
instance;
|
|
||||||
|
|
||||||
private static final Hint hint = new ValueHint(
|
|
||||||
"Permanents sacrificed this turn", PermanentsSacrificedThisTurnCount.instance
|
|
||||||
);
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getText(Game game, Ability ability) {
|
|
||||||
return hint.getText(game, ability);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PermanentsSacrificedThisTurnHint copy() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue