mirror of
https://github.com/correl/mage.git
synced 2025-01-12 19:25:44 +00:00
fixed color-changing effects removing subtypes
This commit is contained in:
parent
3ead624f76
commit
21d3db39c8
7 changed files with 24 additions and 43 deletions
|
@ -98,38 +98,26 @@ class ConspyEffect extends ContinuousEffectImpl {
|
|||
for (UUID cardId : controller.getGraveyard()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||
for (SubType s : card.getSubtype(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
||||
}
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
||||
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||
}
|
||||
}
|
||||
// on Hand
|
||||
for (UUID cardId : controller.getHand()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||
for (SubType s : card.getSubtype(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
||||
}
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
||||
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||
}
|
||||
}
|
||||
// in Exile
|
||||
for (Card card : game.getState().getExile().getAllCards(game)) {
|
||||
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||
for (SubType s : card.getSubtype(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
||||
}
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
||||
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||
}
|
||||
}
|
||||
// in Library (e.g. for Mystical Teachings)
|
||||
for (Card card : controller.getLibrary().getCards(game)) {
|
||||
if (card.getOwnerId().equals(controller.getId()) && card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||
for (SubType s : card.getSubtype(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
||||
}
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
||||
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||
}
|
||||
}
|
||||
// commander in command zone
|
||||
|
@ -137,10 +125,7 @@ class ConspyEffect extends ContinuousEffectImpl {
|
|||
if (game.getState().getZone(commanderId) == Zone.COMMAND) {
|
||||
Card card = game.getCard(commanderId);
|
||||
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||
for (SubType s : card.getSubtype(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
||||
}
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
||||
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -152,10 +137,7 @@ class ConspyEffect extends ContinuousEffectImpl {
|
|||
&& stackObject.isCreature()
|
||||
&& !stackObject.hasSubtype(choice, game)) {
|
||||
Card card = ((Spell) stackObject).getCard();
|
||||
for (SubType s : card.getSubtype(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
||||
}
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
||||
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||
}
|
||||
}
|
||||
// creatures you control
|
||||
|
|
|
@ -49,11 +49,11 @@ import java.util.UUID;
|
|||
public class AshesOfTheFallen extends CardImpl {
|
||||
|
||||
public AshesOfTheFallen(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
|
||||
// As Ashes of the Fallen enters the battlefield, choose a creature type.
|
||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.Benefit)));
|
||||
|
||||
|
||||
// Each creature card in your graveyard has the chosen creature type in addition to its other types.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AshesOfTheFallenEffect()));
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class AshesOfTheFallen extends CardImpl {
|
|||
}
|
||||
|
||||
class AshesOfTheFallenEffect extends ContinuousEffectImpl {
|
||||
|
||||
|
||||
AshesOfTheFallenEffect() {
|
||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||
staticText = "Each creature card in your graveyard has the chosen creature type in addition to its other types";
|
||||
|
@ -88,7 +88,7 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl {
|
|||
for (UUID cardId : controller.getGraveyard()) {
|
||||
Card card = game.getCard(cardId);
|
||||
if (card != null && card.isCreature() && !card.hasSubtype(subtype, game)) {
|
||||
game.getState().getCreateCardAttribute(card).getSubtype().add(subtype);
|
||||
game.getState().getCreateCardAttribute(card, game).getSubtype().add(subtype);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -101,4 +101,3 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl {
|
|||
return new AshesOfTheFallenEffect(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ class ConspiracyEffect extends ContinuousEffectImpl {
|
|||
if (object instanceof Card) {
|
||||
Card card = (Card) object;
|
||||
setChosenSubtype(
|
||||
game.getState().getCreateCardAttribute(card).getSubtype(),
|
||||
game.getState().getCreateCardAttribute(card, game).getSubtype(),
|
||||
subtype);
|
||||
} else {
|
||||
setChosenSubtype(object.getSubtype(game), subtype);
|
||||
|
|
|
@ -52,7 +52,7 @@ import mage.players.Player;
|
|||
public class MycosynthLattice extends CardImpl {
|
||||
|
||||
public MycosynthLattice(UUID ownerId, CardSetInfo setInfo) {
|
||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{6}");
|
||||
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{6}");
|
||||
|
||||
// All permanents are artifacts in addition to their other types.
|
||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PermanentsAreArtifactsEffect()));
|
||||
|
@ -121,7 +121,7 @@ class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
// exile
|
||||
for (Card card : game.getExile().getAllCards(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
||||
game.getState().getCreateCardAttribute(card, game).getColor().setColor(colorless);
|
||||
}
|
||||
// command
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
|
@ -132,15 +132,15 @@ class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
|||
if (player != null) {
|
||||
// hand
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
||||
game.getState().getCreateCardAttribute(card, game).getColor().setColor(colorless);
|
||||
}
|
||||
// library
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
||||
game.getState().getCreateCardAttribute(card, game).getColor().setColor(colorless);
|
||||
}
|
||||
// graveyard
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
||||
game.getState().getCreateCardAttribute(card, game).getColor().setColor(colorless);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class PaintersServantEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
// Exile
|
||||
for (Card card : game.getExile().getAllCards(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
||||
game.getState().getCreateCardAttribute(card, game).getColor().addColor(color);
|
||||
}
|
||||
// Command
|
||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||
|
@ -123,15 +123,15 @@ class PaintersServantEffect extends ContinuousEffectImpl {
|
|||
if (player != null) {
|
||||
// Hand
|
||||
for (Card card : player.getHand().getCards(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
||||
game.getState().getCreateCardAttribute(card, game).getColor().addColor(color);
|
||||
}
|
||||
// Library
|
||||
for (Card card : player.getLibrary().getCards(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
||||
game.getState().getCreateCardAttribute(card, game).getColor().addColor(color);
|
||||
}
|
||||
// Graveyard
|
||||
for (Card card : player.getGraveyard().getCards(game)) {
|
||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
||||
game.getState().getCreateCardAttribute(card, game).getColor().addColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,10 @@ public class CardAttribute implements Serializable {
|
|||
protected ObjectColor color;
|
||||
protected SubTypeList subtype;
|
||||
|
||||
public CardAttribute(Card card) {
|
||||
public CardAttribute(Card card, Game game) {
|
||||
color = card.getColor(null).copy();
|
||||
subtype = new SubTypeList();
|
||||
subtype.addAll(subtype);
|
||||
subtype.addAll(card.getSubtype(game));
|
||||
}
|
||||
|
||||
public CardAttribute(CardAttribute cardAttribute) {
|
||||
|
|
|
@ -1079,8 +1079,8 @@ public class GameState implements Serializable, Copyable<GameState> {
|
|||
return cardAttribute.get(cardId);
|
||||
}
|
||||
|
||||
public CardAttribute getCreateCardAttribute(Card card) {
|
||||
CardAttribute cardAtt = cardAttribute.computeIfAbsent(card.getId(), k -> new CardAttribute(card));
|
||||
public CardAttribute getCreateCardAttribute(Card card, Game game) {
|
||||
CardAttribute cardAtt = cardAttribute.computeIfAbsent(card.getId(), k -> new CardAttribute(card, game));
|
||||
return cardAtt;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue