simplify LKI check using common method

This commit is contained in:
xenohedron 2023-09-30 01:29:32 -04:00
parent 63ae2e5a56
commit 78b5b8bdef
21 changed files with 39 additions and 169 deletions

View file

@ -3,7 +3,6 @@ package mage.abilities.effects.common;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
@ -31,12 +30,7 @@ public class ExileAttachedEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
// The LKI must be used for this step. 608.2g
// In the case that the enchantment is blinked
Permanent enchantment = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (enchantment == null) {
// It was not blinked, use the standard method
enchantment = game.getPermanentOrLKIBattlefield(source.getSourceId());
}
Permanent enchantment = source.getSourcePermanentOrLKI(game);
if (controller != null
&& enchantment != null
&& enchantment.getAttachedTo() != null) {