(final Collection<KeywordInterface> keywords)
| 2438 | |
| 2439 | // convert a keyword list to the String that should be displayed in game |
| 2440 | private String keywordsToText(final Collection<KeywordInterface> keywords) { |
| 2441 | final StringBuilder sb = new StringBuilder(); |
| 2442 | final StringBuilder sbLong = new StringBuilder(); |
| 2443 | |
| 2444 | List<String> printedKW = new ArrayList<>(); |
| 2445 | |
| 2446 | int i = 0; |
| 2447 | for (KeywordInterface inst : keywords) { |
| 2448 | String keyword = inst.getOriginal(); |
| 2449 | try { |
| 2450 | if (keyword.startsWith("etbCounter")) { |
| 2451 | final String[] p = keyword.split(":"); |
| 2452 | final StringBuilder s = new StringBuilder(); |
| 2453 | if (p.length > 4) { |
| 2454 | if (!"no desc".equals(p[4])) { |
| 2455 | s.append(p[4]); |
| 2456 | } |
| 2457 | } else { |
| 2458 | s.append(getName()).append(" enters with "); |
| 2459 | s.append(Lang.nounWithNumeralExceptOne(p[2], |
| 2460 | CounterType.getType(p[1]).getName().toLowerCase() + " counter")); |
| 2461 | s.append(" on it."); |
| 2462 | } |
| 2463 | sbLong.append(s).append("\r\n"); |
| 2464 | } else if (keyword.startsWith("DeckLimit")) { |
| 2465 | final String[] k = keyword.split(":"); |
| 2466 | sbLong.append(k[2]).append("\r\n"); |
| 2467 | } else if (keyword.startsWith("Enchant") && inst instanceof KeywordWithType kwt) { |
| 2468 | String desc = kwt.getTypeDescription(); |
| 2469 | sbLong.append("Enchant ").append(desc).append("\r\n"); |
| 2470 | } else if (keyword.startsWith("Morph") || keyword.startsWith("Megamorph") |
| 2471 | || keyword.startsWith("Multikicker") || keyword.startsWith("Echo") |
| 2472 | || keyword.startsWith("Disguise") || keyword.startsWith("Reflect") |
| 2473 | || keyword.startsWith("Mayhem") || keyword.startsWith("Recover") |
| 2474 | || keyword.startsWith("Sneak") || keyword.startsWith("Squad") |
| 2475 | || keyword.startsWith("Emerge") || keyword.startsWith("More Than Meets the Eye") |
| 2476 | || keyword.startsWith("Level up") || keyword.startsWith("Plot") |
| 2477 | || keyword.startsWith("Impending") || keyword.equals("Suspend")) { |
| 2478 | sbLong.append(inst.getTitle()).append(" (").append(inst.getReminderText()).append(")"); |
| 2479 | sbLong.append("\r\n"); |
| 2480 | } else if (keyword.startsWith("Escape") || keyword.startsWith("Foretell:") |
| 2481 | || keyword.startsWith("Madness:") || keyword.startsWith("Reconfigure") |
| 2482 | || keyword.startsWith("Miracle") || keyword.startsWith("Offspring")) { |
| 2483 | String[] k = keyword.split(":"); |
| 2484 | sbLong.append(k[0]); |
| 2485 | if (k.length > 1) { |
| 2486 | final Cost mCost; |
| 2487 | if ("ManaCost".equals(k[1])) { |
| 2488 | ManaCost cost; |
| 2489 | if (keyword.startsWith("Miracle") && k.length > 2) { |
| 2490 | // TODO better handle 2 hybrid, these should not be reduced? |
| 2491 | ManaCostBeingPaid mcbp = new ManaCostBeingPaid(getManaCost()); |
| 2492 | mcbp.decreaseGenericMana(Integer.valueOf(k[2])); |
| 2493 | cost = mcbp.toManaCost(); |
| 2494 | } else { |
| 2495 | cost = getManaCost(); |
| 2496 | } |
| 2497 | mCost = new Cost(cost, true); |
no test coverage detected