(final Card card, final Player ai, final SpellAbility sa)
| 9 | public class CloakAi extends ManifestBaseAi { |
| 10 | |
| 11 | @Override |
| 12 | protected boolean shouldApply(final Card card, final Player ai, final SpellAbility sa) { |
| 13 | // check to ensure that there are no replacement effects that prevent creatures ETBing from library |
| 14 | // (e.g. Grafdigger's Cage) |
| 15 | Card topCopy = CardCopyService.getLKICopy(card); |
| 16 | topCopy.turnFaceDownNoUpdate(); |
| 17 | topCopy.setCloaked(sa); |
| 18 | |
| 19 | if (ComputerUtil.isETBprevented(topCopy)) { |
| 20 | return false; |
| 21 | } |
| 22 | |
| 23 | if (card.getView().canBeShownTo(ai.getView())) { |
| 24 | // try to avoid manifest a non Permanent |
| 25 | if (!card.isPermanent()) |
| 26 | return false; |
| 27 | |
| 28 | // do not manifest a card with X in its cost |
| 29 | if (card.getManaCost().countX() > 0) |
| 30 | return false; |
| 31 | |
| 32 | // try to avoid manifesting a creature with zero or less toughness |
| 33 | if (card.isCreature() && card.getNetToughness() <= 0) |
| 34 | return false; |
| 35 | |
| 36 | // card has ETBTrigger or ETBReplacement |
| 37 | if (card.hasETBTrigger(false) || card.hasETBReplacement()) { |
| 38 | return false; |
| 39 | } |
| 40 | } |
| 41 | return true; |
| 42 | } |
| 43 | } |
nothing calls this directly
no test coverage detected