[AKH] Implemented some of the 4/13 spoiled cards.

This commit is contained in:
fireshoes 2017-04-13 23:28:21 -05:00
parent 15ea3626ae
commit 7dea71df59
22 changed files with 1389 additions and 27 deletions

View file

@ -50,10 +50,11 @@ public class NameACardEffect extends OneShotEffect {
public enum TypeOfName {
ALL,
NON_ARTFIACT_AND_NON_LAND_NAME,
NON_ARTIFACT_AND_NON_LAND_NAME,
NON_LAND_NAME,
NON_LAND_AND_NON_CREATURE_NAME,
CREATURE_NAME
CREATURE_NAME,
ARTIFACT_NAME
}
private final TypeOfName typeOfName;
@ -83,7 +84,7 @@ public class NameACardEffect extends OneShotEffect {
cardChoice.setChoices(CardRepository.instance.getNames());
cardChoice.setMessage("Name a card");
break;
case NON_ARTFIACT_AND_NON_LAND_NAME:
case NON_ARTIFACT_AND_NON_LAND_NAME:
cardChoice.setChoices(CardRepository.instance.getNonArtifactAndNonLandNames());
cardChoice.setMessage("Name a non artifact and non land card");
break;
@ -99,6 +100,10 @@ public class NameACardEffect extends OneShotEffect {
cardChoice.setChoices(CardRepository.instance.getCreatureNames());
cardChoice.setMessage("Name a creature card");
break;
case ARTIFACT_NAME:
cardChoice.setChoices(CardRepository.instance.getArtifactNames());
cardChoice.setMessage("Name an artifact card");
break;
}
cardChoice.clearChoice();
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
@ -130,7 +135,7 @@ public class NameACardEffect extends OneShotEffect {
case ALL:
sb.append("card");
break;
case NON_ARTFIACT_AND_NON_LAND_NAME:
case NON_ARTIFACT_AND_NON_LAND_NAME:
sb.append("nonartifact, nonland card");
break;
case NON_LAND_AND_NON_CREATURE_NAME:
@ -139,6 +144,12 @@ public class NameACardEffect extends OneShotEffect {
case NON_LAND_NAME:
sb.append("nonland card");
break;
case CREATURE_NAME:
sb.append("creature card");
break;
case ARTIFACT_NAME:
sb.append("artifact card");
break;
}
return sb.toString();
}

View file

@ -41,7 +41,6 @@ import com.j256.ormlite.table.TableUtils;
import java.io.File;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.Callable;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
@ -206,6 +205,29 @@ public enum CardRepository {
return names;
}
public Set<String> getArtifactNames() {
Set<String> names = new TreeSet<>();
try {
QueryBuilder<CardInfo, Object> qb = cardDao.queryBuilder();
qb.distinct().selectColumns("name");
qb.where().like("types", new SelectArg('%' + CardType.ARTIFACT.name() + '%'));
List<CardInfo> results = cardDao.query(qb.prepare());
for (CardInfo card : results) {
int result = card.getName().indexOf(" // ");
if (result > 0) {
names.add(card.getName().substring(0, result));
names.add(card.getName().substring(result + 4));
} else {
names.add(card.getName());
}
}
} catch (SQLException ex) {
Logger.getLogger(CardRepository.class).error("Error getting artifact names from DB : " + ex);
}
return names;
}
public Set<String> getNonLandAndNonCreatureNames() {
Set<String> names = new TreeSet<>();
try {

View file

@ -0,0 +1,57 @@
/*
* 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.game.permanent.token;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import mage.constants.CardType;
import mage.MageInt;
/**
*
* @author fireshoes
*/
public class WurmToken3 extends Token {
final static private List<String> tokenImageSets = new ArrayList<>();
static {
tokenImageSets.addAll(Arrays.asList("AKH"));
}
public WurmToken3() {
super("Wurm", "5/5 green Wurm creature token");
cardType.add(CardType.CREATURE);
color.setGreen(true);
subtype.add("Wurm");
power = new MageInt(5);
toughness = new MageInt(5);
}
}