diff --git a/Mage.Sets/src/mage/cards/a/Anthroplasm.java b/Mage.Sets/src/mage/cards/a/Anthroplasm.java index f90edce634..c42e0f42d7 100644 --- a/Mage.Sets/src/mage/cards/a/Anthroplasm.java +++ b/Mage.Sets/src/mage/cards/a/Anthroplasm.java @@ -53,7 +53,7 @@ import mage.game.permanent.Permanent; public class Anthroplasm extends CardImpl { public Anthroplasm(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{2}{U}{U}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{U}{U}"); this.subtype.add(SubType.SHAPESHIFTER); this.power = new MageInt(0); @@ -65,7 +65,7 @@ public class Anthroplasm extends CardImpl { Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new AnthroplasmEffect(), new ManaCostsImpl("{X}")); ability.addCost(new TapSourceCost()); this.addAbility(ability); - + } public Anthroplasm(final Anthroplasm card) { @@ -80,12 +80,12 @@ public class Anthroplasm extends CardImpl { class AnthroplasmEffect extends OneShotEffect { - AnthroplasmEffect ( ) { + AnthroplasmEffect() { super(Outcome.Benefit); - staticText = "Remove all +1/+1 counters from Anthroplasm and put X +1/+1 counters on it"; + staticText = "Remove all +1/+1 counters from {this} and put X +1/+1 counters on it"; } - AnthroplasmEffect ( AnthroplasmEffect effect ) { + AnthroplasmEffect(AnthroplasmEffect effect) { super(effect); } diff --git a/Mage.Sets/src/mage/cards/k/KumenasSpeaker.java b/Mage.Sets/src/mage/cards/k/KumenasSpeaker.java index 1174fba6aa..989a251d08 100644 --- a/Mage.Sets/src/mage/cards/k/KumenasSpeaker.java +++ b/Mage.Sets/src/mage/cards/k/KumenasSpeaker.java @@ -50,13 +50,10 @@ public class KumenasSpeaker extends CardImpl { private static final FilterPermanent filter = new FilterPermanent("another Merfolk or an Island"); static { + filter.add(new AnotherPredicate()); filter.add(Predicates.or( new SubtypePredicate(SubType.ISLAND), - Predicates.and( - new SubtypePredicate(SubType.MERFOLK), - new AnotherPredicate() - ) - )); + new SubtypePredicate(SubType.MERFOLK))); } public KumenasSpeaker(UUID ownerId, CardSetInfo setInfo) { diff --git a/Mage.Sets/src/mage/cards/p/PathOfAncestry.java b/Mage.Sets/src/mage/cards/p/PathOfAncestry.java index 0bcf821422..b0226c0aeb 100644 --- a/Mage.Sets/src/mage/cards/p/PathOfAncestry.java +++ b/Mage.Sets/src/mage/cards/p/PathOfAncestry.java @@ -29,6 +29,7 @@ package mage.cards.p; import java.util.Iterator; import java.util.UUID; +import mage.MageObject; import mage.abilities.Ability; import mage.abilities.TriggeredAbilityImpl; import mage.abilities.common.EntersBattlefieldTappedAbility; @@ -44,6 +45,7 @@ import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; import mage.game.stack.Spell; +import mage.players.Player; /** * @@ -105,19 +107,24 @@ class PathOfAncestryTriggeredAbility extends TriggeredAbilityImpl { if (event.getData().equals(abilityOriginalId)) { Spell spell = game.getStack().getSpell(event.getTargetId()); if (spell != null && spell.isCreature()) { - Iterator spellSubs = spell.getSubtype(game).iterator(); - while (spellSubs.hasNext()) { - SubType sType = spellSubs.next(); - if (sType.getSubTypeSet() == SubTypeSet.CreatureType) { - for (UUID cmdr : game.getPlayer(spell.getControllerId()).getCommandersIds()) { - if (game.getObject(cmdr).getSubtype(game).contains(sType)) { - return true; + Player controller = game.getPlayer(getControllerId()); + if (controller != null && controller.getCommandersIds() != null && !controller.getCommandersIds().isEmpty()) { + Iterator spellSubs = spell.getSubtype(game).iterator(); + while (spellSubs.hasNext()) { + SubType sType = spellSubs.next(); + if (sType.getSubTypeSet() == SubTypeSet.CreatureType) { + for (UUID cmdr : controller.getCommandersIds()) { + MageObject commander = game.getObject(cmdr); + if (commander != null && commander.getSubtype(game).contains(sType)) { + return true; + } } } } } } } + return false; } diff --git a/Mage.Sets/src/mage/cards/p/PlagueBelcher.java b/Mage.Sets/src/mage/cards/p/PlagueBelcher.java index 0a342194b0..8fb0c4c615 100644 --- a/Mage.Sets/src/mage/cards/p/PlagueBelcher.java +++ b/Mage.Sets/src/mage/cards/p/PlagueBelcher.java @@ -32,6 +32,7 @@ import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility; +import mage.abilities.effects.common.LoseLifeOpponentsEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.keyword.MenaceAbility; import mage.cards.CardImpl; @@ -77,7 +78,7 @@ public class PlagueBelcher extends CardImpl { this.addAbility(ability); // Whenever another Zombie you control dies, each opponent loses 1 life. - this.addAbility(new DiesCreatureTriggeredAbility(new LoseLifeOpponentsEffect(), false, filter)); + this.addAbility(new DiesCreatureTriggeredAbility(new LoseLifeOpponentsEffect(1), false, filter)); } public PlagueBelcher(final PlagueBelcher card) { diff --git a/Mage.Sets/src/mage/cards/v/VerdantSunsAvatar.java b/Mage.Sets/src/mage/cards/v/VerdantSunsAvatar.java index c0b6c091cb..962f98a54a 100644 --- a/Mage.Sets/src/mage/cards/v/VerdantSunsAvatar.java +++ b/Mage.Sets/src/mage/cards/v/VerdantSunsAvatar.java @@ -36,8 +36,8 @@ import mage.abilities.effects.OneShotEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; -import mage.constants.SubType; import mage.constants.Outcome; +import mage.constants.SubType; import mage.constants.Zone; import mage.game.Game; import mage.game.events.GameEvent; @@ -91,7 +91,7 @@ class VerdantSunsAvatarTriggeredAbility extends TriggeredAbilityImpl { @Override public boolean checkTrigger(GameEvent event, Game game) { Permanent permanent = game.getPermanent(event.getTargetId()); - if (permanent.isCreature() + if (permanent != null && permanent.isCreature() && permanent.getControllerId().equals(this.controllerId)) { Effect effect = this.getEffects().get(0); // Life is determined during resolution so it has to be retrieved there (e.g. Giant Growth before resolution) diff --git a/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java b/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java index bfd4b7798e..90173e068d 100644 --- a/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java +++ b/Mage/src/main/java/mage/abilities/condition/common/PermanentsOnTheBattlefieldCondition.java @@ -28,14 +28,14 @@ package mage.abilities.condition.common; import mage.abilities.Ability; -import mage.constants.ComparisonType; import mage.abilities.condition.Condition; +import mage.constants.ComparisonType; import mage.filter.FilterPermanent; import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.game.Game; /** - * Battlefield checking condition. This condition can decorate other conditions + * Battlefield checking condition. This condition can decorate other conditions * as well as be used standalone. * * @author nantuko @@ -63,9 +63,10 @@ public class PermanentsOnTheBattlefieldCondition implements Condition { } /** - * Applies a filter, a {@link ComparisonType}, and count to permanents on the - * battlefield when checking the condition during the - * {@link #apply(mage.game.Game, mage.abilities.Ability) apply} method invocation. + * Applies a filter, a {@link ComparisonType}, and count to permanents on + * the battlefield when checking the condition during the + * {@link #apply(mage.game.Game, mage.abilities.Ability) apply} method + * invocation. * * @param filter * @param type @@ -83,10 +84,10 @@ public class PermanentsOnTheBattlefieldCondition implements Condition { } /** - * Applies a filter, a {@link ComparisonType}, and count to permanents on the - * battlefield and calls the decorated condition to see if it - * {@link #apply(mage.game.Game, mage.abilities.Ability) applies} - * as well. This will force both conditions to apply for this to be true. + * Applies a filter, a {@link ComparisonType}, and count to permanents on + * the battlefield and calls the decorated condition to see if it + * {@link #apply(mage.game.Game, mage.abilities.Ability) applies} as well. + * This will force both conditions to apply for this to be true. * * @param filter * @param type @@ -100,7 +101,7 @@ public class PermanentsOnTheBattlefieldCondition implements Condition { @Override public boolean apply(Game game, Ability source) { - boolean conditionApplies = false; + boolean conditionApplies; FilterPermanent localFilter = filter.copy(); if (onlyControlled) { diff --git a/Mage/src/main/java/mage/cards/CardImpl.java b/Mage/src/main/java/mage/cards/CardImpl.java index b791473878..2215ea496a 100644 --- a/Mage/src/main/java/mage/cards/CardImpl.java +++ b/Mage/src/main/java/mage/cards/CardImpl.java @@ -27,6 +27,11 @@ */ package mage.cards; +import java.lang.reflect.Constructor; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; import mage.MageObject; import mage.MageObjectImpl; import mage.Mana; @@ -48,12 +53,6 @@ import mage.util.SubTypeList; import mage.watchers.Watcher; import org.apache.log4j.Logger; -import java.lang.reflect.Constructor; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; - public abstract class CardImpl extends MageObjectImpl implements Card { private static final long serialVersionUID = 1L; @@ -669,7 +668,9 @@ public abstract class CardImpl extends MageObjectImpl implements Card { @Override public void removeCounters(Counter counter, Game game) { - removeCounters(counter.getName(), counter.getCount(), game); + if (counter != null) { + removeCounters(counter.getName(), counter.getCount(), game); + } } @Override diff --git a/Mage/src/main/java/mage/players/Player.java b/Mage/src/main/java/mage/players/Player.java index e641a41c74..261a24c22f 100644 --- a/Mage/src/main/java/mage/players/Player.java +++ b/Mage/src/main/java/mage/players/Player.java @@ -650,12 +650,12 @@ public interface Player extends MageItem, Copyable { /** * Set the commanderId of the player * - * @param commandersIds + * @param commanderId */ void addCommanderId(UUID commanderId); /** - * Get the commanderId of the player + * Get the commanderIds of the player * * @return */ diff --git a/Mage/src/main/java/mage/players/net/UserData.java b/Mage/src/main/java/mage/players/net/UserData.java index b6bb290d8f..888ca6b158 100644 --- a/Mage/src/main/java/mage/players/net/UserData.java +++ b/Mage/src/main/java/mage/players/net/UserData.java @@ -75,7 +75,7 @@ public class UserData implements Serializable { this.autoOrderTrigger = userData.autoOrderTrigger; this.useFirstManaAbility = userData.useFirstManaAbility; this.userIdStr = userData.userIdStr; - // todo: why we don't copy user stats here? + // todo: why we don't update user stats here? => can't be updated from client side } public static UserData getDefaultUserDataView() {