[TPR] Added Wood Sage, Vhat-Il Dal and Soltari Guerillas.

This commit is contained in:
LevelX2 2015-04-02 08:35:54 +02:00
parent 34b1632f02
commit 2d274ec39a
15 changed files with 681 additions and 13 deletions

View file

@ -50,7 +50,8 @@ public class NameACardEffect extends OneShotEffect {
public enum TypeOfName {
ALL,
NON_LAND_NAME,
NON_LAND_AND_NON_CREATURE_NAME
NON_LAND_AND_NON_CREATURE_NAME,
CREATURE_NAME
}
private final TypeOfName typeOfName;
@ -85,6 +86,10 @@ public class NameACardEffect extends OneShotEffect {
cardChoice.setChoices(CardRepository.instance.getNonLandNames());
cardChoice.setMessage("Name a non land card");
break;
case CREATURE_NAME:
cardChoice.setChoices(CardRepository.instance.getCreatureNames());
cardChoice.setMessage("Name a creature card");
break;
}
cardChoice.clearChoice();
while (!controller.choose(Outcome.Detriment, cardChoice, game)) {
@ -93,8 +98,9 @@ public class NameACardEffect extends OneShotEffect {
}
}
String cardName = cardChoice.getChoice();
if (!game.isSimulation())
if (!game.isSimulation()) {
game.informPlayers(sourceObject.getLogName() + ", named card: [" + cardName + "]");
}
game.getState().setValue(source.getSourceId().toString() + INFO_KEY, cardName);
if (sourceObject instanceof Permanent) {
((Permanent)sourceObject).addInfo(INFO_KEY, CardUtil.addToolTipMarkTags("Named card: " + cardName), game);

View file

@ -77,8 +77,12 @@ public class SetPowerToughnessTargetEffect extends ContinuousEffectImpl {
for (UUID targetId: this.getTargetPointer().getTargets(game, source)) {
Permanent target = game.getPermanent(targetId);
if (target != null) {
target.getPower().setValue(power.calculate(game, source, this));
target.getToughness().setValue(toughness.calculate(game, source, this));
if (power != null) {
target.getPower().setValue(power.calculate(game, source, this));
}
if (toughness != null) {
target.getToughness().setValue(toughness.calculate(game, source, this));
}
result = true;
}
}

View file

@ -89,7 +89,7 @@ public class DynamicManaAbility extends ManaAbility {
public List<Mana> getNetMana(Game game) {
List<Mana> newNetMana = new ArrayList<>();
if (game != null) {
// TODO: effects from replacement effects like Mana Refelection are not considered yet
// TODO: effects from replacement effects like Mana Reflection are not considered yet
newNetMana.add(manaEffect.computeMana(true, game, this));
}
return newNetMana;

View file

@ -165,6 +165,27 @@ public enum CardRepository {
}
return names;
}
public Set<String> getCreatureNames() {
Set<String> names = new TreeSet<>();
try {
QueryBuilder<CardInfo, Object> qb = cardDao.queryBuilder();
qb.distinct().selectColumns("name");
qb.where().like("types", new SelectArg('%' + CardType.CREATURE.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) {
}
return names;
}
public Set<String> getNonLandAndNonCreatureNames() {
Set<String> names = new TreeSet<>();
@ -173,10 +194,6 @@ public enum CardRepository {
qb.distinct().selectColumns("name");
Where where = qb.where();
where.and(where.not().like("types", '%' + CardType.CREATURE.name() +'%'),where.not().like("types", '%' + CardType.LAND.name() + '%'));
// qb.where()
// .not().like("types", '%' + CardType.CREATURE.name() + '%')
// .and()
// .not().like("types", '%' + CardType.LAND.name() + '%');
List<CardInfo> results = cardDao.query(qb.prepare());
for (CardInfo card : results) {
int result = card.getName().indexOf(" // ");