Fixed Land Grant and Slithermuse

This commit is contained in:
Plopman 2014-05-04 18:41:45 +02:00
parent 5fef712202
commit f872a44477
2 changed files with 21 additions and 2 deletions

View file

@ -29,6 +29,7 @@ package mage.sets.mercadianmasques;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.condition.Condition;
import mage.abilities.condition.common.CardsInHandCondition;
import mage.abilities.costs.AlternativeCostSourceAbility;
import mage.abilities.costs.CostImpl;
@ -55,7 +56,7 @@ public class LandGrant extends CardImpl<LandGrant> {
this.color.setGreen(true);
// If you have no land cards in hand, you may reveal your hand rather than pay Land Grant's mana cost.
this.addAbility(new AlternativeCostSourceAbility(new LandGrantReavealCost(), new CardsInHandCondition(CardsInHandCondition.CountType.EQUAL_TO, 0),
this.addAbility(new AlternativeCostSourceAbility(new LandGrantReavealCost(), new LandGrantCondition(),
"If you have no land cards in hand, you may reveal your hand rather than pay Land Grant's mana cost."));
// Search your library for a Forest card, reveal that card, and put it into your hand. Then shuffle your library.
@ -72,6 +73,23 @@ public class LandGrant extends CardImpl<LandGrant> {
}
}
class LandGrantCondition implements Condition {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player != null && player.getHand().count(new FilterLandCard(), game) == 0) {
return true;
}
return false;
}
@Override
public String toString() {
return "If you have no land cards in hand";
}
}
class LandGrantReavealCost extends CostImpl<LandGrantReavealCost> {
public LandGrantReavealCost() {

View file

@ -37,6 +37,7 @@ import mage.abilities.common.LeavesBattlefieldTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.EvokeAbility;
import mage.cards.CardImpl;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -99,7 +100,7 @@ class SlithermuseEffect extends OneShotEffect<SlithermuseEffect> {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
Permanent permanent = game.getPermanent(source.getSourceId());
Permanent permanent = (Permanent)game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (player != null && permanent != null) {
TargetOpponent target = new TargetOpponent();
target.setRequired(true);