mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-19 04:08:01 +00:00
- Some Cleanup related to getZone and getCardsInZone
This commit is contained in:
@@ -140,11 +140,10 @@ public class AIPlayer extends Player{
|
|||||||
if(r.nextBoolean()) libPos = "top";
|
if(r.nextBoolean()) libPos = "top";
|
||||||
else libPos = "bottom";
|
else libPos = "bottom";
|
||||||
}
|
}
|
||||||
CardList hand = new CardList();
|
CardList hand = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer);
|
||||||
hand.addAll(AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer).getCards());
|
|
||||||
|
CardList blIP = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
|
||||||
|
|
||||||
CardList blIP = new CardList();
|
|
||||||
blIP.addAll(AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards());
|
|
||||||
blIP = blIP.getType("Basic");
|
blIP = blIP.getType("Basic");
|
||||||
if(blIP.size() > 5) {
|
if(blIP.size() > 5) {
|
||||||
CardList blIH = hand.getType("Basic");
|
CardList blIH = hand.getType("Basic");
|
||||||
@@ -183,8 +182,7 @@ public class AIPlayer extends Player{
|
|||||||
for(int i = 0; i < num; i++) {
|
for(int i = 0; i < num; i++) {
|
||||||
boolean b = false;
|
boolean b = false;
|
||||||
if(topN.get(i).getType().contains("Basic")) {
|
if(topN.get(i).getType().contains("Basic")) {
|
||||||
CardList bl = new CardList(
|
CardList bl = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
|
||||||
AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards());
|
|
||||||
bl = bl.filter(new CardListFilter() {
|
bl = bl.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
if(c.getType().contains("Basic")) return true;
|
if(c.getType().contains("Basic")) return true;
|
||||||
@@ -196,8 +194,7 @@ public class AIPlayer extends Player{
|
|||||||
if(bl.size() > 5) // if control more than 5 Basic land, probably don't need more
|
if(bl.size() > 5) // if control more than 5 Basic land, probably don't need more
|
||||||
b = true;
|
b = true;
|
||||||
} else if(topN.get(i).getType().contains("Creature")) {
|
} else if(topN.get(i).getType().contains("Creature")) {
|
||||||
CardList cl = new CardList(
|
CardList cl = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
|
||||||
AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards());
|
|
||||||
cl = cl.filter(new CardListFilter() {
|
cl = cl.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
if(c.getType().contains("Creature")) return true;
|
if(c.getType().contains("Creature")) return true;
|
||||||
|
|||||||
@@ -361,10 +361,10 @@ public class AbilityFactory_ChangeZone {
|
|||||||
if (origin.equals("Library") && i < 1) {
|
if (origin.equals("Library") && i < 1) {
|
||||||
player.shuffle();
|
player.shuffle();
|
||||||
}
|
}
|
||||||
destZone.add(c, libraryPos);
|
AllZone.GameAction.moveToLibrary(c, libraryPos);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
destZone.add(c);
|
AllZone.GameAction.moveTo(destZone, c);
|
||||||
if (destination.equals("Battlefield") && params.containsKey("Tapped"))
|
if (destination.equals("Battlefield") && params.containsKey("Tapped"))
|
||||||
c.tap();
|
c.tap();
|
||||||
}
|
}
|
||||||
@@ -456,10 +456,11 @@ public class AbilityFactory_ChangeZone {
|
|||||||
origZone.remove(c);
|
origZone.remove(c);
|
||||||
if (destination.equals("Library")){
|
if (destination.equals("Library")){
|
||||||
int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0;
|
int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0;
|
||||||
destZone.add(c, libraryPos);
|
AllZone.GameAction.moveToLibrary(c, libraryPos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
destZone.add(c);
|
AllZone.GameAction.moveTo(destZone, c);
|
||||||
|
|
||||||
if (destination.equals("Battlefield") && params.containsKey("Tapped"))
|
if (destination.equals("Battlefield") && params.containsKey("Tapped"))
|
||||||
c.tap();
|
c.tap();
|
||||||
}
|
}
|
||||||
@@ -808,6 +809,7 @@ public class AbilityFactory_ChangeZone {
|
|||||||
|
|
||||||
for(Card tgtC : tgtCards){
|
for(Card tgtC : tgtCards){
|
||||||
PlayerZone originZone = AllZone.getZone(tgtC);
|
PlayerZone originZone = AllZone.getZone(tgtC);
|
||||||
|
// if Target isn't in the expected Zone, continue
|
||||||
if (!originZone.is(origin))
|
if (!originZone.is(origin))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -835,9 +837,7 @@ public class AbilityFactory_ChangeZone {
|
|||||||
if (libraryPosition == -1)
|
if (libraryPosition == -1)
|
||||||
libraryPosition = library.size();
|
libraryPosition = library.size();
|
||||||
|
|
||||||
Card cardCopy = AllZone.CardFactory.copyCard(tgtC);
|
AllZone.GameAction.moveToLibrary(tgtC, libraryPosition);
|
||||||
|
|
||||||
library.add(cardCopy, libraryPosition); //move to library
|
|
||||||
|
|
||||||
if (params.containsKey("Shuffle")) // for things like Gaea's Blessing
|
if (params.containsKey("Shuffle")) // for things like Gaea's Blessing
|
||||||
player.shuffle();
|
player.shuffle();
|
||||||
|
|||||||
@@ -344,7 +344,8 @@ public class AbilityFactory_CounterMagic {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
//AI decision-making, only draws a card if it doesn't risk discarding it.
|
//AI decision-making, only draws a card if it doesn't risk discarding it.
|
||||||
if(AllZone.getZone(Constant.Zone.Hand,AllZone.ComputerPlayer).getCards().length + Integer.parseInt(SplitActionParams[0]) < 6) {
|
|
||||||
|
if(AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer).size() + Integer.parseInt(SplitActionParams[0]) < 6) {
|
||||||
Target.drawCards(Integer.parseInt(SplitActionParams[0]));
|
Target.drawCards(Integer.parseInt(SplitActionParams[0]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -419,7 +420,7 @@ public class AbilityFactory_CounterMagic {
|
|||||||
//Does nothing now, of course, but sometime in the future the AI may be able to remember cards revealed and prioritize discard spells accordingly.
|
//Does nothing now, of course, but sometime in the future the AI may be able to remember cards revealed and prioritize discard spells accordingly.
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CardList list = new CardList(AllZone.getZone(Constant.Zone.Hand,AllZone.ComputerPlayer).getCards());
|
CardList list = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer);
|
||||||
AllZone.Display.getChoiceOptional("Revealed cards",list.toArray());
|
AllZone.Display.getChoiceOptional("Revealed cards",list.toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -440,7 +441,7 @@ public class AbilityFactory_CounterMagic {
|
|||||||
AllZoneUtil.rearrangeTopOfLibrary(Target, Integer.parseInt(SplitActionParams[0]), false);
|
AllZoneUtil.rearrangeTopOfLibrary(Target, Integer.parseInt(SplitActionParams[0]), false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
CardList list = new CardList(AllZone.getZone(Constant.Zone.Hand,AllZone.ComputerPlayer).getCards());
|
CardList list = AllZoneUtil.getCardsInZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
|
||||||
AllZone.Display.getChoiceOptional("Revealed cards",list.toArray());
|
AllZone.Display.getChoiceOptional("Revealed cards",list.toArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,7 +137,8 @@ public class AbilityFactory_Counters {
|
|||||||
|
|
||||||
Player player = af.isCurse() ? AllZone.HumanPlayer : AllZone.ComputerPlayer;
|
Player player = af.isCurse() ? AllZone.HumanPlayer : AllZone.ComputerPlayer;
|
||||||
|
|
||||||
list = new CardList(AllZone.getZone(Constant.Zone.Battlefield, player).getCards());
|
|
||||||
|
list = AllZoneUtil.getPlayerCardsInPlay(player);
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return CardFactoryUtil.canTarget(source, c);
|
return CardFactoryUtil.canTarget(source, c);
|
||||||
@@ -273,7 +274,7 @@ public class AbilityFactory_Counters {
|
|||||||
|
|
||||||
Player player = af.isCurse() ? AllZone.HumanPlayer : AllZone.ComputerPlayer;
|
Player player = af.isCurse() ? AllZone.HumanPlayer : AllZone.ComputerPlayer;
|
||||||
|
|
||||||
list = new CardList(AllZone.getZone(Constant.Zone.Battlefield, player).getCards());
|
list = AllZoneUtil.getPlayerCardsInPlay(player);
|
||||||
list = list.filter(new CardListFilter() {
|
list = list.filter(new CardListFilter() {
|
||||||
public boolean addCard(Card c) {
|
public boolean addCard(Card c) {
|
||||||
return CardFactoryUtil.canTarget(source, c);
|
return CardFactoryUtil.canTarget(source, c);
|
||||||
|
|||||||
@@ -208,8 +208,7 @@ public class AbilityFactory_DealDamage {
|
|||||||
|
|
||||||
if (restDamage == 0) return false;
|
if (restDamage == 0) return false;
|
||||||
|
|
||||||
PlayerZone compHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
|
CardList hand = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer);
|
||||||
CardList hand = new CardList(compHand.getCards());
|
|
||||||
|
|
||||||
if(AF.isSpell() && hand.size() > 7) // anti-discard-at-EOT
|
if(AF.isSpell() && hand.size() > 7) // anti-discard-at-EOT
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public class AbilityFactory_Destroy {
|
|||||||
final Card source = sa.getSourceCard();
|
final Card source = sa.getSourceCard();
|
||||||
CardList list;
|
CardList list;
|
||||||
|
|
||||||
list = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer).getCards());
|
list = AllZoneUtil.getPlayerCardsInPlay(AllZone.HumanPlayer);
|
||||||
list = list.getTargetableCards(source);
|
list = list.getTargetableCards(source);
|
||||||
|
|
||||||
if (abTgt != null){
|
if (abTgt != null){
|
||||||
@@ -246,8 +246,8 @@ public class AbilityFactory_Destroy {
|
|||||||
if(params.containsKey("ValidCards"))
|
if(params.containsKey("ValidCards"))
|
||||||
Valid = params.get("ValidCards");
|
Valid = params.get("ValidCards");
|
||||||
|
|
||||||
CardList humanlist = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer).getCards());
|
CardList humanlist = AllZoneUtil.getCreaturesInPlay(AllZone.HumanPlayer);
|
||||||
CardList computerlist = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards());
|
CardList computerlist = AllZoneUtil.getCreaturesInPlay(AllZone.ComputerPlayer);
|
||||||
|
|
||||||
humanlist = humanlist.getValidCards(Valid.split(","), source.getController(), source);
|
humanlist = humanlist.getValidCards(Valid.split(","), source.getController(), source);
|
||||||
computerlist = computerlist.getValidCards(Valid.split(","), source.getController(), source);
|
computerlist = computerlist.getValidCards(Valid.split(","), source.getController(), source);
|
||||||
@@ -339,8 +339,8 @@ public class AbilityFactory_Destroy {
|
|||||||
if(params.containsKey("ValidCards"))
|
if(params.containsKey("ValidCards"))
|
||||||
Valid = params.get("ValidCards");
|
Valid = params.get("ValidCards");
|
||||||
|
|
||||||
CardList list = new CardList(AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer).getCards());
|
|
||||||
list.addAll(AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer).getCards());
|
CardList list = AllZoneUtil.getCardsInPlay();
|
||||||
|
|
||||||
list = list.getValidCards(Valid.split(","), card.getController(), card);
|
list = list.getValidCards(Valid.split(","), card.getController(), card);
|
||||||
|
|
||||||
|
|||||||
@@ -151,8 +151,7 @@ public class AbilityFactory_Regenerate {
|
|||||||
else weight[0] = 0;
|
else weight[0] = 0;
|
||||||
|
|
||||||
// if there are many cards in hand, then maybe it's not such a great idea to waste mana
|
// if there are many cards in hand, then maybe it's not such a great idea to waste mana
|
||||||
CardList HandList = new CardList(AllZone.getZone(Constant.Zone.Hand,
|
CardList HandList = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer);
|
||||||
AllZone.ComputerPlayer).getCards());
|
|
||||||
|
|
||||||
if(HandList.size() >= 4) weight[1] = 25;
|
if(HandList.size() >= 4) weight[1] = 25;
|
||||||
else weight[1] = 75;
|
else weight[1] = 75;
|
||||||
@@ -164,8 +163,7 @@ public class AbilityFactory_Regenerate {
|
|||||||
if(CardUtil.getConvertedManaCost(HandList.getCard(i).getManaCost()) > hCMC) hCMC = CardUtil.getConvertedManaCost(HandList.getCard(
|
if(CardUtil.getConvertedManaCost(HandList.getCard(i).getManaCost()) > hCMC) hCMC = CardUtil.getConvertedManaCost(HandList.getCard(
|
||||||
i).getManaCost());
|
i).getManaCost());
|
||||||
|
|
||||||
CardList LandList = new CardList(AllZone.getZone(Constant.Zone.Battlefield,
|
CardList LandList = AllZoneUtil.getPlayerCardsInPlay(AllZone.ComputerPlayer);
|
||||||
AllZone.ComputerPlayer).getCards());
|
|
||||||
LandList = LandList.getType("Land");
|
LandList = LandList.getType("Land");
|
||||||
|
|
||||||
//most regenerate abilities cost 2 or less
|
//most regenerate abilities cost 2 or less
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ abstract public class Ability_Activated extends SpellAbility implements java.io.
|
|||||||
|
|
||||||
if(Pithing.size() != 0) return false;
|
if(Pithing.size() != 0) return false;
|
||||||
|
|
||||||
if(c.isCreature() && AllZone.getZone(c).getZoneName().equals(Constant.Zone.Battlefield)) {
|
if(c.isCreature() && AllZone.getZone(c).is(Constant.Zone.Battlefield)) {
|
||||||
CardList Silence = AllZoneUtil.getPlayerCardsInPlay(getSourceCard().getController().getOpponent());
|
CardList Silence = AllZoneUtil.getPlayerCardsInPlay(getSourceCard().getController().getOpponent());
|
||||||
Silence = Silence.getName("Linvala, Keeper of Silence");
|
Silence = Silence.getName("Linvala, Keeper of Silence");
|
||||||
if (Silence.size() != 0)
|
if (Silence.size() != 0)
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ public class EndOfTurn implements java.io.Serializable
|
|||||||
if(creature.isEmpty())
|
if(creature.isEmpty())
|
||||||
{
|
{
|
||||||
CardList sacrifice = new CardList();
|
CardList sacrifice = new CardList();
|
||||||
sacrifice.addAll(all.getName("Pyrohemia").toArray());
|
sacrifice.add(all.getName("Pyrohemia"));
|
||||||
sacrifice.addAll(all.getName("Pestilence").toArray());
|
sacrifice.add(all.getName("Pestilence"));
|
||||||
|
|
||||||
for(int i = 0; i < sacrifice.size(); i++)
|
for(int i = 0; i < sacrifice.size(); i++)
|
||||||
AllZone.GameAction.sacrifice(sacrifice.get(i));
|
AllZone.GameAction.sacrifice(sacrifice.get(i));
|
||||||
@@ -55,16 +55,6 @@ public class EndOfTurn implements java.io.Serializable
|
|||||||
|
|
||||||
AllZone.StaticEffects.rePopulateStateBasedList();
|
AllZone.StaticEffects.rePopulateStateBasedList();
|
||||||
|
|
||||||
/*
|
|
||||||
PlayerZone cz = AllZone.getZone(Constant.Zone.Removed_From_Play, AllZone.ComputerPlayer);
|
|
||||||
PlayerZone hz = AllZone.getZone(Constant.Zone.Removed_From_Play, AllZone.HumanPlayer);
|
|
||||||
|
|
||||||
CardList c = new CardList(cz.getCards());
|
|
||||||
CardList h = new CardList(hz.getCards());
|
|
||||||
|
|
||||||
System.out.println("number of cards in compy removed zone: " + c.size());
|
|
||||||
System.out.println("number of cards in human removed zone: " + h.size());
|
|
||||||
*/
|
|
||||||
for(Card c : all) {
|
for(Card c : all) {
|
||||||
if(!c.isFaceDown()
|
if(!c.isFaceDown()
|
||||||
&& c.getKeyword().contains("At the beginning of the end step, sacrifice CARDNAME."))
|
&& c.getKeyword().contains("At the beginning of the end step, sacrifice CARDNAME."))
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ public class GameAction {
|
|||||||
moving = addSuspendTriggers(moving);
|
moving = addSuspendTriggers(moving);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//boolean dontTrigger = p != null && p.is(Constant.Zone.Battlefield) && zone.is(Constant.Zone.Battlefield);
|
||||||
|
|
||||||
zone.add(moving);
|
zone.add(moving);
|
||||||
|
|
||||||
//Run triggers
|
//Run triggers
|
||||||
@@ -191,7 +193,17 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void moveToLibrary(Card c) {
|
public void moveToLibrary(Card c) {
|
||||||
moveToTopOfLibrary(c);
|
moveToLibrary(c, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void moveToLibrary(Card c, int libPosition){
|
||||||
|
PlayerZone p = AllZone.getZone(c);
|
||||||
|
PlayerZone library = AllZone.getZone(Constant.Zone.Library, c.getOwner());
|
||||||
|
|
||||||
|
if(p != null) p.remove(c);
|
||||||
|
if(!c.isToken()) c = AllZone.CardFactory.copyCard(c);
|
||||||
|
|
||||||
|
library.add(c, libPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -123,13 +123,9 @@ public class GameActionUtil {
|
|||||||
|
|
||||||
// Win / Lose
|
// Win / Lose
|
||||||
final Player player = AllZone.Phase.getPlayerTurn();
|
final Player player = AllZone.Phase.getPlayerTurn();
|
||||||
PlayerZone playZone = AllZone.getZone(Constant.Zone.Battlefield, player);
|
|
||||||
PlayerZone OpplayZone = AllZone.getZone(Constant.Zone.Battlefield, player.getOpponent());
|
//Win / Lose
|
||||||
CardList Platinumlist = new CardList(OpplayZone.getCards());
|
// Checks for can't win or can't lose happen in Player.altWinConditionMet()
|
||||||
Platinumlist = Platinumlist.getName("Platinum Angel");
|
|
||||||
CardList Abyssallist = new CardList(playZone.getCards());
|
|
||||||
Abyssallist = Abyssallist.getName("Abyssal Persecutor");
|
|
||||||
if(Platinumlist.size() == 0 && Abyssallist.size() == 0) {
|
|
||||||
upkeep_Battle_of_Wits();
|
upkeep_Battle_of_Wits();
|
||||||
upkeep_Mortal_Combat();
|
upkeep_Mortal_Combat();
|
||||||
upkeep_Epic_Struggle();
|
upkeep_Epic_Struggle();
|
||||||
@@ -138,9 +134,6 @@ public class GameActionUtil {
|
|||||||
upkeep_Helix_Pinnacle();
|
upkeep_Helix_Pinnacle();
|
||||||
upkeep_Barren_Glory();
|
upkeep_Barren_Glory();
|
||||||
upkeep_Felidar_Sovereign();
|
upkeep_Felidar_Sovereign();
|
||||||
upkeep_Klass();
|
|
||||||
}
|
|
||||||
//Win / Lose
|
|
||||||
|
|
||||||
upkeep_Convalescence();
|
upkeep_Convalescence();
|
||||||
upkeep_Convalescent_Care();
|
upkeep_Convalescent_Care();
|
||||||
@@ -10063,33 +10056,6 @@ public class GameActionUtil {
|
|||||||
}// for
|
}// for
|
||||||
}// upkeep_Power_Surge()
|
}// upkeep_Power_Surge()
|
||||||
|
|
||||||
private static void upkeep_Klass() {
|
|
||||||
final Player player = AllZone.Phase.getPlayerTurn();
|
|
||||||
PlayerZone playZone = AllZone.getZone(Constant.Zone.Battlefield, player);
|
|
||||||
|
|
||||||
CardList elf = new CardList(playZone.getCards());
|
|
||||||
elf = elf.getType("Elf");
|
|
||||||
|
|
||||||
CardList list = new CardList(playZone.getCards());
|
|
||||||
list = list.getName("Klaas, Elf Friend");
|
|
||||||
|
|
||||||
if(0 < list.size() && 10 <= elf.size()) {
|
|
||||||
final Card source = list.get(0);
|
|
||||||
Ability ability = new Ability(source, "0") {
|
|
||||||
@Override
|
|
||||||
public void resolve() {
|
|
||||||
player.getOpponent().setLife(0, source);
|
|
||||||
}
|
|
||||||
};// Ability
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Klaas, Elf Friend - ").append(player).append(" wins the game");
|
|
||||||
ability.setStackDescription(sb.toString());
|
|
||||||
|
|
||||||
AllZone.Stack.add(ability);
|
|
||||||
}// if
|
|
||||||
}// upkeep_Klass
|
|
||||||
|
|
||||||
private static void upkeep_Felidar_Sovereign() {
|
private static void upkeep_Felidar_Sovereign() {
|
||||||
final Player player = AllZone.Phase.getPlayerTurn();
|
final Player player = AllZone.Phase.getPlayerTurn();
|
||||||
PlayerZone playZone = AllZone.getZone(Constant.Zone.Battlefield, player);
|
PlayerZone playZone = AllZone.getZone(Constant.Zone.Battlefield, player);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class Input_Mulligan extends Input {
|
|||||||
|
|
||||||
void end() {
|
void end() {
|
||||||
ButtonUtil.reset();
|
ButtonUtil.reset();
|
||||||
CardList HHandList = new CardList(AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer).getCards());
|
CardList HHandList = AllZoneUtil.getPlayerHand(AllZone.HumanPlayer);
|
||||||
PlayerZone HPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer);
|
PlayerZone HPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.HumanPlayer);
|
||||||
PlayerZone HHand = AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer);
|
PlayerZone HHand = AllZone.getZone(Constant.Zone.Hand, AllZone.HumanPlayer);
|
||||||
for(int i = 0; i < HHandList.size() ; i++) {
|
for(int i = 0; i < HHandList.size() ; i++) {
|
||||||
@@ -68,7 +68,7 @@ public class Input_Mulligan extends Input {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CardList CHandList = new CardList(AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer).getCards());
|
CardList CHandList = AllZoneUtil.getPlayerHand(AllZone.ComputerPlayer);
|
||||||
PlayerZone CPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer);
|
PlayerZone CPlay = AllZone.getZone(Constant.Zone.Battlefield, AllZone.ComputerPlayer);
|
||||||
PlayerZone CHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
|
PlayerZone CHand = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer);
|
||||||
for(int i = 0; i < CHandList.size() ; i++) {
|
for(int i = 0; i < CHandList.size() ; i++) {
|
||||||
|
|||||||
@@ -609,8 +609,7 @@ public class MagicStack extends MyObservable {
|
|||||||
private static final long serialVersionUID = -2559488318473330418L;
|
private static final long serialVersionUID = -2559488318473330418L;
|
||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, crd.getOwner());
|
AllZone.GameAction.moveToHand(crd);
|
||||||
AllZone.GameAction.moveTo(hand, crd);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -457,10 +457,8 @@ public class Phase extends MyObservable
|
|||||||
|
|
||||||
public void resetAttackedThisCombat(Player player) {
|
public void resetAttackedThisCombat(Player player) {
|
||||||
// resets the status of attacked/blocked this phase
|
// resets the status of attacked/blocked this phase
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player);
|
CardList list = AllZoneUtil.getPlayerCardsInPlay(player);
|
||||||
|
|
||||||
CardList list = new CardList();
|
|
||||||
list.addAll(play.getCards());
|
|
||||||
list = list.getType("Creature");
|
list = list.getType("Creature");
|
||||||
|
|
||||||
for(int i = 0; i < list.size(); i++) {
|
for(int i = 0; i < list.size(); i++) {
|
||||||
|
|||||||
@@ -28,8 +28,7 @@ public class PhaseUtil {
|
|||||||
runParams.put("Player", AllZone.Phase.getPlayerTurn());
|
runParams.put("Player", AllZone.Phase.getPlayerTurn());
|
||||||
AllZone.TriggerHandler.runTrigger("Phase", runParams);
|
AllZone.TriggerHandler.runTrigger("Phase", runParams);
|
||||||
|
|
||||||
PlayerZone p = AllZone.getZone(Constant.Zone.Battlefield, turn);
|
|
||||||
Card[] c = p.getCards();
|
|
||||||
|
|
||||||
AllZone.Phase.turnReset();
|
AllZone.Phase.turnReset();
|
||||||
|
|
||||||
@@ -39,8 +38,9 @@ public class PhaseUtil {
|
|||||||
|
|
||||||
// For tokens a player starts the game with they don't recover from Sum. Sickness on first turn
|
// For tokens a player starts the game with they don't recover from Sum. Sickness on first turn
|
||||||
if (turn.getTurn() > 0){
|
if (turn.getTurn() > 0){
|
||||||
for(int i = 0; i < c.length; i++)
|
CardList list = AllZoneUtil.getPlayerCardsInPlay(turn);
|
||||||
c[i].setSickness(false);
|
for(Card c : list)
|
||||||
|
c.setSickness(false);
|
||||||
}
|
}
|
||||||
turn.incrementTurn();
|
turn.incrementTurn();
|
||||||
|
|
||||||
@@ -63,8 +63,7 @@ public class PhaseUtil {
|
|||||||
private static void doUntap()
|
private static void doUntap()
|
||||||
{
|
{
|
||||||
Player player = AllZone.Phase.getPlayerTurn();
|
Player player = AllZone.Phase.getPlayerTurn();
|
||||||
PlayerZone p = AllZone.getZone(Constant.Zone.Battlefield, player);
|
CardList list = AllZoneUtil.getPlayerCardsInPlay(player);
|
||||||
CardList list = new CardList(p.getCards());
|
|
||||||
|
|
||||||
for(Card c : list) {
|
for(Card c : list) {
|
||||||
if (c.getBounceAtUntap() && c.getName().contains("Undiscovered Paradise") )
|
if (c.getBounceAtUntap() && c.getName().contains("Undiscovered Paradise") )
|
||||||
@@ -325,9 +324,8 @@ public class PhaseUtil {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
Player turn = AllZone.Phase.getPlayerTurn();
|
Player turn = AllZone.Phase.getPlayerTurn();
|
||||||
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, turn);
|
|
||||||
|
|
||||||
if (turn.getCards(hand).size() == 0 && AllZoneUtil.isCardInPlay("Gibbering Descent", turn))
|
if (AllZoneUtil.getPlayerHand(turn).size() == 0 && AllZoneUtil.isCardInPlay("Gibbering Descent", turn))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -405,13 +403,10 @@ public class PhaseUtil {
|
|||||||
if (list.size() == 1){
|
if (list.size() == 1){
|
||||||
AllZone.GameAction.checkWheneverKeyword(list.get(0), "Attack - Alone", null);
|
AllZone.GameAction.checkWheneverKeyword(list.get(0), "Attack - Alone", null);
|
||||||
Player attackingPlayer = AllZone.Combat.getAttackingPlayer();
|
Player attackingPlayer = AllZone.Combat.getAttackingPlayer();
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, attackingPlayer);
|
|
||||||
CardList exalted = new CardList(play.getCards());
|
CardList exalted = AllZoneUtil.getPlayerCardsInPlay(attackingPlayer);
|
||||||
exalted = exalted.filter(new CardListFilter() {
|
exalted = exalted.getKeyword("Exalted");
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return c.getKeyword().contains("Exalted");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if(exalted.size() > 0) CombatUtil.executeExaltedAbility(list.get(0), exalted.size());
|
if(exalted.size() > 0) CombatUtil.executeExaltedAbility(list.get(0), exalted.size());
|
||||||
// Make sure exalted effects get applied only once per combat
|
// Make sure exalted effects get applied only once per combat
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -675,8 +675,9 @@ public abstract class Player extends MyObservable{
|
|||||||
|
|
||||||
public void discardRandom(final int num, final SpellAbility sa) {
|
public void discardRandom(final int num, final SpellAbility sa) {
|
||||||
for(int i = 0; i < num; i++) {
|
for(int i = 0; i < num; i++) {
|
||||||
Card[] c = AllZone.getZone(Constant.Zone.Hand, this).getCards();
|
CardList list = AllZoneUtil.getPlayerHand(this);
|
||||||
if(c.length != 0) doDiscard(CardUtil.getRandom(c), sa);
|
if(list.size() != 0)
|
||||||
|
doDiscard(CardUtil.getRandom(list.toArray()), sa);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ public class SpellAbilityUtil
|
|||||||
|
|
||||||
static public CardList getAvailableMana(Player player)
|
static public CardList getAvailableMana(Player player)
|
||||||
{
|
{
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Battlefield, player);
|
CardList all = AllZoneUtil.getPlayerCardsInPlay(player);
|
||||||
CardList all = new CardList(play.getCards());
|
|
||||||
CardList mana = all.filter(new CardListFilter()
|
CardList mana = all.filter(new CardListFilter()
|
||||||
{
|
{
|
||||||
public boolean addCard(Card c)
|
public boolean addCard(Card c)
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ public class SpellAbility_Requirements {
|
|||||||
bCasting = true;
|
bCasting = true;
|
||||||
if (!ability.getSourceCard().isCopiedSpell()){
|
if (!ability.getSourceCard().isCopiedSpell()){
|
||||||
Card c = ability.getSourceCard();
|
Card c = ability.getSourceCard();
|
||||||
|
|
||||||
|
// todo(sol): move Spell to Stack here?
|
||||||
fromZone = AllZone.getZone(c);
|
fromZone = AllZone.getZone(c);
|
||||||
if (fromZone != null)
|
if (fromZone != null)
|
||||||
fromZone.remove(c);
|
fromZone.remove(c);
|
||||||
|
|||||||
@@ -171,13 +171,13 @@ public class SpellAbility_Restriction {
|
|||||||
|
|
||||||
if (nCardsInHand != -1){
|
if (nCardsInHand != -1){
|
||||||
// Can handle Library of Alexandria, or Hellbent
|
// Can handle Library of Alexandria, or Hellbent
|
||||||
if (AllZone.getZone(Constant.Zone.Hand, activator).size() != nCardsInHand)
|
if (AllZoneUtil.getPlayerHand(activator).size() != nCardsInHand)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bNeedsThreshold){
|
if (bNeedsThreshold){
|
||||||
// Threshold
|
// Threshold
|
||||||
if (AllZone.getZone(Constant.Zone.Graveyard, activator).size() < THRESHOLD)
|
if (AllZoneUtil.getPlayerGraveyard(activator).size() < THRESHOLD)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -89,15 +89,8 @@ public class StaticEffects
|
|||||||
public void rePopulateStateBasedList()
|
public void rePopulateStateBasedList()
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
PlayerZone playerZone = AllZone.getZone(Constant.Zone.Battlefield,
|
|
||||||
AllZone.HumanPlayer);
|
|
||||||
PlayerZone computerZone = AllZone.getZone(Constant.Zone.Battlefield,
|
|
||||||
AllZone.ComputerPlayer);
|
|
||||||
|
|
||||||
CardList cards = new CardList();
|
|
||||||
cards.addAll(playerZone.getCards());
|
|
||||||
cards.addAll(computerZone.getCards());
|
|
||||||
|
|
||||||
|
CardList cards = AllZoneUtil.getCardsInPlay();
|
||||||
|
|
||||||
Log.debug("== Start add state effects ==");
|
Log.debug("== Start add state effects ==");
|
||||||
for (int i=0;i<cards.size();i++)
|
for (int i=0;i<cards.size();i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user