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;
/** /**
* *
@ -63,13 +65,13 @@ public class HuntingWilds extends CardImpl {
// Kicker {3}{G} // Kicker {3}{G}
this.addAbility(new KickerAbility("{3}{G}")); this.addAbility(new KickerAbility("{3}{G}"));
FilterLandCard filter = new FilterLandCard("Forest card"); FilterLandCard filter = new FilterLandCard("Forest card");
filter.add(new SubtypePredicate("Forest")); filter.add(new SubtypePredicate("Forest"));
// Search your library for up to two Forest cards and put them onto the battlefield tapped. Then shuffle your library. // Search your library for up to two Forest cards and put them onto the battlefield tapped. Then shuffle your library.
this.getSpellAbility().addEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 2, filter), true)); this.getSpellAbility().addEffect(new SearchLibraryPutInPlayEffect(new TargetCardInLibrary(0, 2, filter), true));
// If Hunting Wilds was kicked, untap all Forests put onto the battlefield this way. // If Hunting Wilds was kicked, untap all Forests put onto the battlefield this way.
// They become 3/3 green creatures with haste that are still lands. // They become 3/3 green creatures with haste that are still lands.
this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new HuntingWildsEffect(), KickedCondition.getInstance())); this.getSpellAbility().addEffect(new ConditionalOneShotEffect(new HuntingWildsEffect(), KickedCondition.getInstance()));
@ -86,40 +88,37 @@ public class HuntingWilds extends CardImpl {
} }
class HuntingWildsEffect extends OneShotEffect { class HuntingWildsEffect extends OneShotEffect {
public HuntingWildsEffect() { public HuntingWildsEffect() {
super(Outcome.BecomeCreature); super(Outcome.BecomeCreature);
this.staticText = "Untap all Forests put onto the battlefield this way. They become 3/3 green creatures with haste that are still lands"; this.staticText = "Untap all Forests put onto the battlefield this way. They become 3/3 green creatures with haste that are still lands";
} }
public HuntingWildsEffect(final HuntingWildsEffect effect) { public HuntingWildsEffect(final HuntingWildsEffect effect) {
super(effect); super(effect);
} }
@Override @Override
public HuntingWildsEffect copy() { public HuntingWildsEffect copy() {
return new HuntingWildsEffect(this); return new HuntingWildsEffect(this);
} }
@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) { Cards foundCards = new CardsImpl(((SearchLibraryPutInPlayEffect) sourceEffect).getTargets());
for (UUID target : ((SearchLibraryPutInPlayEffect)sourceEffect).getTargets()) { if (!foundCards.isEmpty()) {
if (target != null) { FixedTargets fixedTargets = new FixedTargets(foundCards, game);
FixedTarget fixedTarget = new FixedTarget(target); UntapTargetEffect untapEffect = new UntapTargetEffect();
BecomesCreatureTargetEffect becomesCreatureEffect = new BecomesCreatureTargetEffect(new HuntingWildsToken(), false, true, Duration.Custom); untapEffect.setTargetPointer(fixedTargets);
becomesCreatureEffect.setTargetPointer(fixedTarget); untapEffect.apply(game, source);
game.addEffect(becomesCreatureEffect, source);
UntapTargetEffect untapEffect = new UntapTargetEffect(); BecomesCreatureTargetEffect becomesCreatureEffect = new BecomesCreatureTargetEffect(new HuntingWildsToken(), false, true, Duration.Custom);
untapEffect.setTargetPointer(fixedTarget); becomesCreatureEffect.setTargetPointer(fixedTargets);
untapEffect.apply(game, source); game.addEffect(becomesCreatureEffect, source);
}
}
return true;
} }
return true;
} }
} }
return false; return false;
@ -127,14 +126,14 @@ class HuntingWildsEffect extends OneShotEffect {
} }
class HuntingWildsToken extends Token { class HuntingWildsToken extends Token {
public HuntingWildsToken() { public HuntingWildsToken() {
super("", "3/3 green creature with haste"); super("", "3/3 green creature with haste");
this.cardType.add(CardType.CREATURE); this.cardType.add(CardType.CREATURE);
this.power = new MageInt(3); this.power = new MageInt(3);
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
this.addAbility(HasteAbility.getInstance()); this.addAbility(HasteAbility.getInstance());
} }
} }

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);