A few similar cards
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
			6 posts
			 • Page 1 of 1
		
	
A few similar cards
 by Sloth » 04 Jul 2010, 17:56
by Sloth » 04 Jul 2010, 17:56 
Here are some cards I found, that are very similar to existing cards or even functional reprints.
1. Kami of the Crescent Moon
cards.txt:
cards.txt:
cards.txt:
			
		1. Kami of the Crescent Moon
cards.txt:
- Code: Select all
- Kami of the Crescent Moon
 U U
 Legndray Creature Spirit
 At the beginning of each player's draw step, that player draws an additional card.
 1/3
- Code: Select all
- upkeep_Kami_Crescent_Moon();
- Code: Select all
- private static void upkeep_Kami_Crescent_Moon() {
 final String player = AllZone.Phase.getActivePlayer();
 CardList list = new CardList();
 list.addAll(AllZone.Human_Play.getCards());
 list.addAll(AllZone.Computer_Play.getCards());
 list = list.getName("Kami of the Crescent Moon");
 for(int i = 0; i < list.size(); i++){
 AllZone.GameAction.drawCard(player);
 }
 }// upkeep_Kami_Crescent_Moon()
cards.txt:
- Code: Select all
- Ancient Runes
 2 R
 Enchantment
 At the beginning of each player's upkeep, Ancient Runes deals damage to that player equal to the number of artifacts he or she controls.
- Code: Select all
- upkeep_Ancient_Runes();
- Code: Select all
- private static void upkeep_Ancient_Runes() {
 final String player = AllZone.Phase.getActivePlayer();
 String opponent = AllZone.GameAction.getOpponent(player);
 PlayerZone opponentPlayZone = AllZone.getZone(Constant.Zone.Play, opponent);
 CardList ancient_runes = new CardList(opponentPlayZone.getCards());
 ancient_runes = ancient_runes.getName("Ancient Runes");
 PlayerZone activePlayZone = AllZone.getZone(Constant.Zone.Play, player);
 CardList artifacts = new CardList(activePlayZone.getCards());
 artifacts = artifacts.getType("Artifact");
 // determine how much damage to deal the current player
 final int damage = artifacts.size();
 // if there are 1 or more Ancient Runes owned by the opponent of the
 // current player have each of them deal damage.
 if(0 < ancient_runes.size()) {
 for(int i = 0; i < ancient_runes.size(); i++) {
 Ability ability = new Ability(ancient_runes.get(0), "0") {
 @Override
 public void resolve() {
 if(damage>0){
 PlayerLife life = AllZone.GameAction.getPlayerLife(player);
 life.setLife(life.getLife() - damage);
 }
 }
 };// Ability
 if(damage>0){
 ability.setStackDescription("Ancient Runes deals " + damage + " damage to " + player);
 AllZone.Stack.add(ability);
 }
 }
 }// if
 }// upkeep_Ancient_Runes()
cards.txt:
- Code: Select all
- Three Visits
 1 G
 Sorcery
 no text
- Code: Select all
- else if(cardName.equals("Nature's Lore"))
- Code: Select all
- else if(cardName.equals("Nature's Lore") || cardName.equals("Assert Authority"))
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: A few similar cards
 by friarsol » 05 Jul 2010, 03:06
by friarsol » 05 Jul 2010, 03:06 
I can take care of 3 and 4. I missed a bunch of sets in between when I stopped playing and now, so some of the older cards that I wanted to get in for a deck I didn't realize there was functional reprints for.Sloth wrote:Here are some cards I found, that are very similar to existing cards or even functional reprints.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: A few similar cards
 by Chris H. » 05 Jul 2010, 10:34
by Chris H. » 05 Jul 2010, 10:34 
I merged 1 and 3 into the SVN last night. We still have numbers 2 and 4 left. Number 2 might be tricky, not sure yet.
			
		- 
				 
 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: A few similar cards
 by Chris H. » 05 Jul 2010, 17:28
by Chris H. » 05 Jul 2010, 17:28 
OK, I added the code for Ancient Runes and ran a test. I put one Ancient Runes into play and both I and the computer have artifacts in play.
Only the computer is taking damage on it's turn. I believe that I should also take damage during my turn dependent on the number of artifacts that I have in play.
It looks like we may then have a similar situation with the Karma enchantment. These two cards are only effecting the opponent of the card's controller.
			
		Only the computer is taking damage on it's turn. I believe that I should also take damage during my turn dependent on the number of artifacts that I have in play.
It looks like we may then have a similar situation with the Karma enchantment. These two cards are only effecting the opponent of the card's controller.
- 
				 
 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: A few similar cards
 by Chris H. » 05 Jul 2010, 19:57
by Chris H. » 05 Jul 2010, 19:57 
I modified the Karma code and it's cousin Ancient Runes. I think that both of these cards are now working correctly. I will merge the code below sometime tonight or tomorrow.
			
		- Code: Select all
- private static void upkeep_Ancient_Runes() {
 final String player = AllZone.Phase.getActivePlayer();
 
 CardList ancient_runes = new CardList();
 ancient_runes.addAll(AllZone.Human_Play.getCards());
 ancient_runes.addAll(AllZone.Computer_Play.getCards());
 ancient_runes = ancient_runes.getName("Ancient Runes");
 
 PlayerZone activePlayZone = AllZone.getZone(Constant.Zone.Play, player);
 CardList artifacts = new CardList(activePlayZone.getCards());
 artifacts = artifacts.getType("Artifact");
 
 // determine how much damage to deal the current player
 final int damage = artifacts.size();
 
 // if there are 1 or more Ancient Runes on the
 // battlefield have each of them deal damage.
 if(0 < ancient_runes.size()) {
 for(int i = 0; i < ancient_runes.size(); i++) {
 Ability ability = new Ability(ancient_runes.get(0), "0") {
 @Override
 public void resolve() {
 if(damage>0){
 PlayerLife life = AllZone.GameAction.getPlayerLife(player);
 life.setLife(life.getLife() - damage);
 }
 }
 };// Ability
 if(damage>0){
 ability.setStackDescription("Ancient Runes deals " + damage + " damage to " + player);
 AllZone.Stack.add(ability);
 }
 }
 }// if
 }// upkeep_Ancient_Runes()
 private static void upkeep_Karma() {
 final String player = AllZone.Phase.getActivePlayer();
 
 CardList karma = new CardList();
 karma.addAll(AllZone.Human_Play.getCards());
 karma.addAll(AllZone.Computer_Play.getCards());
 karma = karma.getName("Karma");
 
 PlayerZone activePlayZone = AllZone.getZone(Constant.Zone.Play, player);
 CardList swamps = new CardList(activePlayZone.getCards());
 swamps = swamps.getType("Swamp");
 
 // determine how much damage to deal the current player
 final int damage = swamps.size();
 
 // if there are 1 or more Karmas on the
 // battlefield have each of them deal damage.
 if(0 < karma.size()) {
 for(int i = 0; i < karma.size(); i++) {
 Ability ability = new Ability(karma.get(0), "0") {
 @Override
 public void resolve() {
 if(damage>0){
 PlayerLife life = AllZone.GameAction.getPlayerLife(player);
 life.setLife(life.getLife() - damage);
 }
 }
 };// Ability
 if(damage>0){
 ability.setStackDescription("Karma deals " + damage + " damage to " + player);
 AllZone.Stack.add(ability);
 }
 }
 }// if
 }// upkeep_Karma()
- 
				 
 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: A few similar cards
 by Sloth » 05 Jul 2010, 20:41
by Sloth » 05 Jul 2010, 20:41 
Thanks, Chris.
I thought the code for Karma was correct and just copied it.
			
		I thought the code for Karma was correct and just copied it.
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
			6 posts
			 • Page 1 of 1
		
	
Who is online
Users browsing this forum: No registered users and 24 guests
