It is currently 28 Oct 2025, 18:25
   
Text Size

adding Channel

Post MTG Forge Related Programming Questions Here

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

adding Channel

Postby slapshot5 » 27 Nov 2010, 06:37

Hi all,

A card that has long been on my wish list is Channel. I think I've got a relatively sane implementation working.

My biggest fear though is breaking something. In my implementation, the following code is placed in Input.selectPlayer(Player player)
Code: Select all
if(player.canChannel()) {
          if (GameActionUtil.showYesNoDialog(player.getChannelCard(), "Pay 1 life?")) {
             player.payLife(1, player.getChannelCard());
             AllZone.ManaPool.addManaToFloating("1", player.getChannelCard());
          }
       }
It is currently empty.

Now, after you cast Channel in a given turn, clicking on your life total will activate Channel to add 1 to your mana pool.

I've tried it in various phases, and I've tried targeting myself with Lightning Bolt after casting Channel, and in that case, selectPlayer should be overridden, allowing targeting without activating Channel. That seems to work.

If anyone is interested in testing this with all the code (it's not checked in, and I probably wont check it in until after the beta):

CardFactory_Sorceries:
Code: Select all
//*************** START *********** START **************************
        else if(cardName.equals("Channel")) {
           /*
            * Until end of turn, any time you could activate a mana ability, you
            * may pay 1 life. If you do, add 1 to your mana pool.
            */
            final SpellAbility spell = new Spell(card) {
            private static final long serialVersionUID = 4113684767236269830L;

            @Override
                public boolean canPlayAI() {
               //AI currently has no mana pool
                    return false;
                }
               
                @Override
                public void resolve() {
                   getActivatingPlayer().setChannelCard(card);
                   final Command untilEOT = new Command() {
                  private static final long serialVersionUID = 6608218813784831252L;

                  public void execute() {
                            getActivatingPlayer().setChannelCard(null);
                        }
                    };//Command
                    AllZone.EndOfTurn.addUntil(untilEOT);
                }//resolve()
            };//SpellAbility
           
            card.clearSpellAbility();
            card.addSpellAbility(spell);
        }//*************** END ************ END **************************
Player.java:
Code: Select all
protected Card channelCard = null;
public void setChannelCard(Card c) {
       channelCard = c;
    }
   
    public boolean canChannel() {
       return null != channelCard;
    }
   
    public Card getChannelCard() {
       return channelCard;
    }
channel.txt
Code: Select all
Name:Channel
ManaCost:G G
Types:Sorcery
Text:Until end of turn, any time you could activate a mana ability, you may pay 1 life. If you do, add 1 to your mana pool.
SVar:RemAIDeck:True
SVar:Rarity:Rare
SVar:Picture:http://www.wizards.com/global/images/magic/general/channel.jpg
End
If anyone sees problems, please let me know. If you have a better idea for implementation, I'm all ears.

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

Re: adding Channel

Postby Sloth » 27 Nov 2010, 07:45

The implementation sounds good to me. You use your life as a source so you click on it.

And I also like Channel a lot since it was the only really broken green card (maybe alongside Fastbond) back in the day. Thanks a lot slapshot!
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: adding Channel

Postby jeffwadsworth » 27 Nov 2010, 18:25

Very cool and an excellent implementation idea. Hopefully this will help with getting Cadaverous Bloom going.
jeffwadsworth
Super Tester Elite
 
Posts: 1172
Joined: 20 Oct 2010, 04:47
Location: USA
Has thanked: 287 times
Been thanked: 70 times

Re: adding Channel

Postby friarsol » 27 Nov 2010, 20:58

. Cadaverous Bloom and Squandered Resources (and Elvish Spirit Guide) will all be very simple when Mana gets a much needed rewrite.
Last edited by Rob Cashwalker on 28 Nov 2010, 01:47, edited 1 time in total.
Reason: Card spelling for highlight
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: adding Channel

Postby zerker2000 » 28 Nov 2010, 10:40

Don't forget Simian Spirit Guide.
Also, stuff like Food Chain and Burnt Offering would probably be supported.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: adding Channel

Postby friarsol » 28 Nov 2010, 23:04

Food Chain still needs more than a conversion. I hadn't forgotten about any of those other things, but they weren't really related to Cad Bloom.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: adding Channel

Postby slapshot5 » 01 Dec 2010, 06:32

Channel has been added. If you notice any funky input stuff when clicking on you life total to select yourself as a target, it may be related to this change. Please let me know.

Now, back to a few more Channel / Fireball s.

-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 22 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 22 users online :: 0 registered, 0 hidden and 22 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 22 guests

Login Form