Merge pull request #9 from magefree/master

merge
This commit is contained in:
theelk801 2017-07-31 16:09:27 -04:00 committed by GitHub
commit c310bcd053
7 changed files with 100 additions and 88 deletions

View file

@ -48,7 +48,7 @@ import mage.players.Player;
public class AvatarOfWill extends CardImpl { public class AvatarOfWill extends CardImpl {
public AvatarOfWill(UUID ownerId, CardSetInfo setInfo) { public AvatarOfWill(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{6}{U}{U}"); super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{6}{U}{U}");
this.subtype.add(SubType.AVATAR); this.subtype.add(SubType.AVATAR);
this.power = new MageInt(5); this.power = new MageInt(5);
this.toughness = new MageInt(6); this.toughness = new MageInt(6);
@ -99,10 +99,12 @@ class AvatarOfWillCostReductionEffect extends CostModificationEffectImpl {
@Override @Override
public boolean applies(Ability abilityToModify, Ability source, Game game) { public boolean applies(Ability abilityToModify, Ability source, Game game) {
for (UUID playerId : game.getOpponents(source.getControllerId())) { if (abilityToModify.getSourceId().equals(source.getSourceId())) {
Player opponent = game.getPlayer(playerId); for (UUID playerId : game.getOpponents(source.getControllerId())) {
if (opponent != null && opponent.getHand().isEmpty()) { Player opponent = game.getPlayer(playerId);
return true; if (opponent != null && opponent.getHand().isEmpty()) {
return true;
}
} }
} }
return false; return false;

View file

@ -27,6 +27,7 @@
*/ */
package mage.cards.c; package mage.cards.c;
import java.util.UUID;
import mage.ObjectColor; import mage.ObjectColor;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
@ -34,13 +35,12 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/** /**
* *
* @author ciaccona007 * @author ciaccona007
@ -50,7 +50,6 @@ public class CinderCloud extends CardImpl {
public CinderCloud(UUID ownerId, CardSetInfo setInfo) { public CinderCloud(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}"); super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{3}{R}{R}");
// Destroy target creature. If a white creature dies this way, Cinder Cloud deals damage to that creature's controller equal to the creature's power. // Destroy target creature. If a white creature dies this way, Cinder Cloud deals damage to that creature's controller equal to the creature's power.
this.getSpellAbility().addEffect(new CinderCloudEffect()); this.getSpellAbility().addEffect(new CinderCloudEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent()); this.getSpellAbility().addTarget(new TargetCreaturePermanent());
@ -85,13 +84,19 @@ class CinderCloudEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source)); Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if(permanent != null && permanent.destroy(source.getSourceId(), game, false) && permanent.getColor(game).equals(ObjectColor.WHITE)) { if (permanent != null && permanent.destroy(source.getSourceId(), game, false) && permanent.getColor(game).equals(ObjectColor.WHITE)) {
int damage = permanent.getPower().getValue(); game.applyEffects();
Player player = game.getPlayer(permanent.getControllerId()); if (permanent.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(permanent.getId())
if(player != null) { && !game.getState().getZone(permanent.getId()).equals(Zone.GRAVEYARD)) {
player.damage(damage, source.getSourceId(), game, false, true); // A replacement effect has moved the card to another zone as grvayard
return true;
}
Player permanentController = game.getPlayer(permanent.getControllerId());
if (permanentController != null) {
int damage = permanent.getPower().getValue();
permanentController.damage(damage, source.getSourceId(), game, false, true);
} }
} }
return false; return true;
} }
} }

View file

@ -44,7 +44,6 @@ import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.SuperType; import mage.constants.SuperType;
import mage.constants.WatcherScope; import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.filter.common.FilterInstantOrSorceryCard; import mage.filter.common.FilterInstantOrSorceryCard;
import mage.game.ExileZone; import mage.game.ExileZone;
import mage.game.Game; import mage.game.Game;
@ -117,7 +116,8 @@ class JelevaNephaliasScourgeEffect extends OneShotEffect {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) { for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId); Player player = game.getPlayer(playerId);
if (player != null) { if (player != null) {
player.moveCards(player.getLibrary().getTopCards(game, xValue), Zone.EXILED, source, game); //
player.moveCardsToExile(player.getLibrary().getTopCards(game, xValue), source, game, true, CardUtil.getCardExileZoneId(game, source), sourceObject.getIdName());
} }
} }
} }

View file

@ -337,7 +337,7 @@ public class CastFromHandWithoutPayingManaCostTest extends CardTestPlayerBase {
Flying Flying
When Jeleva, Nephalia's Scourge enters the battlefield, each player exiles the top X cards of his or her library, where X is the amount of mana spent to cast Jeleva. When Jeleva, Nephalia's Scourge enters the battlefield, each player exiles the top X cards of his or her library, where X is the amount of mana spent to cast Jeleva.
Whenever Jeleva attacks, you may cast an instant or sorcery card exiled with it without paying its mana cost. Whenever Jeleva attacks, you may cast an instant or sorcery card exiled with it without paying its mana cost.
*/ */
String jeleva = "Jeleva, Nephalia's Scourge"; String jeleva = "Jeleva, Nephalia's Scourge";
/* /*
@ -348,11 +348,11 @@ public class CastFromHandWithoutPayingManaCostTest extends CardTestPlayerBase {
- Creatures you control gain double strike until end of turn. - Creatures you control gain double strike until end of turn.
- Untap all creatures you control. After this phase, there is an additional combat phase. - Untap all creatures you control. After this phase, there is an additional combat phase.
Entwine {1}{R} (Choose both if you pay the entwine cost.) Entwine {1}{R} (Choose both if you pay the entwine cost.)
*/ */
String savageBeating = "Savage Beating"; String savageBeating = "Savage Beating";
skipInitShuffling(); skipInitShuffling();
addCard(Zone.LIBRARY, playerA, savageBeating); addCard(Zone.LIBRARY, playerA, savageBeating, 2);
addCard(Zone.HAND, playerA, jeleva); addCard(Zone.HAND, playerA, jeleva);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3); addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3); addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
@ -369,9 +369,10 @@ public class CastFromHandWithoutPayingManaCostTest extends CardTestPlayerBase {
setStopAt(3, PhaseStep.END_COMBAT); setStopAt(3, PhaseStep.END_COMBAT);
execute(); execute();
assertGraveyardCount(playerA, savageBeating, 1);
assertTapped(jeleva, true); assertTapped(jeleva, true);
assertLife(playerB, 18); assertLife(playerB, 18);
assertAbility(playerA, jeleva, DoubleStrikeAbility.getInstance(), true); assertAbility(playerA, jeleva, DoubleStrikeAbility.getInstance(), true);
assertGraveyardCount(playerA, savageBeating, 1);
} }
} }

View file

@ -64,7 +64,7 @@ public class DiesTriggeredAbility extends ZoneChangeTriggeredAbility {
return false; return false;
} }
// check now it is in graveyard // check now it is in graveyard
if (before.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(source.getId())) { if (before.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(sourceId)) {
Zone after = game.getState().getZone(sourceId); Zone after = game.getState().getZone(sourceId);
return after != null && Zone.GRAVEYARD.match(after); return after != null && Zone.GRAVEYARD.match(after);
} else { } else {

View file

@ -49,7 +49,11 @@ public class BoostAllOfChosenSubtypeEffect extends BoostAllEffect {
@Override @Override
protected void setRuntimeData(Ability source, Game game) { protected void setRuntimeData(Ability source, Game game) {
String s = (String) game.getState().getValue(source.getSourceId() + "_type"); String s = (String) game.getState().getValue(source.getSourceId() + "_type");
subtype = SubType.byDescription(s); if (subtype != null) {
subtype = SubType.byDescription(s);
} else {
discard();
}
} }
} }

View file

@ -953,8 +953,8 @@ public abstract class PermanentImpl extends CardImpl implements Permanent {
} }
if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) { if (!game.replaceEvent(GameEvent.getEvent(EventType.DESTROY_PERMANENT, objectId, sourceId, controllerId, noRegen ? 1 : 0))) {
// this means destroy was successful, if object movement to graveyard will be replaced (e.g. commander to command zone) does not count for // this means destroy was successful, if object movement to graveyard will be replaced (e.g. commander to command zone) its still
// successful destroying. // is handled as successful destroying (but not as sucessful "dies this way" for destroying).
if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) { if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) {
if (!game.isSimulation()) { if (!game.isSimulation()) {
String logName; String logName;