Used method to add attacker later to combat so that the attacking player can choose if the palyer or a planeswalker (if existent) shall be attacked.

This commit is contained in:
LevelX2 2013-03-17 16:13:52 +01:00
parent 88e5ddb807
commit 0946313dba
4 changed files with 9 additions and 22 deletions

View file

@ -28,7 +28,6 @@
package mage.sets.innistrad;
import java.util.UUID;
import mage.Constants;
import mage.Constants.CardType;
import mage.Constants.Rarity;
@ -45,6 +44,7 @@ import mage.cards.CardImpl;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.AngelToken;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;
/**
@ -92,10 +92,10 @@ class GeistOfSaintTraftEffect extends OneShotEffect<GeistOfSaintTraftEffect> {
@Override
public boolean apply(Game game, Ability source) {
AngelToken token = new AngelToken();
if (token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
Player controller = game.getPlayer(source.getControllerId());
if (controller != null && token.putOntoBattlefield(1, game, source.getSourceId(), source.getControllerId())) {
Permanent p = game.getPermanent(token.getLastAddedToken());
game.getCombat().declareAttacker(p.getId(), game.getCombat().getDefendingPlayer(source.getSourceId()), game);
p.setTapped(true);
game.getCombat().addAttackingCreature(p.getId(), game);
Effect effect = new ExileTargetEffect();
effect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
CreateDelayedTriggeredAbilityEffect createEffect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(effect));
@ -109,4 +109,4 @@ class GeistOfSaintTraftEffect extends OneShotEffect<GeistOfSaintTraftEffect> {
public GeistOfSaintTraftEffect copy() {
return new GeistOfSaintTraftEffect(this);
}
}
}

View file

@ -97,8 +97,7 @@ class KessigCagebreakersEffect extends OneShotEffect<KessigCagebreakersEffect> {
for (int i = 0; i < count; i++) {
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId());
Permanent permanent = game.getPermanent(token.getLastAddedToken());
game.getCombat().declareAttacker(permanent.getId(), game.getCombat().getDefendingPlayer(source.getSourceId()), game);
permanent.setTapped(true);
game.getCombat().addAttackingCreature(permanent.getId(), game);
}
return true;
}

View file

@ -90,8 +90,7 @@ class HeroOfBladeholdEffect extends OneShotEffect<HeroOfBladeholdEffect> {
for (int i = 0; i < 2; i++) {
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId());
Permanent p = game.getPermanent(token.getLastAddedToken());
game.getCombat().declareAttacker(p.getId(), game.getCombat().getDefendingPlayer(source.getSourceId()), game);
p.setTapped(true);
game.getCombat().addAttackingCreature(p.getId(), game);
}
}
return true;

View file

@ -106,20 +106,9 @@ class PreeminentCaptainEffect extends OneShotEffect<PreeminentCaptainEffect> {
UUID cardId = target.getFirstTarget();
Card card = player.getHand().get(cardId, game);
if (card != null) {
if (card.putOntoBattlefield(game, Zone.HAND,
source.getId(), source.getControllerId())) {
if (card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId())) {
Permanent permanent = game.getPermanent(card.getId());
permanent.setTapped(true);
TargetDefender def = new TargetDefender(game
.getCombat().getDefenders(), player.getId());
if (def.choose(getOutcome(), player.getId(), source.getSourceId(), game)) {
// TODO -> If only one option, don't ask, as for normal attacking.
if (def.getTargets().size() > 0) {
game.getCombat().declareAttacker(
permanent.getId(),
def.getFirstTarget(), game);
}
}
game.getCombat().addAttackingCreature(permanent.getId(), game);
}
}
return true;