1
0
Fork 0
mirror of https://github.com/correl/mage.git synced 2025-04-03 01:08:59 -09:00

Hunter Sliver: use ProvokeAbility

could incorrectly untap any creature
This commit is contained in:
Neil Gentleman 2016-11-05 10:18:22 -07:00
parent e6dc8a56e6
commit 6887dfb61d

View file

@ -29,20 +29,15 @@ package mage.cards.h;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.AttacksTriggeredAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.keyword.ProvokeAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.abilities.effects.RequirementEffect;
import mage.abilities.effects.common.continuous.GainAbilityAllEffect;
import mage.constants.Zone;
import mage.filter.common.FilterCreaturePermanent;
import mage.target.common.TargetCreaturePermanent;
/**
*
@ -58,9 +53,8 @@ public class HunterSliver extends CardImpl {
this.toughness = new MageInt(1);
// All Sliver creatures have provoke.
Ability ability = new AttacksTriggeredAbility(new ProvokeEffect(), true, "may have target creature untap and block if able");
ability.addTarget(new TargetCreaturePermanent());
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(ability, Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures"))));
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new GainAbilityAllEffect(new ProvokeAbility(),
Duration.WhileOnBattlefield, new FilterCreaturePermanent("Sliver", "Sliver creatures"))));
}
public HunterSliver(final HunterSliver card) {
@ -72,54 +66,3 @@ public class HunterSliver extends CardImpl {
return new HunterSliver(this);
}
}
class ProvokeEffect extends RequirementEffect {
public ProvokeEffect() {
this(Duration.EndOfTurn);
}
public ProvokeEffect(Duration duration) {
super(duration);
staticText = "Target creature untaps and blocks {this} this turn if able";
}
public ProvokeEffect(final ProvokeEffect effect) {
super(effect);
}
@Override
public boolean applies(Permanent permanent, Ability source, Game game) {
if (permanent.getId().equals(targetPointer.getFirst(game, source))) {
Permanent blocker = game.getPermanent(source.getFirstTarget());
if (blocker != null && blocker.isTapped()) {
blocker.untap(game);
if (blocker.canBlock(source.getSourceId(), game)) {
return true;
}
}
}
return false;
}
@Override
public boolean mustAttack(Game game) {
return false;
}
@Override
public boolean mustBlock(Game game) {
return true;
}
@Override
public UUID mustBlockAttacker(Ability source, Game game) {
return source.getSourceId();
}
@Override
public ProvokeEffect copy() {
return new ProvokeEffect(this);
}
}