Skip to content

Commit f562ae6

Browse files
authored
More view cleanup (Card-Forge#6967)
1 parent 6615090 commit f562ae6

File tree

10 files changed

+696
-705
lines changed

10 files changed

+696
-705
lines changed

forge-ai/src/main/java/forge/ai/ComputerUtilMana.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,9 @@ public static ManaCostBeingPaid calculateManaCost(final Cost cost, final SpellAb
13261326
}
13271327
}
13281328

1329-
CostAdjustment.adjust(manaCost, sa, null, test);
1329+
if (!effect) {
1330+
CostAdjustment.adjust(manaCost, sa, null, test);
1331+
}
13301332

13311333
if ("NumTimes".equals(sa.getParam("Announce"))) { // e.g. the Adversary cycle
13321334
ManaCost mkCost = sa.getPayCosts().getTotalMana();

forge-game/src/main/java/forge/game/GameAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1276,7 +1276,7 @@ public boolean visit(final Card c) {
12761276
// Update P/T and type in the view only once after all the cards have been processed, to avoid flickering
12771277
for (Card c : affectedCards) {
12781278
c.updateNameforView();
1279-
c.updatePowerToughnessForView();
1279+
c.updatePTforView();
12801280
c.updateTypesForView();
12811281
c.updateKeywords();
12821282
}

forge-game/src/main/java/forge/game/StaticEffect.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ final CardCollectionView remove(List<StaticAbilityLayer> layers) {
267267
if (hasParam("AddAbility") || hasParam("GainsAbilitiesOf")
268268
|| hasParam("GainsAbilitiesOfDefined") || hasParam("GainsTriggerAbsOf")
269269
|| hasParam("AddTrigger") || hasParam("AddStaticAbility")
270-
|| hasParam("AddReplacementEffects") || hasParam("RemoveAllAbilities")
270+
|| hasParam("AddReplacementEffect") || hasParam("RemoveAllAbilities")
271271
|| hasParam("RemoveLandTypes")) {
272272
affectedCard.removeChangedCardTraits(getTimestamp(), ability.getId());
273273
}
@@ -282,9 +282,9 @@ final CardCollectionView remove(List<StaticAbilityLayer> layers) {
282282
affectedCard.updateKeywordsCache(affectedCard.getCurrentState());
283283
}
284284

285-
if (layers.contains(StaticAbilityLayer.SETPT)) {
285+
if (layers.contains(StaticAbilityLayer.CHARACTERISTIC) || layers.contains(StaticAbilityLayer.SETPT)) {
286286
if (hasParam("SetPower") || hasParam("SetToughness")) {
287-
affectedCard.removeNewPT(getTimestamp(), ability.getId());
287+
affectedCard.removeNewPT(getTimestamp(), ability.getId(), false);
288288
}
289289
}
290290

forge-game/src/main/java/forge/game/ability/effects/AnimateEffect.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ public void resolve(final SpellAbility sa) {
202202

203203
if (sa.isCrew()) {
204204
gameCard.becomesCrewed(sa);
205-
gameCard.updatePowerToughnessForView();
205+
gameCard.updatePTforView();
206206
}
207207

208208
game.fireEvent(new GameEventCardStatsChanged(gameCard));

forge-game/src/main/java/forge/game/ability/effects/PumpAllEffect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private static void applyPumpAll(final SpellAbility sa,
7171
tgtC.addChangedCardKeywords(kws, null, false, timestamp, null);
7272
}
7373
if (redrawPT) {
74-
tgtC.updatePowerToughnessForView();
74+
tgtC.updatePTforView();
7575
}
7676

7777
if (!hiddenkws.isEmpty()) {
@@ -93,7 +93,7 @@ public void run() {
9393
tgtC.removeChangedCardKeywords(timestamp, 0);
9494
tgtC.removeHiddenExtrinsicKeywords(timestamp, 0);
9595

96-
tgtC.updatePowerToughnessForView();
96+
tgtC.updatePTforView();
9797

9898
game.fireEvent(new GameEventCardStatsChanged(tgtC));
9999
}

forge-game/src/main/java/forge/game/ability/effects/PumpEffect.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private static void applyPump(final SpellAbility sa, final Card applyTo,
8484
gameCard.addHiddenExtrinsicKeywords(timestamp, 0, hiddenKws);
8585
}
8686
if (redrawPT) {
87-
gameCard.updatePowerToughnessForView();
87+
gameCard.updatePTforView();
8888
}
8989

9090
if (sa.hasParam("CanBlockAny")) {
@@ -120,7 +120,7 @@ public void run() {
120120
gameCard.removeHiddenExtrinsicKeywords(timestamp, 0);
121121
gameCard.removeChangedCardKeywords(timestamp, 0);
122122
}
123-
gameCard.updatePowerToughnessForView();
123+
gameCard.updatePTforView();
124124
if (updateText) {
125125
gameCard.updateAbilityTextForView();
126126
}

0 commit comments

Comments
 (0)