(final SpellAbility ability, final Player payer, final boolean effect)
| 170 | } |
| 171 | |
| 172 | @Override |
| 173 | public final boolean canPay(final SpellAbility ability, final Player payer, final boolean effect) { |
| 174 | final Card source = ability.getHostCard(); |
| 175 | final Game game = source.getGame(); |
| 176 | |
| 177 | String type = this.getType(); |
| 178 | if (type.equals("All")) { |
| 179 | return true; // this will always work |
| 180 | } |
| 181 | else if (type.contains("FromTopGrave")) { |
| 182 | type = TextUtil.fastReplace(type, "FromTopGrave", ""); |
| 183 | } |
| 184 | |
| 185 | CardCollection list = CardLists.filter(zoneRestriction != 1 ? game.getCardsIn(this.from) : |
| 186 | payer.getCardsIn(this.from), CardPredicates.canExiledBy(ability, effect)); |
| 187 | |
| 188 | if (this.payCostFromSource()) { |
| 189 | return list.contains(source); |
| 190 | } |
| 191 | if (getType().equals("OriginalHost")) { |
| 192 | return list.contains(ability.getOriginalHost()); |
| 193 | } |
| 194 | |
| 195 | boolean totalCMC = false; |
| 196 | String totalM = ""; |
| 197 | if (type.contains("+withTotalCMCEQ")) { |
| 198 | totalCMC = true; |
| 199 | totalM = type.split("withTotalCMCEQ")[1]; |
| 200 | type = TextUtil.fastReplace(type, TextUtil.concatNoSpace("+withTotalCMCEQ", totalM), ""); |
| 201 | } |
| 202 | boolean totalCMCgreater = false; |
| 203 | if (type.contains("+withTotalCMCGE")) { |
| 204 | totalCMCgreater = true; |
| 205 | totalM = type.split("withTotalCMCGE")[1]; |
| 206 | type = TextUtil.fastReplace(type, TextUtil.concatNoSpace("+withTotalCMCGE", totalM), ""); |
| 207 | } |
| 208 | |
| 209 | boolean sharedType = false; |
| 210 | if (type.contains("+withSharedCardType")) { |
| 211 | sharedType = true; |
| 212 | type = TextUtil.fastReplace(type, "+withSharedCardType", ""); |
| 213 | } |
| 214 | |
| 215 | int nTypes = -1; |
| 216 | if (type.contains("+withTypesGE")) { |
| 217 | String num = type.split("withTypesGE")[1]; |
| 218 | type = TextUtil.fastReplace(type, TextUtil.concatNoSpace("+withTypesGE", num), ""); |
| 219 | nTypes = Integer.parseInt(num); |
| 220 | } |
| 221 | |
| 222 | if (!type.contains("X") || ability.getXManaCostPaid() != null) { |
| 223 | list = CardLists.getValidCards(list, type.split(";"), payer, source, ability); |
| 224 | } |
| 225 | |
| 226 | if (nTypes > -1 && AbilityUtils.countCardTypesFromList(list, false) < nTypes) { |
| 227 | return false; |
| 228 | } |
| 229 |
nothing calls this directly
no test coverage detected