It is currently 04 Sep 2025, 03:53
   
Text Size

Forbidden Orchard

Post MTG Forge Related Programming Questions Here

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

Forbidden Orchard

Postby Chris H. » 24 Jun 2010, 02:57

I finally found the method where the computer pays mana costs at ComputerUtil.payManaCost(). I searched high and low and found it. I added a test to see if the card paying the mana cost is a Forbidden Orchard. If true, it will make a call to CardFactoryUtil.getForbiddenOrchardAbility() … and the human will now receive a 1/1 Spirit token. Success!

I will merge this into the SVN Thursday. This will allow me to add in Snacko's Oath of Druids deck as the 20th special quest deck. 8)


Code: Select all
  static public void payManaCost(SpellAbility sa)
  {
    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());
    }
    ManaCost cost = new ManaCost(sa.getManaCost());
    cost = AllZone.GameAction.GetSpellCostChange(sa);
    // Beached - Delete old
    if(cost.isPaid())
        return;
 // Beached - Delete old
    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));
           
            if (land.get(i).getName().equals("Forbidden Orchard")) {
               AllZone.Stack.add(CardFactoryUtil.getForbiddenOrchardAbility(land.get(i), Constant.Player.Human));
            }
           
            //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()
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

Return to Developer's Corner

Who is online

Users browsing this forum: Google [Bot] and 36 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 37 users online :: 1 registered, 0 hidden and 36 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: Google [Bot] and 36 guests

Login Form