More view cleanup (#6967)

This commit is contained in:
tool4ever
2025-02-03 22:12:03 +01:00
committed by GitHub
parent 6615090bda
commit f562ae6fdb
10 changed files with 666 additions and 675 deletions

View File

@@ -1326,7 +1326,9 @@ public class ComputerUtilMana {
} }
} }
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 if ("NumTimes".equals(sa.getParam("Announce"))) { // e.g. the Adversary cycle
ManaCost mkCost = sa.getPayCosts().getTotalMana(); ManaCost mkCost = sa.getPayCosts().getTotalMana();

View File

@@ -1276,7 +1276,7 @@ public class GameAction {
// Update P/T and type in the view only once after all the cards have been processed, to avoid flickering // Update P/T and type in the view only once after all the cards have been processed, to avoid flickering
for (Card c : affectedCards) { for (Card c : affectedCards) {
c.updateNameforView(); c.updateNameforView();
c.updatePowerToughnessForView(); c.updatePTforView();
c.updateTypesForView(); c.updateTypesForView();
c.updateKeywords(); c.updateKeywords();
} }

View File

@@ -267,7 +267,7 @@ public class StaticEffect {
if (hasParam("AddAbility") || hasParam("GainsAbilitiesOf") if (hasParam("AddAbility") || hasParam("GainsAbilitiesOf")
|| hasParam("GainsAbilitiesOfDefined") || hasParam("GainsTriggerAbsOf") || hasParam("GainsAbilitiesOfDefined") || hasParam("GainsTriggerAbsOf")
|| hasParam("AddTrigger") || hasParam("AddStaticAbility") || hasParam("AddTrigger") || hasParam("AddStaticAbility")
|| hasParam("AddReplacementEffects") || hasParam("RemoveAllAbilities") || hasParam("AddReplacementEffect") || hasParam("RemoveAllAbilities")
|| hasParam("RemoveLandTypes")) { || hasParam("RemoveLandTypes")) {
affectedCard.removeChangedCardTraits(getTimestamp(), ability.getId()); affectedCard.removeChangedCardTraits(getTimestamp(), ability.getId());
} }
@@ -282,9 +282,9 @@ public class StaticEffect {
affectedCard.updateKeywordsCache(affectedCard.getCurrentState()); affectedCard.updateKeywordsCache(affectedCard.getCurrentState());
} }
if (layers.contains(StaticAbilityLayer.SETPT)) { if (layers.contains(StaticAbilityLayer.CHARACTERISTIC) || layers.contains(StaticAbilityLayer.SETPT)) {
if (hasParam("SetPower") || hasParam("SetToughness")) { if (hasParam("SetPower") || hasParam("SetToughness")) {
affectedCard.removeNewPT(getTimestamp(), ability.getId()); affectedCard.removeNewPT(getTimestamp(), ability.getId(), false);
} }
} }

View File

@@ -202,7 +202,7 @@ public class AnimateEffect extends AnimateEffectBase {
if (sa.isCrew()) { if (sa.isCrew()) {
gameCard.becomesCrewed(sa); gameCard.becomesCrewed(sa);
gameCard.updatePowerToughnessForView(); gameCard.updatePTforView();
} }
game.fireEvent(new GameEventCardStatsChanged(gameCard)); game.fireEvent(new GameEventCardStatsChanged(gameCard));

View File

@@ -71,7 +71,7 @@ public class PumpAllEffect extends SpellAbilityEffect {
tgtC.addChangedCardKeywords(kws, null, false, timestamp, null); tgtC.addChangedCardKeywords(kws, null, false, timestamp, null);
} }
if (redrawPT) { if (redrawPT) {
tgtC.updatePowerToughnessForView(); tgtC.updatePTforView();
} }
if (!hiddenkws.isEmpty()) { if (!hiddenkws.isEmpty()) {
@@ -93,7 +93,7 @@ public class PumpAllEffect extends SpellAbilityEffect {
tgtC.removeChangedCardKeywords(timestamp, 0); tgtC.removeChangedCardKeywords(timestamp, 0);
tgtC.removeHiddenExtrinsicKeywords(timestamp, 0); tgtC.removeHiddenExtrinsicKeywords(timestamp, 0);
tgtC.updatePowerToughnessForView(); tgtC.updatePTforView();
game.fireEvent(new GameEventCardStatsChanged(tgtC)); game.fireEvent(new GameEventCardStatsChanged(tgtC));
} }

View File

@@ -84,7 +84,7 @@ public class PumpEffect extends SpellAbilityEffect {
gameCard.addHiddenExtrinsicKeywords(timestamp, 0, hiddenKws); gameCard.addHiddenExtrinsicKeywords(timestamp, 0, hiddenKws);
} }
if (redrawPT) { if (redrawPT) {
gameCard.updatePowerToughnessForView(); gameCard.updatePTforView();
} }
if (sa.hasParam("CanBlockAny")) { if (sa.hasParam("CanBlockAny")) {
@@ -120,7 +120,7 @@ public class PumpEffect extends SpellAbilityEffect {
gameCard.removeHiddenExtrinsicKeywords(timestamp, 0); gameCard.removeHiddenExtrinsicKeywords(timestamp, 0);
gameCard.removeChangedCardKeywords(timestamp, 0); gameCard.removeChangedCardKeywords(timestamp, 0);
} }
gameCard.updatePowerToughnessForView(); gameCard.updatePTforView();
if (updateText) { if (updateText) {
gameCard.updateAbilityTextForView(); gameCard.updateAbilityTextForView();
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1878,6 +1878,10 @@ public class Player extends GameEntity implements Comparable<Player> {
stats.nextTurn(); stats.nextTurn();
} }
public final int getLastTurnNr() {
return this.lastTurnNr;
}
public boolean hasTappedLandForManaThisTurn() { public boolean hasTappedLandForManaThisTurn() {
return tappedLandForManaThisTurn; return tappedLandForManaThisTurn;
} }
@@ -2285,6 +2289,13 @@ public class Player extends GameEntity implements Comparable<Player> {
view.updateUnlimitedHandSize(this); view.updateUnlimitedHandSize(this);
} }
public int getStartingHandSize() {
return startingHandSize;
}
public void setStartingHandSize(int shs) {
startingHandSize = shs;
}
public final int getLandsPlayedThisTurn() { public final int getLandsPlayedThisTurn() {
return landsPlayedThisTurn; return landsPlayedThisTurn;
} }
@@ -2519,10 +2530,6 @@ public class Player extends GameEntity implements Comparable<Player> {
return keywords.getAmount(k); return keywords.getAmount(k);
} }
public final int getLastTurnNr() {
return this.lastTurnNr;
}
public void onCleanupPhase() { public void onCleanupPhase() {
for (Card c : getCardsIn(ZoneType.Hand)) { for (Card c : getCardsIn(ZoneType.Hand)) {
c.setDrawnThisTurn(false); c.setDrawnThisTurn(false);
@@ -2693,13 +2700,6 @@ public class Player extends GameEntity implements Comparable<Player> {
return !isInGame(); return !isInGame();
} }
public int getStartingHandSize() {
return startingHandSize;
}
public void setStartingHandSize(int shs) {
startingHandSize = shs;
}
/** /**
* Takes the top plane of the planar deck and put it face up in the command zone. * Takes the top plane of the planar deck and put it face up in the command zone.
* Then runs triggers. * Then runs triggers.
@@ -4027,11 +4027,9 @@ public class Player extends GameEntity implements Comparable<Player> {
public void addDeclaresAttackers(long ts, Player p) { public void addDeclaresAttackers(long ts, Player p) {
this.declaresAttackers.put(ts, p); this.declaresAttackers.put(ts, p);
} }
public void removeDeclaresAttackers(long ts) { public void removeDeclaresAttackers(long ts) {
this.declaresAttackers.remove(ts); this.declaresAttackers.remove(ts);
} }
public Player getDeclaresAttackers() { public Player getDeclaresAttackers() {
Map.Entry<Long, Player> e = declaresAttackers.lastEntry(); Map.Entry<Long, Player> e = declaresAttackers.lastEntry();
return e == null ? null : e.getValue(); return e == null ? null : e.getValue();
@@ -4040,11 +4038,9 @@ public class Player extends GameEntity implements Comparable<Player> {
public void addDeclaresBlockers(long ts, Player p) { public void addDeclaresBlockers(long ts, Player p) {
this.declaresBlockers.put(ts, p); this.declaresBlockers.put(ts, p);
} }
public void removeDeclaresBlockers(long ts) { public void removeDeclaresBlockers(long ts) {
this.declaresBlockers.remove(ts); this.declaresBlockers.remove(ts);
} }
public Player getDeclaresBlockers() { public Player getDeclaresBlockers() {
Map.Entry<Long, Player> e = declaresBlockers.lastEntry(); Map.Entry<Long, Player> e = declaresBlockers.lastEntry();
return e == null ? null : e.getValue(); return e == null ? null : e.getValue();

View File

@@ -704,7 +704,7 @@ public final class StaticAbilityContinuous {
setToughness = AbilityUtils.calculateAmount(affectedCard, setT, stAb, true); setToughness = AbilityUtils.calculateAmount(affectedCard, setT, stAb, true);
} }
affectedCard.addNewPT(setPower, setToughness, affectedCard.addNewPT(setPower, setToughness,
se.getTimestamp(), stAb.getId(), layer == StaticAbilityLayer.CHARACTERISTIC); se.getTimestamp(), stAb.getId(), layer == StaticAbilityLayer.CHARACTERISTIC, false);
} }
} }
@@ -752,7 +752,8 @@ public final class StaticAbilityContinuous {
} }
affectedCard.addChangedCardKeywords(newKeywords, removeKeywords, affectedCard.addChangedCardKeywords(newKeywords, removeKeywords,
removeAllAbilities, se.getTimestamp(), stAb, true); removeAllAbilities, se.getTimestamp(), stAb, false);
affectedCard.updateKeywordsCache(affectedCard.getCurrentState());
} }
// add HIDDEN keywords // add HIDDEN keywords
@@ -862,7 +863,7 @@ public final class StaticAbilityContinuous {
|| removeAllAbilities) { || removeAllAbilities) {
affectedCard.addChangedCardTraits( affectedCard.addChangedCardTraits(
addedAbilities, null, addedTrigger, addedReplacementEffects, addedStaticAbility, removeAllAbilities, removeNonMana, addedAbilities, null, addedTrigger, addedReplacementEffects, addedStaticAbility, removeAllAbilities, removeNonMana,
se.getTimestamp(), stAb.getId() se.getTimestamp(), stAb.getId(), false
); );
} }
@@ -874,7 +875,7 @@ public final class StaticAbilityContinuous {
// add Types // add Types
if ((addTypes != null && !addTypes.isEmpty()) || (removeTypes != null && !removeTypes.isEmpty()) || addAllCreatureTypes || !remove.isEmpty()) { if ((addTypes != null && !addTypes.isEmpty()) || (removeTypes != null && !removeTypes.isEmpty()) || addAllCreatureTypes || !remove.isEmpty()) {
affectedCard.addChangedCardTypes(addTypes, removeTypes, addAllCreatureTypes, remove, affectedCard.addChangedCardTypes(addTypes, removeTypes, addAllCreatureTypes, remove,
se.getTimestamp(), stAb.getId(), true, stAb.isCharacteristicDefining()); se.getTimestamp(), stAb.getId(), false, stAb.isCharacteristicDefining());
} }
// add colors // add colors

View File

@@ -2,6 +2,6 @@ Name:Pia's Revolution
ManaCost:2 R ManaCost:2 R
Types:Enchantment Types:Enchantment
T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Artifact.YouOwn+nonToken | TriggerZones$ Battlefield | Execute$ TrigReturn | TriggerDescription$ Whenever a nontoken artifact is put into your graveyard from the battlefield, return that card to your hand unless target opponent has CARDNAME deal 3 damage to them. T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Artifact.YouOwn+nonToken | TriggerZones$ Battlefield | Execute$ TrigReturn | TriggerDescription$ Whenever a nontoken artifact is put into your graveyard from the battlefield, return that card to your hand unless target opponent has CARDNAME deal 3 damage to them.
SVar:TrigReturn:DB$ ChangeZone | Defined$ TriggeredNewCardLKICopy | Origin$ Graveyard | Destination$ Hand | UnlessCost$ DamageYou<3> | UnlessPayer$ Targeted | ValidTgts$ Opponent | IsCurse$ True SVar:TrigReturn:DB$ ChangeZone | ThisDefinedAndTgts$ TriggeredNewCardLKICopy | Origin$ Graveyard | Destination$ Hand | UnlessCost$ DamageYou<3> | UnlessPayer$ Targeted | ValidTgts$ Opponent | IsCurse$ True
SVar:BuffedBy:Permanent.White,Permanent.Black SVar:BuffedBy:Permanent.White,Permanent.Black
Oracle:Whenever a nontoken artifact is put into your graveyard from the battlefield, return that card to your hand unless target opponent has Pia's Revolution deal 3 damage to them. Oracle:Whenever a nontoken artifact is put into your graveyard from the battlefield, return that card to your hand unless target opponent has Pia's Revolution deal 3 damage to them.