More tutor cards
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
More tutor cards
by Sloth » 30 Jun 2009, 13:33
I would like to help to add a few more tutor cards to the game. First of all Imperial Seal and Sylvan Tutor can be added quite easily by adding this to card.txt:
- Code: Select all
Sylvan Tutor
G
Sorcery
Search your library for a creature card and reveal that card. Shuffle your library, then put the revealed card back on top of it.
Imperial Seal
B
Sorcery
Search your library for a card, then shuffle your library and put that card on top of it. You lose 2 life.
- Code: Select all
if(cardName.equals("Vampiric Tutor") || cardName.equals("Cruel Tutor") || cardName.equals("Imperial Seal"))
- Code: Select all
if(cardName.equals("Worldly Tutor") || cardName.equals("Sylvan Tutor"))
- Code: Select all
Grim Tutor
1 B B
Sorcery
Search your library for a card and put that card into your hand. Then shuffle your library. You lose 3 life.
- Code: Select all
//*************** START *********** START **************************
if(cardName.equals("Demonic Tutor") || cardName.equals("Diabolic Tutor") || cardName.equals("Grim Tutor"))
{
final SpellAbility spell = new Spell(card)
{
private static final long serialVersionUID = 1481169060428051519L;
public void resolve()
{
String player = card.getController();
if(player.equals(Constant.Player.Human))
humanResolve();
else
computerResolve();
}
public void humanResolve()
{
Object check = AllZone.Display.getChoiceOptional("Select card", AllZone.Human_Library.getCards());
if(check != null)
{
PlayerZone hand = AllZone.getZone(Constant.Zone.Hand, card.getController());
AllZone.GameAction.moveTo(hand, (Card)check);
}
AllZone.GameAction.shuffle(Constant.Player.Human);
//lose 3 life
if(cardName.equals("Grim Tutor"))
{
String player = Constant.Player.Human;
PlayerLife life = AllZone.GameAction.getPlayerLife(player);
life.subtractLife(3);
}
}
public void computerResolve()
{
Card[] library = AllZone.Computer_Library.getCards();
CardList list = new CardList(library);
//pick best creature
Card c = CardFactoryUtil.AI_getBestCreature(list);
if(c == null)
c = library[0];
//System.out.println("comptuer picked - " +c);
AllZone.Computer_Library.remove(c);
AllZone.Computer_Hand.add(c);
//lose 3 life
if(cardName.equals("Grim Tutor"))
{
String player = Constant.Player.Computer;
PlayerLife life = AllZone.GameAction.getPlayerLife(player);
life.subtractLife(3);
}
}
public boolean canPlay()
{
PlayerZone library = AllZone.getZone(Constant.Zone.Library, card.getController());
return library.getCards().length != 0 && AllZone.Phase.getActivePlayer().equals(card.getController())
&& !AllZone.Phase.getPhase().equals("End of Turn");
}
public boolean canPlayAI()
{
CardList creature = new CardList();
creature.addAll(AllZone.Computer_Library.getCards());
creature = creature.getType("Creature");
return creature.size() != 0;
}
};//SpellAbility
card.clearSpellAbility();
card.addSpellAbility(spell);
}//*************** END ************ END **************************
- Code: Select all
Card c = creature.get(0);
- Code: Select all
Card c = CardFactoryUtil.AI_getBestCreature(creature);
-
Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: More tutor cards
by mtgrares » 30 Jun 2009, 16:24
Well I programmed both Demonic Tutor and Worldly Tutor, ha. Sometimes you have one idea and another times you have another one. Some of CardFactory is a little random, like using different colored crayons, lol.
Thanks for the code.
Thanks for the code.
- mtgrares
- DEVELOPER
- Posts: 1352
- Joined: 08 Sep 2008, 22:10
- Has thanked: 3 times
- Been thanked: 12 times
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 107 guests