mirror of
https://github.com/magefree/mage.git
synced 2025-12-23 03:51:58 -08:00
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:
parent
88e5ddb807
commit
0946313dba
4 changed files with 9 additions and 22 deletions
|
|
@ -28,7 +28,6 @@
|
||||||
package mage.sets.innistrad;
|
package mage.sets.innistrad;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import mage.Constants;
|
import mage.Constants;
|
||||||
import mage.Constants.CardType;
|
import mage.Constants.CardType;
|
||||||
import mage.Constants.Rarity;
|
import mage.Constants.Rarity;
|
||||||
|
|
@ -45,6 +44,7 @@ import mage.cards.CardImpl;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.permanent.token.AngelToken;
|
import mage.game.permanent.token.AngelToken;
|
||||||
|
import mage.players.Player;
|
||||||
import mage.target.targetpointer.FixedTarget;
|
import mage.target.targetpointer.FixedTarget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -92,10 +92,10 @@ class GeistOfSaintTraftEffect extends OneShotEffect<GeistOfSaintTraftEffect> {
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(Game game, Ability source) {
|
public boolean apply(Game game, Ability source) {
|
||||||
AngelToken token = new AngelToken();
|
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());
|
Permanent p = game.getPermanent(token.getLastAddedToken());
|
||||||
game.getCombat().declareAttacker(p.getId(), game.getCombat().getDefendingPlayer(source.getSourceId()), game);
|
game.getCombat().addAttackingCreature(p.getId(), game);
|
||||||
p.setTapped(true);
|
|
||||||
Effect effect = new ExileTargetEffect();
|
Effect effect = new ExileTargetEffect();
|
||||||
effect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
|
effect.setTargetPointer(new FixedTarget(token.getLastAddedToken()));
|
||||||
CreateDelayedTriggeredAbilityEffect createEffect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(effect));
|
CreateDelayedTriggeredAbilityEffect createEffect = new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(effect));
|
||||||
|
|
@ -109,4 +109,4 @@ class GeistOfSaintTraftEffect extends OneShotEffect<GeistOfSaintTraftEffect> {
|
||||||
public GeistOfSaintTraftEffect copy() {
|
public GeistOfSaintTraftEffect copy() {
|
||||||
return new GeistOfSaintTraftEffect(this);
|
return new GeistOfSaintTraftEffect(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -97,8 +97,7 @@ class KessigCagebreakersEffect extends OneShotEffect<KessigCagebreakersEffect> {
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId());
|
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId());
|
||||||
Permanent permanent = game.getPermanent(token.getLastAddedToken());
|
Permanent permanent = game.getPermanent(token.getLastAddedToken());
|
||||||
game.getCombat().declareAttacker(permanent.getId(), game.getCombat().getDefendingPlayer(source.getSourceId()), game);
|
game.getCombat().addAttackingCreature(permanent.getId(), game);
|
||||||
permanent.setTapped(true);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,7 @@ class HeroOfBladeholdEffect extends OneShotEffect<HeroOfBladeholdEffect> {
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId());
|
token.putOntoBattlefield(1, game, source.getId(), source.getControllerId());
|
||||||
Permanent p = game.getPermanent(token.getLastAddedToken());
|
Permanent p = game.getPermanent(token.getLastAddedToken());
|
||||||
game.getCombat().declareAttacker(p.getId(), game.getCombat().getDefendingPlayer(source.getSourceId()), game);
|
game.getCombat().addAttackingCreature(p.getId(), game);
|
||||||
p.setTapped(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -106,20 +106,9 @@ class PreeminentCaptainEffect extends OneShotEffect<PreeminentCaptainEffect> {
|
||||||
UUID cardId = target.getFirstTarget();
|
UUID cardId = target.getFirstTarget();
|
||||||
Card card = player.getHand().get(cardId, game);
|
Card card = player.getHand().get(cardId, game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
if (card.putOntoBattlefield(game, Zone.HAND,
|
if (card.putOntoBattlefield(game, Zone.HAND, source.getId(), source.getControllerId())) {
|
||||||
source.getId(), source.getControllerId())) {
|
|
||||||
Permanent permanent = game.getPermanent(card.getId());
|
Permanent permanent = game.getPermanent(card.getId());
|
||||||
permanent.setTapped(true);
|
game.getCombat().addAttackingCreature(permanent.getId(), game);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue