mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
1) added mayDrawCard functionality to Player structure
2) updated GameActionUtil.java to call new draw functions.
This commit is contained in:
@@ -42,6 +42,16 @@ public class AIPlayer extends Player{
|
|||||||
///
|
///
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
public void mayDrawCard() {
|
||||||
|
mayDrawCards(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mayDrawCards(int n) {
|
||||||
|
if(AllZone.Computer_Library.size() > n) {
|
||||||
|
drawCards(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean dredge() {
|
public boolean dredge() {
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
boolean use = random.nextBoolean();
|
boolean use = random.nextBoolean();
|
||||||
|
|||||||
@@ -485,8 +485,7 @@ public class GameActionUtil {
|
|||||||
{
|
{
|
||||||
public void resolve()
|
public void resolve()
|
||||||
{
|
{
|
||||||
for (int i=0;i<4;i++)
|
controller.drawCards(4);
|
||||||
AllZone.GameAction.drawCard(controller);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ability.setStackDescription("Kozilek - draw four cards.");
|
ability.setStackDescription("Kozilek - draw four cards.");
|
||||||
@@ -2322,14 +2321,7 @@ public class GameActionUtil {
|
|||||||
Ability ability2 = new Ability(card, "0") {
|
Ability ability2 = new Ability(card, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
AllZone.GameAction.drawCard(drawer);
|
drawer.drawCards(7);
|
||||||
AllZone.GameAction.drawCard(drawer);
|
|
||||||
AllZone.GameAction.drawCard(drawer);
|
|
||||||
AllZone.GameAction.drawCard(drawer);
|
|
||||||
AllZone.GameAction.drawCard(drawer);
|
|
||||||
AllZone.GameAction.drawCard(drawer);
|
|
||||||
AllZone.GameAction.drawCard(drawer);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}; // ability2
|
}; // ability2
|
||||||
if(!(card.getController().equals(c.getController()))) {
|
if(!(card.getController().equals(c.getController()))) {
|
||||||
@@ -2361,9 +2353,7 @@ public class GameActionUtil {
|
|||||||
// sac standstill
|
// sac standstill
|
||||||
AllZone.GameAction.sacrifice(card);
|
AllZone.GameAction.sacrifice(card);
|
||||||
// player who didn't play spell, draws 3 cards
|
// player who didn't play spell, draws 3 cards
|
||||||
AllZone.GameAction.drawCard(drawer);
|
drawer.drawCards(3);
|
||||||
AllZone.GameAction.drawCard(drawer);
|
|
||||||
AllZone.GameAction.drawCard(drawer);
|
|
||||||
}
|
}
|
||||||
}; // ability2
|
}; // ability2
|
||||||
|
|
||||||
@@ -2485,7 +2475,7 @@ public class GameActionUtil {
|
|||||||
}// May Draw a card
|
}// May Draw a card
|
||||||
|
|
||||||
if ((mayDrawNotMust && choice == JOptionPane.YES_OPTION) || !mayDrawNotMust) {
|
if ((mayDrawNotMust && choice == JOptionPane.YES_OPTION) || !mayDrawNotMust) {
|
||||||
AllZone.GameAction.drawCard(card.getController());
|
card.getController().drawCard();
|
||||||
}
|
}
|
||||||
}// Human
|
}// Human
|
||||||
|
|
||||||
@@ -2493,7 +2483,7 @@ public class GameActionUtil {
|
|||||||
int compLibSize = AllZone.getZone(Constant.Zone.Library, AllZone.ComputerPlayer).size();
|
int compLibSize = AllZone.getZone(Constant.Zone.Library, AllZone.ComputerPlayer).size();
|
||||||
int compHandSize = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer).size();
|
int compHandSize = AllZone.getZone(Constant.Zone.Hand, AllZone.ComputerPlayer).size();
|
||||||
if ((!mayDrawNotMust) || (mayDrawNotMust && compLibSize >= 5 && compHandSize <= 7)) {
|
if ((!mayDrawNotMust) || (mayDrawNotMust && compLibSize >= 5 && compHandSize <= 7)) {
|
||||||
AllZone.GameAction.drawCard(card.getController());
|
card.getController().drawCard();
|
||||||
}
|
}
|
||||||
}// Computer
|
}// Computer
|
||||||
}// resolve()
|
}// resolve()
|
||||||
@@ -2530,7 +2520,7 @@ public class GameActionUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
// draws a card
|
// draws a card
|
||||||
AllZone.GameAction.drawCard(card.getController());
|
card.getController().drawCard();
|
||||||
}
|
}
|
||||||
}; // ability2
|
}; // ability2
|
||||||
|
|
||||||
@@ -2557,7 +2547,7 @@ public class GameActionUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
// draws a card
|
// draws a card
|
||||||
AllZone.GameAction.drawCard(card.getController());
|
card.getController().drawCard();
|
||||||
}
|
}
|
||||||
}; // ability2
|
}; // ability2
|
||||||
|
|
||||||
@@ -2585,7 +2575,7 @@ public class GameActionUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
// draws a card
|
// draws a card
|
||||||
AllZone.GameAction.drawCard(card.getController());
|
card.getController().drawCard();
|
||||||
}
|
}
|
||||||
}; // ability2
|
}; // ability2
|
||||||
|
|
||||||
@@ -2668,7 +2658,7 @@ public class GameActionUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
// draws a card
|
// draws a card
|
||||||
AllZone.GameAction.drawCard(card.getController());
|
card.getController().drawCard();
|
||||||
}
|
}
|
||||||
}; // ability2
|
}; // ability2
|
||||||
|
|
||||||
@@ -4404,8 +4394,8 @@ public class GameActionUtil {
|
|||||||
public void resolve() {
|
public void resolve() {
|
||||||
Player player = crd.getController();
|
Player player = crd.getController();
|
||||||
if(player.equals(AllZone.HumanPlayer)) {
|
if(player.equals(AllZone.HumanPlayer)) {
|
||||||
if(showDialog(crd2)) AllZone.GameAction.drawCard(player);
|
if(showDialog(crd2)) player.drawCard();
|
||||||
} else AllZone.GameAction.drawCard(player); //computer
|
} else player.drawCard(); //computer
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ability.setStackDescription("Fecundity - " + destroyed.getController() + " may draw a card.");
|
ability.setStackDescription("Fecundity - " + destroyed.getController() + " may draw a card.");
|
||||||
@@ -4532,8 +4522,7 @@ public class GameActionUtil {
|
|||||||
Ability ability = new Ability(c, "0") {
|
Ability ability = new Ability(c, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
Player player = crd.getController();
|
crd.getController().drawCard();
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
ability.setStackDescription("Femeref Enchantress - " + c.getController() + " draws a card.");
|
ability.setStackDescription("Femeref Enchantress - " + c.getController() + " draws a card.");
|
||||||
@@ -5026,7 +5015,7 @@ public class GameActionUtil {
|
|||||||
getTargetPlayer().addDamage(2, src);
|
getTargetPlayer().addDamage(2, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
AllZone.GameAction.drawCard(src.getController());
|
src.getController().drawCard();
|
||||||
}
|
}
|
||||||
}; // ability
|
}; // ability
|
||||||
|
|
||||||
@@ -5409,7 +5398,7 @@ public class GameActionUtil {
|
|||||||
Ability ability2 = new Ability(c, "0") {
|
Ability ability2 = new Ability(c, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
AllZone.GameAction.drawCard(player);
|
player.drawCard();
|
||||||
if(opponent.equals(AllZone.HumanPlayer)) AllZone.InputControl.setInput(CardFactoryUtil.input_discard(this));
|
if(opponent.equals(AllZone.HumanPlayer)) AllZone.InputControl.setInput(CardFactoryUtil.input_discard(this));
|
||||||
else AllZone.GameAction.discardRandom(AllZone.ComputerPlayer, this);
|
else AllZone.GameAction.discardRandom(AllZone.ComputerPlayer, this);
|
||||||
|
|
||||||
@@ -5462,15 +5451,7 @@ public class GameActionUtil {
|
|||||||
{
|
{
|
||||||
if (crd.isUntapped())
|
if (crd.isUntapped())
|
||||||
{
|
{
|
||||||
if (player.equals(AllZone.HumanPlayer))
|
player.mayDrawCard();
|
||||||
{
|
|
||||||
String[] choices = {"Yes", "No"};
|
|
||||||
Object choice = AllZone.Display.getChoice("Draw a card?", choices);
|
|
||||||
if(choice.equals("Yes"))
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -5649,16 +5630,7 @@ public class GameActionUtil {
|
|||||||
Ability ability2 = new Ability(c, "0") {
|
Ability ability2 = new Ability(c, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
if(player.equals(AllZone.HumanPlayer)) {
|
player.mayDrawCard();
|
||||||
String[] choices = {"Yes", "No"};
|
|
||||||
Object choice = AllZone.Display.getChoice("Draw a card?", choices);
|
|
||||||
if(choice.equals("Yes")) {
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
|
|
||||||
CardList libList = new CardList(lib.getCards());
|
|
||||||
if(player.equals(AllZone.ComputerPlayer) && (libList.size() > 3)) AllZone.GameAction.drawCard(player);
|
|
||||||
}
|
}
|
||||||
};// ability2
|
};// ability2
|
||||||
|
|
||||||
@@ -5789,26 +5761,7 @@ public class GameActionUtil {
|
|||||||
Ability ability2 = new Ability(c, "0") {
|
Ability ability2 = new Ability(c, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
if (player.equals(AllZone.HumanPlayer)) {
|
player.mayDrawCard();
|
||||||
StringBuilder title = new StringBuilder();
|
|
||||||
title.append(c.getName()).append(" Ability");
|
|
||||||
StringBuilder message = new StringBuilder();
|
|
||||||
message.append("Will you draw a card?");
|
|
||||||
int choice = JOptionPane.showConfirmDialog(null, message.toString(), title.toString(), JOptionPane.YES_NO_OPTION);
|
|
||||||
|
|
||||||
if (choice == JOptionPane.YES_OPTION) {
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}// May Draw a card
|
|
||||||
}// Human
|
|
||||||
|
|
||||||
if (player.equals(AllZone.ComputerPlayer)) {
|
|
||||||
int compLibSize = AllZone.getZone(Constant.Zone.Library, player).size();
|
|
||||||
int compHandSize = AllZone.getZone(Constant.Zone.Hand, player).size();
|
|
||||||
|
|
||||||
if (compLibSize >= 5 && compHandSize < 7) {
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}// May Draw a card
|
|
||||||
}// Computer
|
|
||||||
}//resolve()
|
}//resolve()
|
||||||
};// ability2
|
};// ability2
|
||||||
|
|
||||||
@@ -5827,9 +5780,7 @@ public class GameActionUtil {
|
|||||||
Ability ability2 = new Ability(c, "0") {
|
Ability ability2 = new Ability(c, "0") {
|
||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
for(int i = 0; i < power; i++) {
|
player.drawCards(power);
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};// ability2
|
};// ability2
|
||||||
|
|
||||||
@@ -5977,7 +5928,7 @@ public class GameActionUtil {
|
|||||||
@Override
|
@Override
|
||||||
public void resolve() {
|
public void resolve() {
|
||||||
player[0] = crd.getController();
|
player[0] = crd.getController();
|
||||||
AllZone.GameAction.drawCard(player[0]);
|
player[0].drawCard();
|
||||||
}
|
}
|
||||||
};// ability2
|
};// ability2
|
||||||
|
|
||||||
@@ -6974,10 +6925,8 @@ public class GameActionUtil {
|
|||||||
for(int j = 0; j < oc.length; j++)
|
for(int j = 0; j < oc.length; j++)
|
||||||
AllZone.GameAction.discard(oc[j], crd.getSpellAbility()[0]);
|
AllZone.GameAction.discard(oc[j], crd.getSpellAbility()[0]);
|
||||||
|
|
||||||
for(int z = 0; z < 4; z++) {
|
AllZone.ComputerPlayer.drawCards(4);
|
||||||
AllZone.GameAction.drawCard(AllZone.ComputerPlayer);
|
AllZone.HumanPlayer.drawCards(4);
|
||||||
AllZone.GameAction.drawCard(AllZone.HumanPlayer);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}// for
|
}// for
|
||||||
@@ -8020,9 +7969,8 @@ public class GameActionUtil {
|
|||||||
public void resolve()
|
public void resolve()
|
||||||
{
|
{
|
||||||
if (player.getLife() <= 5){
|
if (player.getLife() <= 5){
|
||||||
//AllZone.GameAction.gainLife(player, 3);
|
|
||||||
player.gainLife(3);
|
player.gainLife(3);
|
||||||
AllZone.GameAction.drawCard(player);
|
player.drawCard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};// Ability
|
};// Ability
|
||||||
@@ -9106,20 +9054,7 @@ public class GameActionUtil {
|
|||||||
list = list.getName("Bringer of the Blue Dawn");
|
list = list.getName("Bringer of the Blue Dawn");
|
||||||
|
|
||||||
for(int i = 0; i < list.size(); i++) {
|
for(int i = 0; i < list.size(); i++) {
|
||||||
String[] choices = {"Yes", "No"};
|
player.mayDrawCards(2);
|
||||||
Object q = null;
|
|
||||||
if(player.equals(AllZone.HumanPlayer)) {
|
|
||||||
q = AllZone.Display.getChoiceOptional("Use Bringer of the Blue Dawn?", choices);
|
|
||||||
|
|
||||||
if(q == null || q.equals("No")) return;
|
|
||||||
}
|
|
||||||
if(player.equals(AllZone.ComputerPlayer)) {
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
} else if(q.equals("Yes")) {
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}
|
|
||||||
}// for
|
}// for
|
||||||
}// upkeep_Bringer_of_the_Blue_Dawn()
|
}// upkeep_Bringer_of_the_Blue_Dawn()
|
||||||
|
|
||||||
@@ -9260,35 +9195,24 @@ public class GameActionUtil {
|
|||||||
|
|
||||||
for(int i = 0; i < list.size(); i++){
|
for(int i = 0; i < list.size(); i++){
|
||||||
if( list.getCard(i).isUntapped() ) {
|
if( list.getCard(i).isUntapped() ) {
|
||||||
AllZone.GameAction.drawCard(player);
|
player.drawCard();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}// Howling_Mine()
|
}// Howling_Mine()
|
||||||
|
|
||||||
private static void draw_Spiteful_Visions(final Player player) {
|
private static void draw_Spiteful_Visions(final Player player) {
|
||||||
CardList list = AllZoneUtil.getCardsInPlay("Spiteful Visions");
|
CardList list = AllZoneUtil.getCardsInPlay("Spiteful Visions");
|
||||||
|
player.drawCards(list.size());
|
||||||
for(int i = 0; i < list.size(); i++){
|
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}
|
|
||||||
}// Spiteful_Visions()
|
}// Spiteful_Visions()
|
||||||
|
|
||||||
private static void draw_Kami_Crescent_Moon(Player player) {
|
private static void draw_Kami_Crescent_Moon(Player player) {
|
||||||
CardList list = new CardList();
|
CardList list = AllZoneUtil.getCardsInPlay("Kami of the Crescent Moon");
|
||||||
list.addAll(AllZone.Human_Play.getCards());
|
player.drawCards(list.size());
|
||||||
list.addAll(AllZone.Computer_Play.getCards());
|
|
||||||
list = list.getName("Kami of the Crescent Moon");
|
|
||||||
|
|
||||||
AllZone.GameAction.drawCards(player, list.size());
|
|
||||||
}// Kami_Crescent_Moon()
|
}// Kami_Crescent_Moon()
|
||||||
|
|
||||||
private static void draw_Font_of_Mythos(Player player) {
|
private static void draw_Font_of_Mythos(Player player) {
|
||||||
CardList list = new CardList();
|
CardList list = AllZoneUtil.getCardsInPlay("Font of Mythos");
|
||||||
list.addAll(AllZone.Human_Play.getCards());
|
player.drawCards(2*list.size());
|
||||||
list.addAll(AllZone.Computer_Play.getCards());
|
|
||||||
list = list.getName("Font of Mythos");
|
|
||||||
|
|
||||||
AllZone.GameAction.drawCards(player, 2*list.size());
|
|
||||||
}// Font_of_Mythos()
|
}// Font_of_Mythos()
|
||||||
|
|
||||||
private static void draw_Teferi_Puzzle_Box(Player player) {
|
private static void draw_Teferi_Puzzle_Box(Player player) {
|
||||||
@@ -9326,7 +9250,7 @@ public class GameActionUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AllZone.GameAction.drawCards(player, Count);
|
player.drawCards(Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9422,7 +9346,7 @@ public class GameActionUtil {
|
|||||||
|
|
||||||
for(int i = 0; i < list.size(); i++) {
|
for(int i = 0; i < list.size(); i++) {
|
||||||
final Card F_card = list.get(i);
|
final Card F_card = list.get(i);
|
||||||
AllZone.GameAction.drawCard(player);
|
player.drawCard();
|
||||||
player.subtractLife(1,F_card);
|
player.subtractLife(1,F_card);
|
||||||
|
|
||||||
AllZone.GameAction.checkStateEffects();
|
AllZone.GameAction.checkStateEffects();
|
||||||
@@ -9454,19 +9378,11 @@ public class GameActionUtil {
|
|||||||
list = list.getName("Honden of Seeing Winds");
|
list = list.getName("Honden of Seeing Winds");
|
||||||
|
|
||||||
for(int i = 0; i < list.size(); i++) {
|
for(int i = 0; i < list.size(); i++) {
|
||||||
// final Ability ability2 = new Ability(list.get(i), "0")
|
|
||||||
// {
|
|
||||||
// public void resolve() {
|
|
||||||
PlayerZone Play = AllZone.getZone(Constant.Zone.Play, player);
|
PlayerZone Play = AllZone.getZone(Constant.Zone.Play, player);
|
||||||
CardList hondlist = new CardList();
|
CardList hondlist = new CardList();
|
||||||
hondlist.addAll(Play.getCards());
|
hondlist.addAll(Play.getCards());
|
||||||
hondlist = hondlist.getType("Shrine");
|
hondlist = hondlist.getType("Shrine");
|
||||||
for(int j = 0; j < hondlist.size(); j++) {
|
player.drawCards(hondlist.size());
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}//}
|
|
||||||
// };
|
|
||||||
// ability2.setStackDescription(list.get(i)+" - " + list.get(i).getController() + " draws a card for each Shrine he controls.");
|
|
||||||
// AllZone.Stack.add(ability2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}// upkeep_Honden_of_Seeing_Winds
|
}// upkeep_Honden_of_Seeing_Winds
|
||||||
@@ -9671,8 +9587,7 @@ public class GameActionUtil {
|
|||||||
AllZone.Stack.add(ability);
|
AllZone.Stack.add(ability);
|
||||||
|
|
||||||
//drawing cards doesn't seem to work during upkeep if it's in an ability
|
//drawing cards doesn't seem to work during upkeep if it's in an ability
|
||||||
AllZone.GameAction.drawCard(player);
|
player.drawCards(2);
|
||||||
AllZone.GameAction.drawCard(player);
|
|
||||||
}// upkeep_Seizan_Perverter_of_Truth()
|
}// upkeep_Seizan_Perverter_of_Truth()
|
||||||
|
|
||||||
private static void upkeep_Moroii() {
|
private static void upkeep_Moroii() {
|
||||||
|
|||||||
@@ -34,6 +34,17 @@ public class HumanPlayer extends Player{
|
|||||||
///
|
///
|
||||||
///////////////
|
///////////////
|
||||||
|
|
||||||
|
public void mayDrawCards(int n) {
|
||||||
|
String[] choices = {"Yes", "No"};
|
||||||
|
Object choice = AllZone.Display.getChoice("Draw "+n+" cards?", choices);
|
||||||
|
if(choice.equals("Yes"))
|
||||||
|
drawCards(n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mayDrawCard() {
|
||||||
|
mayDrawCards(1);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean dredge() {
|
public boolean dredge() {
|
||||||
boolean dredged = false;
|
boolean dredged = false;
|
||||||
String choices[] = {"Yes", "No"};
|
String choices[] = {"Yes", "No"};
|
||||||
|
|||||||
@@ -238,6 +238,10 @@ public abstract class Player extends MyObservable{
|
|||||||
///
|
///
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|
||||||
|
public abstract void mayDrawCard();
|
||||||
|
|
||||||
|
public abstract void mayDrawCards(int numCards);
|
||||||
|
|
||||||
public void drawCard() {
|
public void drawCard() {
|
||||||
drawCards(1);
|
drawCards(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user