* Myojin of Life's Web - Fixed the put from hand to battlefield effect.

This commit is contained in:
LevelX2 2016-09-21 19:36:01 +02:00
parent babeb5418c
commit 23e24f32ba

View file

@ -28,8 +28,6 @@
package mage.sets.championsofkamigawa;
import java.util.UUID;
import mage.constants.*;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldAbility;
@ -40,15 +38,17 @@ import mage.abilities.condition.common.SourceHasCounterCondition;
import mage.abilities.costs.common.RemoveCountersSourceCost;
import mage.abilities.decorator.ConditionalContinuousEffect;
import mage.abilities.decorator.ConditionalOneShotEffect;
import mage.abilities.effects.common.PutOntoBattlefieldTargetEffect;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.continuous.GainAbilitySourceEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.abilities.keyword.IndestructibleAbility;
import mage.cards.CardImpl;
import mage.cards.CardsImpl;
import mage.constants.*;
import mage.counters.CounterType;
import mage.filter.FilterCard;
import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.filter.predicate.other.OwnerPredicate;
import mage.filter.common.FilterCreatureCard;
import mage.game.Game;
import mage.players.Player;
import mage.target.common.TargetCardInHand;
import mage.watchers.common.CastFromHandWatcher;
@ -57,12 +57,6 @@ import mage.watchers.common.CastFromHandWatcher;
*/
public class MyojinOfLifesWeb extends CardImpl {
private static final FilterCard filter = new FilterCard("any number of creature cards from your hand");
static {
filter.add(new CardTypePredicate(CardType.CREATURE));
filter.add(new OwnerPredicate(TargetController.YOU));
}
public MyojinOfLifesWeb(UUID ownerId) {
super(ownerId, 229, "Myojin of Life's Web", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{6}{G}{G}{G}");
this.expansionSetCode = "CHK";
@ -79,10 +73,10 @@ public class MyojinOfLifesWeb extends CardImpl {
// Myojin of Life's Web is indestructible as long as it has a divinity counter on it.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD,
new ConditionalContinuousEffect(new GainAbilitySourceEffect(IndestructibleAbility.getInstance(), Duration.WhileOnBattlefield),
new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it")));
new SourceHasCounterCondition(CounterType.DIVINITY), "{this} is indestructible as long as it has a divinity counter on it")));
// Remove a divinity counter from Myojin of Life's Web: Put any number of creature cards from your hand onto the battlefield.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new PutOntoBattlefieldTargetEffect(false), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance()));
ability.addTarget(new TargetCardInHand(0, Integer.MAX_VALUE, filter));
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MyojinOfLifesWebPutCreatureOnBattlefieldEffect(), new RemoveCountersSourceCost(CounterType.DIVINITY.createInstance()));
this.addAbility(ability);
}
@ -95,3 +89,35 @@ public class MyojinOfLifesWeb extends CardImpl {
return new MyojinOfLifesWeb(this);
}
}
class MyojinOfLifesWebPutCreatureOnBattlefieldEffect extends OneShotEffect {
public MyojinOfLifesWebPutCreatureOnBattlefieldEffect() {
super(Outcome.PutCreatureInPlay);
this.staticText = "Put any number of creature cards from your hand onto the battlefield";
}
public MyojinOfLifesWebPutCreatureOnBattlefieldEffect(final MyojinOfLifesWebPutCreatureOnBattlefieldEffect effect) {
super(effect);
}
@Override
public MyojinOfLifesWebPutCreatureOnBattlefieldEffect copy() {
return new MyojinOfLifesWebPutCreatureOnBattlefieldEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
TargetCardInHand target = new TargetCardInHand(0, Integer.MAX_VALUE, new FilterCreatureCard("creature cards from your hand to put onto the battlefield"));
if (controller.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
return controller.moveCards(new CardsImpl(target.getTargets()).getCards(game),
Zone.BATTLEFIELD, source, game, false, false, false, null);
}
return false;
}
}