Skip to content

Commit

Permalink
Fixed that adding counters to players did not work correctly (e.g. Wi…
Browse files Browse the repository at this point in the history
…nding Constrictor).
  • Loading branch information
LevelX2 committed Jan 7, 2017
1 parent e04e69f commit a75e4f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions Mage.Sets/src/mage/cards/i/IchorRats.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,17 @@
* 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;
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;
Expand All @@ -49,8 +47,8 @@
*/
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);
Expand All @@ -59,7 +57,7 @@ public IchorRats (UUID ownerId, CardSetInfo setInfo) {
this.addAbility(new EntersBattlefieldTriggeredAbility(new IchorRatsEffect(), false));
}

public IchorRats (final IchorRats card) {
public IchorRats(final IchorRats card) {
super(card);
}

Expand All @@ -71,6 +69,7 @@ public IchorRats copy() {
}

class IchorRatsEffect extends OneShotEffect {

public IchorRatsEffect() {
super(Outcome.Damage);
staticText = "each player gets a poison counter";
Expand All @@ -82,7 +81,7 @@ public IchorRatsEffect(final IchorRatsEffect effect) {

@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);
Expand Down
2 changes: 1 addition & 1 deletion Mage/src/main/java/mage/players/PlayerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1856,7 +1856,7 @@ public boolean addCounters(Counter counter, Game game) {
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);
Expand Down

0 comments on commit a75e4f4

Please sign in to comment.