mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
Merge pull request #10059 from Grath/grath/fix-mari-the-killing-quill
[NCC] Fix Mari, the Killing Quill
This commit is contained in:
commit
30c49de105
1 changed files with 65 additions and 32 deletions
|
@ -2,17 +2,18 @@ package mage.cards.m;
|
|||
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.costs.common.RemoveCounterCost;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.abilities.effects.common.CreateTokenEffect;
|
||||
import mage.abilities.effects.common.DoIfCostPaid;
|
||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||
import mage.abilities.effects.common.continuous.GainAbilityControlledEffect;
|
||||
import mage.abilities.keyword.DeathtouchAbility;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.cards.CardSetInfo;
|
||||
import mage.constants.*;
|
||||
|
@ -26,11 +27,10 @@ import mage.filter.predicate.card.OwnerIdPredicate;
|
|||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.events.ZoneChangeEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.game.permanent.PermanentToken;
|
||||
import mage.game.permanent.token.TreasureToken;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetCard;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
import java.util.UUID;
|
||||
|
@ -58,7 +58,7 @@ public class MariTheKillingQuill extends CardImpl {
|
|||
this.toughness = new MageInt(2);
|
||||
|
||||
// Whenever a creature an opponent controls dies, exile it with a hit counter on it.
|
||||
this.addAbility(new SimpleStaticAbility(new MariTheKillingQuillReplacementEffect()));
|
||||
this.addAbility(new MariTheKillingQuillCreatureDiesAbility());
|
||||
|
||||
// Assassins, Mercenaries, and Rogues you control have deathtouch and
|
||||
// "Whenever this creature deals combat damage to a player, you may remove a hit counter from a card that player owns in exile.
|
||||
|
@ -158,46 +158,79 @@ class MariTheKillingQuillDrawAndTokenEffect extends OneShotEffect {
|
|||
}
|
||||
}
|
||||
|
||||
// Based on Draugr Necromancer
|
||||
class MariTheKillingQuillReplacementEffect extends ReplacementEffectImpl {
|
||||
// Based on Patron of the Vein
|
||||
class MariTheKillingQuillCreatureDiesAbility extends TriggeredAbilityImpl {
|
||||
|
||||
MariTheKillingQuillReplacementEffect() {
|
||||
super(Duration.WhileOnBattlefield, Outcome.Exile);
|
||||
staticText = "Whenever a creature an opponent controls dies, exile it with a hit counter on it.";
|
||||
public MariTheKillingQuillCreatureDiesAbility() {
|
||||
super(Zone.BATTLEFIELD, new MariTheKillingQuillExileCreatureEffect(), false);
|
||||
}
|
||||
|
||||
private MariTheKillingQuillReplacementEffect(final MariTheKillingQuillReplacementEffect effect) {
|
||||
super(effect);
|
||||
public MariTheKillingQuillCreatureDiesAbility(final MariTheKillingQuillCreatureDiesAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MariTheKillingQuillReplacementEffect copy() {
|
||||
return new MariTheKillingQuillReplacementEffect(this);
|
||||
public MariTheKillingQuillCreatureDiesAbility copy() {
|
||||
return new MariTheKillingQuillCreatureDiesAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null
|
||||
|| permanent == null
|
||||
|| !controller.hasOpponent(permanent.getControllerId(), game)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return CardUtil.moveCardWithCounter(game, source, controller, permanent, Zone.EXILED, CounterType.HIT.createInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checksEventType(GameEvent event, Game game) {
|
||||
public boolean checkEventType(GameEvent event, Game game) {
|
||||
return event.getType() == GameEvent.EventType.ZONE_CHANGE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||
ZoneChangeEvent zce = (ZoneChangeEvent) event;
|
||||
return zce.isDiesEvent()
|
||||
&& zce.getTarget().isCreature(game)
|
||||
&& !(zce.getTarget() instanceof PermanentToken);
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (((ZoneChangeEvent) event).isDiesEvent()) {
|
||||
if (game.getOpponents(this.controllerId).contains(event.getPlayerId())) {
|
||||
Card creature = game.getPermanentOrLKIBattlefield(event.getTargetId());
|
||||
if (creature != null
|
||||
&& creature.isCreature(game)) {
|
||||
for (Effect effect : this.getEffects()) {
|
||||
effect.setTargetPointer(new FixedTarget(creature.getId(), game));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a creature an opponent controls dies, exile it with a hit counter on it.";
|
||||
}
|
||||
}
|
||||
|
||||
class MariTheKillingQuillExileCreatureEffect extends OneShotEffect {
|
||||
|
||||
public MariTheKillingQuillExileCreatureEffect() {
|
||||
super(Outcome.Benefit);
|
||||
this.staticText = "exile it with a hit counter on it";
|
||||
}
|
||||
|
||||
public MariTheKillingQuillExileCreatureEffect(final MariTheKillingQuillExileCreatureEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MariTheKillingQuillExileCreatureEffect copy() {
|
||||
return new MariTheKillingQuillExileCreatureEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller == null) {
|
||||
return false;
|
||||
}
|
||||
Card card = game.getCard(this.getTargetPointer().getFirst(game, source));
|
||||
|
||||
if (card != null) {
|
||||
return CardUtil.moveCardWithCounter(game, source, controller, card, Zone.EXILED, CounterType.HIT.createInstance());
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue