Fixed a bug of Aura Finesse not triggering UNATTACH event.

This commit is contained in:
LevelX2 2013-02-10 03:01:05 +01:00
parent cae028cc78
commit 0bf9491aa1

View file

@ -102,9 +102,13 @@ class AuraFinesseEffect extends OneShotEffect<AuraFinesseEffect> {
Permanent aura = game.getPermanent(source.getFirstTarget()); Permanent aura = game.getPermanent(source.getFirstTarget());
Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget()); Permanent creature = game.getPermanent(source.getTargets().get(1).getFirstTarget());
if (aura != null && creature != null) { if (aura != null && creature != null) {
aura.attachTo(creature.getId(), game); Permanent oldCreature = game.getPermanent(aura.getAttachedTo());
creature.addAttachment(aura.getId(), game); if (oldCreature == null || oldCreature.equals(creature)) {
return true; return false;
}
if (oldCreature.removeAttachment(aura.getId(), game)) {
return creature.addAttachment(aura.getId(), game);
}
} }
return false; return false;
} }