mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +00:00
- Recoded how Additional Land Plays work
- Added Summer Bloom - Added Horn of Greed - Each Fastbond will now deal damage to owner, not just 1 damage for all of them. Also, removed limit of 100 land plays for Fastbond. - Additional lands granted by Rites of Flourishing and Storm Cauldron in place for when the second ability for each is implemented. - Oh god, this update was way larger than I was expecting.
This commit is contained in:
@@ -38,6 +38,8 @@ snow_covered_mountain.jpg http://www.wizards.com/global/images/magic/gene
|
|||||||
snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg
|
snow_covered_mountain1.jpg http://www.wizards.com/global/images/magic/general/snow_covered_mountain.jpg
|
||||||
snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg
|
snow_covered_mountain2.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg
|
||||||
snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg
|
snow_covered_mountain3.jpg http://www.magickartenmarkt.de/img/cards/Ice_Age/snow_covered_mountain.jpg
|
||||||
|
summer_bloom.jpg http://www.wizards.com/global/images/magic/general/summer_bloom.jpg
|
||||||
|
horn_of_greed.jpg http://www.wizards.com/global/images/magic/general/horn_of_greed.jpg
|
||||||
dune_brood_nephilim.jpg http://www.wizards.com/global/images/magic/general/dune_brood_nephilim.jpg
|
dune_brood_nephilim.jpg http://www.wizards.com/global/images/magic/general/dune_brood_nephilim.jpg
|
||||||
akuta_born_of_ash.jpg http://www.wizards.com/global/images/magic/general/akuta_born_of_ash.jpg
|
akuta_born_of_ash.jpg http://www.wizards.com/global/images/magic/general/akuta_born_of_ash.jpg
|
||||||
agent_of_masks.jpg http://www.wizards.com/global/images/magic/general/agent_of_masks.jpg
|
agent_of_masks.jpg http://www.wizards.com/global/images/magic/general/agent_of_masks.jpg
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
Summer Bloom
|
||||||
|
1 G
|
||||||
|
Sorcery
|
||||||
|
You may play up to three additional lands this turn.
|
||||||
|
|
||||||
|
Horn of Greed
|
||||||
|
3
|
||||||
|
Artifact
|
||||||
|
When a player plays a land, that player draws a card.
|
||||||
|
|
||||||
Dune-Brood Nephilim
|
Dune-Brood Nephilim
|
||||||
B R G W
|
B R G W
|
||||||
Creature Nephilim
|
Creature Nephilim
|
||||||
@@ -526,7 +536,7 @@ spDiscardTgt:TgtChoose:2:Target player discards two cards.:Mind Rot - target pla
|
|||||||
|
|
||||||
Mind Sludge
|
Mind Sludge
|
||||||
4 B
|
4 B
|
||||||
Sorcery
|
ry
|
||||||
no text
|
no text
|
||||||
spDiscardTgt:TgtChoose:X:Target player discards a card for each Swamp you control.:Mind Sludge - target player discards cards
|
spDiscardTgt:TgtChoose:X:Target player discards a card for each Swamp you control.:Mind Sludge - target player discards cards
|
||||||
SVar:X:Count$TypeYouCtrl.Swamp
|
SVar:X:Count$TypeYouCtrl.Swamp
|
||||||
|
|||||||
@@ -8514,62 +8514,63 @@ public class CardFactory implements NewConstants {
|
|||||||
for(int i = 0; i < Attached.length; i++) {
|
for(int i = 0; i < Attached.length; i++) {
|
||||||
if(Attached[i].isInstant() == true || Attached[i].hasKeyword("Flash") == true) Config.add(Attached[i]);
|
if(Attached[i].isInstant() == true || Attached[i].hasKeyword("Flash") == true) Config.add(Attached[i]);
|
||||||
}
|
}
|
||||||
for(int i = 0; i < Config.size(); i++) {
|
for(int i = 0; i < Config.size(); i++) {
|
||||||
Card crd = Config.get(i);
|
Card crd = Config.get(i);
|
||||||
Choices[i] = crd;
|
Choices[i] = crd;
|
||||||
}
|
}
|
||||||
if(Config.size() == 0) SystemsGo = false;
|
if(Config.size() == 0) SystemsGo = false;
|
||||||
} else {
|
} else {
|
||||||
for(int i = 0; i < Attached.length; i++) {
|
for(int i = 0; i < Attached.length; i++) {
|
||||||
Choices[i] = Attached[i];
|
Choices[i] = Attached[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Object check = null;
|
Object check = null;
|
||||||
if(SystemsGo == true) {
|
if(SystemsGo == true) {
|
||||||
check = AllZone.Display.getChoiceOptional("Select Card to play for free", Choices);
|
check = AllZone.Display.getChoiceOptional("Select Card to play for free", Choices);
|
||||||
if(check != null) {
|
if(check != null) {
|
||||||
target = ((Card) check);
|
target = ((Card) check);
|
||||||
}
|
}
|
||||||
if(target != null) c = copyCard(target);
|
if(target != null) c = copyCard(target);
|
||||||
|
|
||||||
if(c != null) {
|
if(c != null) {
|
||||||
if(c.isLand() == true) {
|
if(c.isLand() == true) {
|
||||||
if(AllZone.GameInfo.getHumanCanPlayNumberOfLands() > 0) {
|
if(CardFactoryUtil.canHumanPlayLand()) {
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
|
// todo(sol): would prefer this in GameAction.playLand somehow
|
||||||
play.add(c);
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
|
||||||
card.unattachCard(c);
|
play.add(c);
|
||||||
AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
card.unattachCard(c);
|
||||||
AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(true);
|
CardFactoryUtil.playLandEffects(c);
|
||||||
} else {
|
AllZone.GameInfo.incrementHumanPlayedLands();
|
||||||
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
} else {
|
||||||
}
|
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||||
} else if(c.isPermanent() == true && c.isAura() == false) {
|
}
|
||||||
c.removeIntrinsicKeyword("Flash"); // Stops the player from re-casting the flash spell.
|
} else if(c.isPermanent() == true && c.isAura() == false) {
|
||||||
PlayCreature.setStackDescription(c.getName() + " - Copied from Mind's Desire");
|
c.removeIntrinsicKeyword("Flash"); // Stops the player from re-casting the flash spell.
|
||||||
Card [] ReAttach = new Card[Attached.length];
|
PlayCreature.setStackDescription(c.getName() + " - Copied from Mind's Desire");
|
||||||
ReAttach[0] = c;
|
Card [] ReAttach = new Card[Attached.length];
|
||||||
int ReAttach_Count = 0;
|
ReAttach[0] = c;
|
||||||
for(int i = 0; i < Attached.length; i++) {
|
int ReAttach_Count = 0;
|
||||||
if(Attached[i] != target) {
|
for(int i = 0; i < Attached.length; i++) {
|
||||||
ReAttach_Count = ReAttach_Count + 1;
|
if(Attached[i] != target) {
|
||||||
ReAttach[ReAttach_Count] = Attached[i];
|
ReAttach_Count = ReAttach_Count + 1;
|
||||||
}
|
ReAttach[ReAttach_Count] = Attached[i];
|
||||||
}
|
}
|
||||||
// Clear Attached List
|
}
|
||||||
for(int i = 0; i < Attached.length; i++) {
|
// Clear Attached List
|
||||||
card.unattachCard(Attached[i]);
|
for(int i = 0; i < Attached.length; i++) {
|
||||||
}
|
card.unattachCard(Attached[i]);
|
||||||
// Re-add
|
}
|
||||||
for(int i = 0; i < ReAttach.length; i++) {
|
// Re-add
|
||||||
if(ReAttach[i] != null) card.attachCard(ReAttach[i]);
|
for(int i = 0; i < ReAttach.length; i++) {
|
||||||
}
|
if(ReAttach[i] != null) card.attachCard(ReAttach[i]);
|
||||||
target.addSpellAbility(PlayCreature);
|
}
|
||||||
AllZone.Stack.add(PlayCreature);
|
target.addSpellAbility(PlayCreature);
|
||||||
} else {
|
AllZone.Stack.add(PlayCreature);
|
||||||
AllZone.GameAction.playCardNoCost(c);
|
} else {
|
||||||
card.unattachCard(c);
|
AllZone.GameAction.playCardNoCost(c);
|
||||||
}
|
card.unattachCard(c);
|
||||||
} else JOptionPane.showMessageDialog(null, "Player cancelled or there is no more cards available on Mind's Desire.", "", JOptionPane.INFORMATION_MESSAGE);
|
}
|
||||||
|
} else JOptionPane.showMessageDialog(null, "Player cancelled or there is no more cards available on Mind's Desire.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||||
} else JOptionPane.showMessageDialog(null, "You can only play an instant at this point in time, but none are attached to Mind's Desire.", "", JOptionPane.INFORMATION_MESSAGE);
|
} else JOptionPane.showMessageDialog(null, "You can only play an instant at this point in time, but none are attached to Mind's Desire.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8804,11 +8805,9 @@ public class CardFactory implements NewConstants {
|
|||||||
Object check = AllZone.Display.getChoiceOptional("Select spells to play in reserve order: ", Pile1.toArray());
|
Object check = AllZone.Display.getChoiceOptional("Select spells to play in reserve order: ", Pile1.toArray());
|
||||||
if(check != null) {
|
if(check != null) {
|
||||||
if(((Card) check).isLand() == true) {
|
if(((Card) check).isLand() == true) {
|
||||||
if(AllZone.GameInfo.getHumanCanPlayNumberOfLands() > 0) {
|
if(CardFactoryUtil.canHumanPlayLand()) {
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||||
play.add(check);
|
GameAction.playLand((Card)check, play);
|
||||||
AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
|
||||||
AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(true);
|
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
@@ -8828,11 +8827,9 @@ public class CardFactory implements NewConstants {
|
|||||||
Object check = AllZone.Display.getChoiceOptional("Select spells to play in reserve order: ", Pile2.toArray());
|
Object check = AllZone.Display.getChoiceOptional("Select spells to play in reserve order: ", Pile2.toArray());
|
||||||
if(check != null) {
|
if(check != null) {
|
||||||
if(((Card) check).isLand() == true) {
|
if(((Card) check).isLand() == true) {
|
||||||
if(AllZone.GameInfo.getHumanCanPlayNumberOfLands() > 0) {
|
if(CardFactoryUtil.canHumanPlayLand()) {
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||||
play.add(check);
|
GameAction.playLand((Card)check, play);
|
||||||
AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
|
||||||
AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(true);
|
|
||||||
} else {
|
} else {
|
||||||
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
JOptionPane.showMessageDialog(null, "You can't play any more lands this turn.", "", JOptionPane.INFORMATION_MESSAGE);
|
||||||
}
|
}
|
||||||
@@ -20658,6 +20655,54 @@ public class CardFactory implements NewConstants {
|
|||||||
card.addSpellAbility(spell);
|
card.addSpellAbility(spell);
|
||||||
}//*************** END ************ END **************************
|
}//*************** END ************ END **************************
|
||||||
|
|
||||||
|
//*************** START *********** START **************************
|
||||||
|
else if(cardName.equals("Summer Bloom"))
|
||||||
|
{
|
||||||
|
final SpellAbility spell = new Spell(card) {
|
||||||
|
private static final long serialVersionUID = 5559004016728325736L;
|
||||||
|
|
||||||
|
public boolean canPlayAI() {
|
||||||
|
// The computer should only play this card if it has at least
|
||||||
|
// one land in its hand. Because of the way the computer turn
|
||||||
|
// is structured, it will already have played land to it's limit
|
||||||
|
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand,
|
||||||
|
Constant.Player.Computer);
|
||||||
|
|
||||||
|
CardList list = new CardList(hand.getCards());
|
||||||
|
|
||||||
|
list = list.getType("Land");
|
||||||
|
if (list.size() > 0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resolve() {
|
||||||
|
final String thePlayer = card.getController();
|
||||||
|
if (thePlayer.equals(Constant.Player.Human))
|
||||||
|
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(3);
|
||||||
|
else
|
||||||
|
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(3);
|
||||||
|
|
||||||
|
Command untilEOT = new Command()
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1665720009691293263L;
|
||||||
|
|
||||||
|
public void execute(){
|
||||||
|
if (thePlayer.equals(Constant.Player.Human))
|
||||||
|
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(-3);
|
||||||
|
else
|
||||||
|
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(-3);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
AllZone.EndOfTurn.addUntil(untilEOT);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
card.clearSpellAbility();
|
||||||
|
card.addSpellAbility(spell);
|
||||||
|
|
||||||
|
card.setSVar("PlayMain1", "TRUE");
|
||||||
|
} //*************** END ************ END **************************
|
||||||
|
|
||||||
//*************** START *********** START **************************
|
//*************** START *********** START **************************
|
||||||
else if(cardName.equals("Explore"))
|
else if(cardName.equals("Explore"))
|
||||||
@@ -20684,25 +20729,23 @@ public class CardFactory implements NewConstants {
|
|||||||
public void resolve() {
|
public void resolve() {
|
||||||
final String thePlayer = card.getController();
|
final String thePlayer = card.getController();
|
||||||
if (thePlayer.equals(Constant.Player.Human))
|
if (thePlayer.equals(Constant.Player.Human))
|
||||||
AllZone.GameInfo.addHumanCanPlayNumberOfLands(1);
|
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(1);
|
||||||
else
|
else
|
||||||
AllZone.GameInfo.addComputerCanPlayNumberOfLands(1);
|
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(1);
|
||||||
|
|
||||||
Command untilEOT = new Command()
|
Command untilEOT = new Command()
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = -2618916698575607634L;
|
private static final long serialVersionUID = -2618916698575607634L;
|
||||||
|
|
||||||
public void execute()
|
public void execute(){
|
||||||
{
|
|
||||||
if (thePlayer.equals(Constant.Player.Human))
|
if (thePlayer.equals(Constant.Player.Human))
|
||||||
AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(-1);
|
||||||
// There's no corresponding 'if' for the computer
|
else
|
||||||
// The computer's land total gets reset to the right value
|
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(-1);
|
||||||
// every turn
|
}
|
||||||
}
|
};
|
||||||
};
|
AllZone.EndOfTurn.addUntil(untilEOT);
|
||||||
AllZone.EndOfTurn.addUntil(untilEOT);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
card.clearSpellAbility();
|
card.clearSpellAbility();
|
||||||
|
|||||||
@@ -3801,26 +3801,6 @@ public class CardFactoryUtil {
|
|||||||
return list.size() > 0;
|
return list.size() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getCanPlayNumberOfLands(String player) {
|
|
||||||
int count = 1;
|
|
||||||
CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, player).getCards());
|
|
||||||
list = list.filter(new CardListFilter() {
|
|
||||||
public boolean addCard(Card c) {
|
|
||||||
return c.getName().equals("Exploration") || c.getName().equals("Azusa, Lost but Seeking")
|
|
||||||
|| c.getName().equals("Fastbond") || c.getName().equals("Oracle of Mul Daya");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
for(Card var:list) {
|
|
||||||
if(var.getName().equals("Exploration")) count++;
|
|
||||||
else if(var.getName().equals("Azusa, Lost but Seeking")) count = count + 2;
|
|
||||||
else if(var.getName().equals("Oracle of Mul Daya")) count = count + 1;
|
|
||||||
else if(var.getName().equals("Fastbond")) count = 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CardList getCards(String cardName)
|
public static CardList getCards(String cardName)
|
||||||
{
|
{
|
||||||
CardList list = new CardList();
|
CardList list = new CardList();
|
||||||
@@ -3831,17 +3811,12 @@ public class CardFactoryUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static CardList getCards(String cardName, String player) {
|
public static CardList getCards(String cardName, String player) {
|
||||||
CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, player).getCards());
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
|
||||||
|
CardList list = new CardList(play.getCards());
|
||||||
list = list.getName(cardName);
|
list = list.getName(cardName);
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CardList getFastbonds(String player) {
|
|
||||||
CardList list = new CardList(AllZone.getZone(Constant.Zone.Play, player).getCards());
|
|
||||||
list = list.getName("Fastbond");
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int countBasicLandTypes(String player) {
|
public static int countBasicLandTypes(String player) {
|
||||||
String basic[] = {"Forest", "Plains", "Mountain", "Island", "Swamp"};
|
String basic[] = {"Forest", "Plains", "Mountain", "Island", "Swamp"};
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, player);
|
||||||
@@ -4211,6 +4186,53 @@ public class CardFactoryUtil {
|
|||||||
c.setManaCost(cost);
|
c.setManaCost(cost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean canHumanPlayLand(){
|
||||||
|
return (AllZone.GameInfo.humanNumberLandPlaysLeft() > 0 || CardFactoryUtil.getCards("Fastbond", "Human").size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean canComputerPlayLand(){
|
||||||
|
return (AllZone.GameInfo.computerNumberLandPlaysLeft() > 0 || CardFactoryUtil.getCards("Fastbond", "Computer").size() > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void playLandEffects(Card c){
|
||||||
|
final String player = c.getController();
|
||||||
|
boolean extraLand;
|
||||||
|
if (player.equals("Human")){
|
||||||
|
extraLand = AllZone.GameInfo.humanPlayedFirstLandThisTurn();
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
extraLand = AllZone.GameInfo.computerPlayedFirstLandThisTurn();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(extraLand) {
|
||||||
|
CardList fastbonds = CardFactoryUtil.getCards("Fastbond", player);
|
||||||
|
for(final Card f : fastbonds){
|
||||||
|
SpellAbility ability = new Ability(f, "0") {
|
||||||
|
@Override
|
||||||
|
public void resolve() {
|
||||||
|
AllZone.GameAction.getPlayerLife(f.getController()).subtractLife(1,f);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ability.setStackDescription("Fastbond - Deals 1 damage to you.");
|
||||||
|
AllZone.Stack.add(ability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CardList greedy = CardFactoryUtil.getCards("Horn of Greed");
|
||||||
|
if (!greedy.isEmpty()){
|
||||||
|
for(final Card g : greedy){
|
||||||
|
SpellAbility ability = new Ability(g, "0") {
|
||||||
|
@Override
|
||||||
|
public void resolve() {
|
||||||
|
AllZone.GameAction.drawCard(player);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ability.setStackDescription("Horn of Greed - " + player + " draws a card.");
|
||||||
|
AllZone.Stack.add(ability);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
CardList in = AllZone.CardFactory.getAllCards();
|
CardList in = AllZone.CardFactory.getAllCards();
|
||||||
|
|||||||
@@ -2704,29 +2704,28 @@ public class CardFactory_Creatures {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
CardList library = new CardList(AllZone.getZone(Constant.Zone.Library, card.getController()).getCards());
|
CardList library = new CardList(AllZone.getZone(Constant.Zone.Library, card.getController()).getCards());
|
||||||
CardList Fastbond = new CardList(AllZone.getZone(Constant.Zone.Play, card.getController()).getCards());
|
Card top = library.get(0);
|
||||||
Fastbond = Fastbond.getName("Fastbond");
|
|
||||||
if(library.size() > 0) {
|
if(library.size() > 0 && top.getType().contains("Land") ) {
|
||||||
if(library.get(0).getType().contains("Land")) {
|
boolean canPlayLand = false;
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
boolean isHuman = false;
|
||||||
AllZone.GameAction.moveTo(play, library.get(0));
|
if(card.getController() == Constant.Player.Human){
|
||||||
if(card.getController() == Constant.Player.Human) {
|
canPlayLand = CardFactoryUtil.canHumanPlayLand();
|
||||||
AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
isHuman = true;
|
||||||
if(AllZone.GameInfo.humanPlayedFirstLandThisTurn() == true) {
|
}
|
||||||
for(int i = 0; i < Fastbond.size(); i++)
|
else{
|
||||||
AllZone.GameAction.addDamage(card.getController(), 1,Fastbond.get(0));
|
canPlayLand = CardFactoryUtil.canComputerPlayLand();
|
||||||
}
|
|
||||||
AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(true);
|
|
||||||
}
|
}
|
||||||
else {
|
if (canPlayLand){
|
||||||
AllZone.GameInfo.addComputerCanPlayNumberOfLands(-1);
|
//todo(sol): would prefer to use GameAction.playLand(top, play) but it doesn't work
|
||||||
if(AllZone.GameInfo.computerPlayedFirstLandThisTurn() == true) {
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||||
for(int i = 0; i < Fastbond.size(); i++)
|
Card land = AllZone.GameAction.moveTo(play, top);
|
||||||
AllZone.GameAction.addDamage(card.getController(), 1,Fastbond.get(0));
|
CardFactoryUtil.playLandEffects(land);
|
||||||
}
|
if (isHuman)
|
||||||
AllZone.GameInfo.setComputerPlayedFirstLandThisTurn(true);
|
AllZone.GameInfo.incrementHumanPlayedLands();
|
||||||
}
|
else
|
||||||
}
|
AllZone.GameInfo.incrementComputerPlayedLands();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}//resolve()
|
}//resolve()
|
||||||
|
|
||||||
@@ -2735,11 +2734,11 @@ public class CardFactory_Creatures {
|
|||||||
CardList library = new CardList(AllZone.getZone(Constant.Zone.Library, card.getController()).getCards());
|
CardList library = new CardList(AllZone.getZone(Constant.Zone.Library, card.getController()).getCards());
|
||||||
if(library.size() == 0) return false;
|
if(library.size() == 0) return false;
|
||||||
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
PlayerZone play = AllZone.getZone(Constant.Zone.Play, card.getController());
|
||||||
int PlayLand = 0;
|
boolean canPlayLand = false;
|
||||||
if(card.getController() == Constant.Player.Human) PlayLand = AllZone.GameInfo.getHumanCanPlayNumberOfLands();
|
if(card.getController() == Constant.Player.Human) canPlayLand = CardFactoryUtil.canHumanPlayLand();
|
||||||
else PlayLand = AllZone.GameInfo.getComputerCanPlayNumberOfLands();
|
else canPlayLand = CardFactoryUtil.canComputerPlayLand();
|
||||||
|
|
||||||
return (AllZone.GameAction.isCardInZone(card, play) && library.get(0).getType().contains("Land") && PlayLand > 0)
|
return (AllZone.GameAction.isCardInZone(card, play) && library.get(0).getType().contains("Land") && canPlayLand)
|
||||||
&& (AllZone.Stack.size() == 0) && AllZone.GameAction.getLastPlayerToDraw().equals(card.getController());
|
&& (AllZone.Stack.size() == 0) && AllZone.GameAction.getLastPlayerToDraw().equals(card.getController());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,13 +8,9 @@ import forge.error.ErrorViewer;
|
|||||||
|
|
||||||
|
|
||||||
public class ComputerAI_Burn implements Computer {
|
public class ComputerAI_Burn implements Computer {
|
||||||
private volatile int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
|
||||||
|
|
||||||
public void main1() {
|
public void main1() {
|
||||||
if(numberPlayLand > 0) {
|
ComputerUtil.chooseLandsToPlay();
|
||||||
numberPlayLand--;
|
|
||||||
ComputerUtil.playLand();
|
|
||||||
}
|
|
||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized(ComputerAI_Burn.this) {
|
synchronized(ComputerAI_Burn.this) {
|
||||||
@@ -56,8 +52,7 @@ public class ComputerAI_Burn implements Computer {
|
|||||||
}//main1()
|
}//main1()
|
||||||
|
|
||||||
public void main2() {
|
public void main2() {
|
||||||
numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
ComputerUtil.chooseLandsToPlay();
|
||||||
|
|
||||||
//AllZone.Phase.nextPhase();
|
//AllZone.Phase.nextPhase();
|
||||||
//for debugging: System.out.println("need to nextPhase(ComputerAI_Burn.main2) = true; Note, this is untested, did it work?");
|
//for debugging: System.out.println("need to nextPhase(ComputerAI_Burn.main2) = true; Note, this is untested, did it work?");
|
||||||
AllZone.Phase.setNeedToNextPhase(true);
|
AllZone.Phase.setNeedToNextPhase(true);
|
||||||
@@ -137,16 +132,6 @@ public class ComputerAI_Burn implements Computer {
|
|||||||
return library.toArray();
|
return library.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNumberPlayLands(int n)
|
|
||||||
{
|
|
||||||
numberPlayLand += n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumberPlayLands(int n)
|
|
||||||
{
|
|
||||||
numberPlayLand = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stack_not_empty() {
|
public void stack_not_empty() {
|
||||||
//same as Input.stop() method
|
//same as Input.stop() method
|
||||||
//ends the method
|
//ends the method
|
||||||
|
|||||||
@@ -6,21 +6,9 @@ import forge.error.ErrorViewer;
|
|||||||
|
|
||||||
|
|
||||||
public class ComputerAI_Burn2 implements Computer {
|
public class ComputerAI_Burn2 implements Computer {
|
||||||
private volatile int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
|
||||||
|
|
||||||
public void main1() {
|
public void main1() {
|
||||||
if(numberPlayLand > 0 ) {
|
ComputerUtil.chooseLandsToPlay();
|
||||||
numberPlayLand--;
|
|
||||||
ComputerUtil.playLand();
|
|
||||||
|
|
||||||
Card c[] = AllZone.Computer_Hand.getCards();
|
|
||||||
if(c.length != 0) {
|
|
||||||
// System.out.print("hand - ");
|
|
||||||
// for(int i = 0; i < c.length; i++)
|
|
||||||
// System.out.print(c[i] +" ");
|
|
||||||
// System.out.println();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Runnable run = new Runnable() {
|
Runnable run = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized(ComputerAI_Burn2.this) {
|
synchronized(ComputerAI_Burn2.this) {
|
||||||
@@ -71,8 +59,7 @@ public class ComputerAI_Burn2 implements Computer {
|
|||||||
}//main1()
|
}//main1()
|
||||||
|
|
||||||
public void main2() {
|
public void main2() {
|
||||||
numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
ComputerUtil.chooseLandsToPlay();
|
||||||
|
|
||||||
//AllZone.Phase.nextPhase();
|
//AllZone.Phase.nextPhase();
|
||||||
//for debugging: System.out.println("need to nextPhase(ComputerAI_Burn2.main2) = true; Note, this is not tested, did it work?");
|
//for debugging: System.out.println("need to nextPhase(ComputerAI_Burn2.main2) = true; Note, this is not tested, did it work?");
|
||||||
AllZone.Phase.setNeedToNextPhase(true);
|
AllZone.Phase.setNeedToNextPhase(true);
|
||||||
@@ -176,16 +163,6 @@ public class ComputerAI_Burn2 implements Computer {
|
|||||||
return library.toArray();
|
return library.toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNumberPlayLands(int n)
|
|
||||||
{
|
|
||||||
numberPlayLand += n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumberPlayLands(int n)
|
|
||||||
{
|
|
||||||
numberPlayLand = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stack_not_empty() {
|
public void stack_not_empty() {
|
||||||
//same as Input.stop() method
|
//same as Input.stop() method
|
||||||
//ends the method
|
//ends the method
|
||||||
|
|||||||
@@ -22,40 +22,13 @@ public class ComputerAI_General implements Computer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void main1() {
|
public void main1() {
|
||||||
if(AllZone.GameInfo.getComputerCanPlayNumberOfLands() > 0) {
|
ComputerUtil.chooseLandsToPlay();
|
||||||
|
|
||||||
AllZone.GameInfo.addComputerCanPlayNumberOfLands(-1);
|
|
||||||
ComputerUtil.playLand();
|
|
||||||
for(String effect:AllZone.StaticEffects.getStateBasedMap().keySet()) {
|
|
||||||
Command com = GameActionUtil.commands.get(effect);
|
|
||||||
com.execute();
|
|
||||||
}
|
|
||||||
GameActionUtil.executeCardStateEffects();
|
|
||||||
}
|
|
||||||
|
|
||||||
// AllZone.Phase.nextPhase();
|
|
||||||
|
|
||||||
playCards(Constant.Phase.Main1);
|
playCards(Constant.Phase.Main1);
|
||||||
|
|
||||||
//for cards like Exploration, Fastbond, Azusa, ...
|
|
||||||
while(AllZone.GameInfo.getComputerCanPlayNumberOfLands() > 0)
|
|
||||||
{
|
|
||||||
AllZone.GameInfo.addComputerCanPlayNumberOfLands(-1);
|
|
||||||
ComputerUtil.playLand();
|
|
||||||
|
|
||||||
for(String effect:AllZone.StaticEffects.getStateBasedMap().keySet()) {
|
|
||||||
Command com = GameActionUtil.commands.get(effect);
|
|
||||||
com.execute();
|
|
||||||
}
|
|
||||||
GameActionUtil.executeCardStateEffects();
|
|
||||||
}
|
|
||||||
}//main1()
|
}//main1()
|
||||||
|
|
||||||
public void main2() {
|
public void main2() {
|
||||||
AllZone.GameInfo.setComputerCanPlayNumberOfLands(CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer));
|
ComputerUtil.chooseLandsToPlay(); // in case we can play more lands now, or drew cards since first main phase
|
||||||
|
|
||||||
playCards(Constant.Phase.Main2);
|
playCards(Constant.Phase.Main2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void playCards(final String phase) {
|
private void playCards(final String phase) {
|
||||||
|
|||||||
@@ -3,35 +3,30 @@ import java.util.*;
|
|||||||
|
|
||||||
public class ComputerAI_Rats2 implements Computer
|
public class ComputerAI_Rats2 implements Computer
|
||||||
{
|
{
|
||||||
private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
|
||||||
|
|
||||||
private static Random random = new Random();
|
private static Random random = new Random();
|
||||||
|
|
||||||
public void main1()
|
public void main1()
|
||||||
{
|
{
|
||||||
if(numberPlayLand > 0)
|
ComputerUtil.chooseLandsToPlay();
|
||||||
{
|
|
||||||
numberPlayLand--;
|
|
||||||
ComputerUtil.playLand();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(playActivatedAbilities() || playSorcery())
|
// if(playActivatedAbilities() || playSorcery())
|
||||||
// return;
|
// return;
|
||||||
Card[] c = AllZone.Computer_Hand.getCards();
|
Card[] c = AllZone.Computer_Hand.getCards();
|
||||||
System.out.println("Computer Thinking " +new CardList(c));
|
System.out.println("Computer Thinking " +new CardList(c));
|
||||||
|
|
||||||
//AllZone.Phase.nextPhase();
|
//AllZone.Phase.nextPhase();
|
||||||
//for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.main1) = true");
|
//for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.main1) = true");
|
||||||
AllZone.Phase.setNeedToNextPhase(true);
|
AllZone.Phase.setNeedToNextPhase(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void main2()
|
public void main2()
|
||||||
{
|
{
|
||||||
numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
ComputerUtil.chooseLandsToPlay();
|
||||||
|
|
||||||
//AllZone.Phase.nextPhase();
|
//AllZone.Phase.nextPhase();
|
||||||
//for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.main2) = true");
|
//for debugging: System.out.println("need to nextPhase(ComputerAI_Rats2.main2) = true");
|
||||||
AllZone.Phase.setNeedToNextPhase(true);
|
AllZone.Phase.setNeedToNextPhase(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void declare_blockers()
|
public void declare_blockers()
|
||||||
{
|
{
|
||||||
if(random.nextBoolean() || AllZone.Computer_Life.getLife() < 10)
|
if(random.nextBoolean() || AllZone.Computer_Life.getLife() < 10)
|
||||||
@@ -145,16 +140,6 @@ public class ComputerAI_Rats2 implements Computer
|
|||||||
AllZone.Phase.setNeedToNextPhase(true);
|
AllZone.Phase.setNeedToNextPhase(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNumberPlayLands(int n)
|
|
||||||
{
|
|
||||||
numberPlayLand += n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumberPlayLands(int n)
|
|
||||||
{
|
|
||||||
numberPlayLand = n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stack_not_empty()
|
public void stack_not_empty()
|
||||||
{
|
{
|
||||||
AllZone.InputControl.resetInput();
|
AllZone.InputControl.resetInput();
|
||||||
|
|||||||
@@ -1,20 +1,17 @@
|
|||||||
package forge;
|
package forge;
|
||||||
public class ComputerAI_Testing implements Computer
|
public class ComputerAI_Testing implements Computer
|
||||||
{
|
{
|
||||||
|
|
||||||
private int numberPlayLand = CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Computer);
|
|
||||||
|
|
||||||
//must shuffle this
|
//must shuffle this
|
||||||
public Card[] getLibrary() {return new Card[] {};}
|
public Card[] getLibrary() {return new Card[] {};}
|
||||||
|
|
||||||
public void stack_not_empty()
|
public void stack_not_empty()
|
||||||
{
|
{
|
||||||
System.out.println("Computer: not empty");
|
System.out.println("Computer: not empty");
|
||||||
//same as Input.stop() method
|
//same as Input.stop() method
|
||||||
//ends the method
|
//ends the method
|
||||||
//different than methods because this isn't a phase like Main1 or Declare Attackers
|
//different than methods because this isn't a phase like Main1 or Declare Attackers
|
||||||
AllZone.InputControl.resetInput();
|
AllZone.InputControl.resetInput();
|
||||||
AllZone.InputControl.updateObservers();
|
AllZone.InputControl.updateObservers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void main1() {AllZone.Phase.nextPhase();}
|
public void main1() {AllZone.Phase.nextPhase();}
|
||||||
@@ -70,15 +67,5 @@ public class ComputerAI_Testing implements Computer
|
|||||||
//AllZone.Phase.nextPhase();
|
//AllZone.Phase.nextPhase();
|
||||||
//for debugging: System.out.println("need to nextPhase(ComputerAI_Testing.end_of_turn) = true");
|
//for debugging: System.out.println("need to nextPhase(ComputerAI_Testing.end_of_turn) = true");
|
||||||
AllZone.Phase.setNeedToNextPhase(true);
|
AllZone.Phase.setNeedToNextPhase(true);
|
||||||
}
|
|
||||||
|
|
||||||
public void addNumberPlayLands(int n)
|
|
||||||
{
|
|
||||||
numberPlayLand += n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setNumberPlayLands(int n)
|
|
||||||
{
|
|
||||||
numberPlayLand = n;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -370,32 +370,34 @@ public class ComputerUtil
|
|||||||
}//getAvailableMana()
|
}//getAvailableMana()
|
||||||
|
|
||||||
//plays a land if one is available
|
//plays a land if one is available
|
||||||
static public void playLand()
|
static public void chooseLandsToPlay()
|
||||||
{
|
{
|
||||||
ArrayList<Card> landList = PlayerZoneUtil.getCardType(AllZone.Computer_Hand, "Land");
|
ArrayList<Card> landList = PlayerZoneUtil.getCardType(AllZone.Computer_Hand, "Land");
|
||||||
if(! landList.isEmpty())
|
while(!landList.isEmpty() && (AllZone.GameInfo.computerNumberLandPlaysLeft() > 0 ||
|
||||||
{
|
CardFactoryUtil.getCards("Fastbond", "Computer").size() > 0)){
|
||||||
int ix = 0;
|
// play as many lands as you can
|
||||||
while (landList.get(ix).isReflectedLand() && (ix+1 < landList.size())) {
|
int ix = 0;
|
||||||
// Play reflected lands LAST so that there is colored mana in play
|
while (landList.get(ix).isReflectedLand() && (ix+1 < landList.size())) {
|
||||||
// Don't increment past the end of the list!
|
// Skip through reflected lands. Choose last if they are all reflected.
|
||||||
ix++;
|
ix++;
|
||||||
}
|
}
|
||||||
AllZone.Computer_Hand.remove(landList.get(ix));
|
|
||||||
AllZone.Computer_Play.add(landList.get(ix));
|
|
||||||
|
|
||||||
if (!AllZone.GameInfo.computerPlayedFirstLandThisTurn()) {
|
Card land = landList.get(ix);
|
||||||
AllZone.GameInfo.setComputerPlayedFirstLandThisTurn(true);
|
landList.remove(ix);
|
||||||
}
|
playLand(land, AllZone.Computer_Hand);
|
||||||
else
|
|
||||||
{
|
|
||||||
if (CardFactoryUtil.getFastbonds(Constant.Player.Computer).size() > 0)
|
|
||||||
AllZone.GameAction.getPlayerLife(Constant.Player.Computer).subtractLife(1,CardFactoryUtil.getFastbonds(Constant.Player.Computer).get(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
AllZone.GameAction.checkStateEffects();
|
AllZone.GameAction.checkStateEffects();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public void playLand(Card land, PlayerZone zone)
|
||||||
|
{
|
||||||
|
zone.remove(land);
|
||||||
|
AllZone.Computer_Play.add(land);
|
||||||
|
CardFactoryUtil.playLandEffects(land);
|
||||||
|
AllZone.GameInfo.incrementComputerPlayedLands();
|
||||||
|
}
|
||||||
|
|
||||||
static public void untapDraw()
|
static public void untapDraw()
|
||||||
{
|
{
|
||||||
AllZone.GameAction.drawCard(Constant.Player.Computer);
|
AllZone.GameAction.drawCard(Constant.Player.Computer);
|
||||||
|
|||||||
@@ -1654,8 +1654,8 @@ public class GameAction {
|
|||||||
|
|
||||||
lastPlayerToDraw = Constant.Player.Human;
|
lastPlayerToDraw = Constant.Player.Human;
|
||||||
|
|
||||||
AllZone.GameInfo.setComputerCanPlayNumberOfLands(1);
|
AllZone.GameInfo.setComputerMaxPlayNumberOfLands(1);
|
||||||
AllZone.GameInfo.setHumanCanPlayNumberOfLands(1);
|
AllZone.GameInfo.setHumanMaxPlayNumberOfLands(1);
|
||||||
|
|
||||||
AllZone.GameInfo.setPreventCombatDamageThisTurn(false);
|
AllZone.GameInfo.setPreventCombatDamageThisTurn(false);
|
||||||
AllZone.GameInfo.setHumanNumberOfTimesMulliganed(0);
|
AllZone.GameInfo.setHumanNumberOfTimesMulliganed(0);
|
||||||
@@ -2043,8 +2043,7 @@ public class GameAction {
|
|||||||
|
|
||||||
ArrayList<String> choices = new ArrayList<String>();
|
ArrayList<String> choices = new ArrayList<String>();
|
||||||
|
|
||||||
if(AllZone.GameInfo.getHumanCanPlayNumberOfLands() > 0
|
if(AllZone.Stack.size() == 0 && CardFactoryUtil.canHumanPlayLand()
|
||||||
&& AllZone.Stack.size() == 0
|
|
||||||
&& (AllZone.Phase.getPhase().equals(Constant.Phase.Main1) || AllZone.Phase.getPhase().equals(
|
&& (AllZone.Phase.getPhase().equals(Constant.Phase.Main1) || AllZone.Phase.getPhase().equals(
|
||||||
Constant.Phase.Main2))) choices.add("Play land");
|
Constant.Phase.Main2))) choices.add("Play land");
|
||||||
|
|
||||||
@@ -2066,10 +2065,7 @@ public class GameAction {
|
|||||||
|
|
||||||
if(choice == null) ;
|
if(choice == null) ;
|
||||||
else if(choice.equals("Play land")) {
|
else if(choice.equals("Play land")) {
|
||||||
AllZone.Human_Hand.remove(c);
|
playLand(c, AllZone.Human_Hand);
|
||||||
AllZone.Human_Play.add(c);
|
|
||||||
AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
|
||||||
AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(true);
|
|
||||||
} else {
|
} else {
|
||||||
SpellAbility sa = map.get(choice);
|
SpellAbility sa = map.get(choice);
|
||||||
playSpellAbility(sa);
|
playSpellAbility(sa);
|
||||||
@@ -2094,6 +2090,16 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static public void playLand(Card land, PlayerZone zone)
|
||||||
|
{
|
||||||
|
if (CardFactoryUtil.canHumanPlayLand()){
|
||||||
|
zone.remove(land);
|
||||||
|
AllZone.Human_Play.add(land);
|
||||||
|
CardFactoryUtil.playLandEffects(land);
|
||||||
|
AllZone.GameInfo.incrementHumanPlayedLands();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void playCardNoCost(Card c) {
|
public void playCardNoCost(Card c) {
|
||||||
//SpellAbility[] choices = (SpellAbility[]) c.getSpells().toArray();
|
//SpellAbility[] choices = (SpellAbility[]) c.getSpells().toArray();
|
||||||
ArrayList<SpellAbility> choices = c.getBasicSpells();
|
ArrayList<SpellAbility> choices = c.getBasicSpells();
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
package forge;
|
package forge;
|
||||||
|
|
||||||
public class GameInfo {
|
public class GameInfo {
|
||||||
private int computerCanPlayNumberOfLands;
|
private int computerMaxPlayNumberOfLands = 1;
|
||||||
private int humanCanPlayNumberOfLands;
|
private int humanMaxPlayNumberOfLands = 1;
|
||||||
|
|
||||||
|
private int computerLandsPlayedThisTurn = 0;
|
||||||
|
private int humanLandsPlayedThisTurn = 0;
|
||||||
|
|
||||||
private boolean computerStartedThisGame = false;
|
private boolean computerStartedThisGame = false;
|
||||||
|
|
||||||
private boolean computerPlayedFirstLandThisTurn;
|
|
||||||
private boolean humanPlayedFirstLandThisTurn;
|
|
||||||
|
|
||||||
private int humanNumberOfTimesMulliganed;
|
private int humanNumberOfTimesMulliganed;
|
||||||
private boolean humanMulliganedToZero;
|
private boolean humanMulliganedToZero;
|
||||||
|
|
||||||
@@ -16,47 +16,66 @@ public class GameInfo {
|
|||||||
private boolean assignedFirstStrikeDamageThisCombat;
|
private boolean assignedFirstStrikeDamageThisCombat;
|
||||||
private boolean resolvedFirstStrikeDamageThisCombat;
|
private boolean resolvedFirstStrikeDamageThisCombat;
|
||||||
|
|
||||||
public void setComputerCanPlayNumberOfLands(int n) {
|
public void setComputerMaxPlayNumberOfLands(int n) {
|
||||||
computerCanPlayNumberOfLands = n;
|
computerMaxPlayNumberOfLands = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getComputerCanPlayNumberOfLands() {
|
public void addComputerMaxPlayNumberOfLands(int n)
|
||||||
return computerCanPlayNumberOfLands;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addComputerCanPlayNumberOfLands(int n)
|
|
||||||
{
|
{
|
||||||
computerCanPlayNumberOfLands += n;
|
computerMaxPlayNumberOfLands += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHumanCanPlayNumberOfLands(int n) {
|
public void setHumanMaxPlayNumberOfLands(int n) {
|
||||||
humanCanPlayNumberOfLands = n;
|
humanMaxPlayNumberOfLands = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHumanCanPlayNumberOfLands() {
|
public void addHumanMaxPlayNumberOfLands(int n)
|
||||||
return humanCanPlayNumberOfLands;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addHumanCanPlayNumberOfLands(int n)
|
|
||||||
{
|
{
|
||||||
humanCanPlayNumberOfLands += n;
|
humanMaxPlayNumberOfLands += n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setComputerPlayedLands(int n) {
|
||||||
|
computerLandsPlayedThisTurn = n;
|
||||||
|
}
|
||||||
|
|
||||||
public void setComputerPlayedFirstLandThisTurn(boolean b) {
|
public int getComputerPlayedLands() {
|
||||||
computerPlayedFirstLandThisTurn = b;
|
return computerLandsPlayedThisTurn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementComputerPlayedLands()
|
||||||
|
{
|
||||||
|
computerLandsPlayedThisTurn++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHumanPlayedLands(int n) {
|
||||||
|
humanLandsPlayedThisTurn = n;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHumanPlayedLands() {
|
||||||
|
return humanLandsPlayedThisTurn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void incrementHumanPlayedLands()
|
||||||
|
{
|
||||||
|
humanLandsPlayedThisTurn++;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int computerNumberLandPlaysLeft()
|
||||||
|
{
|
||||||
|
return computerMaxPlayNumberOfLands - computerLandsPlayedThisTurn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int humanNumberLandPlaysLeft()
|
||||||
|
{
|
||||||
|
return humanMaxPlayNumberOfLands - humanLandsPlayedThisTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean computerPlayedFirstLandThisTurn() {
|
public boolean computerPlayedFirstLandThisTurn() {
|
||||||
return computerPlayedFirstLandThisTurn;
|
return (computerLandsPlayedThisTurn > 0);
|
||||||
}
|
|
||||||
|
|
||||||
public void setHumanPlayedFirstLandThisTurn(boolean b) {
|
|
||||||
humanPlayedFirstLandThisTurn = b;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean humanPlayedFirstLandThisTurn() {
|
public boolean humanPlayedFirstLandThisTurn() {
|
||||||
return humanPlayedFirstLandThisTurn;
|
return (humanLandsPlayedThisTurn > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHumanNumberOfTimesMulliganed()
|
public int getHumanNumberOfTimesMulliganed()
|
||||||
|
|||||||
@@ -13,39 +13,28 @@ public class InputUtil
|
|||||||
//plays activated abilities and any card including land, sorceries, and instants
|
//plays activated abilities and any card including land, sorceries, and instants
|
||||||
static public void playAnyCard(Card card, PlayerZone zone)
|
static public void playAnyCard(Card card, PlayerZone zone)
|
||||||
{
|
{
|
||||||
if(zone.is(Constant.Zone.Hand, Constant.Player.Human) &&
|
if(zone.is(Constant.Zone.Hand, Constant.Player.Human) &&
|
||||||
(card.isLand()))
|
(card.isLand()))
|
||||||
{
|
|
||||||
|
|
||||||
//hacky stuff: see if there's cycling/transmute/other hand abilities on the land:
|
|
||||||
SpellAbility[] sa = card.getSpellAbility();
|
|
||||||
if (sa.length > 0)
|
|
||||||
{
|
{
|
||||||
int count = 0;
|
|
||||||
for (SpellAbility s : sa)
|
//hacky stuff: see if there's cycling/transmute/other hand abilities on the land:
|
||||||
|
SpellAbility[] sa = card.getSpellAbility();
|
||||||
|
if (sa.length > 0)
|
||||||
{
|
{
|
||||||
if (s.canPlay() && (s instanceof Ability_Hand))
|
int count = 0;
|
||||||
count++;
|
for (SpellAbility s : sa)
|
||||||
|
{
|
||||||
|
if (s.canPlay() && (s instanceof Ability_Hand))
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
if (count > 0)
|
||||||
|
AllZone.GameAction.playCard(card);
|
||||||
|
else //play the land
|
||||||
|
GameAction.playLand(card, zone);
|
||||||
}
|
}
|
||||||
if (count > 0)
|
|
||||||
AllZone.GameAction.playCard(card);
|
|
||||||
else //play the land
|
else //play the land
|
||||||
{
|
GameAction.playLand(card, zone);
|
||||||
AllZone.Human_Hand.remove(card);
|
} //land
|
||||||
AllZone.Human_Play.add(card);
|
|
||||||
AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
|
||||||
AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else //play the land
|
|
||||||
{
|
|
||||||
AllZone.Human_Hand.remove(card);
|
|
||||||
AllZone.Human_Play.add(card);
|
|
||||||
AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
|
||||||
AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(true);
|
|
||||||
}
|
|
||||||
} //land
|
|
||||||
/**
|
/**
|
||||||
else if(zone.is(Constant.Zone.Hand, Constant.Player.Human) &&
|
else if(zone.is(Constant.Zone.Hand, Constant.Player.Human) &&
|
||||||
card.getManaCost().equals("0"))//for Mox Ruby and the like
|
card.getManaCost().equals("0"))//for Mox Ruby and the like
|
||||||
|
|||||||
@@ -22,9 +22,7 @@ public class Input_Draw extends Input {
|
|||||||
|| humanCards.containsName("Yawgmoth's Bargain");
|
|| humanCards.containsName("Yawgmoth's Bargain");
|
||||||
|
|
||||||
if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw) && humanSkipsDrawPhase) {
|
if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw) && humanSkipsDrawPhase) {
|
||||||
//Input_Main.canPlayLand = true;
|
AllZone.GameInfo.setHumanPlayedLands(0);
|
||||||
AllZone.GameInfo.setHumanCanPlayNumberOfLands(CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Human));
|
|
||||||
AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(false);
|
|
||||||
AllZone.Phase.setNeedToNextPhase(true);
|
AllZone.Phase.setNeedToNextPhase(true);
|
||||||
|
|
||||||
} else { //continue with draw phase
|
} else { //continue with draw phase
|
||||||
@@ -54,8 +52,7 @@ public class Input_Draw extends Input {
|
|||||||
if(drawCard && AllZone.Phase.getTurn() > 1) AllZone.GameAction.drawCard(Constant.Player.Human);
|
if(drawCard && AllZone.Phase.getTurn() > 1) AllZone.GameAction.drawCard(Constant.Player.Human);
|
||||||
|
|
||||||
if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw)) {
|
if(AllZone.Phase.getPhase().equals(Constant.Phase.Draw)) {
|
||||||
AllZone.GameInfo.setHumanCanPlayNumberOfLands(CardFactoryUtil.getCanPlayNumberOfLands(Constant.Player.Human));
|
AllZone.GameInfo.setHumanPlayedLands(0);
|
||||||
AllZone.GameInfo.setHumanPlayedFirstLandThisTurn(false);
|
|
||||||
|
|
||||||
//AllZone.Phase.nextPhase();
|
//AllZone.Phase.nextPhase();
|
||||||
//for debugging: System.out.println("need to nextPhase(from Input_Draw on human's draw) = true");
|
//for debugging: System.out.println("need to nextPhase(from Input_Draw on human's draw) = true");
|
||||||
|
|||||||
@@ -29,16 +29,8 @@ public class Input_Main extends Input {
|
|||||||
public void selectCard(Card card, PlayerZone zone) {
|
public void selectCard(Card card, PlayerZone zone) {
|
||||||
//these if statements cannot be combined
|
//these if statements cannot be combined
|
||||||
if(card.isLand() && zone.is(Constant.Zone.Hand, Constant.Player.Human)) {
|
if(card.isLand() && zone.is(Constant.Zone.Hand, Constant.Player.Human)) {
|
||||||
if(AllZone.GameInfo.getHumanCanPlayNumberOfLands() > 0) {
|
if(CardFactoryUtil.canHumanPlayLand()) {
|
||||||
CardList fastbonds = CardFactoryUtil.getFastbonds(Constant.Player.Human);
|
|
||||||
if(fastbonds.size() > 0) {
|
|
||||||
if(AllZone.GameInfo.humanPlayedFirstLandThisTurn()) {
|
|
||||||
AllZone.GameAction.getPlayerLife(Constant.Player.Human).subtractLife(1,fastbonds.get(0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
InputUtil.playAnyCard(card, zone);
|
InputUtil.playAnyCard(card, zone);
|
||||||
//canPlayNumberOfLands--;
|
|
||||||
//firstLandHasBeenPlayed = true;
|
|
||||||
AllZone.GameAction.checkStateEffects();
|
AllZone.GameAction.checkStateEffects();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -53,13 +45,9 @@ public class Input_Main extends Input {
|
|||||||
if(count > 0) InputUtil.playAnyCard(card, zone);
|
if(count > 0) InputUtil.playAnyCard(card, zone);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//TODO: add code for exploration / fastbond here
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// SpellAbility sa = card.getSpellAbility()[0];
|
|
||||||
// sa.setRandomTargetAI();
|
|
||||||
// AllZone.Stack.add(sa);
|
|
||||||
InputUtil.playAnyCard(card, zone);
|
InputUtil.playAnyCard(card, zone);
|
||||||
}
|
}
|
||||||
|
AllZone.GameAction.checkStateEffects();
|
||||||
}//selectCard()
|
}//selectCard()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -240,6 +240,7 @@ public class Phase extends MyObservable
|
|||||||
PlayerCreatureSpellCount = 0;
|
PlayerCreatureSpellCount = 0;
|
||||||
ComputerSpellCount = 0;
|
ComputerSpellCount = 0;
|
||||||
ComputerCreatureSpellCount = 0;
|
ComputerCreatureSpellCount = 0;
|
||||||
|
AllZone.GameInfo.setHumanPlayedLands(0);
|
||||||
turn++;
|
turn++;
|
||||||
/*
|
/*
|
||||||
if (humanExtraTurns > 0)
|
if (humanExtraTurns > 0)
|
||||||
@@ -255,7 +256,7 @@ public class Phase extends MyObservable
|
|||||||
PlayerCreatureSpellCount = 0;
|
PlayerCreatureSpellCount = 0;
|
||||||
ComputerSpellCount = 0;
|
ComputerSpellCount = 0;
|
||||||
ComputerCreatureSpellCount = 0;
|
ComputerCreatureSpellCount = 0;
|
||||||
AllZone.GameInfo.setComputerPlayedFirstLandThisTurn(false);
|
AllZone.GameInfo.setComputerPlayedLands(0);
|
||||||
turn++;
|
turn++;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -265,14 +266,12 @@ public class Phase extends MyObservable
|
|||||||
computerExtraTurns++;
|
computerExtraTurns++;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
if(is(Constant.Phase.Main1, Constant.Player.Human)) {
|
if(turn == 1 && is(Constant.Phase.Main1, Constant.Player.Human)) {
|
||||||
if(turn == 1) {
|
|
||||||
StormCount = 0;
|
StormCount = 0;
|
||||||
PlayerSpellCount = 0;
|
PlayerSpellCount = 0;
|
||||||
PlayerCreatureSpellCount = 0;
|
PlayerCreatureSpellCount = 0;
|
||||||
ComputerSpellCount = 0;
|
ComputerSpellCount = 0;
|
||||||
ComputerCreatureSpellCount = 0;
|
ComputerCreatureSpellCount = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//for debugging: System.out.println(getPhase());
|
//for debugging: System.out.println(getPhase());
|
||||||
//System.out.println(getPhase() + " " + getActivePlayer());
|
//System.out.println(getPhase() + " " + getActivePlayer());
|
||||||
|
|||||||
@@ -29,18 +29,37 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
&& (c.isLand() || c.isCreature() || c.isArtifact())) c.tap();
|
&& (c.isLand() || c.isCreature() || c.isArtifact())) c.tap();
|
||||||
|
|
||||||
//cannot use addComesIntoPlayCommand - trigger might be set to false;
|
//cannot use addComesIntoPlayCommand - trigger might be set to false;
|
||||||
if(c.getName().equals("Exploration")) {
|
// Keep track of max lands can play per turn
|
||||||
if(c.getController().equals(Constant.Player.Human)) AllZone.GameInfo.addHumanCanPlayNumberOfLands(1);
|
int addMax = 0;
|
||||||
else AllZone.GameInfo.addComputerCanPlayNumberOfLands(1);
|
boolean isHuman = c.getController().equals(Constant.Player.Human);
|
||||||
} else if(c.getName().equals("Azusa, Lost but Seeking")) {
|
boolean adjustLandPlays = false;
|
||||||
if(c.getController().equals(Constant.Player.Human)) AllZone.GameInfo.addHumanCanPlayNumberOfLands(2);
|
boolean eachPlayer = false;
|
||||||
else AllZone.GameInfo.addComputerCanPlayNumberOfLands(2);
|
|
||||||
} else if(c.getName().equals("Oracle of Mul Daya")) {
|
if(c.getName().equals("Exploration") || c.getName().equals("Oracle of Mul Daya")) {
|
||||||
if(c.getController().equals(Constant.Player.Human)) AllZone.GameInfo.addHumanCanPlayNumberOfLands(1);
|
addMax = 1;
|
||||||
else AllZone.GameInfo.addComputerCanPlayNumberOfLands(1);
|
adjustLandPlays = true;
|
||||||
} else if(c.getName().equals("Fastbond")) {
|
}
|
||||||
if(c.getController().equals(Constant.Player.Human)) AllZone.GameInfo.addHumanCanPlayNumberOfLands(100);
|
else if(c.getName().equals("Azusa, Lost but Seeking")) {
|
||||||
else AllZone.GameInfo.addComputerCanPlayNumberOfLands(100);
|
addMax = 2;
|
||||||
|
adjustLandPlays = true;
|
||||||
|
}
|
||||||
|
else if (c.getName().equals("Storm Cauldron") || c.getName().equals("Rites of Flourishing")){
|
||||||
|
// these two aren't in yet, but will just need the other part of the card to work with more lands
|
||||||
|
adjustLandPlays = true;
|
||||||
|
eachPlayer = true;
|
||||||
|
addMax = 1;
|
||||||
|
}
|
||||||
|
// 7/13: fastbond code removed, fastbond should be unlimited and will be handled elsewhere.
|
||||||
|
|
||||||
|
if (adjustLandPlays){
|
||||||
|
if (eachPlayer){
|
||||||
|
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(addMax);
|
||||||
|
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(addMax);
|
||||||
|
}
|
||||||
|
else if (isHuman)
|
||||||
|
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(addMax);
|
||||||
|
else
|
||||||
|
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(addMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trigger) {
|
if(trigger) {
|
||||||
@@ -234,19 +253,36 @@ public class PlayerZone_ComesIntoPlay extends DefaultPlayerZone {
|
|||||||
|
|
||||||
Card c = (Card) o;
|
Card c = (Card) o;
|
||||||
|
|
||||||
//cannot use addLeavesPlayCommand - trigger might be set to false
|
// Keep track of max lands can play per turn
|
||||||
if(c.getName().equals("Exploration")) {
|
int addMax = 0;
|
||||||
if(c.getController().equals(Constant.Player.Human)) AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
boolean isHuman = c.getController().equals(Constant.Player.Human);
|
||||||
else AllZone.GameInfo.addComputerCanPlayNumberOfLands(-1);
|
boolean adjustLandPlays = false;
|
||||||
|
boolean eachPlayer = false;
|
||||||
|
|
||||||
|
if(c.getName().equals("Exploration") || c.getName().equals("Oracle of Mul Daya")) {
|
||||||
|
addMax = -1;
|
||||||
|
adjustLandPlays = true;
|
||||||
} else if(c.getName().equals("Azusa, Lost but Seeking")) {
|
} else if(c.getName().equals("Azusa, Lost but Seeking")) {
|
||||||
if(c.getController().equals(Constant.Player.Human)) AllZone.GameInfo.addHumanCanPlayNumberOfLands(-2);
|
addMax = -2;
|
||||||
else AllZone.GameInfo.addComputerCanPlayNumberOfLands(-2);
|
adjustLandPlays = true;
|
||||||
} else if(c.getName().equals("Oracle of Mul Daya")) {
|
}
|
||||||
if(c.getController().equals(Constant.Player.Human)) AllZone.GameInfo.addHumanCanPlayNumberOfLands(-1);
|
else if (c.getName().equals("Storm Cauldron") || c.getName().equals("Rites of Flourishing")){
|
||||||
else AllZone.GameInfo.addComputerCanPlayNumberOfLands(-1);
|
// once their second half of their abilities are programmed these two can be added in
|
||||||
} else if(c.getName().equals("Fastbond")) {
|
adjustLandPlays = true;
|
||||||
if(c.getController().equals(Constant.Player.Human)) AllZone.GameInfo.addHumanCanPlayNumberOfLands(-100);
|
eachPlayer = true;
|
||||||
else AllZone.GameInfo.addComputerCanPlayNumberOfLands(-100);
|
addMax = -1;
|
||||||
|
}
|
||||||
|
// 7/12: fastbond code removed, fastbond should be unlimited and will be handled elsewhere.
|
||||||
|
|
||||||
|
if (adjustLandPlays){
|
||||||
|
if (eachPlayer){
|
||||||
|
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(addMax);
|
||||||
|
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(addMax);
|
||||||
|
}
|
||||||
|
else if (isHuman)
|
||||||
|
AllZone.GameInfo.addHumanMaxPlayNumberOfLands(addMax);
|
||||||
|
else
|
||||||
|
AllZone.GameInfo.addComputerMaxPlayNumberOfLands(addMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user