spDiscard[Tgt|Opp]
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
			25 posts
			 • Page 2 of 2 • 1, 2
		
	
Re: spDiscard[Tgt|Opp]
 by Chris H. » 10 Jul 2010, 18:50
by Chris H. » 10 Jul 2010, 18:50 
`Rob Cashwalker wrote:I fixed the addManaCosts method to correctly handle adding a mana cost with no numeric component. Mind Peel costs B, so Integer.valueOf("") apparantly is the number format exception.... In VB Val("") is 0.
Thank you for figuring this out. I will add the last card to the SVN later today.
- 
				 
 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: spDiscard[Tgt|Opp]
 by Rob Cashwalker » 11 Jul 2010, 05:04
by Rob Cashwalker » 11 Jul 2010, 05:04 
Looking at Duress for implementing the Reveal and Choose mode, I discover that the computer cheats:
If I were playing, my evaluation basically amounts to play it as long as the opponent has cards to discard. The only reason I wouldn't is if I knew the contents of his hand based on a previous reveal....
SSSAAAYYYYYYY, wouldn't it be kinda cool if somewhere we could remember the human's hand following a reveal. As the human plays cards, the game would remove them from this memorized list. This sort of knowledge could be applicable to all sorts of AI tweaks.
For example, knowing the player is holding a Giant Growth can affect the AI attack.
Edit --
While posting the AI code, I had a WTF moment, and realized that the Discarding of a Hand AI would allow the human to have a hand of zero, so those cards need to have the <numcards> parameter changed to 1.
I also am submitting a slight tweak to the AI code -
			- Code: Select all
- public boolean canPlayAI() {
 Card[] c = removeLandAndCreats(AllZone.Human_Hand.getCards());
 return 0 < c.length;
 }
- Code: Select all
- public boolean canPlayAI()
 {
 int nCards = getNumCards();
 
 PlayerZone pzH = AllZone.getZone(Constant.Zone.Hand, Constant.Player.Human);
 int numHHand = pzH.size();
 
 if (numHHand > (nCards - 1))
 {
 if (Tgt)
 setTargetPlayer(Constant.Player.Human);
 
 return true;
 }
 
 return false;
 }
If I were playing, my evaluation basically amounts to play it as long as the opponent has cards to discard. The only reason I wouldn't is if I knew the contents of his hand based on a previous reveal....
SSSAAAYYYYYYY, wouldn't it be kinda cool if somewhere we could remember the human's hand following a reveal. As the human plays cards, the game would remove them from this memorized list. This sort of knowledge could be applicable to all sorts of AI tweaks.
For example, knowing the player is holding a Giant Growth can affect the AI attack.
Edit --
While posting the AI code, I had a WTF moment, and realized that the Discarding of a Hand AI would allow the human to have a hand of zero, so those cards need to have the <numcards> parameter changed to 1.
I also am submitting a slight tweak to the AI code -
- Code: Select all
- if (numHHand >= nCards)
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: spDiscard[Tgt|Opp]
 by Rob Cashwalker » 17 Jul 2010, 03:13
by Rob Cashwalker » 17 Jul 2010, 03:13 
I just added the RevealYouChoose method to the the SVN.
Cards we already have:
			Cards we already have:
- Code: Select all
- Coercion
 2 B
 Sorcery
 no text
 spDiscardOpp:RevealYouChoose:1:Target opponent reveals his or her hand. You choose a card from it. That player discards that card.:Coercion - opponent reveals hand and discards a card
 Distress
 B B
 Sorcery
 no text
 spDiscardTgt:RevealYouChoose/Artifact.nonLand,Creature.nonLand,Enchantment,Instant,Planeswalker,Sorcery:1:Target player reveals his or her hand. You choose a nonland card from it. That player discards that card.:Distress - player reveals hand and discards a card
 Thoughtseize
 B
 Sorcery
 no text
 spDiscardTgt:RevealYouChoose/Artifact.nonLand,Creature.nonLand,Enchantment,Instant,Planeswalker,Sorcery:1:Drawback$YouLoseLife/2:Target player reveals his or her hand. You choose a nonland card from it. That player discards that card. You lose 2 life.:Thoughtsieze - player reveals hand and discards a card
 Duress
 B
 Sorcery
 no text
 spDiscardOpp:RevealYouChoose/Artifact.nonCreature.nonLand,Enchantment.nonCreature,Instant,Planeswalker,Sorcery:1:Target opponent reveals his or her hand. Choose a noncreature, nonland card from it. That player discards that card.:Duress - opponent reveals hand and discards a card
 Ostracize
 B
 Sorcery
 no text
 spDiscardOpp:RevealYouChoose/Creature:1:Target opponent reveals his or her hand. Choose a creature card from it. That player discards that card.:Ostracize - opponent reveals hand and discards a card
- Code: Select all
- Brainbite
 2 U B
 Sorcery
 no text
 spDiscardOpp:RevealYouChoose:1:Target opponent reveals his or her hand. You choose a card from it. That player discards that card.:Brainbite - opponent reveals hand and dicards a card
 Draw a card.
 Encroach
 B
 Sorcery
 no text
 spDiscardTgt:RevealYouChoose/Land.nonBasic:1:Target player reveals his or her hand. You choose a nonbasic land card from it. That player discards that card.:Encroach - player reveals hand and discards a card
 Psychic Spear
 B
 Sorcery
 no text
 spDiscardTgt:RevealYouChoose/Creature.Spirit,Instant.Arcane,Sorcery.Arcane:1:Target player reveals his or her hand. You choose a Spirit or Arcane card from it. That player discards that card.:Psychic Spear - player reveals hand and discards a card
 Shattered Dreams
 B
 Sorcery
 no text
 spDiscardOpp:RevealYouChoose/Artifact:1:Target opponent reveals his or her hand. You choose an artifact card from it. That player discards that card.:Shattered Dreams - opponent reveal hand and discards a card
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: spDiscard[Tgt|Opp]
 by Chris H. » 17 Jul 2010, 12:14
by Chris H. » 17 Jul 2010, 12:14 
`Chris H. wrote:Looks good.Thank you.
I merged the new code from the SVN into my local copy and found an error in line 617 at CardFactory.java
- Code: Select all
- CardListUtil.sortByTextLen(dPChHand);
I checked CardListUtil and could not find this method. Did you forget to merge this part of your new code?

- 
				 
 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: spDiscard[Tgt|Opp]
 by Rob Cashwalker » 17 Jul 2010, 13:55
by Rob Cashwalker » 17 Jul 2010, 13:55 
probably...
I just uploaded it.
			I just uploaded it.
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
Re: spDiscard[Tgt|Opp]
 by Chris H. » 17 Jul 2010, 14:19
by Chris H. » 17 Jul 2010, 14:19 
`Rob Cashwalker wrote:I just uploaded it.
Thank you.

- 
				 
 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: spDiscard[Tgt|Opp]
 by Chris H. » 18 Jul 2010, 00:17
by Chris H. » 18 Jul 2010, 00:17 
`Rob Cashwalker wrote:I just added the RevealYouChoose method to the the SVN.
Cards we already have:
Cards that can be added:
I merged this material into the SVN.

- 
				 
 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: spDiscard[Tgt|Opp]
 by Sloth » 10 Sep 2010, 09:26
by Sloth » 10 Sep 2010, 09:26 
Sorry to bring this up again Rob, but Wrench Mind still isn't fixed. If the AI uses it against you, you can discard any number of cards, it won't help unless you discard an artifact. 
If you use it on the AI, compy will just ignore it, if it doesn't have any artifacts in hand.
			
		If you use it on the AI, compy will just ignore it, if it doesn't have any artifacts in hand.
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: spDiscard[Tgt|Opp]
 by Rob Cashwalker » 11 Sep 2010, 03:16
by Rob Cashwalker » 11 Sep 2010, 03:16 
I think I've fixed this - r1973.
The number of cards to be discarded (if not type) was not being set.
			The number of cards to be discarded (if not type) was not being set.
The Force will be with you, Always.
		- 
				 
 Rob Cashwalker
- Programmer
- Posts: 2167
- Joined: 09 Sep 2008, 15:09
- Location: New York
- Has thanked: 5 times
- Been thanked: 40 times
			25 posts
			 • Page 2 of 2 • 1, 2
		
	
Who is online
Users browsing this forum: No registered users and 9 guests
