Added Dolmen Gate.

This commit is contained in:
LevelX2 2015-01-19 07:59:41 +01:00
parent adf7d26201
commit 495b93a679
4 changed files with 95 additions and 20 deletions

View file

@ -0,0 +1,73 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.sets.lorwyn;
import java.util.UUID;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.PreventAllDamageToAllEffect;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.filter.FilterInPlay;
import mage.filter.common.FilterControlledCreatureInPlay;
import mage.filter.predicate.permanent.AttackingPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
/**
*
* @author LevelX2
*/
public class DolmenGate extends CardImpl {
private static final FilterInPlay filter = new FilterControlledCreatureInPlay("attacking creatures you control");
static {
filter.add(new AttackingPredicate());
filter.add(new ControllerPredicate(TargetController.YOU));
}
public DolmenGate(UUID ownerId) {
super(ownerId, 256, "Dolmen Gate", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
this.expansionSetCode = "LRW";
// Prevent all combat damage that would be dealt to attacking creatures you control.
this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new PreventAllDamageToAllEffect(Duration.WhileOnBattlefield, filter, true)));
}
public DolmenGate(final DolmenGate card) {
super(card);
}
@Override
public DolmenGate copy() {
return new DolmenGate(this);
}
}

View file

@ -28,6 +28,7 @@
package mage.sets.mirrodin;
import java.util.UUID;
import mage.MageObject;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.TapSourceCost;
@ -41,11 +42,9 @@ import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.filter.FilterCard;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetCard;
import mage.target.common.TargetCreatureOrPlayer;
/**
@ -94,29 +93,27 @@ class GoblinCharbelcherEffect extends OneShotEffect {
@Override
public boolean apply(Game game, Ability source) {
boolean isMountain = false;
Card sourceCard = game.getCard(source.getSourceId());
Player player = game.getPlayer(source.getControllerId());
if (player == null || sourceCard == null) {
MageObject sourceObject = game.getObject(source.getSourceId());
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || sourceObject == null) {
return false;
}
Cards cards = new CardsImpl();
while (player.getLibrary().size() > 0) {
Card card = player.getLibrary().removeFromTop(game);
while (controller.getLibrary().size() > 0) {
Card card = controller.getLibrary().removeFromTop(game);
if (card != null) {
cards.add(card);
if(card.getCardType().contains(CardType.LAND)){
if (card.getCardType().contains(CardType.LAND)){
if(card.getSubtype().contains("Mountain")){
isMountain = true;
}
break;
}
}
else{
} else {
break;
}
}
player.revealCards(sourceCard.getName(), cards, game);
controller.revealCards(sourceObject.getLogName(), cards, game);
int damage = cards.size();
if(isMountain == true){
damage *= 2;
@ -132,7 +129,7 @@ class GoblinCharbelcherEffect extends OneShotEffect {
targetPlayer.damage(damage, source.getSourceId(), game, false, true);
}
}
player.putCardsOnBottomOfLibrary(cards, game, source, true);
controller.putCardsOnBottomOfLibrary(cards, game, source, true);
return true;
}
}

View file

@ -29,16 +29,13 @@
package mage.abilities.effects.common;
import java.util.UUID;
import mage.constants.Duration;
import mage.abilities.Ability;
import mage.abilities.effects.PreventionEffectImpl;
import mage.constants.TargetController;
import mage.constants.Duration;
import mage.filter.FilterInPlay;
import mage.filter.common.FilterCreatureOrPlayer;
import mage.filter.common.FilterCreaturePermanent;
import mage.filter.predicate.other.PlayerIdPredicate;
import mage.filter.predicate.permanent.ControllerPredicate;
import mage.filter.predicate.permanent.TokenPredicate;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
@ -57,9 +54,17 @@ public class PreventAllDamageToAllEffect extends PreventionEffectImpl {
}
public PreventAllDamageToAllEffect(Duration duration, FilterInPlay filter) {
super(duration);
this(duration, filter, false);
}
public PreventAllDamageToAllEffect(Duration duration, FilterInPlay filter, boolean onlyCombat) {
super(duration, Integer.MAX_VALUE, onlyCombat);
this.filter = filter;
staticText = "Prevent all damage that would be dealt to " + filter.getMessage() + (duration.toString().isEmpty() ?"": " "+ duration.toString());
staticText = "Prevent all "
+ (onlyCombat ? "combat ":"")
+ "damage that would be dealt to "
+ filter.getMessage()
+ (duration.toString().isEmpty() ?"": " "+ duration.toString());
}
public PreventAllDamageToAllEffect(final PreventAllDamageToAllEffect effect) {

View file

@ -277,7 +277,7 @@ public abstract class GameImpl implements Game, Serializable {
card = ((PermanentCard)card).getCard();
}
card.setOwnerId(ownerId);
card.setFaceDown(false); // can be set face dwon from previous game
card.setFaceDown(false); // can be set face down from previous game
gameCards.put(card.getId(), card);
state.addCard(card);
if (card.isSplitCard()) {