Page 1 of 1

adding Channel

PostPosted: 27 Nov 2010, 06:37
by slapshot5
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

Re: adding Channel

PostPosted: 27 Nov 2010, 07:45
by Sloth
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!

Re: adding Channel

PostPosted: 27 Nov 2010, 18:25
by jeffwadsworth
Very cool and an excellent implementation idea. Hopefully this will help with getting Cadaverous Bloom going.

Re: adding Channel

PostPosted: 27 Nov 2010, 20:58
by friarsol
. Cadaverous Bloom and Squandered Resources (and Elvish Spirit Guide) will all be very simple when Mana gets a much needed rewrite.

Re: adding Channel

PostPosted: 28 Nov 2010, 10:40
by zerker2000
Don't forget Simian Spirit Guide.
Also, stuff like Food Chain and Burnt Offering would probably be supported.

Re: adding Channel

PostPosted: 28 Nov 2010, 23:04
by friarsol
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.

Re: adding Channel

PostPosted: 01 Dec 2010, 06:32
by slapshot5
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