forked from External/mage
avoid casting to Card with dedicated method getSourceCardIfItStillExists
This commit is contained in:
parent
a90f226053
commit
d226b30592
40 changed files with 150 additions and 178 deletions
|
|
@ -39,6 +39,7 @@ import mage.util.GameLog;
|
|||
import mage.util.ThreadLocalStringBuilder;
|
||||
import mage.watchers.Watcher;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
@ -1356,6 +1357,15 @@ public abstract class AbilityImpl implements Ability {
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Card getSourceCardIfItStillExists(Game game) {
|
||||
MageObject mageObject = getSourceObjectIfItStillExists(game);
|
||||
if (mageObject instanceof Card) {
|
||||
return (Card) mageObject;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Permanent getSourcePermanentIfItStillExists(Game game) {
|
||||
MageObject mageObject = getSourceObjectIfItStillExists(game);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue