Improve trigger auto ordering and aura attachment (Lynde QOL fixes) (#10648)

* Lynde trigger references objects

* Changed triggered ability auto-order to care about targets

* Copy card test

* When a copy effect comes in as a copy of an aura,
it checks if it's already attached before asking player to attach

* add comments and null check per review

---------

Co-authored-by: xenohedron <xenohedron@users.noreply.github.com>
This commit is contained in:
Alexander Novotny 2023-11-01 21:40:04 -04:00 committed by GitHub
parent 38dd582adc
commit 87921494b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 116 additions and 10 deletions

View file

@ -157,10 +157,15 @@ public class CopyPermanentEffect extends OneShotEffect {
// select new target
auraTarget.withNotTarget(true);
if (!controller.choose(auraOutcome, auraTarget, source, game)) {
return true;
UUID targetId = (UUID) game.getState().getValue("attachTo:" + sourcePermanent.getId());
if (targetId == null) {
if (!controller.choose(auraOutcome, auraTarget, source, game)) {
return true;
}
targetId = auraTarget.getFirstTarget();
}
UUID targetId = auraTarget.getFirstTarget();
Permanent targetPermanent = game.getPermanent(targetId);
Player targetPlayer = game.getPlayer(targetId);
if (targetPermanent != null) {