mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Added Hide//Seek, Mesmeric Orb and Shelldoch Isle.
This commit is contained in:
parent
c352c70e27
commit
2df8da0685
7 changed files with 417 additions and 68 deletions
140
Mage.Sets/src/mage/sets/dissension/HideSeek.java
Normal file
140
Mage.Sets/src/mage/sets/dissension/HideSeek.java
Normal file
|
@ -0,0 +1,140 @@
|
|||
/*
|
||||
* 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.dissension;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.abilities.effects.common.PutOnLibraryTargetEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.SplitCard;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.filter.FilterPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
import mage.target.TargetPermanent;
|
||||
import mage.target.common.TargetCardInLibrary;
|
||||
import mage.target.common.TargetOpponent;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class HideSeek extends SplitCard<HideSeek> {
|
||||
|
||||
private static final FilterPermanent filter = new FilterPermanent("artifact or enchantment");
|
||||
|
||||
static {
|
||||
filter.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new CardTypePredicate(CardType.ENCHANTMENT)));
|
||||
}
|
||||
|
||||
public HideSeek(UUID ownerId) {
|
||||
super(ownerId, 151, "Hide", "Seek", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}{W}", "{W}{B}", false);
|
||||
this.expansionSetCode = "DIS";
|
||||
|
||||
this.color.setRed(true);
|
||||
this.color.setWhite(true);
|
||||
this.color.setBlack(true);
|
||||
|
||||
// Hide
|
||||
// Put target artifact or enchantment on the bottom of its owner's library.
|
||||
getLeftHalfCard().getColor().setRed(true);
|
||||
getLeftHalfCard().getColor().setWhite(true);
|
||||
getLeftHalfCard().getSpellAbility().addEffect(new PutOnLibraryTargetEffect(false));
|
||||
getLeftHalfCard().getSpellAbility().addTarget(new TargetPermanent(filter, true));
|
||||
|
||||
// Seek
|
||||
// Search target opponent's library for a card and exile it. You gain life equal to its converted mana cost. Then that player shuffles his or her library..
|
||||
getRightHalfCard().getColor().setWhite(true);
|
||||
getRightHalfCard().getColor().setBlack(true);
|
||||
getRightHalfCard().getSpellAbility().addEffect(new SeekEffect());
|
||||
getRightHalfCard().getSpellAbility().addTarget(new TargetOpponent(true));
|
||||
|
||||
}
|
||||
|
||||
public HideSeek(final HideSeek card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HideSeek copy() {
|
||||
return new HideSeek(this);
|
||||
}
|
||||
}
|
||||
|
||||
class SeekEffect extends OneShotEffect<SeekEffect> {
|
||||
|
||||
public SeekEffect() {
|
||||
super(Outcome.GainLife);
|
||||
staticText = "Search target opponent's library for a card and exile it. You gain life equal to its converted mana cost. Then that player shuffles his or her library";
|
||||
}
|
||||
|
||||
public SeekEffect(final SeekEffect effect) {
|
||||
super(effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SeekEffect copy() {
|
||||
return new SeekEffect(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean apply(Game game, Ability source) {
|
||||
Player opponent = game.getPlayer(source.getFirstTarget());
|
||||
Player player = game.getPlayer(source.getControllerId());
|
||||
if (player != null && opponent != null) {
|
||||
if (opponent.getLibrary().size() > 0) {
|
||||
TargetCardInLibrary target = new TargetCardInLibrary();
|
||||
target.setRequired(true);
|
||||
if (player.searchLibrary(target, game, opponent.getId())) {
|
||||
UUID targetId = target.getFirstTarget();
|
||||
Card card = opponent.getLibrary().remove(targetId, game);
|
||||
if (card != null) {
|
||||
player.moveCardToExileWithInfo(card, null, null, source.getSourceId(), game, Zone.LIBRARY);
|
||||
int cmc = card.getManaCost().convertedManaCost();
|
||||
if (cmc > 0) {
|
||||
player.gainLife(cmc, game);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
opponent.shuffleLibrary(game);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
74
Mage.Sets/src/mage/sets/lorwyn/ShelldockIsle.java
Normal file
74
Mage.Sets/src/mage/sets/lorwyn/ShelldockIsle.java
Normal file
|
@ -0,0 +1,74 @@
|
|||
/*
|
||||
* 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.Ability;
|
||||
import mage.abilities.common.ActivateIfConditionActivatedAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.abilities.condition.common.CardsInAnyLibraryCondition;
|
||||
import mage.abilities.costs.common.TapSourceCost;
|
||||
import mage.abilities.costs.mana.ManaCostsImpl;
|
||||
import mage.abilities.effects.common.HideawayPlayEffect;
|
||||
import mage.abilities.keyword.HideawayAbility;
|
||||
import mage.abilities.mana.BlueManaAbility;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class ShelldockIsle extends CardImpl<ShelldockIsle> {
|
||||
|
||||
public ShelldockIsle(UUID ownerId) {
|
||||
super(ownerId, 272, "Shelldock Isle", Rarity.RARE, new CardType[]{CardType.LAND}, "");
|
||||
this.expansionSetCode = "LRW";
|
||||
|
||||
// Hideaway
|
||||
this.addAbility(new HideawayAbility(this));
|
||||
// {tap}: Add {U} to your mana pool.
|
||||
this.addAbility(new BlueManaAbility());
|
||||
// {U}, {tap}: You may play the exiled card without paying its mana cost if a library has twenty or fewer cards in it.
|
||||
Ability ability = new ActivateIfConditionActivatedAbility(
|
||||
Zone.BATTLEFIELD, new HideawayPlayEffect(), new ManaCostsImpl("{U}"), new CardsInAnyLibraryCondition(Condition.ComparisonType.LessThan, 21));
|
||||
ability.addCost(new TapSourceCost());
|
||||
this.addAbility(ability);
|
||||
}
|
||||
|
||||
public ShelldockIsle(final ShelldockIsle card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShelldockIsle copy() {
|
||||
return new ShelldockIsle(this);
|
||||
}
|
||||
}
|
101
Mage.Sets/src/mage/sets/mirrodin/MesmericOrb.java
Normal file
101
Mage.Sets/src/mage/sets/mirrodin/MesmericOrb.java
Normal file
|
@ -0,0 +1,101 @@
|
|||
/*
|
||||
* 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.mirrodin;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.TriggeredAbilityImpl;
|
||||
import mage.abilities.effects.Effect;
|
||||
import mage.abilities.effects.common.PutTopCardOfLibraryIntoGraveTargetEffect;
|
||||
import mage.cards.CardImpl;
|
||||
import mage.constants.CardType;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.events.GameEvent;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.target.targetpointer.FixedTarget;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class MesmericOrb extends CardImpl<MesmericOrb> {
|
||||
|
||||
public MesmericOrb(UUID ownerId) {
|
||||
super(ownerId, 204, "Mesmeric Orb", Rarity.RARE, new CardType[]{CardType.ARTIFACT}, "{2}");
|
||||
this.expansionSetCode = "MRD";
|
||||
|
||||
// Whenever a permanent becomes untapped, that permanent's controller puts the top card of his or her library into his or her graveyard.
|
||||
Effect effect = new PutTopCardOfLibraryIntoGraveTargetEffect(1);
|
||||
effect.setText("that permanent's controller puts the top card of his or her library into his or her graveyard");
|
||||
this.addAbility(new BecomesUntappedPermanentTriggeredAbility(effect, false));
|
||||
}
|
||||
|
||||
public MesmericOrb(final MesmericOrb card) {
|
||||
super(card);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MesmericOrb copy() {
|
||||
return new MesmericOrb(this);
|
||||
}
|
||||
}
|
||||
|
||||
class BecomesUntappedPermanentTriggeredAbility extends TriggeredAbilityImpl<BecomesUntappedPermanentTriggeredAbility>{
|
||||
|
||||
public BecomesUntappedPermanentTriggeredAbility(Effect effect, boolean optional) {
|
||||
super(Zone.BATTLEFIELD, effect, optional);
|
||||
}
|
||||
|
||||
public BecomesUntappedPermanentTriggeredAbility(final BecomesUntappedPermanentTriggeredAbility ability) {
|
||||
super(ability);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BecomesUntappedPermanentTriggeredAbility copy() {
|
||||
return new BecomesUntappedPermanentTriggeredAbility(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTrigger(GameEvent event, Game game) {
|
||||
if (event.getType() == GameEvent.EventType.UNTAPPED) {
|
||||
Permanent permanent = game.getPermanent(event.getTargetId());
|
||||
if (permanent != null) {
|
||||
this.getEffects().get(0).setTargetPointer(new FixedTarget(permanent.getControllerId()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRule() {
|
||||
return "Whenever a permanent becomes untapped, " + super.getRule();
|
||||
}
|
||||
|
||||
}
|
|
@ -106,9 +106,10 @@ class PraetorsGraspEffect extends OneShotEffect<PraetorsGraspEffect> {
|
|||
}
|
||||
}
|
||||
opponent.shuffleLibrary(game);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class PraetorsGraspPlayEffect extends AsThoughEffectImpl<PraetorsGraspPlayEffect> {
|
||||
|
|
|
@ -29,12 +29,9 @@ package mage.sets.shadowmoor;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.MageInt;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.Condition;
|
||||
import static mage.abilities.condition.Condition.ComparisonType.Equal;
|
||||
import static mage.abilities.condition.Condition.ComparisonType.GreaterThan;
|
||||
import static mage.abilities.condition.Condition.ComparisonType.LessThan;
|
||||
import mage.abilities.condition.common.CardsInAnyLibraryCondition;
|
||||
import mage.abilities.decorator.ConditionalContinousEffect;
|
||||
import mage.abilities.effects.common.continious.BoostSourceEffect;
|
||||
import mage.abilities.keyword.ShroudAbility;
|
||||
|
@ -43,8 +40,6 @@ import mage.constants.CardType;
|
|||
import mage.constants.Duration;
|
||||
import mage.constants.Rarity;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -79,61 +74,3 @@ public class IslebackSpawn extends CardImpl<IslebackSpawn> {
|
|||
return new IslebackSpawn(this);
|
||||
}
|
||||
}
|
||||
|
||||
class CardsInAnyLibraryCondition implements Condition {
|
||||
|
||||
protected final Condition.ComparisonType type;
|
||||
protected final int value;
|
||||
|
||||
public CardsInAnyLibraryCondition(Condition.ComparisonType type, int value) {
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
switch(type) {
|
||||
case GreaterThan:
|
||||
if (player.getLibrary().size() > value) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Equal:
|
||||
if (player.getLibrary().size() == value) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case LessThan:
|
||||
if (player.getLibrary().size() < value) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("a library has ");
|
||||
switch(type) {
|
||||
case GreaterThan:
|
||||
sb.append(value+1).append(" or more cards in it ");
|
||||
break;
|
||||
case Equal:
|
||||
sb.append(value).append(" cards in it ");
|
||||
break;
|
||||
case LessThan:
|
||||
sb.append(value-1).append(" or fewer cards in it ");
|
||||
break;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* 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.abilities.condition.common;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.condition.Condition;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class CardsInAnyLibraryCondition implements Condition {
|
||||
|
||||
protected final Condition.ComparisonType type;
|
||||
protected final int value;
|
||||
|
||||
public CardsInAnyLibraryCondition(Condition.ComparisonType type, int value) {
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean apply(Game game, Ability source) {
|
||||
Player controller = game.getPlayer(source.getControllerId());
|
||||
if (controller != null) {
|
||||
for (UUID playerId: controller.getInRange()) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
switch(type) {
|
||||
case GreaterThan:
|
||||
if (player.getLibrary().size() > value) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case Equal:
|
||||
if (player.getLibrary().size() == value) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case LessThan:
|
||||
if (player.getLibrary().size() < value) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("a library has ");
|
||||
switch(type) {
|
||||
case GreaterThan:
|
||||
sb.append(value+1).append(" or more cards in it ");
|
||||
break;
|
||||
case Equal:
|
||||
sb.append(value).append(" cards in it ");
|
||||
break;
|
||||
case LessThan:
|
||||
sb.append(value-1).append(" or fewer cards in it ");
|
||||
break;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -28,18 +28,17 @@
|
|||
|
||||
package mage.abilities.effects.common;
|
||||
|
||||
import mage.constants.Outcome;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.players.Player;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
|
||||
/**
|
||||
* @author LevelX2
|
||||
*/
|
||||
|
@ -75,7 +74,7 @@ public class PutTopCardOfLibraryIntoGraveTargetEffect extends OneShotEffect<PutT
|
|||
for (int i = 0; i < cardsCount; i++) {
|
||||
Card card = player.getLibrary().removeFromTop(game);
|
||||
if (card != null) {
|
||||
card.moveToZone(Zone.GRAVEYARD, source.getId(), game, true);
|
||||
player.moveCardToGraveyardWithInfo(card, source.getSourceId(), game, Zone.LIBRARY);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue