forked from External/mage
Improve attachment to permanent logic; implement [PIP] Codsworth, Handy Helper (#12098)
* [PIP] Implement Codsworth, Handy Helper * Fix Codsworth and Halvar * Write tests for attachments * Fix auras going to graveyard when attaching to illegal targets * Fix Captured by the Consulate interaction * Fix failing tests, add additional test * Add source name to log message * Implement requested changes * Revert removed null check * Remove filter check, clean up code * Add additional test * Fix failing roles test * Account for all current attachment edge cases * Implement rule 303.4g * Apply requested changes
This commit is contained in:
parent
9fcbfdeac6
commit
8d249aa691
10 changed files with 580 additions and 20 deletions
|
|
@ -4836,6 +4836,15 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
if (enterTransformed != null && enterTransformed && !card.isTransformable()) {
|
||||
continue;
|
||||
}
|
||||
// 303.4g. If an Aura is entering the battlefield and there is no legal object or player for it to enchant,
|
||||
// the Aura remains in its current zone, unless that zone is the stack. In that case, the Aura is put into
|
||||
// its owner's graveyard instead of entering the battlefield. If the Aura is a token, it isn't created.
|
||||
if (card.hasSubtype(SubType.AURA, game)
|
||||
&& card.getSpellAbility() != null
|
||||
&& !card.getSpellAbility().getTargets().isEmpty()
|
||||
&& !card.getSpellAbility().getTargets().get(0).copy().withNotTarget(true).canChoose(byOwner ? card.getOwnerId() : getId(), game)) {
|
||||
continue;
|
||||
}
|
||||
ZoneChangeEvent event = new ZoneChangeEvent(card.getId(), source,
|
||||
byOwner ? card.getOwnerId() : getId(), fromZone, Zone.BATTLEFIELD, appliedEffects);
|
||||
infoList.add(new ZoneChangeInfo.Battlefield(event, faceDown, tapped, source));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue