Merge pull request #62 from magefree/master

merge
This commit is contained in:
theelk801 2017-09-13 11:11:16 -04:00 committed by GitHub
commit 9b5dd0a8fc
9 changed files with 47 additions and 40 deletions

View file

@ -53,7 +53,7 @@ import mage.game.permanent.Permanent;
public class Anthroplasm extends CardImpl { public class Anthroplasm extends CardImpl {
public Anthroplasm(UUID ownerId, CardSetInfo setInfo) { 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.subtype.add(SubType.SHAPESHIFTER);
this.power = new MageInt(0); this.power = new MageInt(0);
@ -80,12 +80,12 @@ public class Anthroplasm extends CardImpl {
class AnthroplasmEffect extends OneShotEffect { class AnthroplasmEffect extends OneShotEffect {
AnthroplasmEffect ( ) { AnthroplasmEffect() {
super(Outcome.Benefit); 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); super(effect);
} }

View file

@ -50,13 +50,10 @@ public class KumenasSpeaker extends CardImpl {
private static final FilterPermanent filter = new FilterPermanent("another Merfolk or an Island"); private static final FilterPermanent filter = new FilterPermanent("another Merfolk or an Island");
static { static {
filter.add(new AnotherPredicate());
filter.add(Predicates.or( filter.add(Predicates.or(
new SubtypePredicate(SubType.ISLAND), new SubtypePredicate(SubType.ISLAND),
Predicates.and( new SubtypePredicate(SubType.MERFOLK)));
new SubtypePredicate(SubType.MERFOLK),
new AnotherPredicate()
)
));
} }
public KumenasSpeaker(UUID ownerId, CardSetInfo setInfo) { public KumenasSpeaker(UUID ownerId, CardSetInfo setInfo) {

View file

@ -29,6 +29,7 @@ package mage.cards.p;
import java.util.Iterator; import java.util.Iterator;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.TriggeredAbilityImpl; import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.EntersBattlefieldTappedAbility; import mage.abilities.common.EntersBattlefieldTappedAbility;
@ -44,6 +45,7 @@ import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.stack.Spell; import mage.game.stack.Spell;
import mage.players.Player;
/** /**
* *
@ -105,19 +107,24 @@ class PathOfAncestryTriggeredAbility extends TriggeredAbilityImpl {
if (event.getData().equals(abilityOriginalId)) { if (event.getData().equals(abilityOriginalId)) {
Spell spell = game.getStack().getSpell(event.getTargetId()); Spell spell = game.getStack().getSpell(event.getTargetId());
if (spell != null && spell.isCreature()) { if (spell != null && spell.isCreature()) {
Iterator<SubType> spellSubs = spell.getSubtype(game).iterator(); Player controller = game.getPlayer(getControllerId());
while (spellSubs.hasNext()) { if (controller != null && controller.getCommandersIds() != null && !controller.getCommandersIds().isEmpty()) {
SubType sType = spellSubs.next(); Iterator<SubType> spellSubs = spell.getSubtype(game).iterator();
if (sType.getSubTypeSet() == SubTypeSet.CreatureType) { while (spellSubs.hasNext()) {
for (UUID cmdr : game.getPlayer(spell.getControllerId()).getCommandersIds()) { SubType sType = spellSubs.next();
if (game.getObject(cmdr).getSubtype(game).contains(sType)) { if (sType.getSubTypeSet() == SubTypeSet.CreatureType) {
return true; for (UUID cmdr : controller.getCommandersIds()) {
MageObject commander = game.getObject(cmdr);
if (commander != null && commander.getSubtype(game).contains(sType)) {
return true;
}
} }
} }
} }
} }
} }
} }
return false; return false;
} }

View file

@ -32,6 +32,7 @@ import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility; import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility; import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.effects.common.LoseLifeOpponentsEffect;
import mage.abilities.effects.common.counter.AddCountersTargetEffect; import mage.abilities.effects.common.counter.AddCountersTargetEffect;
import mage.abilities.keyword.MenaceAbility; import mage.abilities.keyword.MenaceAbility;
import mage.cards.CardImpl; import mage.cards.CardImpl;
@ -77,7 +78,7 @@ public class PlagueBelcher extends CardImpl {
this.addAbility(ability); this.addAbility(ability);
// Whenever another Zombie you control dies, each opponent loses 1 life. // 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) { public PlagueBelcher(final PlagueBelcher card) {

View file

@ -36,8 +36,8 @@ import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.Zone; import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
@ -91,7 +91,7 @@ class VerdantSunsAvatarTriggeredAbility extends TriggeredAbilityImpl {
@Override @Override
public boolean checkTrigger(GameEvent event, Game game) { public boolean checkTrigger(GameEvent event, Game game) {
Permanent permanent = game.getPermanent(event.getTargetId()); Permanent permanent = game.getPermanent(event.getTargetId());
if (permanent.isCreature() if (permanent != null && permanent.isCreature()
&& permanent.getControllerId().equals(this.controllerId)) { && permanent.getControllerId().equals(this.controllerId)) {
Effect effect = this.getEffects().get(0); Effect effect = this.getEffects().get(0);
// Life is determined during resolution so it has to be retrieved there (e.g. Giant Growth before resolution) // Life is determined during resolution so it has to be retrieved there (e.g. Giant Growth before resolution)

View file

@ -28,14 +28,14 @@
package mage.abilities.condition.common; package mage.abilities.condition.common;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.constants.ComparisonType;
import mage.abilities.condition.Condition; import mage.abilities.condition.Condition;
import mage.constants.ComparisonType;
import mage.filter.FilterPermanent; import mage.filter.FilterPermanent;
import mage.filter.predicate.permanent.ControllerIdPredicate; import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game; 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. * as well as be used standalone.
* *
* @author nantuko * @author nantuko
@ -63,9 +63,10 @@ public class PermanentsOnTheBattlefieldCondition implements Condition {
} }
/** /**
* Applies a filter, a {@link ComparisonType}, and count to permanents on the * Applies a filter, a {@link ComparisonType}, and count to permanents on
* battlefield when checking the condition during the * the battlefield when checking the condition during the
* {@link #apply(mage.game.Game, mage.abilities.Ability) apply} method invocation. * {@link #apply(mage.game.Game, mage.abilities.Ability) apply} method
* invocation.
* *
* @param filter * @param filter
* @param type * @param type
@ -83,10 +84,10 @@ public class PermanentsOnTheBattlefieldCondition implements Condition {
} }
/** /**
* Applies a filter, a {@link ComparisonType}, and count to permanents on the * Applies a filter, a {@link ComparisonType}, and count to permanents on
* battlefield and calls the decorated condition to see if it * the battlefield and calls the decorated condition to see if it
* {@link #apply(mage.game.Game, mage.abilities.Ability) applies} * {@link #apply(mage.game.Game, mage.abilities.Ability) applies} as well.
* as well. This will force both conditions to apply for this to be true. * This will force both conditions to apply for this to be true.
* *
* @param filter * @param filter
* @param type * @param type
@ -100,7 +101,7 @@ public class PermanentsOnTheBattlefieldCondition implements Condition {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
boolean conditionApplies = false; boolean conditionApplies;
FilterPermanent localFilter = filter.copy(); FilterPermanent localFilter = filter.copy();
if (onlyControlled) { if (onlyControlled) {

View file

@ -27,6 +27,11 @@
*/ */
package mage.cards; 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.MageObject;
import mage.MageObjectImpl; import mage.MageObjectImpl;
import mage.Mana; import mage.Mana;
@ -48,12 +53,6 @@ import mage.util.SubTypeList;
import mage.watchers.Watcher; import mage.watchers.Watcher;
import org.apache.log4j.Logger; 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 { public abstract class CardImpl extends MageObjectImpl implements Card {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -669,7 +668,9 @@ public abstract class CardImpl extends MageObjectImpl implements Card {
@Override @Override
public void removeCounters(Counter counter, Game game) { public void removeCounters(Counter counter, Game game) {
removeCounters(counter.getName(), counter.getCount(), game); if (counter != null) {
removeCounters(counter.getName(), counter.getCount(), game);
}
} }
@Override @Override

View file

@ -650,12 +650,12 @@ public interface Player extends MageItem, Copyable<Player> {
/** /**
* Set the commanderId of the player * Set the commanderId of the player
* *
* @param commandersIds * @param commanderId
*/ */
void addCommanderId(UUID commanderId); void addCommanderId(UUID commanderId);
/** /**
* Get the commanderId of the player * Get the commanderIds of the player
* *
* @return * @return
*/ */

View file

@ -75,7 +75,7 @@ public class UserData implements Serializable {
this.autoOrderTrigger = userData.autoOrderTrigger; this.autoOrderTrigger = userData.autoOrderTrigger;
this.useFirstManaAbility = userData.useFirstManaAbility; this.useFirstManaAbility = userData.useFirstManaAbility;
this.userIdStr = userData.userIdStr; 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() { public static UserData getDefaultUserDataView() {