mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Added [MOR]Preeminent Captain ans [ZEN]Summoning Trap
This commit is contained in:
parent
41683d924d
commit
9822fb1cf8
2 changed files with 47 additions and 27 deletions
|
@ -27,7 +27,6 @@
|
||||||
*/
|
*/
|
||||||
package mage.sets.morningtide;
|
package mage.sets.morningtide;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
|
@ -41,13 +40,10 @@ import mage.abilities.keyword.FirstStrikeAbility;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.CardImpl;
|
import mage.cards.CardImpl;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
import mage.filter.common.FilterCreatureCard;
|
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.combat.CombatGroup;
|
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
|
||||||
import mage.target.common.TargetDefender;
|
import mage.target.common.TargetDefender;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -87,21 +83,19 @@ public class PreeminentCaptain extends CardImpl<PreeminentCaptain> {
|
||||||
|
|
||||||
class PreeminentCaptainEffect extends OneShotEffect<PreeminentCaptainEffect> {
|
class PreeminentCaptainEffect extends OneShotEffect<PreeminentCaptainEffect> {
|
||||||
|
|
||||||
protected TargetCardInHand target;
|
|
||||||
|
|
||||||
public PreeminentCaptainEffect() {
|
public PreeminentCaptainEffect() {
|
||||||
super(Outcome.PutCreatureInPlay);
|
super(Outcome.PutCreatureInPlay);
|
||||||
target = new TargetCardInHand(new FilterSoldierCard());
|
this.staticText = "put a Soldier creature card from your hand onto the battlefield tapped and attacking.";
|
||||||
}
|
}
|
||||||
|
|
||||||
public PreeminentCaptainEffect(final PreeminentCaptainEffect effect) {
|
public PreeminentCaptainEffect(final PreeminentCaptainEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
target = effect.target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
Player player = game.getPlayer(source.getControllerId());
|
Player player = game.getPlayer(source.getControllerId());
|
||||||
|
TargetCardInHand target = new TargetCardInHand(new FilterSoldierCard());
|
||||||
if (target.choose(getOutcome(), player.getId(), game)) {
|
if (target.choose(getOutcome(), player.getId(), game)) {
|
||||||
if (target.getTargets().size() > 0) {
|
if (target.getTargets().size() > 0) {
|
||||||
UUID cardId = target.getFirstTarget();
|
UUID cardId = target.getFirstTarget();
|
||||||
|
@ -112,12 +106,15 @@ class PreeminentCaptainEffect extends OneShotEffect<PreeminentCaptainEffect> {
|
||||||
source.getId(), source.getControllerId())) {
|
source.getId(), source.getControllerId())) {
|
||||||
Permanent permanent = game.getPermanent(card.getId());
|
Permanent permanent = game.getPermanent(card.getId());
|
||||||
permanent.setTapped(true);
|
permanent.setTapped(true);
|
||||||
TargetDefender target = new TargetDefender(game
|
TargetDefender def = new TargetDefender(game
|
||||||
.getCombat().getDefenders(), player.getId());
|
.getCombat().getDefenders(), player.getId());
|
||||||
if (target.choose(getOutcome(), player.getId(), game)) {
|
if (def.choose(getOutcome(), player.getId(), game)) {
|
||||||
if (target.getTargets().size() > 0) {
|
// TODO -> If only one option, don't ask, as for
|
||||||
game.getCombat().declareAttacker(permanent.getId(),
|
// normal attacking.
|
||||||
target.getFirstTarget(), game);
|
if (def.getTargets().size() > 0) {
|
||||||
|
game.getCombat().declareAttacker(
|
||||||
|
permanent.getId(),
|
||||||
|
def.getFirstTarget(), game);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
package mage.sets.zendikar;
|
package mage.sets.zendikar;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Outcome;
|
import mage.Constants.Outcome;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
@ -41,6 +44,7 @@ import mage.cards.CardImpl;
|
||||||
import mage.cards.Cards;
|
import mage.cards.Cards;
|
||||||
import mage.cards.CardsImpl;
|
import mage.cards.CardsImpl;
|
||||||
import mage.filter.FilterCard;
|
import mage.filter.FilterCard;
|
||||||
|
import mage.filter.common.FilterCreatureCard;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.events.GameEvent;
|
import mage.game.events.GameEvent;
|
||||||
import mage.game.events.GameEvent.EventType;
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
@ -67,13 +71,13 @@ public class SummoningTrap extends CardImpl<SummoningTrap> {
|
||||||
// If a creature spell you cast this turn was countered by a spell or
|
// If a creature spell you cast this turn was countered by a spell or
|
||||||
// ability an opponent controlled, you may pay {0} rather than pay
|
// ability an opponent controlled, you may pay {0} rather than pay
|
||||||
// Summoning Trap's mana cost.
|
// Summoning Trap's mana cost.
|
||||||
|
this.getSpellAbility().addAlternativeCost(
|
||||||
|
new SummoningTrapAlternativeCost());
|
||||||
|
this.addWatcher(new SummoningTrapWatcher());
|
||||||
// Look at the top seven cards of your library. You may put a creature
|
// Look at the top seven cards of your library. You may put a creature
|
||||||
// card from among them onto the battlefield. Put the rest on the bottom
|
// card from among them onto the battlefield. Put the rest on the bottom
|
||||||
// of your library in any order.
|
// of your library in any order.
|
||||||
this.getSpellAbility().addEffect(new SummoningTrapEffect());
|
this.getSpellAbility().addEffect(new SummoningTrapEffect());
|
||||||
this.getSpellAbility().addAlternativeCost(
|
|
||||||
new SummoningTrapAlternativeCost());
|
|
||||||
this.addWatcher(new SummoningTrapWatcher());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SummoningTrap(final SummoningTrap card) {
|
public SummoningTrap(final SummoningTrap card) {
|
||||||
|
@ -106,12 +110,14 @@ class SummoningTrapWatcher extends WatcherImpl<SummoningTrapWatcher> {
|
||||||
if (condition == true) // no need to check - condition has already
|
if (condition == true) // no need to check - condition has already
|
||||||
// occured
|
// occured
|
||||||
return;
|
return;
|
||||||
if (event.getType() == EventType.COUNTER
|
if (event.getType() == EventType.COUNTERED
|
||||||
&& game.getCard(event.getTargetId()).getCardType()
|
&& game.getStack().getStackObject(event.getTargetId())
|
||||||
.contains(CardType.CREATURE)
|
.getCardType().contains(CardType.CREATURE)
|
||||||
&& game.getOpponents(controllerId)
|
&& game.getOpponents(controllerId)
|
||||||
.contains(event.getPlayerId()))
|
.contains(event.getPlayerId()))
|
||||||
condition = true;
|
Logger.getAnonymousLogger().info(
|
||||||
|
game.getCard(event.getTargetId()).toString());
|
||||||
|
condition = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +162,7 @@ class SummoningTrapEffect extends OneShotEffect<SummoningTrapEffect> {
|
||||||
|
|
||||||
public SummoningTrapEffect() {
|
public SummoningTrapEffect() {
|
||||||
super(Outcome.PutCreatureInPlay);
|
super(Outcome.PutCreatureInPlay);
|
||||||
|
this.staticText = "Look at the top seven cards of your library. You may put a creature card from among them onto the battlefield. Put the rest on the bottom of your library in any order.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -170,14 +177,11 @@ class SummoningTrapEffect extends OneShotEffect<SummoningTrapEffect> {
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.lookAtCards("Summoning Trap", cards, game);
|
|
||||||
|
|
||||||
if (!cards.isEmpty()
|
if (!cards.isEmpty()) {
|
||||||
&& player.chooseUse(Outcome.PutCreatureInPlay,
|
TargetCard target = new TargetCard(Zone.PICK,
|
||||||
"Do you wish to put a creature on the battlefield?",
|
new FilterCreatureCard(
|
||||||
game)) {
|
"creature card to put on the battlefield"));
|
||||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard(
|
|
||||||
"card to put on the battlefield"));
|
|
||||||
if (player.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
|
if (player.choose(Outcome.PutCreatureInPlay, cards, target, game)) {
|
||||||
Card card = cards.get(target.getFirstTarget(), game);
|
Card card = cards.get(target.getFirstTarget(), game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
|
@ -186,6 +190,25 @@ class SummoningTrapEffect extends OneShotEffect<SummoningTrapEffect> {
|
||||||
source.getSourceId(), source.getControllerId());
|
source.getSourceId(), source.getControllerId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (cards.size() > 0) {
|
||||||
|
TargetCard target2 = new TargetCard(Constants.Zone.PICK,
|
||||||
|
new FilterCard(
|
||||||
|
"card to put on the bottom of your library"));
|
||||||
|
target2.setRequired(true);
|
||||||
|
while (cards.size() > 1) {
|
||||||
|
player.choose(Constants.Outcome.Benefit, cards, target2,
|
||||||
|
game);
|
||||||
|
Card card = cards.get(target2.getFirstTarget(), game);
|
||||||
|
if (card != null) {
|
||||||
|
cards.remove(card);
|
||||||
|
player.getLibrary().putOnBottom(card, game);
|
||||||
|
}
|
||||||
|
target2.clearChosen();
|
||||||
|
}
|
||||||
|
Card card = cards.get(cards.iterator().next(), game);
|
||||||
|
cards.remove(card);
|
||||||
|
player.getLibrary().putOnBottom(card, game);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue