Skip to content

Commit

Permalink
More view cleanup (#6967)
Browse files Browse the repository at this point in the history
  • Loading branch information
tool4ever authored Feb 3, 2025
1 parent 6615090 commit f562ae6
Show file tree
Hide file tree
Showing 10 changed files with 696 additions and 705 deletions.
4 changes: 3 additions & 1 deletion forge-ai/src/main/java/forge/ai/ComputerUtilMana.java
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,9 @@ public static ManaCostBeingPaid calculateManaCost(final Cost cost, final SpellAb
}
}

CostAdjustment.adjust(manaCost, sa, null, test);
if (!effect) {
CostAdjustment.adjust(manaCost, sa, null, test);
}

if ("NumTimes".equals(sa.getParam("Announce"))) { // e.g. the Adversary cycle
ManaCost mkCost = sa.getPayCosts().getTotalMana();
Expand Down
2 changes: 1 addition & 1 deletion forge-game/src/main/java/forge/game/GameAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ public boolean visit(final Card c) {
// Update P/T and type in the view only once after all the cards have been processed, to avoid flickering
for (Card c : affectedCards) {
c.updateNameforView();
c.updatePowerToughnessForView();
c.updatePTforView();
c.updateTypesForView();
c.updateKeywords();
}
Expand Down
6 changes: 3 additions & 3 deletions forge-game/src/main/java/forge/game/StaticEffect.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ final CardCollectionView remove(List<StaticAbilityLayer> layers) {
if (hasParam("AddAbility") || hasParam("GainsAbilitiesOf")
|| hasParam("GainsAbilitiesOfDefined") || hasParam("GainsTriggerAbsOf")
|| hasParam("AddTrigger") || hasParam("AddStaticAbility")
|| hasParam("AddReplacementEffects") || hasParam("RemoveAllAbilities")
|| hasParam("AddReplacementEffect") || hasParam("RemoveAllAbilities")
|| hasParam("RemoveLandTypes")) {
affectedCard.removeChangedCardTraits(getTimestamp(), ability.getId());
}
Expand All @@ -282,9 +282,9 @@ final CardCollectionView remove(List<StaticAbilityLayer> layers) {
affectedCard.updateKeywordsCache(affectedCard.getCurrentState());
}

if (layers.contains(StaticAbilityLayer.SETPT)) {
if (layers.contains(StaticAbilityLayer.CHARACTERISTIC) || layers.contains(StaticAbilityLayer.SETPT)) {
if (hasParam("SetPower") || hasParam("SetToughness")) {
affectedCard.removeNewPT(getTimestamp(), ability.getId());
affectedCard.removeNewPT(getTimestamp(), ability.getId(), false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ public void resolve(final SpellAbility sa) {

if (sa.isCrew()) {
gameCard.becomesCrewed(sa);
gameCard.updatePowerToughnessForView();
gameCard.updatePTforView();
}

game.fireEvent(new GameEventCardStatsChanged(gameCard));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static void applyPumpAll(final SpellAbility sa,
tgtC.addChangedCardKeywords(kws, null, false, timestamp, null);
}
if (redrawPT) {
tgtC.updatePowerToughnessForView();
tgtC.updatePTforView();
}

if (!hiddenkws.isEmpty()) {
Expand All @@ -93,7 +93,7 @@ public void run() {
tgtC.removeChangedCardKeywords(timestamp, 0);
tgtC.removeHiddenExtrinsicKeywords(timestamp, 0);

tgtC.updatePowerToughnessForView();
tgtC.updatePTforView();

game.fireEvent(new GameEventCardStatsChanged(tgtC));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private static void applyPump(final SpellAbility sa, final Card applyTo,
gameCard.addHiddenExtrinsicKeywords(timestamp, 0, hiddenKws);
}
if (redrawPT) {
gameCard.updatePowerToughnessForView();
gameCard.updatePTforView();
}

if (sa.hasParam("CanBlockAny")) {
Expand Down Expand Up @@ -120,7 +120,7 @@ public void run() {
gameCard.removeHiddenExtrinsicKeywords(timestamp, 0);
gameCard.removeChangedCardKeywords(timestamp, 0);
}
gameCard.updatePowerToughnessForView();
gameCard.updatePTforView();
if (updateText) {
gameCard.updateAbilityTextForView();
}
Expand Down
Loading

0 comments on commit f562ae6

Please sign in to comment.