Update the changed text of the intrinsic spell abilities and keywords.
()
| 5470 | * Update the changed text of the intrinsic spell abilities and keywords. |
| 5471 | */ |
| 5472 | public void updateChangedText() { |
| 5473 | currentState.updateChangedText(); |
| 5474 | |
| 5475 | // update changed text in the layer, for Volrath's Shapeshifter |
| 5476 | for (CardTraitChanges change : this.changedCardTraitsByText.values()) { |
| 5477 | change.changeText(); |
| 5478 | } |
| 5479 | |
| 5480 | // need to get keywords before text change |
| 5481 | KeywordCollection beforeKeywords = new KeywordCollection(); |
| 5482 | beforeKeywords.insertAll(currentState.getIntrinsicKeywords()); |
| 5483 | beforeKeywords.applyChanges(this.changedCardKeywordsByText.values()); |
| 5484 | |
| 5485 | final List<KeywordInterface> addKeywords = Lists.newArrayList(); |
| 5486 | final List<KeywordInterface> removeKeywords = Lists.newArrayList(); |
| 5487 | // Text Change for intrinsic keywords |
| 5488 | for (KeywordInterface kw : beforeKeywords) { |
| 5489 | String oldtxt = kw.getOriginal(); |
| 5490 | if (oldtxt.startsWith("Class")) { |
| 5491 | for (StaticAbility trait : kw.getStaticAbilities()) { |
| 5492 | trait.changeText(); |
| 5493 | } |
| 5494 | } else if (oldtxt.startsWith("Chapter")) { |
| 5495 | for (Trigger trait : kw.getTriggers()) { |
| 5496 | trait.changeText(); |
| 5497 | } |
| 5498 | } else { |
| 5499 | final String newtxt = AbilityUtils.applyKeywordTextChangeEffects(oldtxt, getChangedTextColorWords(), getChangedTextTypeWords()); |
| 5500 | if (!newtxt.equals(oldtxt)) { |
| 5501 | KeywordInterface newKw = Keyword.getInstance(newtxt); |
| 5502 | newKw.createTraits(this, true); |
| 5503 | addKeywords.add(newKw); |
| 5504 | removeKeywords.add(kw); |
| 5505 | } |
| 5506 | } |
| 5507 | } |
| 5508 | |
| 5509 | changedCardKeywordsByWord = new KeywordsChange(addKeywords, removeKeywords, false); |
| 5510 | |
| 5511 | text = AbilityUtils.applyDescriptionTextChangeEffects(originalText, this); |
| 5512 | |
| 5513 | getView().updateChangedColorWords(this); |
| 5514 | getView().updateChangedTypes(this); |
| 5515 | updateManaCostForView(); |
| 5516 | |
| 5517 | updateTypeCache(); |
| 5518 | updateTypesForView(); |
| 5519 | |
| 5520 | updateAbilityTextForView(); |
| 5521 | view.updateNonAbilityText(this); |
| 5522 | } |
| 5523 | |
| 5524 | public final ImmutableMap<String, String> getChangedTextColorWords() { |
| 5525 | return ImmutableMap.copyOf(changedTextColors); |
no test coverage detected