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

@ -99,12 +99,14 @@ class AvatarOfWillCostReductionEffect extends CostModificationEffectImpl {
@Override
public boolean applies(Ability abilityToModify, Ability source, Game game) {
if (abilityToModify.getSourceId().equals(source.getSourceId())) {
for (UUID playerId : game.getOpponents(source.getControllerId())) {
Player opponent = game.getPlayer(playerId);
if (opponent != null && opponent.getHand().isEmpty()) {
return true;
}
}
}
return false;
}

View file

@ -27,6 +27,7 @@
*/
package mage.cards.c;
import java.util.UUID;
import mage.ObjectColor;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
@ -34,13 +35,12 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.common.TargetCreaturePermanent;
import java.util.UUID;
/**
*
* @author ciaccona007
@ -50,7 +50,6 @@ public class CinderCloud extends CardImpl {
public CinderCloud(UUID ownerId, CardSetInfo setInfo) {
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.
this.getSpellAbility().addEffect(new CinderCloudEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
@ -86,12 +85,18 @@ class CinderCloudEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) {
Permanent permanent = game.getPermanent(getTargetPointer().getFirst(game, source));
if (permanent != null && permanent.destroy(source.getSourceId(), game, false) && permanent.getColor(game).equals(ObjectColor.WHITE)) {
game.applyEffects();
if (permanent.getZoneChangeCounter(game) + 1 == game.getState().getZoneChangeCounter(permanent.getId())
&& !game.getState().getZone(permanent.getId()).equals(Zone.GRAVEYARD)) {
// 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();
Player player = game.getPlayer(permanent.getControllerId());
if(player != null) {
player.damage(damage, source.getSourceId(), game, false, true);
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.SuperType;
import mage.constants.WatcherScope;
import mage.constants.Zone;
import mage.filter.common.FilterInstantOrSorceryCard;
import mage.game.ExileZone;
import mage.game.Game;
@ -117,7 +116,8 @@ class JelevaNephaliasScourgeEffect extends OneShotEffect {
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
Player player = game.getPlayer(playerId);
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

@ -352,7 +352,7 @@ public class CastFromHandWithoutPayingManaCostTest extends CardTestPlayerBase {
String savageBeating = "Savage Beating";
skipInitShuffling();
addCard(Zone.LIBRARY, playerA, savageBeating);
addCard(Zone.LIBRARY, playerA, savageBeating, 2);
addCard(Zone.HAND, playerA, jeleva);
addCard(Zone.BATTLEFIELD, playerA, "Swamp", 3);
addCard(Zone.BATTLEFIELD, playerA, "Island", 3);
@ -369,9 +369,10 @@ public class CastFromHandWithoutPayingManaCostTest extends CardTestPlayerBase {
setStopAt(3, PhaseStep.END_COMBAT);
execute();
assertGraveyardCount(playerA, savageBeating, 1);
assertTapped(jeleva, true);
assertLife(playerB, 18);
assertAbility(playerA, jeleva, DoubleStrikeAbility.getInstance(), true);
assertGraveyardCount(playerA, savageBeating, 1);
}
}

View file

@ -64,7 +64,7 @@ public class DiesTriggeredAbility extends ZoneChangeTriggeredAbility {
return false;
}
// 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);
return after != null && Zone.GRAVEYARD.match(after);
} else {

View file

@ -49,7 +49,11 @@ public class BoostAllOfChosenSubtypeEffect extends BoostAllEffect {
@Override
protected void setRuntimeData(Ability source, Game game) {
String s = (String) game.getState().getValue(source.getSourceId() + "_type");
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))) {
// this means destroy was successful, if object movement to graveyard will be replaced (e.g. commander to command zone) does not count for
// successful destroying.
// this means destroy was successful, if object movement to graveyard will be replaced (e.g. commander to command zone) its still
// is handled as successful destroying (but not as sucessful "dies this way" for destroying).
if (moveToZone(Zone.GRAVEYARD, sourceId, game, false)) {
if (!game.isSimulation()) {
String logName;