mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
prevent direct access of Player->counters ; some cleanup on counter removal effects ; implement [MH3] Izzet Generatorium (#12314)
This commit is contained in:
parent
8d02ff14ff
commit
20b7a115da
110 changed files with 895 additions and 646 deletions
|
|
@ -16,8 +16,6 @@ import mage.components.ImagePanelStyle;
|
|||
import mage.constants.CardType;
|
||||
import static mage.constants.Constants.*;
|
||||
import mage.constants.ManaType;
|
||||
import mage.counters.Counter;
|
||||
import mage.counters.CounterType;
|
||||
import mage.designations.DesignationType;
|
||||
import mage.utils.timer.PriorityTimer;
|
||||
import mage.view.*;
|
||||
|
|
@ -186,6 +184,18 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Not the most optimized, but we just query a few counterName here.
|
||||
// More optimized would use a Map<String, CounterView>
|
||||
private static int counterOfName(PlayerView player, String name) {
|
||||
return player
|
||||
.getCounters()
|
||||
.stream()
|
||||
.filter(counter -> counter.getName().equals(name))
|
||||
.map(CounterView::getCount)
|
||||
.findFirst()
|
||||
.orElse(0);
|
||||
}
|
||||
|
||||
public void update(GameView game, PlayerView player, Set<UUID> possibleTargets) {
|
||||
this.player = player;
|
||||
int pastLife = player.getLife();
|
||||
|
|
@ -226,10 +236,10 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
changedFontLife = false;
|
||||
}
|
||||
setTextForLabel("life", lifeLabel, life, playerLife, true);
|
||||
setTextForLabel("poison", poisonLabel, poison, player.getCounters().getCount(CounterType.POISON), false);
|
||||
setTextForLabel("energy", energyLabel, energy, player.getCounters().getCount(CounterType.ENERGY), false);
|
||||
setTextForLabel("experience", experienceLabel, experience, player.getCounters().getCount(CounterType.EXPERIENCE), false);
|
||||
setTextForLabel("rad", radLabel, rad, player.getCounters().getCount(CounterType.RAD), false);
|
||||
setTextForLabel("poison", poisonLabel, poison, counterOfName(player, "poison"), false);
|
||||
setTextForLabel("energy", energyLabel, energy, counterOfName(player, "energy"), false);
|
||||
setTextForLabel("experience", experienceLabel, experience, counterOfName(player, "experience"), false);
|
||||
setTextForLabel("rad", radLabel, rad, counterOfName(player, "rad"), false);
|
||||
setTextForLabel("hand zone", handLabel, hand, player.getHandCount(), true);
|
||||
int libraryCards = player.getLibraryCount();
|
||||
if (libraryCards > 99) {
|
||||
|
|
@ -417,7 +427,7 @@ public class PlayerPanelExt extends javax.swing.JPanel {
|
|||
}
|
||||
|
||||
// counters
|
||||
for (Counter counter : player.getCounters().values()) {
|
||||
for (CounterView counter : player.getCounters()) {
|
||||
tooltipText.append("<br/>").append(counter.getName()).append(" counters: ").append(counter.getCount());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue