Avoid some redundant view updates

This commit is contained in:
tool4EvEr
2023-10-05 19:11:26 +02:00
parent 9e64f374bf
commit 06ff43eb86
3 changed files with 3 additions and 19 deletions

View File

@@ -1159,18 +1159,6 @@ public class GameAction {
} }
c.getStaticCommandList().removeAll(toRemove); c.getStaticCommandList().removeAll(toRemove);
} }
// Exclude cards in hidden zones from update
/*
* Refactoring this code to affectedCards.removeIf((Card c) -> c.isInZone(ZoneType.Library));
* causes Android build not to compile
* */
Iterator<Card> it = affectedCards.iterator();
while (it.hasNext()) {
Card c = it.next();
if (c.isInZone(ZoneType.Library)) {
it.remove();
}
}
// preList means that this is run by a pre Check with LKI objects // preList means that this is run by a pre Check with LKI objects
// in that case Always trigger should not Run // in that case Always trigger should not Run

View File

@@ -217,13 +217,11 @@ public class StaticEffect {
// remove P/T bonus // remove P/T bonus
affectedCard.removePTBoost(getTimestamp(), ability.getId()); affectedCard.removePTBoost(getTimestamp(), ability.getId());
// the view is updated in GameAction#checkStaticAbilities to avoid flickering
// remove keywords // remove keywords
// (Although nothing uses it at this time) // (Although nothing uses it at this time)
if (hasParam("AddKeyword") || hasParam("RemoveKeyword") || hasParam("RemoveLandTypes") if (hasParam("AddKeyword") || hasParam("RemoveKeyword") || hasParam("RemoveLandTypes")
|| hasParam("ShareRememberedKeywords") || hasParam("RemoveAllAbilities")) { || hasParam("ShareRememberedKeywords") || hasParam("RemoveAllAbilities")) {
affectedCard.removeChangedCardKeywords(getTimestamp(), ability.getId()); affectedCard.removeChangedCardKeywords(getTimestamp(), ability.getId(), false);
} }
if (hasParam("CantHaveKeyword")) { if (hasParam("CantHaveKeyword")) {
@@ -289,8 +287,6 @@ public class StaticEffect {
} }
affectedCard.removeChangedSVars(getTimestamp(), ability.getId()); affectedCard.removeChangedSVars(getTimestamp(), ability.getId());
affectedCard.updateAbilityTextForView(); // only update keywords and text for view to avoid flickering
} }
return affectedCards; return affectedCards;
} }

View File

@@ -766,7 +766,7 @@ public final class StaticAbilityContinuous {
} }
affectedCard.addChangedCardKeywords(newKeywords, removeKeywords, affectedCard.addChangedCardKeywords(newKeywords, removeKeywords,
removeAllAbilities, hostCard.getTimestamp(), stAb.getId()); removeAllAbilities, hostCard.getTimestamp(), stAb.getId(), false);
} }
// add HIDDEN keywords // add HIDDEN keywords
@@ -895,7 +895,7 @@ public final class StaticAbilityContinuous {
if (addTypes != null || removeTypes != null || addAllCreatureTypes if (addTypes != null || removeTypes != null || addAllCreatureTypes
|| !remove.isEmpty()) { || !remove.isEmpty()) {
affectedCard.addChangedCardTypes(addTypes, removeTypes, addAllCreatureTypes, remove, affectedCard.addChangedCardTypes(addTypes, removeTypes, addAllCreatureTypes, remove,
hostCard.getTimestamp(), stAb.getId(), true, stAb.hasParam("CharacteristicDefining")); hostCard.getTimestamp(), stAb.getId(), false, stAb.hasParam("CharacteristicDefining"));
} }
// add colors // add colors