mirror of
https://github.com/magefree/mage.git
synced 2025-12-22 03:22:00 -08: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()) {
|
for (UUID cardId : controller.getGraveyard()) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||||
for (SubType s : card.getSubtype(game)) {
|
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
|
||||||
}
|
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// on Hand
|
// on Hand
|
||||||
for (UUID cardId : controller.getHand()) {
|
for (UUID cardId : controller.getHand()) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||||
for (SubType s : card.getSubtype(game)) {
|
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
|
||||||
}
|
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// in Exile
|
// in Exile
|
||||||
for (Card card : game.getState().getExile().getAllCards(game)) {
|
for (Card card : game.getState().getExile().getAllCards(game)) {
|
||||||
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||||
for (SubType s : card.getSubtype(game)) {
|
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
|
||||||
}
|
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// in Library (e.g. for Mystical Teachings)
|
// in Library (e.g. for Mystical Teachings)
|
||||||
for (Card card : controller.getLibrary().getCards(game)) {
|
for (Card card : controller.getLibrary().getCards(game)) {
|
||||||
if (card.getOwnerId().equals(controller.getId()) && card.isCreature() && !card.hasSubtype(choice, game)) {
|
if (card.getOwnerId().equals(controller.getId()) && card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||||
for (SubType s : card.getSubtype(game)) {
|
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
|
||||||
}
|
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// commander in command zone
|
// commander in command zone
|
||||||
|
|
@ -137,10 +125,7 @@ class ConspyEffect extends ContinuousEffectImpl {
|
||||||
if (game.getState().getZone(commanderId) == Zone.COMMAND) {
|
if (game.getState().getZone(commanderId) == Zone.COMMAND) {
|
||||||
Card card = game.getCard(commanderId);
|
Card card = game.getCard(commanderId);
|
||||||
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
if (card.isCreature() && !card.hasSubtype(choice, game)) {
|
||||||
for (SubType s : card.getSubtype(game)) {
|
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
|
||||||
}
|
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -152,10 +137,7 @@ class ConspyEffect extends ContinuousEffectImpl {
|
||||||
&& stackObject.isCreature()
|
&& stackObject.isCreature()
|
||||||
&& !stackObject.hasSubtype(choice, game)) {
|
&& !stackObject.hasSubtype(choice, game)) {
|
||||||
Card card = ((Spell) stackObject).getCard();
|
Card card = ((Spell) stackObject).getCard();
|
||||||
for (SubType s : card.getSubtype(game)) {
|
game.getState().getCreateCardAttribute(card, game).getSubtype().add(choice);
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(s);
|
|
||||||
}
|
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype().add(choice);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// creatures you control
|
// creatures you control
|
||||||
|
|
|
||||||
|
|
@ -49,11 +49,11 @@ import java.util.UUID;
|
||||||
public class AshesOfTheFallen extends CardImpl {
|
public class AshesOfTheFallen extends CardImpl {
|
||||||
|
|
||||||
public AshesOfTheFallen(UUID ownerId, CardSetInfo setInfo) {
|
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.
|
// As Ashes of the Fallen enters the battlefield, choose a creature type.
|
||||||
this.addAbility(new AsEntersBattlefieldAbility(new ChooseCreatureTypeEffect(Outcome.Benefit)));
|
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.
|
// 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()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new AshesOfTheFallenEffect()));
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,7 @@ public class AshesOfTheFallen extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class AshesOfTheFallenEffect extends ContinuousEffectImpl {
|
class AshesOfTheFallenEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
AshesOfTheFallenEffect() {
|
AshesOfTheFallenEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
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";
|
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()) {
|
for (UUID cardId : controller.getGraveyard()) {
|
||||||
Card card = game.getCard(cardId);
|
Card card = game.getCard(cardId);
|
||||||
if (card != null && card.isCreature() && !card.hasSubtype(subtype, game)) {
|
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;
|
return true;
|
||||||
|
|
@ -101,4 +101,3 @@ class AshesOfTheFallenEffect extends ContinuousEffectImpl {
|
||||||
return new AshesOfTheFallenEffect(this);
|
return new AshesOfTheFallenEffect(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ class ConspiracyEffect extends ContinuousEffectImpl {
|
||||||
if (object instanceof Card) {
|
if (object instanceof Card) {
|
||||||
Card card = (Card) object;
|
Card card = (Card) object;
|
||||||
setChosenSubtype(
|
setChosenSubtype(
|
||||||
game.getState().getCreateCardAttribute(card).getSubtype(),
|
game.getState().getCreateCardAttribute(card, game).getSubtype(),
|
||||||
subtype);
|
subtype);
|
||||||
} else {
|
} else {
|
||||||
setChosenSubtype(object.getSubtype(game), subtype);
|
setChosenSubtype(object.getSubtype(game), subtype);
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ import mage.players.Player;
|
||||||
public class MycosynthLattice extends CardImpl {
|
public class MycosynthLattice extends CardImpl {
|
||||||
|
|
||||||
public MycosynthLattice(UUID ownerId, CardSetInfo setInfo) {
|
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.
|
// All permanents are artifacts in addition to their other types.
|
||||||
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PermanentsAreArtifactsEffect()));
|
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PermanentsAreArtifactsEffect()));
|
||||||
|
|
@ -121,7 +121,7 @@ class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
||||||
}
|
}
|
||||||
// exile
|
// exile
|
||||||
for (Card card : game.getExile().getAllCards(game)) {
|
for (Card card : game.getExile().getAllCards(game)) {
|
||||||
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
game.getState().getCreateCardAttribute(card, game).getColor().setColor(colorless);
|
||||||
}
|
}
|
||||||
// command
|
// command
|
||||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||||
|
|
@ -132,15 +132,15 @@ class EverythingIsColorlessEffect extends ContinuousEffectImpl {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
// hand
|
// hand
|
||||||
for (Card card : player.getHand().getCards(game)) {
|
for (Card card : player.getHand().getCards(game)) {
|
||||||
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
game.getState().getCreateCardAttribute(card, game).getColor().setColor(colorless);
|
||||||
}
|
}
|
||||||
// library
|
// library
|
||||||
for (Card card : player.getLibrary().getCards(game)) {
|
for (Card card : player.getLibrary().getCards(game)) {
|
||||||
game.getState().getCreateCardAttribute(card).getColor().setColor(colorless);
|
game.getState().getCreateCardAttribute(card, game).getColor().setColor(colorless);
|
||||||
}
|
}
|
||||||
// graveyard
|
// graveyard
|
||||||
for (Card card : player.getGraveyard().getCards(game)) {
|
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
|
// Exile
|
||||||
for (Card card : game.getExile().getAllCards(game)) {
|
for (Card card : game.getExile().getAllCards(game)) {
|
||||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
game.getState().getCreateCardAttribute(card, game).getColor().addColor(color);
|
||||||
}
|
}
|
||||||
// Command
|
// Command
|
||||||
for (CommandObject commandObject : game.getState().getCommand()) {
|
for (CommandObject commandObject : game.getState().getCommand()) {
|
||||||
|
|
@ -123,15 +123,15 @@ class PaintersServantEffect extends ContinuousEffectImpl {
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
// Hand
|
// Hand
|
||||||
for (Card card : player.getHand().getCards(game)) {
|
for (Card card : player.getHand().getCards(game)) {
|
||||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
game.getState().getCreateCardAttribute(card, game).getColor().addColor(color);
|
||||||
}
|
}
|
||||||
// Library
|
// Library
|
||||||
for (Card card : player.getLibrary().getCards(game)) {
|
for (Card card : player.getLibrary().getCards(game)) {
|
||||||
game.getState().getCreateCardAttribute(card).getColor().addColor(color);
|
game.getState().getCreateCardAttribute(card, game).getColor().addColor(color);
|
||||||
}
|
}
|
||||||
// Graveyard
|
// Graveyard
|
||||||
for (Card card : player.getGraveyard().getCards(game)) {
|
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 ObjectColor color;
|
||||||
protected SubTypeList subtype;
|
protected SubTypeList subtype;
|
||||||
|
|
||||||
public CardAttribute(Card card) {
|
public CardAttribute(Card card, Game game) {
|
||||||
color = card.getColor(null).copy();
|
color = card.getColor(null).copy();
|
||||||
subtype = new SubTypeList();
|
subtype = new SubTypeList();
|
||||||
subtype.addAll(subtype);
|
subtype.addAll(card.getSubtype(game));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardAttribute(CardAttribute cardAttribute) {
|
public CardAttribute(CardAttribute cardAttribute) {
|
||||||
|
|
|
||||||
|
|
@ -1079,8 +1079,8 @@ public class GameState implements Serializable, Copyable<GameState> {
|
||||||
return cardAttribute.get(cardId);
|
return cardAttribute.get(cardId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public CardAttribute getCreateCardAttribute(Card card) {
|
public CardAttribute getCreateCardAttribute(Card card, Game game) {
|
||||||
CardAttribute cardAtt = cardAttribute.computeIfAbsent(card.getId(), k -> new CardAttribute(card));
|
CardAttribute cardAtt = cardAttribute.computeIfAbsent(card.getId(), k -> new CardAttribute(card, game));
|
||||||
return cardAtt;
|
return cardAtt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue