refactor: introduce new helper method

to find permanent from card after moved to battlefield
This commit is contained in:
xenohedron 2025-04-17 19:12:50 -04:00
parent f07aa6a4a3
commit 535543860f
4 changed files with 12 additions and 3 deletions

View file

@ -1315,6 +1315,15 @@ public final class CardUtil {
return permCard;
}
/**
* If a card object is moved to the battlefield, object id can be different (e.g. MDFC).
* Use this method to get the permanent object from the card object after move to battlefield.
* Can return null if not found on the battlefield.
*/
public static Permanent getPermanentFromCardPutToBattlefield(Card card, Game game) {
return game.getPermanent(CardUtil.getDefaultCardSideForBattlefield(game, card).getId());
}
/**
* Return card name for same name searching
*