magefree / mage

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

Halvar, God of Battle wrongly attaches to protection permanents #12108

Open PurpleCrowbar opened 2 months ago

PurpleCrowbar commented 2 months ago

When using [[Halvar, God of Battle]]'s triggered ability to attach an equipment / aura to a creature, if the creature being targeted has protection from an attribute possessed by the attachment (i.e., the aura is blue and the creature has protection from blue), the attachment will attach to the permanent and then immediately be moved to the graveyard during state-based actions (due to the protection). In reality the attachment shouldn't be moved at all in such a case, as protection prohibits the act of enchanting, which means it shouldn't move. See the rule below:

303.4j. If an effect attempts to attach an Aura on the battlefield to an object or player it can't legally enchant, the Aura doesn't move.

This issue likewise applies to equipment.

github-actions[bot] commented 2 months ago

Halvar, God of Battle // Sword of the Realms - (Gatherer) (Scryfall) (EDHREC)

{2}{W}{W} Legendary Creature — God 4/4 Creatures you control that are enchanted or equipped have double strike. At the beginning of each combat, you may attach target Aura or Equipment attached to a creature you control to target creature you control. :arrows_counterclockwise: {1}{W} Legendary Artifact — Equipment Equipped creature gets +2/+0 and has vigilance. Whenever equipped creature dies, return it to its owner's hand. Equip {1}{W}

Susucre commented 2 months ago

That check in Halvar code is flawed: image

Should call Permanent::cantBeAttachedBy instead. For instance on creating Role tokens, the check is this: image

PurpleCrowbar commented 2 months ago

@Susucre Can confirm that fixes the issue - will include that in #12098