mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 19:41:59 -08:00
[MKC] Implement Hot Pursuit
This commit is contained in:
parent
17c43f3a44
commit
d64ddc999c
3 changed files with 117 additions and 1 deletions
111
Mage.Sets/src/mage/cards/h/HotPursuit.java
Normal file
111
Mage.Sets/src/mage/cards/h/HotPursuit.java
Normal file
|
|
@ -0,0 +1,111 @@
|
||||||
|
package mage.cards.h;
|
||||||
|
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.BeginningOfCombatTriggeredAbility;
|
||||||
|
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
|
||||||
|
import mage.abilities.condition.Condition;
|
||||||
|
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
|
||||||
|
import mage.abilities.effects.common.SuspectTargetEffect;
|
||||||
|
import mage.abilities.effects.common.combat.GoadTargetEffect;
|
||||||
|
import mage.abilities.effects.common.continuous.GainControlAllUntapGainHasteEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.CardSetInfo;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.TargetController;
|
||||||
|
import mage.constants.WatcherScope;
|
||||||
|
import mage.filter.FilterPermanent;
|
||||||
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
import mage.filter.predicate.Predicates;
|
||||||
|
import mage.filter.predicate.permanent.GoadedPredicate;
|
||||||
|
import mage.filter.predicate.permanent.SuspectedPredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.target.common.TargetOpponentsCreaturePermanent;
|
||||||
|
import mage.watchers.Watcher;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author TheElk801
|
||||||
|
*/
|
||||||
|
public final class HotPursuit extends CardImpl {
|
||||||
|
|
||||||
|
private static final FilterPermanent filter = new FilterCreaturePermanent("goaded and/or suspected creatures");
|
||||||
|
|
||||||
|
static {
|
||||||
|
filter.add(Predicates.or(
|
||||||
|
GoadedPredicate.instance,
|
||||||
|
SuspectedPredicate.instance
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
public HotPursuit(UUID ownerId, CardSetInfo setInfo) {
|
||||||
|
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{1}{R}");
|
||||||
|
|
||||||
|
// When Hot Pursuit enters the battlefield, suspect target creature an opponent controls. As long as Hot Pursuit remains on the battlefield, that creature is also goaded.
|
||||||
|
Ability ability = new EntersBattlefieldTriggeredAbility(new SuspectTargetEffect());
|
||||||
|
ability.addEffect(new GoadTargetEffect(Duration.UntilSourceLeavesBattlefield)
|
||||||
|
.setText("as long as {this} remains on the battlefield, that creature is also goaded"));
|
||||||
|
ability.addTarget(new TargetOpponentsCreaturePermanent());
|
||||||
|
this.addAbility(ability);
|
||||||
|
|
||||||
|
// At the beginning of combat on your turn, if two or more players have lost the game, gain control of all goaded and/or suspected creatures until end of turn. Untap them. They gain haste until end of turn.
|
||||||
|
this.addAbility(new ConditionalInterveningIfTriggeredAbility(
|
||||||
|
new BeginningOfCombatTriggeredAbility(
|
||||||
|
new GainControlAllUntapGainHasteEffect(filter),
|
||||||
|
TargetController.YOU, false
|
||||||
|
), HotPursuitCondition.instance, "At the beginning of combat on your turn, " +
|
||||||
|
"if two or more players have lost the game, gain control of all goaded and/or " +
|
||||||
|
"suspected creatures until end of turn. Untap them. They gain haste until end of turn."
|
||||||
|
), new HotPursuitWatcher());
|
||||||
|
}
|
||||||
|
|
||||||
|
private HotPursuit(final HotPursuit card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HotPursuit copy() {
|
||||||
|
return new HotPursuit(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum HotPursuitCondition implements Condition {
|
||||||
|
instance;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
return HotPursuitWatcher.checkCondition(game);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HotPursuitWatcher extends Watcher {
|
||||||
|
|
||||||
|
private final Set<UUID> players = new HashSet<>();
|
||||||
|
|
||||||
|
HotPursuitWatcher() {
|
||||||
|
super(WatcherScope.GAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void watch(GameEvent event, Game game) {
|
||||||
|
switch (event.getType()) {
|
||||||
|
case BEGINNING_PHASE_PRE:
|
||||||
|
players.clear();
|
||||||
|
return;
|
||||||
|
case LOST:
|
||||||
|
players.add(event.getPlayerId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static boolean checkCondition(Game game) {
|
||||||
|
return game
|
||||||
|
.getState()
|
||||||
|
.getWatcher(HotPursuitWatcher.class)
|
||||||
|
.players
|
||||||
|
.size() >= 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -129,6 +129,7 @@ public final class MurdersAtKarlovManorCommander extends ExpansionSet {
|
||||||
cards.add(new SetCardInfo("Hooded Hydra", 171, Rarity.MYTHIC, mage.cards.h.HoodedHydra.class));
|
cards.add(new SetCardInfo("Hooded Hydra", 171, Rarity.MYTHIC, mage.cards.h.HoodedHydra.class));
|
||||||
cards.add(new SetCardInfo("Hornet Queen", 172, Rarity.RARE, mage.cards.h.HornetQueen.class));
|
cards.add(new SetCardInfo("Hornet Queen", 172, Rarity.RARE, mage.cards.h.HornetQueen.class));
|
||||||
cards.add(new SetCardInfo("Hostile Desert", 266, Rarity.RARE, mage.cards.h.HostileDesert.class));
|
cards.add(new SetCardInfo("Hostile Desert", 266, Rarity.RARE, mage.cards.h.HostileDesert.class));
|
||||||
|
cards.add(new SetCardInfo("Hot Pursuit", 32, Rarity.RARE, mage.cards.h.HotPursuit.class));
|
||||||
cards.add(new SetCardInfo("Hydroid Krasis", 212, Rarity.RARE, mage.cards.h.HydroidKrasis.class));
|
cards.add(new SetCardInfo("Hydroid Krasis", 212, Rarity.RARE, mage.cards.h.HydroidKrasis.class));
|
||||||
cards.add(new SetCardInfo("Idol of Oblivion", 229, Rarity.RARE, mage.cards.i.IdolOfOblivion.class));
|
cards.add(new SetCardInfo("Idol of Oblivion", 229, Rarity.RARE, mage.cards.i.IdolOfOblivion.class));
|
||||||
cards.add(new SetCardInfo("Imperial Hellkite", 155, Rarity.RARE, mage.cards.i.ImperialHellkite.class));
|
cards.add(new SetCardInfo("Imperial Hellkite", 155, Rarity.RARE, mage.cards.i.ImperialHellkite.class));
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,11 @@ public class GoadTargetEffect extends ContinuousEffectImpl {
|
||||||
* each combat if able and attacks a player other than that player if able.
|
* each combat if able and attacks a player other than that player if able.
|
||||||
*/
|
*/
|
||||||
public GoadTargetEffect() {
|
public GoadTargetEffect() {
|
||||||
super(Duration.UntilYourNextTurn, Layer.RulesEffects, SubLayer.NA, Outcome.Detriment);
|
this(Duration.UntilYourNextTurn);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GoadTargetEffect(Duration duration) {
|
||||||
|
super(duration, Layer.RulesEffects, SubLayer.NA, Outcome.Detriment);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GoadTargetEffect(final GoadTargetEffect effect) {
|
private GoadTargetEffect(final GoadTargetEffect effect) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue