mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 13:02:06 -08:00
[KLD] Added 15 black cards.
This commit is contained in:
parent
c8937f8ab4
commit
c515a6d690
30 changed files with 1851 additions and 302 deletions
|
|
@ -25,7 +25,6 @@
|
|||
* authors and should not be interpreted as representing official policies, either expressed
|
||||
* or implied, of BetaSteward_at_googlemail.com.
|
||||
*/
|
||||
|
||||
package mage.abilities.costs.common;
|
||||
|
||||
import mage.abilities.Ability;
|
||||
|
|
@ -39,17 +38,17 @@ import mage.target.common.TargetControlledPermanent;
|
|||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class SacrificeXTargetCost extends VariableCostImpl {
|
||||
public class SacrificeXTargetCost extends VariableCostImpl {
|
||||
|
||||
protected FilterControlledPermanent filter;
|
||||
|
||||
|
||||
public SacrificeXTargetCost(FilterControlledPermanent filter) {
|
||||
this(filter, false);
|
||||
}
|
||||
|
||||
public SacrificeXTargetCost(FilterControlledPermanent filter, boolean additionalCostText) {
|
||||
super(new StringBuilder(filter.getMessage()).append(" to sacrifice").toString());
|
||||
this.text = new StringBuilder(additionalCostText ? "As an additional cost to cast {source}, sacrifice ":"Sacrifice ").append(xText).append(" ").append(filter.getMessage()).toString();
|
||||
super(filter.getMessage() + " to sacrifice");
|
||||
this.text = (additionalCostText ? "As an additional cost to cast {source}, sacrifice " : "Sacrifice ") + xText + " " + filter.getMessage();
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,4 +43,8 @@ public class StaticValue implements DynamicValue {
|
|||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ public class NameACardEffect extends OneShotEffect {
|
|||
public enum TypeOfName {
|
||||
|
||||
ALL,
|
||||
NON_ARTFIACT_AND_NON_LAND_NAME,
|
||||
NON_LAND_NAME,
|
||||
NON_LAND_AND_NON_CREATURE_NAME,
|
||||
CREATURE_NAME
|
||||
|
|
@ -82,6 +83,10 @@ public class NameACardEffect extends OneShotEffect {
|
|||
cardChoice.setChoices(CardRepository.instance.getNames());
|
||||
cardChoice.setMessage("Name a card");
|
||||
break;
|
||||
case NON_ARTFIACT_AND_NON_LAND_NAME:
|
||||
cardChoice.setChoices(CardRepository.instance.getNonArtifactAndNonLandNames());
|
||||
cardChoice.setMessage("Name a non artifact and non land card");
|
||||
break;
|
||||
case NON_LAND_AND_NON_CREATURE_NAME:
|
||||
cardChoice.setChoices(CardRepository.instance.getNonLandAndNonCreatureNames());
|
||||
cardChoice.setMessage("Name a non land and non creature card");
|
||||
|
|
@ -125,6 +130,9 @@ public class NameACardEffect extends OneShotEffect {
|
|||
case ALL:
|
||||
sb.append("card");
|
||||
break;
|
||||
case NON_ARTFIACT_AND_NON_LAND_NAME:
|
||||
sb.append("nonartifact, nonland card");
|
||||
break;
|
||||
case NON_LAND_AND_NON_CREATURE_NAME:
|
||||
sb.append("card other than a creature or a land card");
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -30,19 +30,18 @@ package mage.abilities.effects.common;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.Mode;
|
||||
import mage.abilities.effects.OneShotEffect;
|
||||
import mage.cards.Card;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.constants.Outcome;
|
||||
import mage.constants.Zone;
|
||||
import mage.game.Game;
|
||||
import mage.game.permanent.Permanent;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.cards.Cards;
|
||||
import mage.cards.CardsImpl;
|
||||
import mage.target.Target;
|
||||
import mage.util.CardUtil;
|
||||
|
||||
|
|
@ -149,16 +148,14 @@ public class PutOnLibraryTargetEffect extends OneShotEffect {
|
|||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
Target target = mode.getTargets().get(0);
|
||||
sb.append("Put ");
|
||||
sb.append("put ");
|
||||
if (target.getMaxNumberOfTargets() == 0) {
|
||||
sb.append("any number of ");
|
||||
} else {
|
||||
if (target.getMaxNumberOfTargets() != 1 || target.getNumberOfTargets() != 1) {
|
||||
if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
} else if (target.getMaxNumberOfTargets() != 1 || target.getNumberOfTargets() != 1) {
|
||||
if (target.getMaxNumberOfTargets() > target.getNumberOfTargets()) {
|
||||
sb.append("up to ");
|
||||
}
|
||||
sb.append(CardUtil.numberToText(target.getMaxNumberOfTargets())).append(" ");
|
||||
}
|
||||
sb.append("target ").append(mode.getTargets().get(0).getTargetName()).append(" on ");
|
||||
sb.append(onTop ? "top" : "the bottom").append(" of its owner's library");
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@ package mage.abilities.effects.common.continuous;
|
|||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.dynamicvalue.DynamicValue;
|
||||
import mage.abilities.dynamicvalue.common.StaticValue;
|
||||
import mage.abilities.effects.ContinuousEffectImpl;
|
||||
import mage.constants.Duration;
|
||||
import mage.constants.Layer;
|
||||
|
|
@ -48,7 +50,7 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
|
|||
SET, INCREASE, REDUCE
|
||||
};
|
||||
|
||||
protected int handSize;
|
||||
protected DynamicValue handSize;
|
||||
protected HandSizeModification handSizeModification;
|
||||
protected TargetController targetController;
|
||||
|
||||
|
|
@ -63,6 +65,10 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
|
|||
}
|
||||
|
||||
public MaximumHandSizeControllerEffect(int handSize, Duration duration, HandSizeModification handSizeModification, TargetController targetController) {
|
||||
this(new StaticValue(handSize), duration, handSizeModification, targetController);
|
||||
}
|
||||
|
||||
public MaximumHandSizeControllerEffect(DynamicValue handSize, Duration duration, HandSizeModification handSizeModification, TargetController targetController) {
|
||||
super(duration, Layer.PlayerEffects, SubLayer.NA, defineOutcome(handSizeModification, targetController));
|
||||
this.handSize = handSize;
|
||||
this.handSizeModification = handSizeModification;
|
||||
|
|
@ -98,16 +104,16 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
|
|||
switch (targetController) {
|
||||
case ANY:
|
||||
for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {
|
||||
setHandSize(game, playerId);
|
||||
setHandSize(game, source, playerId);
|
||||
}
|
||||
break;
|
||||
case OPPONENT:
|
||||
for (UUID playerId : game.getOpponents(source.getControllerId())) {
|
||||
setHandSize(game, playerId);
|
||||
setHandSize(game, source, playerId);
|
||||
}
|
||||
break;
|
||||
case YOU:
|
||||
setHandSize(game, source.getControllerId());
|
||||
setHandSize(game, source, source.getControllerId());
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("Not supported yet.");
|
||||
|
|
@ -117,18 +123,18 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
|
|||
return false;
|
||||
}
|
||||
|
||||
private void setHandSize(Game game, UUID playerId) {
|
||||
private void setHandSize(Game game, Ability source, UUID playerId) {
|
||||
Player player = game.getPlayer(playerId);
|
||||
if (player != null) {
|
||||
switch (handSizeModification) {
|
||||
case SET:
|
||||
player.setMaxHandSize(handSize);
|
||||
player.setMaxHandSize(handSize.calculate(game, source, this));
|
||||
break;
|
||||
case INCREASE:
|
||||
player.setMaxHandSize(player.getMaxHandSize() + handSize);
|
||||
player.setMaxHandSize(player.getMaxHandSize() + handSize.calculate(game, source, this));
|
||||
break;
|
||||
case REDUCE:
|
||||
player.setMaxHandSize(player.getMaxHandSize() - handSize);
|
||||
player.setMaxHandSize(player.getMaxHandSize() - handSize.calculate(game, source, this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -138,21 +144,21 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
|
|||
StringBuilder sb = new StringBuilder();
|
||||
switch (targetController) {
|
||||
case ANY:
|
||||
if (handSize == Integer.MAX_VALUE) {
|
||||
if (handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) {
|
||||
sb.append("All players have no ");
|
||||
} else {
|
||||
sb.append("All players ");
|
||||
}
|
||||
break;
|
||||
case OPPONENT:
|
||||
if (handSize == Integer.MAX_VALUE) {
|
||||
if (handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) {
|
||||
sb.append("Each opponent has no ");
|
||||
} else {
|
||||
sb.append("Each opponent's ");
|
||||
}
|
||||
break;
|
||||
case YOU:
|
||||
if (handSize == Integer.MAX_VALUE) {
|
||||
if (handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) {
|
||||
sb.append("You have no ");
|
||||
} else {
|
||||
sb.append("Your ");
|
||||
|
|
@ -164,11 +170,11 @@ public class MaximumHandSizeControllerEffect extends ContinuousEffectImpl {
|
|||
sb.append(" is increased by ");
|
||||
} else if (handSizeModification.equals(HandSizeModification.REDUCE)) {
|
||||
sb.append(" is reduced by ");
|
||||
} else if (handSize != Integer.MAX_VALUE) {
|
||||
} else if ((handSize instanceof StaticValue && ((StaticValue) handSize).getValue() == Integer.MAX_VALUE) || !(handSize instanceof StaticValue)) {
|
||||
sb.append(" is ");
|
||||
}
|
||||
if (handSize != Integer.MAX_VALUE) {
|
||||
sb.append(CardUtil.numberToText(handSize));
|
||||
if ((handSize instanceof StaticValue && ((StaticValue) handSize).getValue() != Integer.MAX_VALUE) || !(handSize instanceof StaticValue)) {
|
||||
sb.append(CardUtil.numberToText(((StaticValue) handSize).getValue()));
|
||||
}
|
||||
if (duration == Duration.EndOfGame) {
|
||||
sb.append(" for the rest of the game");
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ import java.sql.SQLException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.Callable;
|
||||
|
|
@ -214,6 +213,28 @@ public enum CardRepository {
|
|||
return names;
|
||||
}
|
||||
|
||||
public Set<String> getNonArtifactAndNonLandNames() {
|
||||
Set<String> names = new TreeSet<>();
|
||||
try {
|
||||
QueryBuilder<CardInfo, Object> qb = cardDao.queryBuilder();
|
||||
qb.distinct().selectColumns("name");
|
||||
Where where = qb.where();
|
||||
where.and(where.not().like("types", '%' + CardType.ARTIFACT.name() + '%'), where.not().like("types", '%' + CardType.LAND.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> getCreatureTypes() {
|
||||
TreeSet<String> subtypes = new TreeSet<>();
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ public enum CounterType {
|
|||
HATCHLING("hatchling"),
|
||||
HEALING("healing"),
|
||||
HOOFPRINT("hoofprint"),
|
||||
HOUR("hour"),
|
||||
ICE("ice"),
|
||||
INTERVENTION("intervention"),
|
||||
JAVELIN("javelin"),
|
||||
|
|
|
|||
40
Mage/src/main/java/mage/filter/StaticFilters.java
Normal file
40
Mage/src/main/java/mage/filter/StaticFilters.java
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package mage.filter;
|
||||
|
||||
import mage.constants.CardType;
|
||||
import mage.filter.common.FilterControlledArtifactPermanent;
|
||||
import mage.filter.common.FilterControlledPermanent;
|
||||
import mage.filter.predicate.Predicates;
|
||||
import mage.filter.predicate.mageobject.CardTypePredicate;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author LevelX2
|
||||
*/
|
||||
public class StaticFilters {
|
||||
|
||||
public static final FilterPermanent FILTER_PERMANENT_ARTIFACT_OR_CREATURE = new FilterPermanent("artifact or creature");
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE = new FilterControlledPermanent("artifact or creature you control");
|
||||
public static final FilterControlledPermanent FILTER_CONTROLLED_PERMANENT_ARTIFACT = new FilterControlledArtifactPermanent();
|
||||
public static final FilterCard FILTER_CARD_ARTIFACT_OR_CREATURE = new FilterCard("artifact or creature card");
|
||||
|
||||
static {
|
||||
FILTER_PERMANENT_ARTIFACT_OR_CREATURE.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new CardTypePredicate(CardType.CREATURE)
|
||||
));
|
||||
FILTER_CONTROLLED_PERMANENT_ARTIFACT_OR_CREATURE.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new CardTypePredicate(CardType.CREATURE)
|
||||
));
|
||||
FILTER_CARD_ARTIFACT_OR_CREATURE.add(Predicates.or(
|
||||
new CardTypePredicate(CardType.ARTIFACT),
|
||||
new CardTypePredicate(CardType.CREATURE)
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue