mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
minor cleanups in CardFactory classes
This commit is contained in:
@@ -7548,7 +7548,6 @@ public class CardFactory implements NewConstants {
|
|||||||
}
|
}
|
||||||
};//SpellAbility
|
};//SpellAbility
|
||||||
|
|
||||||
//card.clearSpellKeepManaAbility();
|
|
||||||
card.addSpellAbility(a1);
|
card.addSpellAbility(a1);
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -7566,6 +7565,7 @@ public class CardFactory implements NewConstants {
|
|||||||
a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1));
|
a1.setBeforePayMana(new Input_PayManaCost_Ability(a1.getManaCost(), paid1));
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if (cardName.equals("An-Zerrin Ruins")) {
|
else if (cardName.equals("An-Zerrin Ruins")) {
|
||||||
|
|
||||||
@@ -7645,6 +7645,7 @@ public class CardFactory implements NewConstants {
|
|||||||
card.addSpellAbility(ability);
|
card.addSpellAbility(ability);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START ************ START **************************
|
//*************** START ************ START **************************
|
||||||
else if(cardName.equals("Black Mana Battery") || cardName.equals("Blue Mana Battery")
|
else if(cardName.equals("Black Mana Battery") || cardName.equals("Blue Mana Battery")
|
||||||
|| cardName.equals("Green Mana Battery") || cardName.equals("Red Mana Battery")
|
|| cardName.equals("Green Mana Battery") || cardName.equals("Red Mana Battery")
|
||||||
@@ -8166,6 +8167,8 @@ public class CardFactory implements NewConstants {
|
|||||||
else JOptionPane.showMessageDialog(null, "Error in "+cardName+". freeCard is null", "", JOptionPane.INFORMATION_MESSAGE);
|
else JOptionPane.showMessageDialog(null, "Error in "+cardName+". freeCard is null", "", JOptionPane.INFORMATION_MESSAGE);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -926,6 +926,7 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Lava Hounds")) {
|
else if(cardName.equals("Lava Hounds")) {
|
||||||
final SpellAbility ability = new Ability(card, "0") {
|
final SpellAbility ability = new Ability(card, "0") {
|
||||||
@@ -952,25 +953,25 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Thunder Dragon")) {
|
else if(cardName.equals("Thunder Dragon")) {
|
||||||
final SpellAbility ability = new Ability(card, "0") {
|
final SpellAbility ability = new Ability(card, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
|
|
||||||
CardList all = AllZoneUtil.getCreaturesInPlay();
|
CardList all = AllZoneUtil.getCreaturesInPlay();
|
||||||
all = all.filter(new CardListFilter()
|
all = all.filter(new CardListFilter()
|
||||||
{
|
{
|
||||||
public boolean addCard(Card c)
|
public boolean addCard(Card c)
|
||||||
{
|
{
|
||||||
return !c.getKeyword().contains("Flying") &&
|
return !c.getKeyword().contains("Flying") &&
|
||||||
CardFactoryUtil.canDamage(card, c);
|
CardFactoryUtil.canDamage(card, c);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for(int i = 0; i < all.size(); i++)
|
for(int i = 0; i < all.size(); i++)
|
||||||
all.get(i).addDamage(3, card);
|
all.get(i).addDamage(3, card);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Command intoPlay = new Command() {
|
Command intoPlay = new Command() {
|
||||||
private static final long serialVersionUID = 9072052875006010434L;
|
private static final long serialVersionUID = 9072052875006010434L;
|
||||||
|
|
||||||
@@ -989,28 +990,28 @@ public class CardFactory_Creatures {
|
|||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Cloudthresher")) {
|
else if(cardName.equals("Cloudthresher")) {
|
||||||
final SpellAbility ability = new Ability(card, "0") {
|
final SpellAbility ability = new Ability(card, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
|
|
||||||
CardList all = AllZoneUtil.getCreaturesInPlay();
|
CardList all = AllZoneUtil.getCreaturesInPlay();
|
||||||
all = all.filter(new CardListFilter()
|
all = all.filter(new CardListFilter()
|
||||||
{
|
{
|
||||||
public boolean addCard(Card c)
|
public boolean addCard(Card c)
|
||||||
{
|
{
|
||||||
return c.getKeyword().contains("Flying") &&
|
return c.getKeyword().contains("Flying") &&
|
||||||
CardFactoryUtil.canDamage(card, c);
|
CardFactoryUtil.canDamage(card, c);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for(int i = 0; i < all.size(); i++)
|
for(int i = 0; i < all.size(); i++)
|
||||||
all.get(i).addDamage(2, card);
|
all.get(i).addDamage(2, card);
|
||||||
|
|
||||||
AllZone.HumanPlayer.addDamage(2, card);
|
AllZone.HumanPlayer.addDamage(2, card);
|
||||||
AllZone.ComputerPlayer.addDamage(2, card);
|
AllZone.ComputerPlayer.addDamage(2, card);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Command intoPlay = new Command() {
|
Command intoPlay = new Command() {
|
||||||
private static final long serialVersionUID = 9072052875006010410L;
|
private static final long serialVersionUID = 9072052875006010410L;
|
||||||
|
|
||||||
@@ -1412,36 +1413,36 @@ public class CardFactory_Creatures {
|
|||||||
}//getKeywordBoost()
|
}//getKeywordBoost()
|
||||||
|
|
||||||
String getChosenColor() {
|
String getChosenColor() {
|
||||||
// Choose color for protection in Brave the Elements
|
// Choose color for protection in Brave the Elements
|
||||||
String color = "";
|
String color = "";
|
||||||
if (card.getController().equals(AllZone.HumanPlayer)) {
|
if (card.getController().equals(AllZone.HumanPlayer)) {
|
||||||
|
|
||||||
String[] colors = Constant.Color.Colors;
|
String[] colors = Constant.Color.Colors;
|
||||||
colors[colors.length-1] = null;
|
colors[colors.length-1] = null;
|
||||||
|
|
||||||
Object o = AllZone.Display.getChoice("Choose color", colors);
|
Object o = AllZone.Display.getChoice("Choose color", colors);
|
||||||
color = (String)o;
|
color = (String)o;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, AllZone.HumanPlayer);
|
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, AllZone.HumanPlayer);
|
||||||
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer);
|
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer);
|
||||||
CardList list = new CardList();
|
CardList list = new CardList();
|
||||||
list.addAll(lib.getCards());
|
list.addAll(lib.getCards());
|
||||||
list.addAll(hand.getCards());
|
list.addAll(hand.getCards());
|
||||||
|
|
||||||
if (list.size() > 0) {
|
if (list.size() > 0) {
|
||||||
String mpcolor = CardFactoryUtil.getMostProminentColor(list);
|
String mpcolor = CardFactoryUtil.getMostProminentColor(list);
|
||||||
if (!mpcolor.equals(""))
|
if (!mpcolor.equals(""))
|
||||||
color = mpcolor;
|
color = mpcolor;
|
||||||
else
|
else
|
||||||
color = "black";
|
color = "black";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
color = "black";
|
color = "black";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
} // getChosenColor
|
} // getChosenColor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
@@ -2025,7 +2026,6 @@ public class CardFactory_Creatures {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
Player opponent = card.getController().getOpponent();
|
Player opponent = card.getController().getOpponent();
|
||||||
//AllZone.GameAction.addDamage(opponent, card, 4);
|
|
||||||
opponent.addDamage(4, card);
|
opponent.addDamage(4, card);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -3835,7 +3835,6 @@ public class CardFactory_Creatures {
|
|||||||
@Override
|
@Override
|
||||||
public void selectPlayer(Player player) {
|
public void selectPlayer(Player player) {
|
||||||
int damage = ((Integer) countZubera.execute()).intValue();
|
int damage = ((Integer) countZubera.execute()).intValue();
|
||||||
//AllZone.GameAction.addDamage(player, card, damage);
|
|
||||||
player.addDamage(damage, card);
|
player.addDamage(damage, card);
|
||||||
stop();
|
stop();
|
||||||
}//selectPlayer()
|
}//selectPlayer()
|
||||||
@@ -5629,51 +5628,6 @@ public class CardFactory_Creatures {
|
|||||||
card.addSpellAbility(ability2);
|
card.addSpellAbility(ability2);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
/*
|
|
||||||
//*************** START *********** START **************************
|
|
||||||
else if(cardName.equals("Turtleshell Changeling")) {
|
|
||||||
//mana ability - targets itself - until EOT
|
|
||||||
//mana ability
|
|
||||||
final Ability ability = new Ability(card, "1 U") {
|
|
||||||
@Override
|
|
||||||
public boolean canPlayAI() {
|
|
||||||
return CardFactoryUtil.AI_doesCreatureAttack(card) && card.getNetAttack() == 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
//in case ability is played twice
|
|
||||||
final int[] oldAttack = new int[1];
|
|
||||||
final int[] oldDefense = new int[1];
|
|
||||||
|
|
||||||
oldAttack[0] = card.getBaseAttack();
|
|
||||||
oldDefense[0] = card.getBaseDefense();
|
|
||||||
|
|
||||||
card.setBaseAttack(oldDefense[0]);
|
|
||||||
card.setBaseDefense(oldAttack[0]);
|
|
||||||
|
|
||||||
//EOT
|
|
||||||
final Command untilEOT = new Command() {
|
|
||||||
private static final long serialVersionUID = -5494886974452901728L;
|
|
||||||
|
|
||||||
public void execute() {
|
|
||||||
card.setBaseAttack(oldAttack[0]);
|
|
||||||
card.setBaseDefense(oldDefense[0]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
|
||||||
}//resolve()
|
|
||||||
};//SpellAbility
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append(card).append(" - switch power and toughness until EOT.");
|
|
||||||
ability.setStackDescription(sb.toString());
|
|
||||||
|
|
||||||
ability.setDescription("1 U: Switch Turtleshell Changeling's power and toughness until end of turn.");
|
|
||||||
card.addSpellAbility(ability);
|
|
||||||
}//*************** END ************ END **************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Jugan, the Rising Star")) {
|
else if(cardName.equals("Jugan, the Rising Star")) {
|
||||||
|
|||||||
@@ -2467,7 +2467,6 @@ class CardFactory_Planeswalkers {
|
|||||||
for(int i = 0; i < dragons.size(); i++) {
|
for(int i = 0; i < dragons.size(); i++) {
|
||||||
Card dragon = dragons.get(i);
|
Card dragon = dragons.get(i);
|
||||||
int damage = dragon.getNetAttack();
|
int damage = dragon.getNetAttack();
|
||||||
//AllZone.GameAction.addDamage(target, dragon, damage);
|
|
||||||
target.addDamage(damage, dragon);
|
target.addDamage(damage, dragon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4526,30 +4526,30 @@ public class CardFactory_Sorceries {
|
|||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Stream of Life"))
|
else if(cardName.equals("Stream of Life"))
|
||||||
{
|
{
|
||||||
final SpellAbility spell = new Spell(card){
|
final SpellAbility spell = new Spell(card){
|
||||||
private static final long serialVersionUID = 851280814064291421L;
|
private static final long serialVersionUID = 851280814064291421L;
|
||||||
|
|
||||||
public void resolve()
|
public void resolve()
|
||||||
{
|
{
|
||||||
getTargetPlayer().gainLife(card.getXManaCostPaid(), card);
|
getTargetPlayer().gainLife(card.getXManaCostPaid(), card);
|
||||||
card.setXManaCostPaid(0);
|
card.setXManaCostPaid(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canPlayAI()
|
public boolean canPlayAI()
|
||||||
{
|
{
|
||||||
int humanLife = AllZone.HumanPlayer.getLife();
|
int humanLife = AllZone.HumanPlayer.getLife();
|
||||||
int computerLife = AllZone.ComputerPlayer.getLife();
|
int computerLife = AllZone.ComputerPlayer.getLife();
|
||||||
|
|
||||||
final int maxX = ComputerUtil.getAvailableMana().size() - 1;
|
final int maxX = ComputerUtil.getAvailableMana().size() - 1;
|
||||||
return maxX > 3 && (humanLife >= computerLife);
|
return maxX > 3 && (humanLife >= computerLife);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
spell.setDescription("Target player gains X life.");
|
spell.setDescription("Target player gains X life.");
|
||||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
||||||
spell.setChooseTargetAI(CardFactoryUtil.AI_targetComputer());
|
spell.setChooseTargetAI(CardFactoryUtil.AI_targetComputer());
|
||||||
|
|
||||||
card.clearSpellAbility();
|
card.clearSpellAbility();
|
||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
}
|
}
|
||||||
//*************** END ************ END **************************
|
//*************** END ************ END **************************
|
||||||
|
|
||||||
@@ -4557,63 +4557,61 @@ public class CardFactory_Sorceries {
|
|||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if (cardName.equals("Lavalanche"))
|
else if (cardName.equals("Lavalanche"))
|
||||||
{
|
{
|
||||||
final SpellAbility spell = new Spell(card)
|
final SpellAbility spell = new Spell(card)
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 3571646571415945308L;
|
private static final long serialVersionUID = 3571646571415945308L;
|
||||||
public void resolve()
|
public void resolve()
|
||||||
{
|
{
|
||||||
int damage = card.getXManaCostPaid();
|
int damage = card.getXManaCostPaid();
|
||||||
|
|
||||||
Player player = getTargetPlayer();
|
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player);
|
|
||||||
CardList list = new CardList(play.getCards());
|
|
||||||
|
|
||||||
list = list.filter(new CardListFilter()
|
|
||||||
{
|
|
||||||
public boolean addCard(Card c)
|
|
||||||
{
|
|
||||||
return c.isCreature() && CardFactoryUtil.canDamage(card, c);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
for(int i = 0; i < list.size(); i++) {
|
|
||||||
list.get(i).addDamage(card.getXManaCostPaid(), card);
|
|
||||||
}
|
|
||||||
|
|
||||||
//AllZone.GameAction.addDamage(player, card, damage);
|
|
||||||
player.addDamage(damage, card);
|
|
||||||
card.setXManaCostPaid(0);
|
|
||||||
}
|
|
||||||
public boolean canPlayAI()
|
|
||||||
{
|
|
||||||
final int maxX = ComputerUtil.getAvailableMana().size() - 3;
|
|
||||||
|
|
||||||
if (AllZone.HumanPlayer.getLife() <= maxX)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
CardListFilter filter = new CardListFilter(){
|
|
||||||
public boolean addCard(Card c)
|
|
||||||
{
|
|
||||||
return c.isCreature() && CardFactoryUtil.canDamage(card, c) &&
|
|
||||||
maxX >= (c.getNetDefense() + c.getDamage());
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CardList killableCreatures = new CardList(AllZone.Human_Battlefield.getCards());
|
|
||||||
killableCreatures = killableCreatures.filter(filter);
|
|
||||||
|
|
||||||
return (killableCreatures.size() >= 2); // kill at least two of the human's creatures
|
|
||||||
}
|
|
||||||
};
|
|
||||||
spell.setDescription("Lavalanche deals X damage to target player and each creature he or she controls.");
|
|
||||||
spell.setStackDescription("Lavalanche - deals X damage to target player and each creature he or she controls.");
|
|
||||||
spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
|
||||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
|
||||||
|
|
||||||
card.clearSpellAbility();
|
Player player = getTargetPlayer();
|
||||||
card.addSpellAbility(spell);
|
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player);
|
||||||
}
|
CardList list = new CardList(play.getCards());
|
||||||
//*************** END ************ END **************************
|
|
||||||
|
list = list.filter(new CardListFilter()
|
||||||
|
{
|
||||||
|
public boolean addCard(Card c)
|
||||||
|
{
|
||||||
|
return c.isCreature() && CardFactoryUtil.canDamage(card, c);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
for(int i = 0; i < list.size(); i++) {
|
||||||
|
list.get(i).addDamage(card.getXManaCostPaid(), card);
|
||||||
|
}
|
||||||
|
|
||||||
|
player.addDamage(damage, card);
|
||||||
|
card.setXManaCostPaid(0);
|
||||||
|
}
|
||||||
|
public boolean canPlayAI()
|
||||||
|
{
|
||||||
|
final int maxX = ComputerUtil.getAvailableMana().size() - 3;
|
||||||
|
|
||||||
|
if (AllZone.HumanPlayer.getLife() <= maxX)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
CardListFilter filter = new CardListFilter(){
|
||||||
|
public boolean addCard(Card c)
|
||||||
|
{
|
||||||
|
return c.isCreature() && CardFactoryUtil.canDamage(card, c) &&
|
||||||
|
maxX >= (c.getNetDefense() + c.getDamage());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
CardList killableCreatures = new CardList(AllZone.Human_Battlefield.getCards());
|
||||||
|
killableCreatures = killableCreatures.filter(filter);
|
||||||
|
|
||||||
|
return (killableCreatures.size() >= 2); // kill at least two of the human's creatures
|
||||||
|
}
|
||||||
|
};
|
||||||
|
spell.setDescription("Lavalanche deals X damage to target player and each creature he or she controls.");
|
||||||
|
spell.setStackDescription("Lavalanche - deals X damage to target player and each creature he or she controls.");
|
||||||
|
spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
||||||
|
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
||||||
|
|
||||||
|
card.clearSpellAbility();
|
||||||
|
card.addSpellAbility(spell);
|
||||||
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
|
|||||||
Reference in New Issue
Block a user