mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
code cleanup/consolidation in CardFactory_Sorceries
This commit is contained in:
@@ -106,11 +106,7 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
//get all creatures
|
CardList list = AllZoneUtil.getCreaturesInPlay();
|
||||||
CardList list = new CardList();
|
|
||||||
list.addAll(AllZone.Human_Battlefield.getCards());
|
|
||||||
list.addAll(AllZone.Computer_Battlefield.getCards());
|
|
||||||
list = list.getType("Creature");
|
|
||||||
|
|
||||||
for(int i = 0; i < list.size(); i++) {
|
for(int i = 0; i < list.size(); i++) {
|
||||||
final Card[] target = new Card[1];
|
final Card[] target = new Card[1];
|
||||||
@@ -428,9 +424,7 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, getTargetPlayer());
|
CardList list = AllZoneUtil.getCreaturesInPlay(getTargetPlayer());
|
||||||
CardList list = new CardList(play.getCards());
|
|
||||||
list = list.getType("Creature");
|
|
||||||
|
|
||||||
list.shuffle();
|
list.shuffle();
|
||||||
|
|
||||||
@@ -489,7 +483,6 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
spell_one.setDescription("Put a 1/1 black Rat token into play.");
|
spell_one.setDescription("Put a 1/1 black Rat token into play.");
|
||||||
spell_two.setDescription("Buyback 4 (You may pay an additional 4 as you cast this spell. If you do, put this card into your hand as it resolves.)");
|
spell_two.setDescription("Buyback 4 (You may pay an additional 4 as you cast this spell. If you do, put this card into your hand as it resolves.)");
|
||||||
// spell_two.setDescription("Buyback 4 - Pay 4B, put this card into your hand as it resolves.");
|
|
||||||
|
|
||||||
spell_one.setStackDescription("Lab Rats - Put a 1/1 black Rat token into play");
|
spell_one.setStackDescription("Lab Rats - Put a 1/1 black Rat token into play");
|
||||||
spell_two.setStackDescription("Lab Rats - Buyback, Put a 1/1 black Rat token into play");
|
spell_two.setStackDescription("Lab Rats - Buyback, Put a 1/1 black Rat token into play");
|
||||||
@@ -673,38 +666,6 @@ public class CardFactory_Sorceries {
|
|||||||
spell.setBeforePayMana(target);
|
spell.setBeforePayMana(target);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
/*
|
|
||||||
//*************** START *********** START **************************
|
|
||||||
else if(cardName.equals("Blinding Light")) {
|
|
||||||
SpellAbility spell = new Spell(card) {
|
|
||||||
private static final long serialVersionUID = -631672055247954361L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
CardList nonwhite = AllZoneUtil.getCreaturesInPlay();
|
|
||||||
nonwhite = nonwhite.filter(new CardListFilter() {
|
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return !c.isWhite();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
for(int i = 0; i < nonwhite.size(); i++)
|
|
||||||
nonwhite.get(i).tap();
|
|
||||||
}//resolve()
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlayAI() {
|
|
||||||
//the computer seems to play this card at stupid times
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
card.setSVar("PlayMain1", "TRUE");
|
|
||||||
|
|
||||||
card.clearSpellAbility();
|
|
||||||
card.addSpellAbility(spell);
|
|
||||||
}//*************** END ************ END **************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Grapeshot")) {
|
else if(cardName.equals("Grapeshot")) {
|
||||||
@@ -753,8 +714,6 @@ public class CardFactory_Sorceries {
|
|||||||
handChoices[i] = null;
|
handChoices[i] = null;
|
||||||
}
|
}
|
||||||
AllZone.Display.getChoice("Random card", handChoices);
|
AllZone.Display.getChoice("Random card", handChoices);
|
||||||
//AllZone.GameAction.addDamage(opponent, card,
|
|
||||||
// CardUtil.getConvertedManaCost(choice.getManaCost()));
|
|
||||||
opponent.addDamage(CardUtil.getConvertedManaCost(choice.getManaCost()), card);
|
opponent.addDamage(CardUtil.getConvertedManaCost(choice.getManaCost()), card);
|
||||||
}
|
}
|
||||||
}//resolve()
|
}//resolve()
|
||||||
@@ -1556,10 +1515,7 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList all = new CardList();
|
CardList all = AllZoneUtil.getCreaturesInPlay();
|
||||||
all.addAll(AllZone.Human_Battlefield.getCards());
|
|
||||||
all.addAll(AllZone.Computer_Battlefield.getCards());
|
|
||||||
all = all.getType("Creature");
|
|
||||||
|
|
||||||
for(int i = 0; i < all.size(); i++)
|
for(int i = 0; i < all.size(); i++)
|
||||||
if(!all.get(i).getKeyword().contains("Flying")) {
|
if(!all.get(i).getKeyword().contains("Flying")) {
|
||||||
@@ -1646,11 +1602,7 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
for(int i = 0; i < all.size(); i++)
|
for(int i = 0; i < all.size(); i++)
|
||||||
if(all.get(i).getName().equals(c.getName())) {
|
if(all.get(i).getName().equals(c.getName())) {
|
||||||
if(player.equals(AllZone.HumanPlayer)) {
|
AllZone.GameAction.exile(all.get(i));
|
||||||
AllZone.GameAction.moveTo(AllZone.Human_Exile, all.get(i));
|
|
||||||
} else {
|
|
||||||
AllZone.GameAction.moveTo(AllZone.Computer_Exile, all.get(i));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}//remove()
|
}//remove()
|
||||||
|
|
||||||
@@ -1723,9 +1675,7 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
if(!getTargetCard().isFaceDown()) {
|
if(!getTargetCard().isFaceDown()) {
|
||||||
//get all creatures
|
//get all creatures
|
||||||
CardList list = new CardList();
|
CardList list = AllZoneUtil.getCardsInPlay();
|
||||||
list.addAll(AllZone.Human_Battlefield.getCards());
|
|
||||||
list.addAll(AllZone.Computer_Battlefield.getCards());
|
|
||||||
|
|
||||||
list = list.getName(getTargetCard().getName());
|
list = list.getName(getTargetCard().getName());
|
||||||
list.remove(getTargetCard());
|
list.remove(getTargetCard());
|
||||||
@@ -2197,9 +2147,7 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList all = new CardList();
|
CardList all = AllZoneUtil.getCardsInPlay();
|
||||||
all.addAll(AllZone.Human_Battlefield.getCards());
|
|
||||||
all.addAll(AllZone.Computer_Battlefield.getCards());
|
|
||||||
int Soldiers = card.getXManaCostPaid();
|
int Soldiers = card.getXManaCostPaid();
|
||||||
for(int i = 0; i < Soldiers; i++) {
|
for(int i = 0; i < Soldiers; i++) {
|
||||||
CardFactoryUtil.makeToken("Soldier", "W 1 1 Soldier", card.getController(), "W", new String[] {
|
CardFactoryUtil.makeToken("Soldier", "W 1 1 Soldier", card.getController(), "W", new String[] {
|
||||||
@@ -2215,11 +2163,8 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
CardList human = new CardList(AllZone.Human_Battlefield.getCards());
|
CardList human = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer);
|
||||||
CardList computer = new CardList(AllZone.Computer_Battlefield.getCards());
|
CardList computer = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer);
|
||||||
|
|
||||||
human = human.getType("Creature");
|
|
||||||
computer = computer.getType("Creature");
|
|
||||||
|
|
||||||
// the computer will at least destroy 2 more human creatures
|
// the computer will at least destroy 2 more human creatures
|
||||||
return (computer.size() < human.size() - 1
|
return (computer.size() < human.size() - 1
|
||||||
@@ -2252,6 +2197,7 @@ public class CardFactory_Sorceries {
|
|||||||
//System.out.println(userChoice);
|
//System.out.println(userChoice);
|
||||||
//System.out.println(m_land[0]);
|
//System.out.println(m_land[0]);
|
||||||
//System.out.println(m_player[0]);
|
//System.out.println(m_player[0]);
|
||||||
|
|
||||||
//"Incendiary Command deals 4 damage to target player",
|
//"Incendiary Command deals 4 damage to target player",
|
||||||
for(int i = 0; i <card.getChoices().size(); i++) {
|
for(int i = 0; i <card.getChoices().size(); i++) {
|
||||||
if(card.getChoice(i).equals(cardChoice[0])) {
|
if(card.getChoice(i).equals(cardChoice[0])) {
|
||||||
@@ -2670,11 +2616,9 @@ public class CardFactory_Sorceries {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
||||||
|
|
||||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
||||||
|
|
||||||
card.setSVar("PlayMain1", "TRUE");
|
card.setSVar("PlayMain1", "TRUE");
|
||||||
|
|
||||||
card.clearSpellAbility();
|
card.clearSpellAbility();
|
||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
@@ -2708,104 +2652,6 @@ public class CardFactory_Sorceries {
|
|||||||
card.setFlashback(true);
|
card.setFlashback(true);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
/*
|
|
||||||
//*************** START *********** START **************************
|
|
||||||
else if(cardName.equals("Allied Strategies")) {
|
|
||||||
SpellAbility spell = new Spell(card) {
|
|
||||||
private static final long serialVersionUID = 2730790148899002194L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
int n = countLandTypes();
|
|
||||||
|
|
||||||
getTargetPlayer().drawCards(n);
|
|
||||||
}
|
|
||||||
|
|
||||||
int countLandTypes() {
|
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, getTargetPlayer());
|
|
||||||
CardList land = new CardList(play.getCards());
|
|
||||||
|
|
||||||
String basic[] = {"Forest", "Plains", "Mountain", "Island", "Swamp"};
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
for(int i = 0; i < basic.length; i++) {
|
|
||||||
CardList c = land.getType(basic[i]);
|
|
||||||
if(!c.isEmpty()) count++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}//countLandTypes()
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlayAI() {
|
|
||||||
return AllZone.Computer_Hand.getCards().length <= 5;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
spell.setChooseTargetAI(CardFactoryUtil.AI_targetComputer());
|
|
||||||
|
|
||||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
|
||||||
card.clearSpellAbility();
|
|
||||||
card.addSpellAbility(spell);
|
|
||||||
}//*************** END ************ END **************************
|
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
|
||||||
else if(cardName.equals("Sylvan Tutor")) {
|
|
||||||
SpellAbility spell = new Spell(card) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1873791994168389407L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlayAI() {
|
|
||||||
return 6 < AllZone.Phase.getTurn();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
Player player = card.getController();
|
|
||||||
if(player.equals(AllZone.HumanPlayer)) humanResolve();
|
|
||||||
else computerResolve();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void computerResolve() {
|
|
||||||
CardList creature = new CardList(AllZone.Computer_Library.getCards());
|
|
||||||
creature = creature.getType("Creature");
|
|
||||||
if(creature.size() != 0) {
|
|
||||||
Card c = creature.get(0);
|
|
||||||
card.getController().shuffle();
|
|
||||||
|
|
||||||
//move to top of library
|
|
||||||
AllZone.Computer_Library.remove(c);
|
|
||||||
AllZone.Computer_Library.add(c, 0);
|
|
||||||
|
|
||||||
CardList list = new CardList();
|
|
||||||
list.add(c);
|
|
||||||
AllZone.Display.getChoiceOptional("Computer picked:", list.toArray());
|
|
||||||
}
|
|
||||||
}//computerResolve()
|
|
||||||
|
|
||||||
public void humanResolve() {
|
|
||||||
PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController());
|
|
||||||
|
|
||||||
CardList list = new CardList(library.getCards());
|
|
||||||
list = list.getType("Creature");
|
|
||||||
|
|
||||||
if(list.size() != 0) {
|
|
||||||
Object o = AllZone.Display.getChoiceOptional("Select a creature", list.toArray());
|
|
||||||
|
|
||||||
card.getController().shuffle();
|
|
||||||
if(o != null) {
|
|
||||||
//put creature on top of library
|
|
||||||
library.remove(o);
|
|
||||||
library.add((Card) o, 0);
|
|
||||||
}
|
|
||||||
}//if
|
|
||||||
}//resolve()
|
|
||||||
};
|
|
||||||
card.clearSpellAbility();
|
|
||||||
card.addSpellAbility(spell);
|
|
||||||
}//*************** END ************ END **************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Pulse of the Tangle")) {
|
else if(cardName.equals("Pulse of the Tangle")) {
|
||||||
@@ -3580,15 +3426,8 @@ public class CardFactory_Sorceries {
|
|||||||
@Override
|
@Override
|
||||||
public boolean canPlay() {
|
public boolean canPlay() {
|
||||||
Player oppPlayer = card.getController().getOpponent();
|
Player oppPlayer = card.getController().getOpponent();
|
||||||
|
CardList self = AllZoneUtil.getPlayerLandsInPlay(card.getController());
|
||||||
PlayerZone selfZone = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
|
CardList opp = AllZoneUtil.getPlayerLandsInPlay(oppPlayer);
|
||||||
PlayerZone oppZone = AllZone.getZone(Constant.Zone.Battlefield, oppPlayer);
|
|
||||||
|
|
||||||
CardList self = new CardList(selfZone.getCards());
|
|
||||||
CardList opp = new CardList(oppZone.getCards());
|
|
||||||
|
|
||||||
self = self.getType("Land");
|
|
||||||
opp = opp.getType("Land");
|
|
||||||
|
|
||||||
return (self.size() < opp.size()) && super.canPlay();
|
return (self.size() < opp.size()) && super.canPlay();
|
||||||
}//canPlay()
|
}//canPlay()
|
||||||
@@ -3623,11 +3462,8 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
PlayerZone cPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer);
|
CardList hList = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer);
|
||||||
PlayerZone hPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer);
|
CardList cList = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
|
||||||
|
|
||||||
CardList hList = new CardList(hPlay.getCards());
|
|
||||||
CardList cList = new CardList(cPlay.getCards());
|
|
||||||
CardList smallCreats = cList.filter(new CardListFilter() {
|
CardList smallCreats = cList.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return c.isCreature() && c.getNetAttack() < 2 && c.getNetDefense() < 3;
|
return c.isCreature() && c.getNetAttack() < 2 && c.getNetDefense() < 3;
|
||||||
@@ -3646,74 +3482,6 @@ public class CardFactory_Sorceries {
|
|||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
/*
|
|
||||||
//*************** START *********** START **************************
|
|
||||||
else if(cardName.equals("Chainer's Edict")) {
|
|
||||||
final SpellAbility spell = new Spell(card) {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1139979866902867554L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
getTargetPlayer().sacrificeCreature();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlayAI() {
|
|
||||||
PlayerZone hPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer);
|
|
||||||
CardList hList = new CardList(hPlay.getCards());
|
|
||||||
hList = hList.getType("Creature");
|
|
||||||
return hList.size() > 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
spell.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
|
||||||
spell.setBeforePayMana(CardFactoryUtil.input_targetPlayer(spell));
|
|
||||||
|
|
||||||
card.clearSpellAbility();
|
|
||||||
card.addSpellAbility(spell);
|
|
||||||
|
|
||||||
|
|
||||||
final SpellAbility flashback = new Spell(card) {
|
|
||||||
private static final long serialVersionUID = -4889392369463499074L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlay() {
|
|
||||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
|
|
||||||
|
|
||||||
return AllZone.GameAction.isCardInZone(card, grave)
|
|
||||||
&& Phase.canCastSorcery(card.getController());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canPlayAI() {
|
|
||||||
PlayerZone hPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer);
|
|
||||||
CardList hList = new CardList(hPlay.getCards());
|
|
||||||
hList = hList.getType("Creature");
|
|
||||||
return hList.size() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, card.getController());
|
|
||||||
PlayerZone removed = AllZone.getZone(Constant.Zone.Exile, card.getController());
|
|
||||||
|
|
||||||
getTargetPlayer().sacrificeCreature();
|
|
||||||
|
|
||||||
grave.remove(card);
|
|
||||||
removed.add(card);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
flashback.setManaCost("5 B B");
|
|
||||||
flashback.setBeforePayMana(CardFactoryUtil.input_targetPlayer(flashback));
|
|
||||||
flashback.setDescription("Flashback: 5 B B");
|
|
||||||
flashback.setChooseTargetAI(CardFactoryUtil.AI_targetHuman());
|
|
||||||
|
|
||||||
card.addSpellAbility(flashback);
|
|
||||||
card.setFlashback(true);
|
|
||||||
|
|
||||||
}//*************** END ************ END **************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Rite of Replication")) {
|
else if(cardName.equals("Rite of Replication")) {
|
||||||
@@ -3721,12 +3489,8 @@ public class CardFactory_Sorceries {
|
|||||||
private static final long serialVersionUID = -2902112019334177L;
|
private static final long serialVersionUID = -2902112019334177L;
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
PlayerZone zone = AllZone.getZone(Constant.Zone.Battlefield, card.getController());
|
|
||||||
Card biggest = null;
|
Card biggest = null;
|
||||||
if(zone != null) {
|
CardList creature = AllZoneUtil.getCreaturesInPlay(card.getController());
|
||||||
CardList creature = new CardList();
|
|
||||||
creature.addAll(zone.getCards());
|
|
||||||
creature = creature.getType("Creature");
|
|
||||||
creature = creature.filter(new CardListFilter() {
|
creature = creature.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card card) {
|
public boolean addCard(Card card) {
|
||||||
return (!card.getType().contains("Legendary"));
|
return (!card.getType().contains("Legendary"));
|
||||||
@@ -3737,7 +3501,7 @@ public class CardFactory_Sorceries {
|
|||||||
for(int i = 0; i < creature.size(); i++)
|
for(int i = 0; i < creature.size(); i++)
|
||||||
if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i);
|
if(biggest.getNetAttack() < creature.get(i).getNetAttack()) biggest = creature.get(i);
|
||||||
setTargetCard(biggest);
|
setTargetCard(biggest);
|
||||||
}
|
|
||||||
return biggest.getNetAttack() > 4;
|
return biggest.getNetAttack() > 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4997,10 +4761,8 @@ public class CardFactory_Sorceries {
|
|||||||
public void resolve()
|
public void resolve()
|
||||||
{
|
{
|
||||||
//Lands:
|
//Lands:
|
||||||
CardList humLand = new CardList(AllZone.Human_Battlefield.getCards());
|
CardList humLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.HumanPlayer);
|
||||||
humLand = humLand.getType("Land");
|
CardList compLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.ComputerPlayer);
|
||||||
CardList compLand = new CardList(AllZone.Computer_Battlefield.getCards());
|
|
||||||
compLand = compLand.getType("Land");
|
|
||||||
|
|
||||||
if (compLand.size() > humLand.size())
|
if (compLand.size() > humLand.size())
|
||||||
{
|
{
|
||||||
@@ -5015,8 +4777,8 @@ public class CardFactory_Sorceries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Hand
|
//Hand
|
||||||
CardList humHand = new CardList(AllZone.Human_Hand.getCards());
|
CardList humHand = AllZoneUtil.getPlayerHand(AllZone.HumanPlayer);
|
||||||
CardList compHand = new CardList(AllZone.Computer_Hand.getCards());
|
CardList compHand = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer);
|
||||||
int handDiff = humHand.size() - compHand.size();
|
int handDiff = humHand.size() - compHand.size();
|
||||||
|
|
||||||
if (compHand.size() > humHand.size())
|
if (compHand.size() > humHand.size())
|
||||||
@@ -5029,10 +4791,8 @@ public class CardFactory_Sorceries {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Creatures:
|
//Creatures:
|
||||||
CardList humCreats = new CardList(AllZone.Human_Battlefield.getCards());
|
CardList humCreats = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer);
|
||||||
humCreats = humCreats.getType("Creature");
|
CardList compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer);
|
||||||
CardList compCreats = new CardList(AllZone.Computer_Battlefield.getCards());
|
|
||||||
compCreats = compCreats.getType("Creature");
|
|
||||||
|
|
||||||
if (compCreats.size() > humCreats.size())
|
if (compCreats.size() > humCreats.size())
|
||||||
{
|
{
|
||||||
@@ -5052,20 +4812,17 @@ public class CardFactory_Sorceries {
|
|||||||
public boolean canPlayAI()
|
public boolean canPlayAI()
|
||||||
{
|
{
|
||||||
int diff = 0;
|
int diff = 0;
|
||||||
CardList humLand = new CardList(AllZone.Human_Battlefield.getCards());
|
CardList humLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.HumanPlayer);
|
||||||
humLand = humLand.getType("Land");
|
CardList compLand = AllZoneUtil.getPlayerLandsInPlay(AllZone.ComputerPlayer);
|
||||||
CardList compLand = new CardList(AllZone.Computer_Battlefield.getCards());
|
|
||||||
compLand = compLand.getType("Land");
|
|
||||||
diff += humLand.size() - compLand.size();
|
diff += humLand.size() - compLand.size();
|
||||||
|
|
||||||
CardList humCreats = new CardList(AllZone.Human_Battlefield.getCards());
|
CardList humCreats = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer);
|
||||||
humCreats = humCreats.getType("Creature");
|
CardList compCreats = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer);
|
||||||
CardList compCreats = new CardList(AllZone.Computer_Battlefield.getCards());
|
|
||||||
compCreats = compCreats.getType("Creature");
|
compCreats = compCreats.getType("Creature");
|
||||||
diff += 1.5 * (humCreats.size() - compCreats.size());
|
diff += 1.5 * (humCreats.size() - compCreats.size());
|
||||||
|
|
||||||
CardList humHand = new CardList(AllZone.Human_Hand.getCards());
|
CardList humHand = AllZoneUtil.getPlayerHand(AllZone.HumanPlayer);
|
||||||
CardList compHand = new CardList(AllZone.Computer_Hand.getCards());
|
CardList compHand = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer);
|
||||||
diff += 0.5 * (humHand.size() - compHand.size());
|
diff += 0.5 * (humHand.size() - compHand.size());
|
||||||
|
|
||||||
return diff > 2;
|
return diff > 2;
|
||||||
@@ -5173,16 +4930,10 @@ public class CardFactory_Sorceries {
|
|||||||
// The computer should only play this card if it has at least
|
// The computer should only play this card if it has at least
|
||||||
// one land in its hand. Because of the way the computer turn
|
// one land in its hand. Because of the way the computer turn
|
||||||
// is structured, it will already have played land to it's limit
|
// is structured, it will already have played land to it's limit
|
||||||
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand,
|
|
||||||
AllZone.ComputerPlayer);
|
|
||||||
|
|
||||||
CardList list = new CardList(hand.getCards());
|
CardList hand = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer);
|
||||||
|
hand = hand.getType("Land");
|
||||||
list = list.getType("Land");
|
return hand.size() > 0;
|
||||||
if (list.size() > 0)
|
|
||||||
return true;
|
|
||||||
else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
@@ -5271,32 +5022,19 @@ public class CardFactory_Sorceries {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canPlayAI() {
|
public boolean canPlayAI() {
|
||||||
return getCreatures(AllZone.ComputerPlayer).size() > 0;
|
return AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer).size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
Card[] c = getCreatures(card.getController()).toArray();
|
CardList cards = AllZoneUtil.getCreaturesInPlay(card.getController());
|
||||||
for(int i = 0; i < c.length; i++) {
|
for(Card creature:cards) {
|
||||||
if(c[i].isCreature()) {
|
AllZone.GameAction.sacrifice(creature);
|
||||||
AllZone.GameAction.sacrifice(c[i]);
|
CardFactoryUtil.makeToken("Hellion", "R 4 4 hellion", creature.getController(), "R", new String[] {
|
||||||
CardFactoryUtil.makeToken("Hellion", "R 4 4 hellion", c[i].getController(), "R", new String[] {
|
|
||||||
"Creature", "Hellion"}, 4, 4, new String[] {""});
|
"Creature", "Hellion"}, 4, 4, new String[] {""});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private CardList getCreatures(Player player) {
|
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player);
|
|
||||||
CardList creatures = new CardList();
|
|
||||||
creatures.addAll(play.getCards());
|
|
||||||
creatures = creatures.filter(new CardListFilter() {
|
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return c.isCreature();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return creatures;
|
|
||||||
}
|
|
||||||
};//SpellAbility
|
};//SpellAbility
|
||||||
card.clearSpellAbility();
|
card.clearSpellAbility();
|
||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
@@ -6476,7 +6214,6 @@ public class CardFactory_Sorceries {
|
|||||||
else if(cardName.equals("Patriarch's Bidding")) {
|
else if(cardName.equals("Patriarch's Bidding")) {
|
||||||
final String[] input = new String[2];
|
final String[] input = new String[2];
|
||||||
|
|
||||||
// final SpellAbility ability = new Ability(card, "0") {
|
|
||||||
final SpellAbility spell = new Spell(card) {
|
final SpellAbility spell = new Spell(card) {
|
||||||
private static final long serialVersionUID = -2182173662547136798L;
|
private static final long serialVersionUID = -2182173662547136798L;
|
||||||
|
|
||||||
@@ -6557,18 +6294,7 @@ public class CardFactory_Sorceries {
|
|||||||
}
|
}
|
||||||
}//resolve()
|
}//resolve()
|
||||||
};//SpellAbility
|
};//SpellAbility
|
||||||
/* No longer needed.
|
|
||||||
Command intoPlay = new Command() {
|
|
||||||
private static final long serialVersionUID = 5634360316643996274L;
|
|
||||||
|
|
||||||
public void execute() {
|
|
||||||
ability.setStackDescription("When " + card.getName()
|
|
||||||
+ " comes into play, choose a creature type.");
|
|
||||||
AllZone.Stack.add(ability);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
card.addComesIntoPlayCommand(intoPlay);
|
|
||||||
*/
|
|
||||||
card.clearSpellAbility();
|
card.clearSpellAbility();
|
||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
@@ -7248,6 +6974,7 @@ public class CardFactory_Sorceries {
|
|||||||
spell.setDescription(abCost+"Destroy target non-Swamp land. If that land was nonbasic, Choking Sands deals 2 damage to the land's controller.");
|
spell.setDescription(abCost+"Destroy target non-Swamp land. If that land was nonbasic, Choking Sands deals 2 damage to the land's controller.");
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Rite of Flame")) {
|
else if(cardName.equals("Rite of Flame")) {
|
||||||
final SpellAbility spell = new Spell(card) {
|
final SpellAbility spell = new Spell(card) {
|
||||||
|
|||||||
Reference in New Issue
Block a user