It is currently 07 Sep 2025, 06:41
   
Text Size

Computer tapping lands for mana

Post MTG Forge Related Programming Questions Here

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

Computer tapping lands for mana

Postby slapshot5 » 24 Oct 2010, 03:16

I am trying to add Manabarbs, which deals damage when a player taps a land for mana.

I have some code in Ability_Mana.resolve:
Code: Select all
//Manabarbs code
        if(sourceCard.isLand() && this.isTapAbility()) {
           CardList barbs = AllZoneUtil.getCardsInPlay("Manabarbs");
           for(Card barb:barbs) {
              final Card manabarb = barb;
              SpellAbility ability = new Ability(manabarb, "") {
                 @Override
                 public void resolve() {
                    sourceCard.getController().addDamage(1, manabarb);
                 }
              };
              ability.setStackDescription(manabarb.getName()+" - deal 1 damage to "+sourceCard.getController());
              AllZone.Stack.add(ability);
           }
        }
It damages the human appropriately, but does not damage the computer.

Is there a different place where the Compy taps lands for mana?

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Computer tapping lands for mana

Postby Chris H. » 24 Oct 2010, 10:29

Try ComputerUtil.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

Re: Computer tapping lands for mana

Postby slapshot5 » 24 Oct 2010, 12:45

Chris H. wrote:Try ComputerUtil.payManaCost().
That did the trick. Thanks Chris!

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 28 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 28 users online :: 0 registered, 0 hidden and 28 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 28 guests

Login Form