Fixed that if a creature get attached to an object (e.g. because equipment becomes a creature), it gets unattached.

This commit is contained in:
LevelX2 2014-05-22 16:25:22 +02:00
parent 809d2034be
commit 0d8325bc79

View file

@ -1423,13 +1423,17 @@ public abstract class GameImpl<T extends GameImpl<T>> implements Game, Serializa
}
}
}
//20091005 - 704.5q
if (perm.getAttachments().size() > 0) {
for (UUID attachmentId: perm.getAttachments()) {
//20091005 - 704.5q If a creature is attached to an object or player, it becomes unattached and remains on the battlefield.
// Similarly, if a permanent that’s neither an Aura, an Equipment, nor a Fortification is attached to an object or player,
// it becomes unattached and remains on the battlefield.
if (perm.getAttachments().size() > 0) {
for (UUID attachmentId : perm.getAttachments()) {
Permanent attachment = getPermanent(attachmentId);
if (attachment != null && !(attachment.getSubtype().contains("Aura") ||
attachment.getSubtype().contains("Equipment") ||
attachment.getSubtype().contains("Fortification"))) {
if (attachment != null &&
(attachment.getCardType().contains(CardType.CREATURE) ||
!(attachment.getSubtype().contains("Aura")
|| attachment.getSubtype().contains("Equipment")
|| attachment.getSubtype().contains("Fortification")))) {
if (perm.removeAttachment(attachment.getId(), this)) {
somethingHappened = true;
break;