- Second attempt at fixing the keywords lingering longer than necessary, looks like there were actually two related problems - the data about equipments being copied over to a temporary copy that then became a card going to graveyard *and* the keywords from enchantments and such staying on the card (even the copied one, without any enchantment info being hard-copied) when going to graveyard.

- A better fix for the second problem would be to actually find *why* (and where in the code) those keywords are not cleaned up and clean them up there, but I can't find where it is for now. Please review and update as necessary.
This commit is contained in:
Agetian
2015-01-16 10:44:15 +00:00
parent 12688a1bb1
commit e5c25f1cab
2 changed files with 22 additions and 1 deletions

View File

@@ -136,7 +136,14 @@ public class GameAction {
c.updateStateForView(); c.updateStateForView();
} }
copied = CardFactory.copyCard(c, false); copied = CardFactory.copyCard(c, false, false);
// clear any leftover keyword replacements from the card leaving battlefield
copied.removeChangedCardKeywords(copied.getTimestamp());
copied.removeChangedCardTypes(copied.getTimestamp());
copied.removeChangedTextColorWord(copied.getTimestamp());
copied.removeChangedTextTypeWord(copied.getTimestamp());
copied.setUnearthed(c.isUnearthed()); copied.setUnearthed(c.isUnearthed());
copied.setTapped(false); copied.setTapped(false);
for (final Trigger trigger : copied.getTriggers()) { for (final Trigger trigger : copied.getTriggers()) {

View File

@@ -78,6 +78,10 @@ public class CardFactory {
* @return a {@link forge.game.card.Card} object. * @return a {@link forge.game.card.Card} object.
*/ */
public final static Card copyCard(final Card in, boolean assignNewId) { public final static Card copyCard(final Card in, boolean assignNewId) {
return copyCard(in, assignNewId, true);
}
public final static Card copyCard(final Card in, boolean assignNewId, boolean copyAttachmentData) {
Card out; Card out;
if (!(in.isToken() || in.getCopiedPermanent() != null)) { if (!(in.isToken() || in.getCopiedPermanent() != null)) {
out = assignNewId ? getCard(in.getPaperCard(), in.getOwner(), in.getGame()) out = assignNewId ? getCard(in.getPaperCard(), in.getOwner(), in.getGame())
@@ -99,6 +103,16 @@ public class CardFactory {
} }
out.setState(in.getCurrentStateName(), true); out.setState(in.getCurrentStateName(), true);
if (copyAttachmentData) {
// I'm not sure if we really should be copying enchant/equip stuff over.
out.setEquipping(in.getEquipping());
out.setEquippedBy(in.getEquippedBy(false));
out.setFortifying(in.getFortifying());
out.setFortifiedBy(in.getFortifiedBy(false));
out.setEnchantedBy(in.getEnchantedBy(false));
out.setEnchanting(in.getEnchanting());
}
out.setClones(in.getClones()); out.setClones(in.getClones());
out.setZone(in.getZone()); out.setZone(in.getZone());
for (final Object o : in.getRemembered()) { for (final Object o : in.getRemembered()) {