mirror of
https://github.com/correl/mage.git
synced 2024-11-15 19:19:33 +00:00
Added 3 cards.
This commit is contained in:
parent
4acadf051d
commit
1dbd3ea41c
14 changed files with 731 additions and 38 deletions
|
@ -49,7 +49,6 @@ public class DreamFracture extends CardImpl {
|
||||||
super(ownerId, 19, "Dream Fracture", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
super(ownerId, 19, "Dream Fracture", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{1}{U}{U}");
|
||||||
this.expansionSetCode = "EVE";
|
this.expansionSetCode = "EVE";
|
||||||
|
|
||||||
|
|
||||||
// Counter target spell. Its controller draws a card.
|
// Counter target spell. Its controller draws a card.
|
||||||
this.getSpellAbility().addEffect(new DreamFractureEffect());
|
this.getSpellAbility().addEffect(new DreamFractureEffect());
|
||||||
this.getSpellAbility().addTarget(new TargetSpell());
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
|
@ -73,7 +72,7 @@ class DreamFractureEffect extends OneShotEffect {
|
||||||
|
|
||||||
public DreamFractureEffect() {
|
public DreamFractureEffect() {
|
||||||
super(Outcome.Neutral);
|
super(Outcome.Neutral);
|
||||||
this.staticText = "Counter target spell. Its controller draws a card";
|
this.staticText = "Counter target spell. Its controller draws a card";
|
||||||
}
|
}
|
||||||
|
|
||||||
public DreamFractureEffect(final DreamFractureEffect effect) {
|
public DreamFractureEffect(final DreamFractureEffect effect) {
|
||||||
|
@ -102,4 +101,4 @@ class DreamFractureEffect extends OneShotEffect {
|
||||||
}
|
}
|
||||||
return countered;
|
return countered;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
52
Mage.Sets/src/mage/sets/fifthedition/LibraryOfLeng.java
Normal file
52
Mage.Sets/src/mage/sets/fifthedition/LibraryOfLeng.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* 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.fifthedition;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class LibraryOfLeng extends mage.sets.limitedbeta.LibraryOfLeng {
|
||||||
|
|
||||||
|
public LibraryOfLeng(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 387;
|
||||||
|
this.expansionSetCode = "5ED";
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryOfLeng(final LibraryOfLeng card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LibraryOfLeng copy() {
|
||||||
|
return new LibraryOfLeng(this);
|
||||||
|
}
|
||||||
|
}
|
52
Mage.Sets/src/mage/sets/fourthedition/LibraryOfLeng.java
Normal file
52
Mage.Sets/src/mage/sets/fourthedition/LibraryOfLeng.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* 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.fourthedition;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class LibraryOfLeng extends mage.sets.limitedbeta.LibraryOfLeng {
|
||||||
|
|
||||||
|
public LibraryOfLeng(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 351;
|
||||||
|
this.expansionSetCode = "4ED";
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryOfLeng(final LibraryOfLeng card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LibraryOfLeng copy() {
|
||||||
|
return new LibraryOfLeng(this);
|
||||||
|
}
|
||||||
|
}
|
121
Mage.Sets/src/mage/sets/legions/ElvishSoultiller.java
Normal file
121
Mage.Sets/src/mage/sets/legions/ElvishSoultiller.java
Normal file
|
@ -0,0 +1,121 @@
|
||||||
|
/*
|
||||||
|
* 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.legions;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.MageObject;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.DiesTriggeredAbility;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.Cards;
|
||||||
|
import mage.cards.CardsImpl;
|
||||||
|
import mage.cards.repository.CardRepository;
|
||||||
|
import mage.choices.Choice;
|
||||||
|
import mage.choices.ChoiceImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.filter.common.FilterCreatureCard;
|
||||||
|
import mage.filter.predicate.mageobject.SubtypePredicate;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class ElvishSoultiller extends CardImpl {
|
||||||
|
|
||||||
|
public ElvishSoultiller(UUID ownerId) {
|
||||||
|
super(ownerId, 124, "Elvish Soultiller", Rarity.RARE, new CardType[]{CardType.CREATURE}, "{3}{G}{G}");
|
||||||
|
this.expansionSetCode = "LGN";
|
||||||
|
this.subtype.add("Elf");
|
||||||
|
this.subtype.add("Mutant");
|
||||||
|
this.power = new MageInt(5);
|
||||||
|
this.toughness = new MageInt(4);
|
||||||
|
|
||||||
|
// When Elvish Soultiller dies, choose a creature type. Shuffle all creature cards of that type from your graveyard into your library.
|
||||||
|
addAbility(new DiesTriggeredAbility(new ElvishSoultillerEffect()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElvishSoultiller(final ElvishSoultiller card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ElvishSoultiller copy() {
|
||||||
|
return new ElvishSoultiller(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ElvishSoultillerEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public ElvishSoultillerEffect() {
|
||||||
|
super(Outcome.Benefit);
|
||||||
|
this.staticText = "choose a creature type. Shuffle all creature cards of that type from your graveyard into your library";
|
||||||
|
}
|
||||||
|
|
||||||
|
public ElvishSoultillerEffect(final ElvishSoultillerEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ElvishSoultillerEffect copy() {
|
||||||
|
return new ElvishSoultillerEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
MageObject mageObject = game.getObject(source.getSourceId());
|
||||||
|
if (controller != null && mageObject != null) {
|
||||||
|
Choice typeChoice = new ChoiceImpl(true);
|
||||||
|
typeChoice.setMessage("Choose creature type");
|
||||||
|
typeChoice.setChoices(CardRepository.instance.getCreatureTypes());
|
||||||
|
while (!controller.choose(outcome, typeChoice, game)) {
|
||||||
|
if (!controller.canRespond()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!game.isSimulation()) {
|
||||||
|
game.informPlayers(mageObject.getName() + ": " + controller.getLogName() + " has chosen " + typeChoice.getChoice());
|
||||||
|
}
|
||||||
|
Cards cardsToLibrary = new CardsImpl();
|
||||||
|
FilterCreatureCard filter = new FilterCreatureCard();
|
||||||
|
filter.add(new SubtypePredicate(typeChoice.getChoice()));
|
||||||
|
cardsToLibrary.addAll(controller.getGraveyard().getCards(filter, source.getSourceId(), source.getControllerId(), game));
|
||||||
|
controller.putCardsOnTopOfLibrary(cardsToLibrary, game, source, false);
|
||||||
|
controller.shuffleLibrary(game);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
52
Mage.Sets/src/mage/sets/limitedalpha/LibraryOfLeng.java
Normal file
52
Mage.Sets/src/mage/sets/limitedalpha/LibraryOfLeng.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* 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.limitedalpha;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class LibraryOfLeng extends mage.sets.limitedbeta.LibraryOfLeng {
|
||||||
|
|
||||||
|
public LibraryOfLeng(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 257;
|
||||||
|
this.expansionSetCode = "LEA";
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryOfLeng(final LibraryOfLeng card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LibraryOfLeng copy() {
|
||||||
|
return new LibraryOfLeng(this);
|
||||||
|
}
|
||||||
|
}
|
149
Mage.Sets/src/mage/sets/limitedbeta/LibraryOfLeng.java
Normal file
149
Mage.Sets/src/mage/sets/limitedbeta/LibraryOfLeng.java
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
/*
|
||||||
|
* 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.limitedbeta;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.common.SimpleStaticAbility;
|
||||||
|
import mage.abilities.effects.Effect;
|
||||||
|
import mage.abilities.effects.ReplacementEffectImpl;
|
||||||
|
import mage.abilities.effects.common.continuous.MaximumHandSizeControllerEffect;
|
||||||
|
import mage.cards.Card;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.cards.Cards;
|
||||||
|
import mage.cards.CardsImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Duration;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.constants.Zone;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.game.events.GameEvent;
|
||||||
|
import mage.game.events.GameEvent.EventType;
|
||||||
|
import mage.game.events.ZoneChangeEvent;
|
||||||
|
import mage.players.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class LibraryOfLeng extends CardImpl {
|
||||||
|
|
||||||
|
public LibraryOfLeng(UUID ownerId) {
|
||||||
|
super(ownerId, 259, "Library of Leng", Rarity.UNCOMMON, new CardType[]{CardType.ARTIFACT}, "{1}");
|
||||||
|
this.expansionSetCode = "LEB";
|
||||||
|
|
||||||
|
// You have no maximum hand size.
|
||||||
|
Effect effect = new MaximumHandSizeControllerEffect(Integer.MAX_VALUE, Duration.WhileOnBattlefield, MaximumHandSizeControllerEffect.HandSizeModification.SET);
|
||||||
|
addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect));
|
||||||
|
|
||||||
|
// If an effect causes you to discard a card, discard it, but you may put it on top of your library instead of into your graveyard.
|
||||||
|
addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new LibraryOfLengEffect()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryOfLeng(final LibraryOfLeng card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LibraryOfLeng copy() {
|
||||||
|
return new LibraryOfLeng(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class LibraryOfLengEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
|
private UUID cardId;
|
||||||
|
private int zoneChangeCounter;
|
||||||
|
|
||||||
|
public LibraryOfLengEffect() {
|
||||||
|
super(Duration.WhileOnBattlefield, Outcome.Benefit);
|
||||||
|
staticText = "If an effect causes you to discard a card, discard it, but you may put it on top of your library instead of into your graveyard";
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryOfLengEffect(final LibraryOfLengEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
this.cardId = effect.cardId;
|
||||||
|
this.zoneChangeCounter = effect.zoneChangeCounter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LibraryOfLengEffect copy() {
|
||||||
|
return new LibraryOfLengEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean checksEventType(GameEvent event, Game game) {
|
||||||
|
return event.getType().equals(EventType.DISCARD_CARD)
|
||||||
|
|| event.getType().equals(EventType.ZONE_CHANGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
|
if (event.getType().equals(EventType.DISCARD_CARD)) {
|
||||||
|
return event.getPlayerId().equals(source.getControllerId());
|
||||||
|
}
|
||||||
|
if (event.getType().equals(EventType.ZONE_CHANGE)) {
|
||||||
|
if (event.getTargetId().equals(cardId) && game.getState().getZoneChangeCounter(event.getTargetId()) == zoneChangeCounter) {
|
||||||
|
if (((ZoneChangeEvent) event).getFromZone().equals(Zone.HAND) && ((ZoneChangeEvent) event).getToZone().equals(Zone.GRAVEYARD)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean replaceEvent(GameEvent event, Ability source, Game game) {
|
||||||
|
if (event.getType().equals(EventType.DISCARD_CARD)) {
|
||||||
|
// only save card info
|
||||||
|
Card card = game.getCard(event.getTargetId());
|
||||||
|
if (card != null) {
|
||||||
|
cardId = card.getId();
|
||||||
|
zoneChangeCounter = game.getState().getZoneChangeCounter(cardId);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (event.getType().equals(EventType.ZONE_CHANGE)) {
|
||||||
|
Player controller = game.getPlayer(source.getControllerId());
|
||||||
|
Card card = game.getCard(event.getTargetId());
|
||||||
|
if (controller != null && card != null) {
|
||||||
|
cardId = null;
|
||||||
|
zoneChangeCounter = 0;
|
||||||
|
if (controller.chooseUse(outcome, "Put " + card.getIdName() + " on top of your library instead?", source, game)) {
|
||||||
|
Cards cardsToLibrary = new CardsImpl(card);
|
||||||
|
controller.putCardsOnTopOfLibrary(cardsToLibrary, game, source, false);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -50,7 +50,6 @@ import mage.filter.predicate.permanent.AnotherPredicate;
|
||||||
import mage.filter.predicate.permanent.ControllerPredicate;
|
import mage.filter.predicate.permanent.ControllerPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.Permanent;
|
import mage.game.permanent.Permanent;
|
||||||
import mage.players.Player;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author nantuko
|
* @author nantuko
|
||||||
|
@ -87,8 +86,8 @@ public class AdaptiveAutomaton extends CardImpl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class AdaptiveAutomatonAddSubtypeEffect extends ContinuousEffectImpl {
|
class AdaptiveAutomatonAddSubtypeEffect extends ContinuousEffectImpl {
|
||||||
|
|
||||||
public AdaptiveAutomatonAddSubtypeEffect() {
|
public AdaptiveAutomatonAddSubtypeEffect() {
|
||||||
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
super(Duration.WhileOnBattlefield, Layer.TypeChangingEffects_4, SubLayer.NA, Outcome.Benefit);
|
||||||
staticText = "{this} is the chosen type in addition to its other types";
|
staticText = "{this} is the chosen type in addition to its other types";
|
||||||
|
|
54
Mage.Sets/src/mage/sets/masterseditioniv/LibraryOfLeng.java
Normal file
54
Mage.Sets/src/mage/sets/masterseditioniv/LibraryOfLeng.java
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* 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.masterseditioniv;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class LibraryOfLeng extends mage.sets.limitedbeta.LibraryOfLeng {
|
||||||
|
|
||||||
|
public LibraryOfLeng(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 211;
|
||||||
|
this.expansionSetCode = "ME4";
|
||||||
|
this.rarity = Rarity.COMMON;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryOfLeng(final LibraryOfLeng card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LibraryOfLeng copy() {
|
||||||
|
return new LibraryOfLeng(this);
|
||||||
|
}
|
||||||
|
}
|
99
Mage.Sets/src/mage/sets/planarchaos/DismalFailure.java
Normal file
99
Mage.Sets/src/mage/sets/planarchaos/DismalFailure.java
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* 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.planarchaos;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
import mage.abilities.Ability;
|
||||||
|
import mage.abilities.effects.OneShotEffect;
|
||||||
|
import mage.cards.CardImpl;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.constants.Outcome;
|
||||||
|
import mage.constants.Rarity;
|
||||||
|
import mage.game.Game;
|
||||||
|
import mage.players.Player;
|
||||||
|
import mage.target.TargetSpell;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class DismalFailure extends CardImpl {
|
||||||
|
|
||||||
|
public DismalFailure(UUID ownerId) {
|
||||||
|
super(ownerId, 39, "Dismal Failure", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{2}{U}{U}");
|
||||||
|
this.expansionSetCode = "PLC";
|
||||||
|
|
||||||
|
// Counter target spell. Its controller discards a card.
|
||||||
|
this.getSpellAbility().addEffect(new DismalFailureEffect());
|
||||||
|
this.getSpellAbility().addTarget(new TargetSpell());
|
||||||
|
}
|
||||||
|
|
||||||
|
public DismalFailure(final DismalFailure card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DismalFailure copy() {
|
||||||
|
return new DismalFailure(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DismalFailureEffect extends OneShotEffect {
|
||||||
|
|
||||||
|
public DismalFailureEffect() {
|
||||||
|
super(Outcome.Neutral);
|
||||||
|
this.staticText = "Counter target spell. Its controller discards a card";
|
||||||
|
}
|
||||||
|
|
||||||
|
public DismalFailureEffect(final DismalFailureEffect effect) {
|
||||||
|
super(effect);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DismalFailureEffect copy() {
|
||||||
|
return new DismalFailureEffect(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(Game game, Ability source) {
|
||||||
|
UUID targetId = source.getFirstTarget();
|
||||||
|
Player controller = null;
|
||||||
|
boolean countered = false;
|
||||||
|
if (targetId != null) {
|
||||||
|
controller = game.getPlayer(game.getControllerId(targetId));
|
||||||
|
}
|
||||||
|
if (targetId != null
|
||||||
|
&& game.getStack().counter(targetId, source.getSourceId(), game)) {
|
||||||
|
countered = true;
|
||||||
|
}
|
||||||
|
if (controller != null) {
|
||||||
|
controller.discard(1, false, source, game);
|
||||||
|
}
|
||||||
|
return countered;
|
||||||
|
}
|
||||||
|
}
|
52
Mage.Sets/src/mage/sets/revisededition/LibraryOfLeng.java
Normal file
52
Mage.Sets/src/mage/sets/revisededition/LibraryOfLeng.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* 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.revisededition;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class LibraryOfLeng extends mage.sets.limitedbeta.LibraryOfLeng {
|
||||||
|
|
||||||
|
public LibraryOfLeng(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 261;
|
||||||
|
this.expansionSetCode = "3ED";
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryOfLeng(final LibraryOfLeng card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LibraryOfLeng copy() {
|
||||||
|
return new LibraryOfLeng(this);
|
||||||
|
}
|
||||||
|
}
|
52
Mage.Sets/src/mage/sets/unlimitededition/LibraryOfLeng.java
Normal file
52
Mage.Sets/src/mage/sets/unlimitededition/LibraryOfLeng.java
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* 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.unlimitededition;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author LevelX2
|
||||||
|
*/
|
||||||
|
public class LibraryOfLeng extends mage.sets.limitedbeta.LibraryOfLeng {
|
||||||
|
|
||||||
|
public LibraryOfLeng(UUID ownerId) {
|
||||||
|
super(ownerId);
|
||||||
|
this.cardNumber = 258;
|
||||||
|
this.expansionSetCode = "2ED";
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryOfLeng(final LibraryOfLeng card) {
|
||||||
|
super(card);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LibraryOfLeng copy() {
|
||||||
|
return new LibraryOfLeng(this);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,19 @@
|
||||||
package org.mage.test.serverside.base;
|
package org.mage.test.serverside.base;
|
||||||
|
|
||||||
import mage.constants.PhaseStep;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.FilenameFilter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Scanner;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import mage.cards.Card;
|
import mage.cards.Card;
|
||||||
import mage.cards.repository.CardInfo;
|
import mage.cards.repository.CardInfo;
|
||||||
import mage.cards.repository.CardRepository;
|
import mage.cards.repository.CardRepository;
|
||||||
|
import mage.constants.PhaseStep;
|
||||||
import mage.constants.RangeOfInfluence;
|
import mage.constants.RangeOfInfluence;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
|
@ -25,19 +35,13 @@ import org.junit.BeforeClass;
|
||||||
import org.mage.test.player.RandomPlayer;
|
import org.mage.test.player.RandomPlayer;
|
||||||
import org.mage.test.player.TestPlayer;
|
import org.mage.test.player.TestPlayer;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FilenameFilter;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all tests.
|
* Base class for all tests.
|
||||||
*
|
*
|
||||||
* @author ayratn
|
* @author ayratn
|
||||||
*/
|
*/
|
||||||
public abstract class MageTestBase {
|
public abstract class MageTestBase {
|
||||||
|
|
||||||
protected static Logger logger = Logger.getLogger(MageTestBase.class);
|
protected static Logger logger = Logger.getLogger(MageTestBase.class);
|
||||||
|
|
||||||
public static PluginClassLoader classLoader = new PluginClassLoader();
|
public static PluginClassLoader classLoader = new PluginClassLoader();
|
||||||
|
@ -46,17 +50,17 @@ public abstract class MageTestBase {
|
||||||
|
|
||||||
protected Pattern pattern = Pattern.compile("([a-zA-Z]*):([\\w]*):([a-zA-Z ,\\-.!'\\d]*):([\\d]*)(:\\{tapped\\})?");
|
protected Pattern pattern = Pattern.compile("([a-zA-Z]*):([\\w]*):([a-zA-Z ,\\-.!'\\d]*):([\\d]*)(:\\{tapped\\})?");
|
||||||
|
|
||||||
protected List<Card> handCardsA = new ArrayList<Card>();
|
protected List<Card> handCardsA = new ArrayList<>();
|
||||||
protected List<Card> handCardsB = new ArrayList<Card>();
|
protected List<Card> handCardsB = new ArrayList<>();
|
||||||
protected List<PermanentCard> battlefieldCardsA = new ArrayList<PermanentCard>();
|
protected List<PermanentCard> battlefieldCardsA = new ArrayList<>();
|
||||||
protected List<PermanentCard> battlefieldCardsB = new ArrayList<PermanentCard>();
|
protected List<PermanentCard> battlefieldCardsB = new ArrayList<>();
|
||||||
protected List<Card> graveyardCardsA = new ArrayList<Card>();
|
protected List<Card> graveyardCardsA = new ArrayList<>();
|
||||||
protected List<Card> graveyardCardsB = new ArrayList<Card>();
|
protected List<Card> graveyardCardsB = new ArrayList<>();
|
||||||
protected List<Card> libraryCardsA = new ArrayList<Card>();
|
protected List<Card> libraryCardsA = new ArrayList<>();
|
||||||
protected List<Card> libraryCardsB = new ArrayList<Card>();
|
protected List<Card> libraryCardsB = new ArrayList<>();
|
||||||
|
|
||||||
protected Map<Zone, String> commandsA = new HashMap<Zone, String>();
|
protected Map<Zone, String> commandsA = new HashMap<>();
|
||||||
protected Map<Zone, String> commandsB = new HashMap<Zone, String>();
|
protected Map<Zone, String> commandsB = new HashMap<>();
|
||||||
|
|
||||||
protected TestPlayer playerA;
|
protected TestPlayer playerA;
|
||||||
protected TestPlayer playerB;
|
protected TestPlayer playerB;
|
||||||
|
@ -67,8 +71,7 @@ public abstract class MageTestBase {
|
||||||
protected static Game currentGame = null;
|
protected static Game currentGame = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Player thats starts the game first.
|
* Player thats starts the game first. By default, it is ComputerA.
|
||||||
* By default, it is ComputerA.
|
|
||||||
*/
|
*/
|
||||||
protected static Player activePlayer = null;
|
protected static Player activePlayer = null;
|
||||||
|
|
||||||
|
@ -77,6 +80,7 @@ public abstract class MageTestBase {
|
||||||
protected PhaseStep stopAtStep = PhaseStep.UNTAP;
|
protected PhaseStep stopAtStep = PhaseStep.UNTAP;
|
||||||
|
|
||||||
protected enum ParserState {
|
protected enum ParserState {
|
||||||
|
|
||||||
INIT,
|
INIT,
|
||||||
OPTIONS,
|
OPTIONS,
|
||||||
EXPECTED
|
EXPECTED
|
||||||
|
@ -85,18 +89,13 @@ public abstract class MageTestBase {
|
||||||
protected ParserState parserState;
|
protected ParserState parserState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Expected results of the test.
|
* Expected results of the test. Read from test case in {@link String} based
|
||||||
* Read from test case in {@link String} based format:
|
* format:
|
||||||
* <p/>
|
* <p/>
|
||||||
* Example:
|
* Example: turn:1 result:won:ComputerA life:ComputerA:20 life:ComputerB:0
|
||||||
* turn:1
|
* battlefield:ComputerB:Tine Shrike:0 graveyard:ComputerB:Tine Shrike:1
|
||||||
* result:won:ComputerA
|
|
||||||
* life:ComputerA:20
|
|
||||||
* life:ComputerB:0
|
|
||||||
* battlefield:ComputerB:Tine Shrike:0
|
|
||||||
* graveyard:ComputerB:Tine Shrike:1
|
|
||||||
*/
|
*/
|
||||||
protected List<String> expectedResults = new ArrayList<String>();
|
protected List<String> expectedResults = new ArrayList<>();
|
||||||
|
|
||||||
protected static final String TESTS_PATH = "tests" + File.separator;
|
protected static final String TESTS_PATH = "tests" + File.separator;
|
||||||
|
|
||||||
|
@ -163,8 +162,9 @@ public abstract class MageTestBase {
|
||||||
|
|
||||||
private static void deleteSavedGames() {
|
private static void deleteSavedGames() {
|
||||||
File directory = new File("saved/");
|
File directory = new File("saved/");
|
||||||
if (!directory.exists())
|
if (!directory.exists()) {
|
||||||
directory.mkdirs();
|
directory.mkdirs();
|
||||||
|
}
|
||||||
File[] files = directory.listFiles(
|
File[] files = directory.listFiles(
|
||||||
new FilenameFilter() {
|
new FilenameFilter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -185,7 +185,9 @@ public abstract class MageTestBase {
|
||||||
try {
|
try {
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
String line = scanner.nextLine().trim();
|
String line = scanner.nextLine().trim();
|
||||||
if (line == null || line.isEmpty() || line.startsWith("#")) continue;
|
if (line == null || line.isEmpty() || line.startsWith("#")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (line.startsWith("$include")) {
|
if (line.startsWith("$include")) {
|
||||||
includeFrom(line);
|
includeFrom(line);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -91,6 +91,7 @@ public class GameEvent implements Serializable {
|
||||||
DRAW_CARD, DREW_CARD,
|
DRAW_CARD, DREW_CARD,
|
||||||
MIRACLE_CARD_REVEALED,
|
MIRACLE_CARD_REVEALED,
|
||||||
MADNESS_CARD_EXILED,
|
MADNESS_CARD_EXILED,
|
||||||
|
DISCARD_CARD,
|
||||||
DISCARDED_CARD,
|
DISCARDED_CARD,
|
||||||
CYCLE_CARD, CYCLED_CARD,
|
CYCLE_CARD, CYCLED_CARD,
|
||||||
CLASH, CLASHED,
|
CLASH, CLASHED,
|
||||||
|
|
|
@ -92,6 +92,14 @@ import mage.constants.ManaType;
|
||||||
import mage.constants.Outcome;
|
import mage.constants.Outcome;
|
||||||
import mage.constants.PhaseStep;
|
import mage.constants.PhaseStep;
|
||||||
import mage.constants.PlayerAction;
|
import mage.constants.PlayerAction;
|
||||||
|
import static mage.constants.PlayerAction.PASS_PRIORITY_CANCEL_ALL_ACTIONS;
|
||||||
|
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_MY_NEXT_TURN;
|
||||||
|
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_NEXT_MAIN_PHASE;
|
||||||
|
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_NEXT_TURN;
|
||||||
|
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_STACK_RESOLVED;
|
||||||
|
import static mage.constants.PlayerAction.PASS_PRIORITY_UNTIL_TURN_END_STEP;
|
||||||
|
import static mage.constants.PlayerAction.PERMISSION_REQUESTS_ALLOWED_OFF;
|
||||||
|
import static mage.constants.PlayerAction.PERMISSION_REQUESTS_ALLOWED_ON;
|
||||||
import mage.constants.RangeOfInfluence;
|
import mage.constants.RangeOfInfluence;
|
||||||
import mage.constants.SpellAbilityType;
|
import mage.constants.SpellAbilityType;
|
||||||
import mage.constants.TimingRule;
|
import mage.constants.TimingRule;
|
||||||
|
@ -760,7 +768,8 @@ public abstract class PlayerImpl implements Player, Serializable {
|
||||||
about the discarded card, that cost payment is illegal; the game returns to
|
about the discarded card, that cost payment is illegal; the game returns to
|
||||||
the moment before the cost was paid (see rule 717, "Handling Illegal Actions").
|
the moment before the cost was paid (see rule 717, "Handling Illegal Actions").
|
||||||
*/
|
*/
|
||||||
if (card != null) {
|
if (card != null
|
||||||
|
&& !game.replaceEvent(GameEvent.getEvent(GameEvent.EventType.DISCARD_CARD, card.getId(), source == null ? null : source.getSourceId(), playerId), source)) {
|
||||||
// write info to game log first so game log infos from triggered or replacement effects follow in the game log
|
// write info to game log first so game log infos from triggered or replacement effects follow in the game log
|
||||||
if (!game.isSimulation()) {
|
if (!game.isSimulation()) {
|
||||||
game.informPlayers(getLogName() + " discards " + card.getLogName());
|
game.informPlayers(getLogName() + " discards " + card.getLogName());
|
||||||
|
|
Loading…
Reference in a new issue