mirror of
https://github.com/correl/mage.git
synced 2025-04-10 17:00:08 -09:00
* Mycosynth Lattice - fixed that it doesn't work with double faces cards (related to a0e046bf70
);
This commit is contained in:
parent
21a9735aaf
commit
b950c7fbd6
1 changed files with 57 additions and 31 deletions
|
@ -1,6 +1,5 @@
|
||||||
package mage.cards.m;
|
package mage.cards.m;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
import mage.MageObject;
|
import mage.MageObject;
|
||||||
import mage.ObjectColor;
|
import mage.ObjectColor;
|
||||||
import mage.abilities.Ability;
|
import mage.abilities.Ability;
|
||||||
|
@ -9,18 +8,18 @@ import mage.abilities.effects.AsThoughEffectImpl;
|
||||||
import mage.abilities.effects.AsThoughManaEffect;
|
import mage.abilities.effects.AsThoughManaEffect;
|
||||||
import mage.abilities.effects.ContinuousEffectImpl;
|
import mage.abilities.effects.ContinuousEffectImpl;
|
||||||
import mage.abilities.hint.StaticHint;
|
import mage.abilities.hint.StaticHint;
|
||||||
import mage.cards.Card;
|
import mage.cards.*;
|
||||||
import mage.cards.CardImpl;
|
|
||||||
import mage.cards.CardSetInfo;
|
|
||||||
import mage.constants.*;
|
import mage.constants.*;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.command.CommandObject;
|
|
||||||
import mage.game.command.Commander;
|
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.game.stack.Spell;
|
import mage.game.stack.Spell;
|
||||||
import mage.players.ManaPoolItem;
|
import mage.players.ManaPoolItem;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author duncant
|
* @author duncant
|
||||||
*/
|
*/
|
||||||
|
@ -89,46 +88,73 @@ class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
||||||
Player controller = game.getPlayer(source.getControllerId());
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
ObjectColor colorless = new ObjectColor();
|
ObjectColor colorless = new ObjectColor();
|
||||||
|
|
||||||
// permaments
|
// permaments
|
||||||
for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
|
for (Permanent perm : game.getBattlefield().getActivePermanents(source.getControllerId(), game)) {
|
||||||
perm.getColor(game).setColor(colorless);
|
perm.getColor(game).setColor(colorless);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<Card> affectedCards = new ArrayList<>();
|
||||||
|
|
||||||
// spells
|
// spells
|
||||||
for (MageObject object : game.getStack()) {
|
for (MageObject object : game.getStack()) {
|
||||||
if (object instanceof Spell) {
|
if (object instanceof Spell) {
|
||||||
game.getState().getCreateMageObjectAttribute(object, game).getColor().setColor(colorless);
|
game.getState().getCreateMageObjectAttribute(object, game).getColor().setColor(colorless);
|
||||||
|
|
||||||
|
Card card = ((Spell) object).getCard();
|
||||||
|
affectedCards.add(card);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// exile
|
// exile
|
||||||
for (Card card : game.getExile().getAllCards(game)) {
|
affectedCards.addAll(game.getExile().getAllCardsByRange(game, controller.getId()));
|
||||||
game.getState().getCreateMageObjectAttribute(card, game).getColor().setColor(colorless);
|
|
||||||
}
|
|
||||||
// command
|
|
||||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
|
||||||
if (commandObject instanceof Commander) {
|
|
||||||
Card card = game.getCard(((Commander) commandObject).getId());
|
|
||||||
if (card != null) {
|
|
||||||
game.getState().getCreateMageObjectAttribute(card, game).getColor().addColor(colorless);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||||
Player player = game.getPlayer(playerId);
|
Player player = game.getPlayer(playerId);
|
||||||
if (player != null) {
|
if (player == null) {
|
||||||
// hand
|
continue;
|
||||||
for (Card card : player.getHand().getCards(game)) {
|
|
||||||
game.getState().getCreateMageObjectAttribute(card, game).getColor().setColor(colorless);
|
|
||||||
}
|
|
||||||
// library
|
|
||||||
for (Card card : player.getLibrary().getCards(game)) {
|
|
||||||
game.getState().getCreateMageObjectAttribute(card, game).getColor().setColor(colorless);
|
|
||||||
}
|
|
||||||
// graveyard
|
|
||||||
for (Card card : player.getGraveyard().getCards(game)) {
|
|
||||||
game.getState().getCreateMageObjectAttribute(card, game).getColor().setColor(colorless);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// command
|
||||||
|
affectedCards.addAll(game.getCommanderCardsFromCommandZone(player, CommanderCardType.ANY));
|
||||||
|
|
||||||
|
// hand
|
||||||
|
affectedCards.addAll(player.getHand().getCards(game));
|
||||||
|
|
||||||
|
// library
|
||||||
|
affectedCards.addAll(player.getLibrary().getCards(game));
|
||||||
|
|
||||||
|
// graveyard
|
||||||
|
affectedCards.addAll(player.getGraveyard().getCards(game));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// apply colors to all cards
|
||||||
|
affectedCards.forEach(card -> {
|
||||||
|
game.getState().getCreateMageObjectAttribute(card, game).getColor().setColor(colorless);
|
||||||
|
|
||||||
|
// mdf cards
|
||||||
|
if (card instanceof ModalDoubleFacesCard) {
|
||||||
|
ModalDoubleFacesCardHalf leftHalfCard = ((ModalDoubleFacesCard) card).getLeftHalfCard();
|
||||||
|
ModalDoubleFacesCardHalf rightHalfCard = ((ModalDoubleFacesCard) card).getRightHalfCard();
|
||||||
|
game.getState().getCreateMageObjectAttribute(leftHalfCard, game).getColor().setColor(colorless);
|
||||||
|
game.getState().getCreateMageObjectAttribute(rightHalfCard, game).getColor().setColor(colorless);
|
||||||
|
}
|
||||||
|
|
||||||
|
// split cards
|
||||||
|
if (card instanceof SplitCard) {
|
||||||
|
SplitCardHalf leftHalfCard = ((SplitCard) card).getLeftHalfCard();
|
||||||
|
SplitCardHalf rightHalfCard = ((SplitCard) card).getRightHalfCard();
|
||||||
|
game.getState().getCreateMageObjectAttribute(leftHalfCard, game).getColor().setColor(colorless);
|
||||||
|
game.getState().getCreateMageObjectAttribute(rightHalfCard, game).getColor().setColor(colorless);
|
||||||
|
}
|
||||||
|
|
||||||
|
// double faces cards
|
||||||
|
if (card.getSecondCardFace() != null) {
|
||||||
|
game.getState().getCreateMageObjectAttribute(card, game).getColor().setColor(colorless);
|
||||||
|
}
|
||||||
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue