mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 04:52:07 -08:00
Refactor - moved OpponentsPoisonCountersCount to shared area
This commit is contained in:
parent
f2d358b5b4
commit
171e9f183d
3 changed files with 44 additions and 37 deletions
|
|
@ -0,0 +1,42 @@
|
|||
package mage.abilities.dynamicvalue.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.counters.CounterType;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public class OpponentsPoisonCountersCount implements DynamicValue {
|
||||
|
||||
@Override
|
||||
public int calculate(Game game, Ability sourceAbility, Effect effect) {
|
||||
int amount = 0;
|
||||
Set<UUID> playerList = game.getOpponents(sourceAbility.getControllerId());
|
||||
for (UUID playerUUID : playerList) {
|
||||
Player player = game.getPlayer(playerUUID);
|
||||
if (player != null) {
|
||||
amount += player.getCounters().getCount(CounterType.POISON);
|
||||
}
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DynamicValue copy() {
|
||||
return new OpponentsPoisonCountersCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return "poison counter your opponents have";
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue