Some minor changes to Hunting Wilds.

This commit is contained in:
LevelX2 2016-02-04 10:57:48 +01:00
parent 4b7e774ff8
commit 7c8d0881f7
2 changed files with 29 additions and 31 deletions

View file

@ -40,6 +40,8 @@ import mage.abilities.effects.common.search.SearchLibraryPutInPlayEffect;
import mage.abilities.keyword.HasteAbility; import mage.abilities.keyword.HasteAbility;
import mage.abilities.keyword.KickerAbility; import mage.abilities.keyword.KickerAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.Cards;
import mage.cards.CardsImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Duration; import mage.constants.Duration;
import mage.constants.Outcome; import mage.constants.Outcome;
@ -49,7 +51,7 @@ import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.token.Token; import mage.game.permanent.token.Token;
import mage.target.common.TargetCardInLibrary; import mage.target.common.TargetCardInLibrary;
import mage.target.targetpointer.FixedTarget; import mage.target.targetpointer.FixedTargets;
/** /**
* *
@ -103,25 +105,22 @@ class HuntingWildsEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
if (game.getPlayer(source.getControllerId()) != null) {
for (Effect sourceEffect : source.getEffects()) { for (Effect sourceEffect : source.getEffects()) {
if (sourceEffect instanceof SearchLibraryPutInPlayEffect) { if (sourceEffect instanceof SearchLibraryPutInPlayEffect) {
for (UUID target : ((SearchLibraryPutInPlayEffect)sourceEffect).getTargets()) { Cards foundCards = new CardsImpl(((SearchLibraryPutInPlayEffect) sourceEffect).getTargets());
if (target != null) { if (!foundCards.isEmpty()) {
FixedTarget fixedTarget = new FixedTarget(target); FixedTargets fixedTargets = new FixedTargets(foundCards, game);
BecomesCreatureTargetEffect becomesCreatureEffect = new BecomesCreatureTargetEffect(new HuntingWildsToken(), false, true, Duration.Custom);
becomesCreatureEffect.setTargetPointer(fixedTarget);
game.addEffect(becomesCreatureEffect, source);
UntapTargetEffect untapEffect = new UntapTargetEffect(); UntapTargetEffect untapEffect = new UntapTargetEffect();
untapEffect.setTargetPointer(fixedTarget); untapEffect.setTargetPointer(fixedTargets);
untapEffect.apply(game, source); untapEffect.apply(game, source);
}
BecomesCreatureTargetEffect becomesCreatureEffect = new BecomesCreatureTargetEffect(new HuntingWildsToken(), false, true, Duration.Custom);
becomesCreatureEffect.setTargetPointer(fixedTargets);
game.addEffect(becomesCreatureEffect, source);
} }
return true; return true;
} }
} }
}
return false; return false;
} }
} }

View file

@ -24,15 +24,14 @@
* The views and conclusions contained in the software and documentation are those of the * The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed * authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com. * or implied, of BetaSteward_at_googlemail.com.
*/ */
package mage.abilities.effects.common; package mage.abilities.effects.common;
import java.util.UUID; import java.util.UUID;
import mage.constants.Outcome;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.target.Target; import mage.target.Target;
@ -58,7 +57,7 @@ public class UntapTargetEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
for (UUID target: targetPointer.getTargets(game, source)) { for (UUID target : targetPointer.getTargets(game, source)) {
Permanent permanent = game.getPermanent(target); Permanent permanent = game.getPermanent(target);
if (permanent != null) { if (permanent != null) {
permanent.untap(game); permanent.untap(game);