magefree / mage

Magic Another Game Engine
http://xmage.today
MIT License
1.92k stars 781 forks source link

Grafted Exoskeleton copy being destroyed doesn't trigger the sacrifice #8984

Open Pataah opened 2 years ago

Pataah commented 2 years ago

I had a game where a copy of Grafted Exoskeleton created with Masterwork of Ingenuity was destroyed, but the creature it was equipped with was not sacrificed. The copy was attached via Hammer of Nazahn's ability.

jeffwadsworth commented 2 years ago

[[Grafted Exoskeleton]] [[Masterwork of Ingenuity]] [[Hammer of Nazahn]]

github-actions[bot] commented 2 years ago

Grafted Exoskeleton - (Gatherer) (Scryfall) (EDHREC)

{4} Artifact — Equipment Equipped creature gets +2/+2 and has infect. (It deals damage to creatures in the form of -1/-1 counters and to players in the form of poison counters.) Whenever Grafted Exoskeleton becomes unattached from a permanent, sacrifice that permanent. Equip {2}

Masterwork of Ingenuity - (Gatherer) (Scryfall) (EDHREC)

{1} Artifact — Equipment You may have Masterwork of Ingenuity enter the battlefield as a copy of any Equipment on the battlefield.

Hammer of Nazahn - (Gatherer) (Scryfall) (EDHREC)

{4} Legendary Artifact — Equipment Whenever Hammer of Nazahn or another Equipment enters the battlefield under your control, you may attach that Equipment to target creature you control. Equipped creature gets +2/+0 and has indestructible. Equip {4}

jeffwadsworth commented 2 years ago

It works correctly if it is unattached via its equip ability, but it does not if blinked/destroyed.

jeffwadsworth commented 2 years ago

When a copy of a permanent is made, the (sourceId card) of all abilities on that card point to the "card or permanent that was copied", not the "card or permanent that it was copied to". So, if the permanent that is copying that object is moved to another zone, the triggered ability refers to the copied card/permanent instead. For example: Master of Ingenuity enters the battlefield and copies a Grafted Exoskeleton. That copied Grafted Exoskeleton (Master of Ingenuity) is attached to a permanent. That copied Grafted Exoskeleton is blinked. The trigger on the copied Grafted Exoskeleton will no longer refer to the Master of Ingenuity, but will have its "sourceId card" set as the original copied card (Grafted Exoskeleton). This is done so that the image of the Grafted Exoskeleton is referenced on the battlefield. A similar issue was "fixed" here: https://github.com/magefree/mage/commit/2ca1643b54e876329be83d96665d5848b7580b4b

The original issue with Arcane Denial: https://github.com/magefree/mage/issues/5437

Perhaps a similar thing can be implemented here, because this affects all copied cards.