mirror of
https://github.com/correl/mage.git
synced 2025-02-27 03:45:09 +00:00
* Leadership Vacuum - Fixed that the movement of the commanders were not reported in the game log.
This commit is contained in:
parent
b6b2103b6c
commit
349a2cc612
3 changed files with 139 additions and 91 deletions
|
@ -1,5 +1,7 @@
|
||||||
package mage.cards.l;
|
package mage.cards.l;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.UUID;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
import mage.abilities.effects.OneShotEffect;
|
import mage.abilities.effects.OneShotEffect;
|
||||||
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
|
||||||
|
@ -14,8 +16,6 @@ import mage.game.Game;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author TheElk801
|
* @author TheElk801
|
||||||
*/
|
*/
|
||||||
|
@ -70,9 +70,8 @@ class LeadershipVacuumEffect extends OneShotEffect {
|
||||||
if (player == null) {
|
if (player == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return player.moveCards(
|
||||||
return game.getBattlefield().getAllActivePermanents(filter, source.getFirstTarget(), game).stream()
|
new HashSet<>(game.getBattlefield().getAllActivePermanents(filter, player.getId(), game)),
|
||||||
.map(commander -> commander.moveToZone(Zone.COMMAND, source.getId(), game, true))
|
Zone.COMMAND, source, game);
|
||||||
.reduce(true, Boolean::logicalAnd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package mage.players;
|
package mage.players;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
import mage.MageItem;
|
import mage.MageItem;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
|
@ -38,9 +40,6 @@ import mage.target.TargetCard;
|
||||||
import mage.target.common.TargetCardInLibrary;
|
import mage.target.common.TargetCardInLibrary;
|
||||||
import mage.util.Copyable;
|
import mage.util.Copyable;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author BetaSteward_at_googlemail.com
|
* @author BetaSteward_at_googlemail.com
|
||||||
*/
|
*/
|
||||||
|
@ -457,7 +456,8 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
* Adds the cards to the reveal window and adds the source object's id name
|
* Adds the cards to the reveal window and adds the source object's id name
|
||||||
* to the title bar of the revealed cards window
|
* to the title bar of the revealed cards window
|
||||||
* <p>
|
* <p>
|
||||||
* Warning, if you use it from continuous effect, then check with extra call isCanLookAtNextTopLibraryCard
|
* Warning, if you use it from continuous effect, then check with extra call
|
||||||
|
* isCanLookAtNextTopLibraryCard
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -475,7 +475,8 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
* Adds the cards to the look window and adds the source object's id name to
|
* Adds the cards to the look window and adds the source object's id name to
|
||||||
* the title bar of the lookedAt window
|
* the title bar of the lookedAt window
|
||||||
* <p>
|
* <p>
|
||||||
* Warning, if you use it from continuous effect, then check with extra call isCanLookAtNextTopLibraryCard
|
* Warning, if you use it from continuous effect, then check with extra call
|
||||||
|
* isCanLookAtNextTopLibraryCard
|
||||||
*
|
*
|
||||||
* @param source
|
* @param source
|
||||||
* @param name
|
* @param name
|
||||||
|
@ -819,6 +820,18 @@ public interface Player extends MageItem, Copyable<Player> {
|
||||||
*/
|
*/
|
||||||
boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName);
|
boolean moveCardToLibraryWithInfo(Card card, UUID sourceId, Game game, Zone fromZone, boolean toTop, boolean withName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Uses card.moveToZone and posts a inform message about moving the card to
|
||||||
|
* library into the game log
|
||||||
|
*
|
||||||
|
* @param card
|
||||||
|
* @param sourceId
|
||||||
|
* @param game
|
||||||
|
* @param fromZone if null, this info isn't postet
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean moveCardToCommandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the playerToCheckId is from an opponent in range
|
* Checks if the playerToCheckId is from an opponent in range
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package mage.players;
|
package mage.players;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import mage.ConditionalMana;
|
import mage.ConditionalMana;
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.MageObjectReference;
|
import mage.MageObjectReference;
|
||||||
|
@ -65,10 +68,6 @@ import mage.util.GameLog;
|
||||||
import mage.util.RandomUtil;
|
import mage.util.RandomUtil;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
public abstract class PlayerImpl implements Player, Serializable {
|
public abstract class PlayerImpl implements Player, Serializable {
|
||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
private static final Logger logger = Logger.getLogger(PlayerImpl.class);
|
||||||
|
@ -3281,7 +3280,6 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
boolean isPlayLand = (ability instanceof PlayLandAbility);
|
boolean isPlayLand = (ability instanceof PlayLandAbility);
|
||||||
|
|
||||||
// as original controller
|
// as original controller
|
||||||
|
|
||||||
// land restrictions
|
// land restrictions
|
||||||
if (isPlayLand && game.getContinuousEffects().preventedByRuleModification(
|
if (isPlayLand && game.getContinuousEffects().preventedByRuleModification(
|
||||||
GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(),
|
GameEvent.getEvent(GameEvent.EventType.PLAY_LAND, ability.getSourceId(),
|
||||||
|
@ -3937,6 +3935,13 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case COMMAND:
|
||||||
|
for (Card card : cards) {
|
||||||
|
if (moveCardToCommandWithInfo(card, source.getSourceId(), game, fromZone)) {
|
||||||
|
successfulMovedCards.add(card);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case OUTSIDE:
|
case OUTSIDE:
|
||||||
for (Card card : cards) {
|
for (Card card : cards) {
|
||||||
if (card instanceof Permanent) {
|
if (card instanceof Permanent) {
|
||||||
|
@ -4023,7 +4028,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
// identify cards from one owner
|
// identify cards from one owner
|
||||||
Cards cards = new CardsImpl();
|
Cards cards = new CardsImpl();
|
||||||
UUID ownerId = null;
|
UUID ownerId = null;
|
||||||
for (Iterator<Card> it = allCards.iterator(); it.hasNext(); ) {
|
for (Iterator<Card> it = allCards.iterator(); it.hasNext();) {
|
||||||
Card card = it.next();
|
Card card = it.next();
|
||||||
if (cards.isEmpty()) {
|
if (cards.isEmpty()) {
|
||||||
ownerId = card.getOwnerId();
|
ownerId = card.getOwnerId();
|
||||||
|
@ -4148,6 +4153,37 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean moveCardToCommandWithInfo(Card card, UUID sourceId, Game game, Zone fromZone) {
|
||||||
|
if (card == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
boolean result = false;
|
||||||
|
if (card.moveToZone(Zone.COMMAND, sourceId, game, true)) {
|
||||||
|
if (!game.isSimulation()) {
|
||||||
|
if (card instanceof PermanentCard && game.getCard(card.getId()) != null) {
|
||||||
|
card = game.getCard(card.getId());
|
||||||
|
}
|
||||||
|
StringBuilder sb = new StringBuilder(this.getLogName())
|
||||||
|
.append(" puts ").append(card.getLogName()).append(' ');
|
||||||
|
if (fromZone != null) {
|
||||||
|
sb.append("from ").append(fromZone.toString().toLowerCase(Locale.ENGLISH)).append(' ');
|
||||||
|
}
|
||||||
|
if (card.isOwnedBy(getId())) {
|
||||||
|
sb.append(" to his or her command zone");
|
||||||
|
} else {
|
||||||
|
Player player = game.getPlayer(card.getOwnerId());
|
||||||
|
if (player != null) {
|
||||||
|
sb.append(" to ").append(player.getLogName()).append("'s command zone");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
game.informPlayers(sb.toString());
|
||||||
|
}
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId,
|
public boolean moveCardToExileWithInfo(Card card, UUID exileId, String exileName, UUID sourceId,
|
||||||
Game game, Zone fromZone, boolean withName) {
|
Game game, Zone fromZone, boolean withName) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue