mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +00:00
* Sidis Brood Tyrant - Fixed triggered ability not working as intended.
This commit is contained in:
parent
86965dfde6
commit
e6d2bce95d
2 changed files with 10 additions and 8 deletions
|
@ -135,8 +135,11 @@ class SidisiBroodTyrantTriggeredAbility extends ZoneChangeTriggeredAbility {
|
||||||
Card card = game.getCard(event.getTargetId());
|
Card card = game.getCard(event.getTargetId());
|
||||||
if (card != null && card.getOwnerId().equals(getControllerId()) && card.getCardType().contains(CardType.CREATURE)) {
|
if (card != null && card.getOwnerId().equals(getControllerId()) && card.getCardType().contains(CardType.CREATURE)) {
|
||||||
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
StackObject stackObject = game.getStack().getStackObject(event.getSourceId());
|
||||||
|
if (stackObject == null) {
|
||||||
|
stackObject = (StackObject) game.getLastKnownInformation(event.getSourceId(), Zone.STACK);
|
||||||
|
}
|
||||||
if (stackObject != null) {
|
if (stackObject != null) {
|
||||||
if (lastStackObjectId.equals(stackObject.getId())) {
|
if (stackObject.getId().equals(lastStackObjectId)) {
|
||||||
return false; // was already handled
|
return false; // was already handled
|
||||||
}
|
}
|
||||||
lastStackObjectId = stackObject.getId();
|
lastStackObjectId = stackObject.getId();
|
||||||
|
|
|
@ -127,14 +127,13 @@ public class LookLibraryControllerEffect extends OneShotEffect {
|
||||||
// take cards from library and look at them
|
// take cards from library and look at them
|
||||||
boolean topCardRevealed = player.isTopCardRevealed();
|
boolean topCardRevealed = player.isTopCardRevealed();
|
||||||
player.setTopCardRevealed(false);
|
player.setTopCardRevealed(false);
|
||||||
Cards cards = new CardsImpl(Zone.PICK);
|
Cards cards = new CardsImpl();
|
||||||
int count = Math.min(player.getLibrary().size(), this.numberOfCards.calculate(game, source, this));
|
int count = Math.min(player.getLibrary().size(), this.numberOfCards.calculate(game, source, this));
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
Card card = player.getLibrary().removeFromTop(game);
|
Card card = player.getLibrary().removeFromTop(game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
cards.add(card);
|
cards.add(card);
|
||||||
this.cardLooked(card, game, source);
|
this.cardLooked(card, game, source);
|
||||||
game.setZone(card.getId(), Zone.PICK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.lookAtCards(windowName, cards, game);
|
player.lookAtCards(windowName, cards, game);
|
||||||
|
@ -167,25 +166,25 @@ public class LookLibraryControllerEffect extends OneShotEffect {
|
||||||
protected void putCardsBack(Ability source, Player player, Cards cards, Game game) {
|
protected void putCardsBack(Ability source, Player player, Cards cards, Game game) {
|
||||||
switch(targetZoneLookedCards) {
|
switch(targetZoneLookedCards) {
|
||||||
case LIBRARY:
|
case LIBRARY:
|
||||||
TargetCard target = new TargetCard(Zone.PICK, new FilterCard(this.getPutBackText()));
|
TargetCard target = new TargetCard(Zone.LIBRARY, new FilterCard(this.getPutBackText()));
|
||||||
while (player.isInGame() && cards.size() > 1) {
|
while (player.isInGame() && cards.size() > 1) {
|
||||||
player.choose(Outcome.Neutral, cards, target, game);
|
player.choose(Outcome.Neutral, cards, target, game);
|
||||||
Card card = cards.get(target.getFirstTarget(), game);
|
Card card = cards.get(target.getFirstTarget(), game);
|
||||||
if (card != null) {
|
if (card != null) {
|
||||||
cards.remove(card);
|
cards.remove(card);
|
||||||
card.moveToZone(targetZoneLookedCards, source.getSourceId(), game, putOnTop);
|
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, putOnTop, false);
|
||||||
game.informPlayers(player.getName() + " moves a card to " + targetZoneLookedCards.toString());
|
|
||||||
}
|
}
|
||||||
target.clearChosen();
|
target.clearChosen();
|
||||||
}
|
}
|
||||||
if (cards.size() == 1) {
|
if (cards.size() == 1) {
|
||||||
Card card = cards.get(cards.iterator().next(), game);
|
Card card = cards.get(cards.iterator().next(), game);
|
||||||
card.moveToZone(targetZoneLookedCards, source.getSourceId(), game, putOnTop);
|
player.moveCardToLibraryWithInfo(card, source.getSourceId(), game, Zone.LIBRARY, putOnTop, false);
|
||||||
game.informPlayers(player.getName() + " moves a card to " + targetZoneLookedCards.toString());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GRAVEYARD:
|
case GRAVEYARD:
|
||||||
for (Card card : cards.getCards(game)) {
|
for (Card card : cards.getCards(game)) {
|
||||||
|
player.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||||
|
|
||||||
card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true);
|
card.moveToZone(Zone.GRAVEYARD, source.getSourceId(), game, true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue