Fixed that adding counters to players did not work correctly (e.g. Winding Constrictor).

This commit is contained in:
LevelX2 2017-01-07 23:53:47 +01:00
parent e04e69f947
commit a75e4f4fcb
2 changed files with 7 additions and 8 deletions

View file

@ -25,12 +25,9 @@
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.cards.i;
import java.util.UUID;
import mage.constants.CardType;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
@ -38,6 +35,7 @@ import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.InfectAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.counters.CounterType;
import mage.game.Game;
@ -49,8 +47,8 @@ import mage.players.Player;
*/
public class IchorRats extends CardImpl {
public IchorRats (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{1}{B}{B}");
public IchorRats(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{B}{B}");
this.subtype.add("Rat");
this.power = new MageInt(2);
@ -59,7 +57,7 @@ public class IchorRats extends CardImpl {
this.addAbility(new EntersBattlefieldTriggeredAbility(new IchorRatsEffect(), false));
}
public IchorRats (final IchorRats card) {
public IchorRats(final IchorRats card) {
super(card);
}
@ -71,6 +69,7 @@ public class IchorRats extends CardImpl {
}
class IchorRatsEffect extends OneShotEffect {
public IchorRatsEffect() {
super(Outcome.Damage);
staticText = "each player gets a poison counter";
@ -82,7 +81,7 @@ class IchorRatsEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
for (UUID playerId : game.getPlayerList()) {
for (UUID playerId : game.getState().getPlayerList(source.getControllerId())) {
Player player = game.getPlayer(playerId);
if (player != null) {
player.addCounters(CounterType.POISON.createInstance(), game);

View file

@ -1856,7 +1856,7 @@ public abstract class PlayerImpl implements Player, Serializable {
int finalAmount = amount;
for (int i = 0; i < amount; i++) {
Counter eventCounter = counter.copy();
eventCounter.remove(amount - 1);
eventCounter.remove(eventCounter.getCount() - 1);
GameEvent event = GameEvent.getEvent(EventType.ADD_COUNTER, playerId, null, playerId, counter.getName(), 1);
if (!game.replaceEvent(event)) {
getCounters().addCounter(eventCounter);