mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Urge to Feed - Fixed selection of vampires during resolution handling.
This commit is contained in:
parent
99e998a89e
commit
58c0d859be
2 changed files with 11 additions and 16 deletions
|
@ -28,15 +28,14 @@
|
||||||
package mage.sets.worldwake;
|
package mage.sets.worldwake;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.constants.CardType;
|
|
||||||
import mage.constants.Rarity;
|
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
import mage.abilities.effects.common.continuous.BoostTargetEffect;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
import mage.constants.TargetController;
|
import mage.constants.TargetController;
|
||||||
import mage.counters.CounterType;
|
import mage.counters.CounterType;
|
||||||
import mage.filter.common.FilterCreaturePermanent;
|
import mage.filter.common.FilterCreaturePermanent;
|
||||||
|
@ -45,6 +44,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||||
import mage.filter.predicate.permanent.TappedPredicate;
|
import mage.filter.predicate.permanent.TappedPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
import mage.game.permanent.Permanent;
|
||||||
import mage.target.common.TargetCreaturePermanent;
|
import mage.target.common.TargetCreaturePermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +59,6 @@ public class UrgeToFeed extends CardImpl {
|
||||||
super(ownerId, 70, "Urge to Feed", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{B}{B}");
|
super(ownerId, 70, "Urge to Feed", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{B}{B}");
|
||||||
this.expansionSetCode = "WWK";
|
this.expansionSetCode = "WWK";
|
||||||
|
|
||||||
|
|
||||||
// Target creature gets -3/-3 until end of turn. You may tap any number of untapped Vampire creatures you control. If you do, put a +1/+1 counter on each of those Vampires.
|
// Target creature gets -3/-3 until end of turn. You may tap any number of untapped Vampire creatures you control. If you do, put a +1/+1 counter on each of those Vampires.
|
||||||
this.getSpellAbility().addEffect(new BoostTargetEffect(-3, -3, Duration.EndOfTurn));
|
this.getSpellAbility().addEffect(new BoostTargetEffect(-3, -3, Duration.EndOfTurn));
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent(filter));
|
||||||
|
@ -97,20 +96,17 @@ class UrgeToFeedEffect extends OneShotEffect {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
TargetCreaturePermanent target = new TargetCreaturePermanent(filter);
|
TargetCreaturePermanent target = new TargetCreaturePermanent(0, Integer.MAX_VALUE, filter, true);
|
||||||
while (true) {
|
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
|
||||||
target.clearChosen();
|
for (UUID vampireId : target.getTargets()) {
|
||||||
if (target.canChoose(source.getControllerId(), game) && target.choose(Outcome.Tap, source.getControllerId(), source.getSourceId(), game)) {
|
Permanent vampire = game.getPermanent(vampireId);
|
||||||
UUID vampire = target.getFirstTarget();
|
|
||||||
if (vampire != null) {
|
if (vampire != null) {
|
||||||
game.getPermanent(vampire).tap(game);
|
vampire.tap(game);
|
||||||
game.getPermanent(vampire).addCounters(CounterType.P1P1.createInstance(), game);
|
vampire.addCounters(CounterType.P1P1.createInstance(), game);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -34,7 +34,6 @@ import mage.filter.predicate.Predicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.target.Target;
|
import mage.target.Target;
|
||||||
import mage.target.Targets;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -57,7 +56,7 @@ public class NumberOfTargetsPredicate implements Predicate<MageObject> {
|
||||||
Mode mode = spell.getSpellAbility().getModes().get(modeId);
|
Mode mode = spell.getSpellAbility().getModes().get(modeId);
|
||||||
for (Target target : mode.getTargets()) {
|
for (Target target : mode.getTargets()) {
|
||||||
numberOfTargets += target.getTargets().size();
|
numberOfTargets += target.getTargets().size();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (numberOfTargets == targets) {
|
if (numberOfTargets == targets) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue