@@ -120,7 +120,6 @@ public class Card extends GameEntity implements Comparable<Card>, IHasSVars, ITr
120120
121121 // changes by AF animate and continuous static effects
122122
123- protected ICardChangedType changedTypeByText ; // Layer 3 by Text Change
124123 // x=timestamp y=StaticAbility id
125124 private final Table <Long , Long , ICardChangedType > changedCardTypesByText = TreeBasedTable .create (); // Layer 3
126125 private final Table <Long , Long , ICardChangedType > changedCardTypesCharacterDefining = TreeBasedTable .create (); // Layer 4 CDA
@@ -4140,25 +4139,19 @@ public Iterable<ICardChangedType> getChangedCardTypes() {
41404139 // If there are no changed types, just return an empty immutable list, which actually
41414140 // produces a surprisingly large speedup by avoid lots of temp objects and making iteration
41424141 // over the result much faster. (This function gets called a lot!)
4143- if (changedCardTypesByText .isEmpty () && changedTypeByText == null && changedCardTypesCharacterDefining .isEmpty () && changedCardTypes .isEmpty ()) {
4142+ if (changedCardTypesByText .isEmpty () && changedCardTypesCharacterDefining .isEmpty () && changedCardTypes .isEmpty ()) {
41444143 return ImmutableList .of ();
41454144 }
4146- Iterable <ICardChangedType > byText = changedTypeByText == null ? ImmutableList .of () : ImmutableList .of (this .changedTypeByText );
41474145 return ImmutableList .copyOf (Iterables .concat (
41484146 changedCardTypesByText .values (), // Layer 3
4149- byText , // Layer 3 by Word Changes,
41504147 changedCardTypesCharacterDefining .values (), // Layer 4
4151- changedCardTypes .values () // Layer 6
4148+ changedCardTypes .values () // Layer 4
41524149 ));
41534150 }
41544151
41554152 public boolean clearChangedCardTypes () {
41564153 boolean changed = false ;
41574154
4158- if (changedTypeByText != null )
4159- changed = true ;
4160- changedTypeByText = null ;
4161-
41624155 if (!changedCardTypesByText .isEmpty ())
41634156 changed = true ;
41644157 changedCardTypesByText .clear ();
@@ -4210,18 +4203,16 @@ public void setChangedCardKeywords(Table<Long, Long, KeywordsChange> changedCard
42104203 }
42114204 }
42124205
4213- public final void addChangedCardTypesByText (final CardType addType , final long timestamp , final long staticId ) {
4214- changedCardTypesByText .put (timestamp , staticId , new CardChangedType (addType , null , false ,
4215- EnumSet .of (RemoveType .SuperTypes , RemoveType .CardTypes , RemoveType .SubTypes )));
4216-
4217- // setting card type via text, does overwrite any other word change effects?
4218- this .changedTextColors .addEmpty (timestamp , staticId );
4219- this .changedTextTypes .addEmpty (timestamp , staticId );
4220-
4221- this .updateChangedText ();
4206+ public final void addChangedCardTypesByText (final CardTypeView addType , final long timestamp , final long staticId ) {
4207+ changedCardTypesByText .put (timestamp , staticId , new StateChangedType (addType ));
4208+ updateTypeCache ();
42224209 }
42234210 public final boolean removeChangedCardTypesByText (final long timestamp , final long staticId ) {
4224- return changedCardTypesByText .remove (timestamp , staticId ) != null ;
4211+ boolean removed = changedCardTypesByText .remove (timestamp , staticId ) != null ;
4212+ if (removed ) {
4213+ updateTypeCache ();
4214+ }
4215+ return removed ;
42254216 }
42264217
42274218 public final void addChangedCardTypes (final CardType addType , final CardType removeType , final boolean addAllCreatureTypes ,
@@ -4472,7 +4463,6 @@ public final void setPTCharacterDefiningTable(Table<Long, Long, Pair<Integer, In
44724463
44734464 public final void addNewPTByText (final Integer power , final Integer toughness , final long timestamp , final long staticId ) {
44744465 newPTText .put (timestamp , staticId , Pair .of (power , toughness ));
4475- updatePTforView ();
44764466 }
44774467 public final boolean removeNewPTbyText (final long timestamp , final long staticId ) {
44784468 return newPTText .remove (timestamp , staticId ) != null ;
@@ -4993,7 +4983,11 @@ public final void addChangedCardTraitsByText(Collection<SpellAbility> spells,
49934983 changedCardTraitsByText .put (timestamp , staticId , new CardTraitChanges (
49944984 spells , null , trigger , replacements , statics , true , false
49954985 ));
4996- updateAbilityTextForView ();
4986+
4987+ // setting card traits via text, does overwrite any other word change effects?
4988+ this .changedTextColors .addEmpty (timestamp , staticId );
4989+ this .changedTextTypes .addEmpty (timestamp , staticId );
4990+ updateChangedText ();
49974991 }
49984992
49994993 public final CardTraitChanges addChangedCardTraits (Collection <SpellAbility > spells , Collection <SpellAbility > removedAbilities ,
@@ -5536,10 +5530,14 @@ public final void removeChangedTextColorWord(final Long timestamp, final long st
55365530 */
55375531 public final void addChangedTextTypeWord (final String originalWord , final String newWord , final Long timestamp , final long staticId ) {
55385532 changedTextTypes .add (timestamp , staticId , originalWord , newWord );
5533+ changedCardTypesByText .put (timestamp , staticId , new WordChangedType (originalWord , newWord ));
55395534 updateChangedText ();
55405535 }
55415536
55425537 public final void removeChangedTextTypeWord (final Long timestamp , final long staticId ) {
5538+ if (changedCardTypesByText .remove (timestamp , staticId ) != null ) {
5539+ updateTypeCache ();
5540+ }
55435541 if (changedTextTypes .remove (timestamp , staticId )) {
55445542 updateChangedText ();
55455543 }
@@ -5549,8 +5547,6 @@ public final void removeChangedTextTypeWord(final Long timestamp, final long sta
55495547 * Update the changed text of the intrinsic spell abilities and keywords.
55505548 */
55515549 public void updateChangedText () {
5552- this .changedTypeByText = new TextChangedType (this .changedTextTypes );
5553-
55545550 currentState .updateChangedText ();
55555551
55565552 // update changed text in the layer, for Volrath's Shapeshifter
0 commit comments