It is currently 07 Sep 2025, 17:12
   
Text Size

Code from Beached As

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

Re: Code from Beached As

Postby Beached As » 16 May 2010, 17:54

Symbiotic Wurm : Onslaught Rare
Based on Symbiotic Elf. It has been tested.

add to CardFactory_Creatures.java
Code: Select all
        //*************** START *********** START **************************
        else if(cardName.equals("Symbiotic Wurm")) {
            final SpellAbility ability = new Ability(card, "0") {
                @Override
                public void resolve() {
                    for(int i = 0; i < 7; i++) {
                    makeToken();
                    }
                }
               
                void makeToken() {
                    CardFactoryUtil.makeToken("Insect", "G 1 1 Insect", card, "G", new String[] {
                            "Creature", "Insect"}, 1, 1, new String[] {""});
                }//makeToken()
            };//SpellAbility
           
            Command destroy = new Command() {
                private static final long serialVersionUID = -7121390569051656027L;
               
                public void execute() {
                    ability.setStackDescription("Symbiotic Wurm - " + card.getController()
                            + " puts seven 1/1 tokens into play ");
                    AllZone.Stack.add(ability);
                }
            };
            card.addDestroyCommand(destroy);
        }//*************** END ************ END **************************
add to cards.txt

Code: Select all
Symbiotic Wurm
5 G G G
Creature Wurm
When Symbiotic Wurm is put into a graveyard from play, put seven 1/1 green Insect creature tokens into play.
7/7
URL:
Code: Select all
http://www.wizards.com/global/images/magic/general/Symbiotic_Wurm.jpg
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Beached As » 16 May 2010, 18:03

No problem, sometimes its worth to wait before committing so early because i might find new bugs.
With Doomed Necromancer and Oath of Druids , i did alot of mixing and matching from various sources of code, so i'm not surprised that the coding may be unfamiliar. I'll have another look at Oath of Druids and see if i can suss out any problems
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Beached As » 16 May 2010, 18:46

Hmm, i found a bug with the computer using Oath of Druids and fixed it. Not sure to what you're refering to chris but in my version, i've put the Oath of Druids upkeep code underneath the code for Defense of the Heart if that helps.

New Version of Oath of Druids is shown below, only the code in GameActionUtil.java has changed. Of course "upkeep_Oath of Druids();" is required which i've put under "upkeep_Defense_of_the_Heart();" in the upkeep effects in GameActionUtil.java. The cards.txt and URL are unchanged from the previous post regarding Oath Of Druids.

Code: Select all
   private static void upkeep_Oath_of_Druids() {
      final String player = AllZone.Phase.getActivePlayer();
      String opponent = AllZone.GameAction.getOpponent(player);
        PlayerZone PlayerPlayZone = AllZone.getZone(Constant.Zone.Play, player);
      PlayerZone opponentPlayZone = AllZone.getZone(Constant.Zone.Play, opponent);
      CardList Oath = new CardList(PlayerPlayZone.getCards());
      Oath = Oath.getName("Oath of Druids");

      if(0 < Oath.size()) {
         for(int i = 0; i < Oath.size(); i++) {
            Ability ability = new Ability(Oath.get(i), "0") {
               @Override
               public void resolve() {   
                  String player = AllZone.Phase.getActivePlayer();
                  String opponent = AllZone.GameAction.getOpponent(player);
                    PlayerZone PlayerPlayZone = AllZone.getZone(Constant.Zone.Play, player);
                    CardList PlayerCreatureList = new CardList(PlayerPlayZone.getCards());
                    PlayerCreatureList = PlayerCreatureList.getType("Creature");
                  PlayerZone opponentPlayZone = AllZone.getZone(Constant.Zone.Play, opponent);
                    CardList opponentCreatureList = new CardList(opponentPlayZone.getCards());
                    opponentCreatureList = opponentCreatureList.getType("Creature");
                    PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
                    PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
                    CardList libList = new CardList(lib.getCards());
                    if(PlayerCreatureList.size() < opponentCreatureList.size()) {
                       if(player == "Human"){
                      String[] choices = {"Yes", "No"};
                      Object q = null;
                      q = AllZone.Display.getChoiceOptional("Use Oath of Druids?", choices);
                      if(q == null || q.equals("No"));
                      else {
                        int max = libList.size();
                        int stop = 0;                 

                        for(int i = 0; i < max; i++) {
                            Card c = libList.get(i);
                            if(c.getType().contains("Creature")) {
                                if(stop == 0) {
                                    AllZone.GameAction.moveTo(PlayerPlayZone, c);
                                   stop = 1;
                                }         
                            } else if(stop == 0) {
                               lib.remove(c);
                               grave.add(c);
                            }
                        }
                        }
                       } else {
                          CardList CompLibCreature = new CardList(lib.getCards());
                          CompLibCreature = CompLibCreature.getType("Creature");
                          if(CompLibCreature.size() > 2) {
                              int max = libList.size();
                              int stop = 0;                 

                              for(int i = 0; i < max; i++) {
                                  Card c = libList.get(i);
                                  if(c.getType().contains("Creature")) {
                                      if(stop == 0) {
                                          AllZone.GameAction.moveTo(PlayerPlayZone, c);
                                         stop = 1;
                                      }         
                                  } else if(stop == 0) {
                                     lib.remove(c);
                                     grave.add(c);
                                  }
                              }                             
                          }
                       }
                    }
               }
            };// Ability
               ability.setStackDescription("At the beginning of each player's upkeep, that player chooses target player who controls more creatures than he or she does and is his or her opponent. The first player may reveal cards from the top of his or her library until he or she reveals a creature card. If he or she does, that player puts that card onto the battlefield and all other cards revealed this way into his or her graveyard.");
               AllZone.Stack.add(ability);
            }
         
      }// if
      CardList Oath2 = new CardList(opponentPlayZone.getCards());
      Oath2 = Oath2.getName("Oath of Druids");

      if(0 < Oath2.size()) {
         for(int i = 0; i < Oath2.size(); i++) {
            Ability ability = new Ability(Oath2.get(i), "0") {
               @Override
               public void resolve() {   
                  String player = AllZone.Phase.getActivePlayer();
                  String opponent = AllZone.GameAction.getOpponent(player);
                    PlayerZone PlayerPlayZone = AllZone.getZone(Constant.Zone.Play, player);
                    CardList PlayerCreatureList = new CardList(PlayerPlayZone.getCards());
                    PlayerCreatureList = PlayerCreatureList.getType("Creature");
                  PlayerZone opponentPlayZone = AllZone.getZone(Constant.Zone.Play, opponent);
                    CardList opponentCreatureList = new CardList(opponentPlayZone.getCards());
                    opponentCreatureList = opponentCreatureList.getType("Creature");
                    PlayerZone grave = AllZone.getZone(Constant.Zone.Graveyard, player);
                    PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
                    CardList libList = new CardList(lib.getCards());
                    if(PlayerCreatureList.size() < opponentCreatureList.size()) {
                       if(player == "Human"){
                      String[] choices = {"Yes", "No"};
                      Object q = null;
                      q = AllZone.Display.getChoiceOptional("Use Oath of Druids?", choices);
                      if(q == null || q.equals("No"));
                      else {
                        int max = libList.size();
                        int stop = 0;                 

                        for(int i = 0; i < max; i++) {
                            Card c = libList.get(i);
                            if(c.getType().contains("Creature")) {
                                if(stop == 0) {
                                    AllZone.GameAction.moveTo(PlayerPlayZone, c);
                                   stop = 1;
                                }         
                            } else if(stop == 0) {
                               lib.remove(c);
                               grave.add(c);
                            }
                        }
                        }
                       } else {
                          CardList CompLibCreature = new CardList(lib.getCards());
                          CompLibCreature = CompLibCreature.getType("Creature");
                          if(CompLibCreature.size() > 2) {
                              int max = libList.size();
                              int stop = 0;                 

                              for(int i = 0; i < max; i++) {
                                  Card c = libList.get(i);
                                  if(c.getType().contains("Creature")) {
                                      if(stop == 0) {
                                          AllZone.GameAction.moveTo(PlayerPlayZone, c);
                                         stop = 1;
                                      }         
                                  } else if(stop == 0) {
                                     lib.remove(c);
                                     grave.add(c);
                                  }
                              }                             
                          }
                       }
                    }
               }
            };// Ability
               ability.setStackDescription("At the beginning of each player's upkeep, that player chooses target player who controls more creatures than he or she does and is his or her opponent. The first player may reveal cards from the top of his or her library until he or she reveals a creature card. If he or she does, that player puts that card onto the battlefield and all other cards revealed this way into his or her graveyard.");
               AllZone.Stack.add(ability);
            }
         
      }// if
   }// upkeep_Oath_of_Druids()
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Chris H. » 16 May 2010, 19:05

Beached As wrote:Not sure to what you're refering to chris but in my version, i've put the Oath of Druids upkeep code underneath the code for Defense of the Heart if that helps.

New Version of Oath of Druids is shown below, only the code in GameActionUtil.java has changed. Of course "upkeep_Oath of Druids();" is required which i've put under "upkeep_Defense_of_the_Heart();" in the upkeep effects in GameActionUtil.java. The cards.txt and URL are unchanged from the previous post regarding Oath Of Druids
`
I was not familiar with the code in GameActionUtil. When I looked at the code in this section it became apparent to me that the place to insert your code might be an issue. Was not sure.

With CardFactory_Creatures for example, I can just place the code for Doomed Necromancer at the end of the card objects and just before the keyword code at the end. :)
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Code from Beached As

Postby DennisBergkamp » 16 May 2010, 21:10

Ah, I'll merge Oath of Druids Chris. There's a number of different places the pastes have to happen.

EDIT: By the way, I completely missed you added Forbidden Orchard already, Beached As. Anyway, I coded it myself yesterday (a bit differently, I put all of the code in Ability_Mana).
At least I just merged Oath of Druids :)
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Chris H. » 16 May 2010, 22:49

DennisBergkamp wrote:Ah, I'll merge Oath of Druids Chris. There's a number of different places the pastes have to happen.

EDIT: By the way, I completely missed you added Forbidden Orchard already, Beached As. Anyway, I coded it myself yesterday (a bit differently, I put all of the code in Ability_Mana).
At least I just merged Oath of Druids :)
`
Thank you Dennis. I will try to merge a couple of the easier ones over the next several days.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Code from Beached As

Postby Beached As » 17 May 2010, 08:18

My version of Forbidden Orchard was a bit of a rush, i just really wanted to see the combo between it and Oath of Druids. Thanks again Chris and Dennis for the help with the merging.
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Beached As » 17 May 2010, 15:31

Demonic Consultation: Ice Age Uncommon
This card is not usable by the computer, didn't think the computer could use this card intelligently

Add to CardFactory.java

Code: Select all
        //*************** START *********** START **************************
        else if(cardName.equals("Demonic Consultation")) {
            final SpellAbility spell = new Spell(card) {
                private static final long serialVersionUID = 1481101852928051519L;
               
                @Override
            public void resolve() {   
               String player = AllZone.Phase.getActivePlayer();
                 PlayerZone PlayerHand = AllZone.getZone(Constant.Zone.Hand, player);
                 PlayerZone RFG = AllZone.getZone(Constant.Zone.Removed_From_Play , player);                
                 PlayerZone lib = AllZone.getZone(Constant.Zone.Library, player);
                 CardList libList = new CardList(lib.getCards());
                  final String[] input = new String[1];
                    input[0] = JOptionPane.showInputDialog(null, "Which card?", "Pick card",
                            JOptionPane.QUESTION_MESSAGE);
                  for(int i = 0; i < 7; i++) {
                      Card c = libList.get(i);
                         lib.remove(c);
                         RFG.add(c);
                      }
               
                     int max = libList.size();
                     int stop = 0;                 
                     for(int i = 0; i < max; i++) {
                         Card c = libList.get(i);
                         if(c.getName().equals(input[0])) {
                             if(stop == 0) {
                                 AllZone.GameAction.moveTo(PlayerHand, c);
                                stop = 1;
                             }       
                         } else if(stop == 0) {
                            lib.remove(c);
                            RFG.add(c);
                         }
                     }
                     }
       
                                   
                @Override
                public boolean canPlay() {
                    PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController());
                   
                    return library.getCards().length > 6
                            && AllZone.Phase.getActivePlayer().equals(card.getController())
                            && !AllZone.Phase.getPhase().equals("End of Turn") && super.canPlay();
                }
               
                @Override
                public boolean canPlayAI() {
                    return false;
                }
            };//SpellAbility
            card.clearSpellAbility();
            spell.setStackDescription("Name a card. Exile the top six cards of your library, then reveal cards from the top of your library until you reveal the named card. Put that card into your hand and exile all other cards revealed this way");
            card.addSpellAbility(spell);
        }//*************** END ************ END ************************** 
add to cards.txt

Code: Select all
Demonic Consultation
B
Instant
Name a card. Exile the top six cards of your library, then reveal cards from the top of your library until you reveal the named card. Put that card into your hand and exile all other cards revealed this way.
URL:

Code: Select all
http://www.wizards.com/global/images/magic/general/demonic_consultation.jpg
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Beached As » 18 May 2010, 23:28

UPDATE: IT WORKS!!!
Avatar of Woe : Prophecy Rare

Change in CardFactory_Creatures.java (Since Visara the Dreadful has the same ability)

Code: Select all
        //*************** START *********** START **************************
        else if(cardName.equals("Visara the Dreadful") || cardName.equals("Avatar of Woe")) {
            final Ability_Tap ability = new Ability_Tap(card) {
                private static final long serialVersionUID = 6371765024236754171L;
               
                @Override
                public boolean canPlayAI() {
                    if(CardFactoryUtil.AI_doesCreatureAttack(card)) return false;
                   
                    return CardFactoryUtil.AI_getHumanCreature(card, true).size() != 0;
                }
               
                @Override
                public void chooseTargetAI() {
                    CardList creature = CardFactoryUtil.AI_getHumanCreature(card, true);
                    Card target = CardFactoryUtil.AI_getBestCreature(creature);
                    setTargetCard(target);
                }
               
                @Override
                public void resolve() {
                    if(AllZone.GameAction.isCardInPlay(getTargetCard())
                            && CardFactoryUtil.canTarget(card, getTargetCard())) {
                        AllZone.GameAction.destroyNoRegeneration(getTargetCard());
                    }
                }//resolve()
            };//SpellAbility
            card.addSpellAbility(ability);
            ability.setDescription("tap: Destroy target creature. It can't be regenerated");
           
            ability.setBeforePayMana(CardFactoryUtil.input_targetCreature(ability));
        }//*************** END ************ END **************************
Change Input_PayManaCost.java (i've included a bit of code before and after so you know exactly where to add the code)

Code: Select all
    //private final ArrayList<Card> tappedLand = new ArrayList<Card>();
    private final SpellAbility spell;
   
    public Input_PayManaCost(SpellAbility sa) {
        originalManaCost = sa.getManaCost();
        originalCard = sa.getSourceCard();     
        spell = sa;

        if(originalCard.getName().equals("Avatar of Woe")){
         String player = AllZone.Phase.getActivePlayer();
         String opponent = AllZone.GameAction.getOpponent(player);
           PlayerZone PlayerGraveyard = AllZone.getZone(Constant.Zone.Graveyard, player);
           CardList PlayerCreatureList = new CardList(PlayerGraveyard.getCards());
           PlayerCreatureList = PlayerCreatureList.getType("Creature");
         PlayerZone OpponentGraveyard = AllZone.getZone(Constant.Zone.Graveyard, opponent);
           CardList OpponentCreatureList = new CardList(OpponentGraveyard.getCards());
           OpponentCreatureList = OpponentCreatureList.getType("Creature");
           if((PlayerCreatureList.size() + OpponentCreatureList.size()) >= 10) {
            manaCost = new ManaCost("B B");   
           } else {
               manaCost = new ManaCost(sa.getManaCost());              
           }
        } else {
        manaCost = new ManaCost(sa.getManaCost());
        }
    }
   
    private void resetManaCost() {
        manaCost = new ManaCost(originalManaCost);
    }
add to cards.txt

Code: Select all
Avatar of Woe
6 B B
Creature Avatar
If there are ten or more creature cards total in all graveyards, Avatar of Woe costs 6 less to play.
6/5
Fear
URL:
Code: Select all
http://www.wizards.com/global/images/magic/general/avatar_of_woe.jpg
In ComputerUtil.java, two changes need to be made, probably easiest to search the boolean to find where to put the code
First for canPayCost:

Code: Select all
  static public boolean canPayCost(SpellAbility sa)
  {
    if(sa.getManaCost().equals(("0")))
       return true;

    CardList land = getAvailableMana();
   
    if(sa.getSourceCard().isLand() /*&& sa.isTapAbility()*/)
    {
       land.remove(sa.getSourceCard());
    }
    Card originalCard = sa.getSourceCard();
    ManaCost cost = new ManaCost(sa.getManaCost());
    if(originalCard.getName().equals("Avatar of Woe")){
      String player = AllZone.Phase.getActivePlayer();
      String opponent = AllZone.GameAction.getOpponent(player);
        PlayerZone PlayerGraveyard = AllZone.getZone(Constant.Zone.Graveyard, player);
        CardList PlayerCreatureList = new CardList(PlayerGraveyard.getCards());
        PlayerCreatureList = PlayerCreatureList.getType("Creature");
      PlayerZone OpponentGraveyard = AllZone.getZone(Constant.Zone.Graveyard, opponent);
        CardList OpponentCreatureList = new CardList(OpponentGraveyard.getCards());
        OpponentCreatureList = OpponentCreatureList.getType("Creature");
        if((PlayerCreatureList.size() + OpponentCreatureList.size()) >= 10) {
           ManaCost cost2 = new ManaCost("B B");
           cost = cost2;
        }
    }   
    ArrayList<String> colors;

    for(int i = 0; i < land.size(); i++)
    {
      colors = getColors(land.get(i));
      int once = 0;
     
      for(int j =0; j < colors.size(); j++)
      {
         if(cost.isNeeded(colors.get(j)) && once == 0)
         {
          //System.out.println(j + " color:" +colors.get(j));
           cost.subtractMana(colors.get(j));
           //System.out.println("thinking, I just subtracted " + colors.get(j) + ", cost is now: " + cost.toString());
           once++;
         }

         if(cost.isPaid()) {
            //System.out.println("Cost is paid.");
            return true;
         }
      }
    }
    return false;
  }//canPayCost()
Then for payManacost:

Code: Select all
  static public void payManaCost(SpellAbility sa)
  {
    if(sa.getManaCost().equals(("0")))
       return;

    CardList land = getAvailableMana();
   
    //this is to prevent errors for land cards that have abilities that cost mana.
    if(sa.getSourceCard().isLand() /*&& sa.isTapAbility()*/)
    {
       land.remove(sa.getSourceCard());
    }
   
    Card originalCard = sa.getSourceCard();
    ManaCost cost = new ManaCost(sa.getManaCost());
    if(originalCard.getName().equals("Avatar of Woe")){
      String player = AllZone.Phase.getActivePlayer();
      String opponent = AllZone.GameAction.getOpponent(player);
        PlayerZone PlayerGraveyard = AllZone.getZone(Constant.Zone.Graveyard, player);
        CardList PlayerCreatureList = new CardList(PlayerGraveyard.getCards());
        PlayerCreatureList = PlayerCreatureList.getType("Creature");
      PlayerZone OpponentGraveyard = AllZone.getZone(Constant.Zone.Graveyard, opponent);
        CardList OpponentCreatureList = new CardList(OpponentGraveyard.getCards());
        OpponentCreatureList = OpponentCreatureList.getType("Creature");
        if((PlayerCreatureList.size() + OpponentCreatureList.size()) >= 10) {
           ManaCost cost2 = new ManaCost("B B");
           cost = cost2;
        }
    }
    ArrayList<String> colors;

    for(int i = 0; i < land.size(); i++)
    {
       colors = getColors(land.get(i));
      for(int j = 0; j <colors.size();j++)
      {
         if(cost.isNeeded(colors.get(j)) && land.get(i).isUntapped())
         {
            land.get(i).tap();
            cost.subtractMana(colors.get(j));
            //System.out.println("just subtracted " + colors.get(j) + ", cost is now: " + cost.toString());

         }
         if(cost.isPaid())
            break;
      }
     
    }
    if(! cost.isPaid())
      throw new RuntimeException("ComputerUtil : payManaCost() cost was not paid for " + sa.getSourceCard().getName());
  }//payManaCost()
Last edited by Beached As on 19 May 2010, 12:50, edited 1 time in total.
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Beached As » 19 May 2010, 12:37

I've noticed that i've been changing code in random areas to get these cards to work. It might be an idea for me to start looking at committing my own code
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Chris H. » 19 May 2010, 13:17

Beached As wrote:I've noticed that i've been changing code in random areas to get these cards to work. It might be an idea for me to start looking at committing my own code
`
I was able to recently merge your code for Demonic Consultation, Stitch Together, Symbiotic Wurm and Windfall. Granted, these were the easiest for me to merge. :)

Have you been able to install a matched set of Subclipse and Subversion? If you have and are updating your local copy of the code from our SVN then you are in good shape.

The main challenge with merging your material into the SVN is learning how to do this without overwriting the recent additions from other people with the older material.

Dennis can give you the ability to commit. Good luck. We can answer any questions that you may have. :)
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Code from Beached As

Postby Beached As » 19 May 2010, 13:42

Yep i've got subclipse and subversion, i've had it for a while now. I haven't been updating to the most recent version though because i'm scared i'll lose some of my code that hasn't been committed yet (i think i'm at revision 1056 or something so thats still pretty recent).

Im guessing to commit, i would need to right click the file you want to commit in the Package Explorer -> Team -> Commit
Then add a comment and OK, and it should commit.
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Chris H. » 19 May 2010, 15:02

Beached As wrote:Yep i've got subclipse and subversion, i've had it for a while now. I haven't been updating to the most recent version though because i'm scared i'll lose some of my code that hasn't been committed yet (i think i'm at revision 1056 or something so thats still pretty recent).

Im guessing to commit, i would need to right click the file you want to commit in the Package Explorer -> Team -> Commit
Then add a comment and OK, and it should commit.
`
I have a Mac and Mac OS and the Mac version of Eclipse, so things might be a little different.

I select the Team Synchronize Perspective and then I click on the Synchronize SVN (Workspace) button. I select Update All Incoming Changes. Resolving conflicts can then be taken care of before Commit all Outgoing Changes.

I do not know enough enough Java to be able to resolve conflicts ... so I have two different workspaces. One for the SVN and a second where I have my own local copy where I do my work.

When I am ready, I will switch to the SVN workspace and will Update All Incoming Changes. I then quickly paste in my own changes. From here a Synchronize SVN (Workspace) will usually show no conflicts to resolve and I can then Commit all Outgoing Changes. :D

My way is the extra cautious way. I do not want to overwrite other people's work. It works for me and I do not think that I have erased anyone else's hard work. :mrgreen:
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

Re: Code from Beached As

Postby Beached As » 19 May 2010, 17:46

Sounds like a fool proof way of committing, i'll be sure to try that method when i can commit.

My first Mythic Rare :)
Novablast Wurm : Worldwake Mythic Rare

add to CombatUtil.java (Under the code for Nemesis of Reason)

Code: Select all
            else if(c.getName().equals("Novablast Wurm") && !c.getCreatureAttackedThisCombat()) {
                final Card Novablast_Wurm = c;
                CardList all = new CardList();
                all.addAll(AllZone.Human_Play.getCards());
                all.addAll(AllZone.Computer_Play.getCards());
                CardList wurms = new CardList();
                wurms.addAll(AllZone.Combat.getAttackers());
                wurms = wurms.filter(new CardListFilter()
                {
                   public boolean addCard(Card c)
                   {
                      return c.getName().equals("Novablast Wurm");
                   }
                }); 
                if(wurms.size() > 1) {
                for(int i = 0; i < all.size(); i++) {
                    Card Card_Destroy = all.get(i);
                    if(Card_Destroy.isCreature()) AllZone.GameAction.destroy(Card_Destroy);
                } 
                } else {             
                all = all.filter(new CardListFilter()
                {
                   public boolean addCard(Card check)
                   {
                      return !(check == Novablast_Wurm);
                   }
                });               
                for(int i = 0; i < all.size(); i++) {
                    Card Card_Destroy = all.get(i);
                    if(Card_Destroy.isCreature()) AllZone.GameAction.destroy(Card_Destroy);
                }
                }
            }//Novablast Wurm
add to cards.txt

Code: Select all
Novablast Wurm
3 G G W W
Creature Wurm
Whenever Novablast Wurm attacks, destroy all other creatures.
7/7
URL:

Code: Select all
http://www.wizards.com/global/images/magic/general/novablast_wurm.jpg
Beached As
Programmer
 
Posts: 110
Joined: 23 Feb 2010, 07:48
Has thanked: 0 time
Been thanked: 0 time

Re: Code from Beached As

Postby Chris H. » 19 May 2010, 18:13

Beached As wrote:Im guessing to commit, i would need to right click the file you want to commit in the Package Explorer -> Team -> Commit
Then add a comment and OK, and it should commit.
`
I just found the Package Explorer -> Team -> Commit option ... have not seen it before. I guess that there are more than one way to make a commit.
User avatar
Chris H.
Forge Moderator
 
Posts: 6320
Joined: 04 Nov 2008, 12:11
Location: Mac OS X Yosemite
Has thanked: 644 times
Been thanked: 643 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 39 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 39 users online :: 0 registered, 0 hidden and 39 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 39 guests

Login Form