mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Cleaning up unused functions
This commit is contained in:
@@ -132,7 +132,7 @@ public class ComputerAI_General implements Computer {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
all.addAll(AllZone.Computer_Battlefield.getCards());
|
all.addAll(AllZone.Computer_Battlefield.getCards());
|
||||||
all.addAll(CardFactoryUtil.getFlashbackCards(AllZone.ComputerPlayer).toArray());
|
all.addAll(CardFactoryUtil.getGraveyardActivationCards(AllZone.ComputerPlayer).toArray());
|
||||||
|
|
||||||
// Prevent the computer from summoning Ball Lightning type creatures during main phase 2
|
// Prevent the computer from summoning Ball Lightning type creatures during main phase 2
|
||||||
all = all.getNotKeyword("At the beginning of the end step, sacrifice CARDNAME.");
|
all = all.getNotKeyword("At the beginning of the end step, sacrifice CARDNAME.");
|
||||||
@@ -171,7 +171,7 @@ public class ComputerAI_General implements Computer {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
all.addAll(AllZone.Computer_Battlefield.getCards());
|
all.addAll(AllZone.Computer_Battlefield.getCards());
|
||||||
all.addAll(CardFactoryUtil.getFlashbackCards(AllZone.ComputerPlayer).toArray());
|
all.addAll(CardFactoryUtil.getGraveyardActivationCards(AllZone.ComputerPlayer).toArray());
|
||||||
|
|
||||||
|
|
||||||
CardList humanPlayable = new CardList();
|
CardList humanPlayable = new CardList();
|
||||||
|
|||||||
@@ -2533,106 +2533,6 @@ public class CardFactoryUtil {
|
|||||||
return target;
|
return target;
|
||||||
}//input_targetPlayer()
|
}//input_targetPlayer()
|
||||||
|
|
||||||
public static Input input_targetPlayer(final SpellAbility spell, final Command command) {
|
|
||||||
Input target = new Input() {
|
|
||||||
private static final long serialVersionUID = 8736682807625129068L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showMessage() {
|
|
||||||
AllZone.Display.showMessage("Select target player");
|
|
||||||
ButtonUtil.enableOnlyCancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectButtonCancel() {
|
|
||||||
stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectPlayer(Player player) {
|
|
||||||
spell.setTargetPlayer(player);
|
|
||||||
command.execute();
|
|
||||||
if(spell.getManaCost().equals("0") || this.isFree()) {
|
|
||||||
this.setFree(false);
|
|
||||||
AllZone.Stack.add(spell, spell.getSourceCard().getManaCost().contains("X"));
|
|
||||||
stop();
|
|
||||||
} else stopSetNext(new Input_PayManaCost(spell));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
return target;
|
|
||||||
}//input_targetPlayer()
|
|
||||||
|
|
||||||
|
|
||||||
public static Input spReturnTgt_input_targetCards_InGraveyard(
|
|
||||||
final Card card, final SpellAbility spell, final boolean UpTo,
|
|
||||||
final int numCards, final String Tgts[], final boolean anyNumber) {
|
|
||||||
|
|
||||||
Input target = new Input() {
|
|
||||||
private static final long serialVersionUID = 816838038180106359L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void showMessage() {
|
|
||||||
|
|
||||||
CardList grave = getGraveyardList();
|
|
||||||
CardList targets = new CardList();
|
|
||||||
|
|
||||||
if (UpTo) {
|
|
||||||
for (int i = 0; i < numCards; i++) {
|
|
||||||
if (grave.size() > 0) {
|
|
||||||
Object o = GuiUtils.getChoiceOptional("Select a card", grave.toArray());
|
|
||||||
if (o == null) break;
|
|
||||||
Card c = (Card) o;
|
|
||||||
targets.add(c);
|
|
||||||
grave.remove(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (anyNumber) {
|
|
||||||
int max = grave.size();
|
|
||||||
for (int i = 0; i < max; i++) {
|
|
||||||
if (grave.size() > 0) {
|
|
||||||
Object o = GuiUtils.getChoiceOptional("Select a card", grave.toArray());
|
|
||||||
if (o == null) break;
|
|
||||||
Card c = (Card) o;
|
|
||||||
targets.add(c);
|
|
||||||
grave.remove(c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (grave.size() > numCards) {
|
|
||||||
for (int i = 0; i < numCards; i++) {
|
|
||||||
Object o = GuiUtils.getChoice("Select a card", grave.toArray());
|
|
||||||
Card c = (Card) o;
|
|
||||||
targets.add(c);
|
|
||||||
grave.remove(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (grave.size() == numCards) {
|
|
||||||
targets = grave;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (targets.size() > 0) {
|
|
||||||
spell.setTargetList(targets);
|
|
||||||
|
|
||||||
if (this.isFree()) {
|
|
||||||
|
|
||||||
this.setFree(false);
|
|
||||||
stop();
|
|
||||||
AllZone.Stack.add(spell);
|
|
||||||
}
|
|
||||||
else stopSetNext(new Input_PayManaCost(spell));
|
|
||||||
}
|
|
||||||
}// showMessage()
|
|
||||||
|
|
||||||
public CardList getGraveyardList() {
|
|
||||||
CardList list = new CardList();
|
|
||||||
PlayerZone zone = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
|
|
||||||
list.addAll(zone.getCards());
|
|
||||||
list = list.getValidCards(Tgts,card.getController(),card);
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
};// Input
|
|
||||||
return target;
|
|
||||||
}//spReturnTgt_input_targetCards_InGraveyard()
|
|
||||||
|
|
||||||
public static Input modularInput(final SpellAbility ability, final Card card){
|
public static Input modularInput(final SpellAbility ability, final Card card){
|
||||||
Input modularInput = new Input() {
|
Input modularInput = new Input() {
|
||||||
|
|
||||||
@@ -2748,22 +2648,6 @@ public class CardFactoryUtil {
|
|||||||
};
|
};
|
||||||
}//targetHuman()
|
}//targetHuman()
|
||||||
|
|
||||||
//is it the computer's main phase before attacking?
|
|
||||||
public static boolean AI_isMainPhase() {
|
|
||||||
return AllZone.Phase.is(Constant.Phase.Main1, AllZone.ComputerPlayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CommandArgs AI_targetComputer() {
|
|
||||||
return new CommandArgs() {
|
|
||||||
private static final long serialVersionUID = -445231553588926627L;
|
|
||||||
|
|
||||||
public void execute(Object o) {
|
|
||||||
SpellAbility sa = (SpellAbility) o;
|
|
||||||
sa.setTargetPlayer(AllZone.ComputerPlayer);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}//targetComputer()
|
|
||||||
|
|
||||||
//type can also be "All"
|
//type can also be "All"
|
||||||
public static CommandArgs AI_targetType(final String type, final PlayerZone zone) {
|
public static CommandArgs AI_targetType(final String type, final PlayerZone zone) {
|
||||||
return new CommandArgs() {
|
return new CommandArgs() {
|
||||||
@@ -2806,42 +2690,6 @@ public class CardFactoryUtil {
|
|||||||
return list.containsName(c.getName());
|
return list.containsName(c.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean controlsAnotherMulticoloredPermanent(Card c) {
|
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, c.getController());
|
|
||||||
|
|
||||||
final Card crd = c;
|
|
||||||
|
|
||||||
CardList list = new CardList(play.getCards());
|
|
||||||
list = list.filter(new CardListFilter() {
|
|
||||||
|
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return !c.equals(crd) && CardUtil.getColors(c).size() >= 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return list.size() >= 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean controlsAnotherColoredCreature(Card c, String color) {
|
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, c.getController());
|
|
||||||
|
|
||||||
final Card crd = c;
|
|
||||||
final String col = color;
|
|
||||||
CardList list = new CardList(play.getCards());
|
|
||||||
list = list.filter(new CardListFilter() {
|
|
||||||
|
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return !c.equals(crd) && c.isCreature() && CardUtil.getColors(c).contains(col);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return list.size() >= 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean oppHasKismet(Player player) {
|
public static boolean oppHasKismet(Player player) {
|
||||||
Player opp = player.getOpponent();
|
Player opp = player.getOpponent();
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, opp);
|
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, opp);
|
||||||
@@ -2873,45 +2721,6 @@ public class CardFactoryUtil {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String sumManaCost(String manacost1, String manacost2)
|
|
||||||
{
|
|
||||||
String tokenized1[] = manacost1.split("\\s");
|
|
||||||
String tokenized2[] = manacost2.split("\\s");
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
|
|
||||||
int totalNumberCost = 0;
|
|
||||||
if (Character.isDigit(tokenized1[0].charAt(0)) && Character.isDigit(tokenized2[0].charAt(0)))
|
|
||||||
{
|
|
||||||
int cost1 = Integer.parseInt(tokenized1[0]);
|
|
||||||
int cost2 = Integer.parseInt(tokenized2[0]);
|
|
||||||
totalNumberCost = cost1 + cost2;
|
|
||||||
}
|
|
||||||
else if (Character.isDigit(tokenized1[0].charAt(0)))
|
|
||||||
totalNumberCost = Integer.parseInt(tokenized1[0]);
|
|
||||||
else if (Character.isDigit(tokenized2[0].charAt(0)))
|
|
||||||
totalNumberCost = Integer.parseInt(tokenized2[0]);
|
|
||||||
|
|
||||||
if (totalNumberCost != 0) {
|
|
||||||
sb.append(totalNumberCost);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=1;i<tokenized1.length;i++)
|
|
||||||
{
|
|
||||||
sb.append(" ");
|
|
||||||
sb.append(tokenized1[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=1;i<tokenized2.length;i++)
|
|
||||||
{
|
|
||||||
sb.append(" ");
|
|
||||||
sb.append(tokenized2[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: resort mana symbol order?
|
|
||||||
return sb.toString().trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String multiplyManaCost(String manacost, int multiplier) {
|
public static String multiplyManaCost(String manacost, int multiplier) {
|
||||||
if(multiplier == 0) return "";
|
if(multiplier == 0) return "";
|
||||||
if(multiplier == 1) return manacost;
|
if(multiplier == 1) return manacost;
|
||||||
@@ -3096,57 +2905,11 @@ public class CardFactoryUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*no longer needed
|
|
||||||
public static boolean canDamage(Card spell, Card receiver) {
|
|
||||||
//this is for untargeted damage spells, such as Pestilence, Pyroclasm, Tremor, etc.
|
|
||||||
//and also combat damage?
|
|
||||||
|
|
||||||
if(hasProtectionFrom(spell,receiver)) return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static boolean isCounterable(Card c) {
|
public static boolean isCounterable(Card c) {
|
||||||
if(!c.getKeyword().contains("CARDNAME can't be countered.")) return true;
|
if(!c.getKeyword().contains("CARDNAME can't be countered.")) return true;
|
||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//returns the number of enchantments named "e" card c is enchanted by
|
|
||||||
public static int hasNumberEnchantments(Card c, String e) {
|
|
||||||
if(!c.isEnchanted()) return 0;
|
|
||||||
|
|
||||||
final String enchantmentName = e;
|
|
||||||
CardList list = new CardList(c.getEnchantedBy().toArray());
|
|
||||||
list = list.filter(new CardListFilter() {
|
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return c.getName().equals(enchantmentName);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return list.size();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//returns a CardList of all auras named e enchanting Card c
|
|
||||||
public static CardList getAurasEnchanting(Card c, String e) {
|
|
||||||
CardList list = new CardList();
|
|
||||||
if(!c.isEnchanted()) return list;
|
|
||||||
|
|
||||||
final String enchantmentName = e;
|
|
||||||
CardList cl = new CardList(c.getEnchantedBy().toArray());
|
|
||||||
cl = cl.filter(new CardListFilter() {
|
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return c.getName().equals(enchantmentName);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
return cl;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//returns the number of equipments named "e" card c is equipped by
|
//returns the number of equipments named "e" card c is equipped by
|
||||||
public static int hasNumberEquipments(Card c, String e) {
|
public static int hasNumberEquipments(Card c, String e) {
|
||||||
@@ -3165,23 +2928,6 @@ public class CardFactoryUtil {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public static CardList getValuableCreatures()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
public static CardList getFlashbackCards(Player player) {
|
|
||||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
|
||||||
CardList cl = new CardList(grave.getCards());
|
|
||||||
cl = cl.filter(new CardListFilter() {
|
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return c.hasFlashback();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return cl;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CardList getGraveyardActivationCards(final Player player) {
|
public static CardList getGraveyardActivationCards(final Player player) {
|
||||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
|
||||||
CardList cl = new CardList(grave.getCards());
|
CardList cl = new CardList(grave.getCards());
|
||||||
|
|||||||
Reference in New Issue
Block a user