mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
[C17] fix Mathas, Fiend Seeker ability coming back when another counter is added
This commit is contained in:
parent
dfd09d9a78
commit
794fb7d42e
1 changed files with 38 additions and 44 deletions
|
|
@ -1,43 +1,30 @@
|
||||||
|
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageInt;
|
import mage.MageInt;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
|
||||||
import mage.abilities.common.DiesSourceTriggeredAbility;
|
import mage.abilities.common.DiesSourceTriggeredAbility;
|
||||||
import mage.abilities.effects.Effect;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DrawCardAllEffect;
|
import mage.abilities.effects.common.DrawCardAllEffect;
|
||||||
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
|
|
||||||
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
import mage.abilities.effects.common.counter.AddCountersTargetEffect;
|
||||||
import mage.abilities.keyword.MenaceAbility;
|
import mage.abilities.keyword.MenaceAbility;
|
||||||
|
import mage.abilities.triggers.BeginningOfEndStepTriggeredAbility;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.cards.CardSetInfo;
|
import mage.cards.CardSetInfo;
|
||||||
import mage.constants.CardType;
|
import mage.constants.*;
|
||||||
import mage.constants.SubType;
|
|
||||||
import mage.constants.Duration;
|
|
||||||
import mage.constants.Outcome;
|
|
||||||
import mage.constants.SuperType;
|
|
||||||
import mage.constants.TargetController;
|
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.StaticFilters;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPermanent;
|
import mage.target.common.TargetOpponentsCreaturePermanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
|
||||||
|
|
||||||
import static mage.filter.StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
public final class MathasFiendSeeker extends CardImpl {
|
public final class MathasFiendSeeker extends CardImpl {
|
||||||
|
|
||||||
private static final String rule = "For as long as that creature has a bounty counter on it, it has \"When this creature dies, each opponent draws a card and gains 2 life.\"";
|
|
||||||
|
|
||||||
public MathasFiendSeeker(UUID ownerId, CardSetInfo setInfo) {
|
public MathasFiendSeeker(UUID ownerId, CardSetInfo setInfo) {
|
||||||
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{W}{B}");
|
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{R}{W}{B}");
|
||||||
|
|
||||||
|
|
@ -50,12 +37,11 @@ public final class MathasFiendSeeker extends CardImpl {
|
||||||
this.addAbility(new MenaceAbility(false));
|
this.addAbility(new MenaceAbility(false));
|
||||||
|
|
||||||
// At the beginning of your end step, put a bounty counter on target creature an opponent controls. For as long as that creature has a bounty counter on it, it has "When this creature dies, each opponent draws a card and gains 2 life."
|
// At the beginning of your end step, put a bounty counter on target creature an opponent controls. For as long as that creature has a bounty counter on it, it has "When this creature dies, each opponent draws a card and gains 2 life."
|
||||||
Ability ability = new BeginningOfEndStepTriggeredAbility(new AddCountersTargetEffect(CounterType.BOUNTY.createInstance()));
|
Ability ability = new BeginningOfEndStepTriggeredAbility(
|
||||||
ability.addTarget(new TargetPermanent(FILTER_OPPONENTS_PERMANENT_CREATURE));
|
new AddCountersTargetEffect(CounterType.BOUNTY.createInstance())
|
||||||
Ability ability2 = new DiesSourceTriggeredAbility(new DrawCardAllEffect(1, TargetController.OPPONENT));
|
);
|
||||||
ability2.addEffect(new OpponentsGainLifeEffect());
|
ability.addEffect(new MathasFiendSeekerGainAbilityEffect());
|
||||||
Effect effect = new MathasFiendSeekerGainAbilityEffect(ability2, Duration.Custom, rule);
|
ability.addTarget(new TargetOpponentsCreaturePermanent());
|
||||||
ability.addEffect(effect);
|
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,56 +55,64 @@ public final class MathasFiendSeeker extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class MathasFiendSeekerGainAbilityEffect extends GainAbilityTargetEffect {
|
class MathasFiendSeekerGainAbilityEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
MathasFiendSeekerGainAbilityEffect(Ability ability, Duration duration, String rule) {
|
private final Ability ability;
|
||||||
super(ability, duration, rule);
|
|
||||||
|
MathasFiendSeekerGainAbilityEffect() {
|
||||||
|
super(Duration.Custom, Layer.AbilityAddingRemovingEffects_6, SubLayer.NA, Outcome.AddAbility);
|
||||||
|
staticText = "For as long as that creature has a bounty counter on it, " +
|
||||||
|
"it has \"When this creature dies, each opponent draws a card and gains 2 life.\"";
|
||||||
|
this.ability = new DiesSourceTriggeredAbility(new DrawCardAllEffect(1, TargetController.OPPONENT));
|
||||||
|
this.ability.addEffect(new MathasFiendSeekerGainLifeEffect());
|
||||||
}
|
}
|
||||||
|
|
||||||
private MathasFiendSeekerGainAbilityEffect(final MathasFiendSeekerGainAbilityEffect effect) {
|
private MathasFiendSeekerGainAbilityEffect(final MathasFiendSeekerGainAbilityEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
this.ability = effect.ability.copy();
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isInactive(Ability source, Game game) {
|
|
||||||
Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
|
||||||
if (creature != null && creature.getCounters(game).getCount(CounterType.BOUNTY) < 1) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MathasFiendSeekerGainAbilityEffect copy() {
|
public MathasFiendSeekerGainAbilityEffect copy() {
|
||||||
return new MathasFiendSeekerGainAbilityEffect(this);
|
return new MathasFiendSeekerGainAbilityEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Permanent creature = game.getPermanent(this.getTargetPointer().getFirst(game, source));
|
||||||
|
if (creature == null || !creature.getCounters(game).containsKey(CounterType.BOUNTY)) {
|
||||||
|
discard();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
creature.addAbility(ability, source.getSourceId(), game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OpponentsGainLifeEffect extends OneShotEffect {
|
class MathasFiendSeekerGainLifeEffect extends OneShotEffect {
|
||||||
|
|
||||||
OpponentsGainLifeEffect() {
|
MathasFiendSeekerGainLifeEffect() {
|
||||||
super(Outcome.GainLife);
|
super(Outcome.GainLife);
|
||||||
staticText = "and gains 2 life.";
|
staticText = "and gains 2 life.";
|
||||||
}
|
}
|
||||||
|
|
||||||
private OpponentsGainLifeEffect(final OpponentsGainLifeEffect effect) {
|
private MathasFiendSeekerGainLifeEffect(final MathasFiendSeekerGainLifeEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public OpponentsGainLifeEffect copy() {
|
public MathasFiendSeekerGainLifeEffect copy() {
|
||||||
return new OpponentsGainLifeEffect(this);
|
return new MathasFiendSeekerGainLifeEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(source.getControllerId(), game)) {
|
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null && game.isOpponent(player, source.getControllerId())) {
|
if (player != null) {
|
||||||
player.gainLife(2, game, source);
|
player.gainLife(2, game, source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue