* Bestow - Fixed a problem that if the target of a bestow enchantment aura got illegal, the bestow permanent did not chnage back to be a creature.

This commit is contained in:
LevelX2 2018-02-12 15:49:16 +01:00
parent f0f407457e
commit a85fa82de0
2 changed files with 51 additions and 2 deletions

View file

@ -1884,6 +1884,7 @@ public abstract class GameImpl implements Game, Serializable {
if (card != null && card.isCreature()) {
UUID wasAttachedTo = perm.getAttachedTo();
perm.attachTo(null, this);
BestowAbility.becomeCreature(perm, this);
fireEvent(new GameEvent(GameEvent.EventType.UNATTACHED, wasAttachedTo, perm.getId(), perm.getControllerId()));
} else if (movePermanentToGraveyardWithInfo(perm)) {
somethingHappened = true;
@ -1909,7 +1910,9 @@ public abstract class GameImpl implements Game, Serializable {
if (attachedTo == null
|| !((TargetCard) spellAbility.getTargets().get(0)).canTarget(perm.getControllerId(), perm.getAttachedTo(), spellAbility, this)) {
if (movePermanentToGraveyardWithInfo(perm)) {
attachedTo.removeAttachment(perm.getId(), this);
if (attachedTo != null) {
attachedTo.removeAttachment(perm.getId(), this);
}
somethingHappened = true;
}
}