Merge pull request #1105 from LoneFox78/master

IPA cards
This commit is contained in:
LevelX2 2015-07-09 10:05:36 +02:00
commit 8d5137e40e
23 changed files with 1756 additions and 6 deletions

View file

@ -1,6 +1,7 @@
package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.OneShotEffect;
import mage.cards.Card;
import mage.constants.Outcome;
@ -15,15 +16,20 @@ import mage.target.common.TargetCardInHand;
*/
public class PutCreatureOnBattlefieldEffect extends OneShotEffect {
private static final String choiceText = "Put a creature card from your hand onto the battlefield?";
private final FilterCreatureCard filter;
public PutCreatureOnBattlefieldEffect() {
this(new FilterCreatureCard("a creature card"));
}
public PutCreatureOnBattlefieldEffect(FilterCreatureCard filter) {
super(Outcome.PutCreatureInPlay);
this.staticText = "You may put a creature card from your hand onto the battlefield";
this.filter = filter;
}
public PutCreatureOnBattlefieldEffect(final PutCreatureOnBattlefieldEffect effect) {
super(effect);
this.filter = effect.filter.copy();
}
@Override
@ -34,11 +40,12 @@ public class PutCreatureOnBattlefieldEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
String choiceText = "Put " + filter.getMessage() + " from your hand onto the battlefield?";
if (player == null || !player.chooseUse(Outcome.PutCreatureInPlay, choiceText, source, game)) {
return false;
}
TargetCardInHand target = new TargetCardInHand(new FilterCreatureCard());
TargetCardInHand target = new TargetCardInHand(filter);
if (player.choose(Outcome.PutCreatureInPlay, target, source.getSourceId(), game)) {
Card card = game.getCard(target.getFirstTarget());
if (card != null) {
@ -48,4 +55,13 @@ public class PutCreatureOnBattlefieldEffect extends OneShotEffect {
}
return false;
}
}
@Override
public String getText(Mode mode) {
if(this.staticText != null && !this.staticText.isEmpty()) {
return staticText;
}
return "You may put " + filter.getMessage() + " from your hand onto the battlefield";
}
}