adding Channel
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)
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:
Thanks,
slapshot5
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());
}
}
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 **************************
- 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;
}
- 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
Thanks,
slapshot5