New SVar: NeedsToPlay
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
10 posts
• Page 1 of 1
New SVar: NeedsToPlay
by Sloth » 26 May 2011, 11:31
Added the SVar NeedsToPlay. The AI won't play cards with it unless a valid
card is on the battlefield.
Example:
card is on the battlefield.
Example:
- Code: Select all
Name:Rith's Grove
ManaCost:no cost
Types:Land Lair
Text:When CARDNAME enters the battlefield, sacrifice it unless you return a non-Lair land you control to its owner's hand.
A:AB$ Mana | Cost$ T | Produced$ R | SpellDescription$ Add R to your mana pool.
A:AB$ Mana | Cost$ T | Produced$ G | SpellDescription$ Add G to your mana pool.
A:AB$ Mana | Cost$ T | Produced$ W | SpellDescription$ Add W to your mana pool.
SVar:NeedsToPlay:Land.nonLair+YouCtrl
SVar:Rarity:Uncommon
SVar:Picture:http://www.wizards.com/global/images/magic/general/riths_grove.jpg
SetInfo:PLS|Uncommon|http://magiccards.info/scans/en/ps/141.jpg
End
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New SVar: NeedsToPlay
by Corwin72 » 26 May 2011, 12:20
could Oblivion Ring and Journey to Nowhere be updated to use this?
So that they would only be able to be played by the AI if there is a creature or planeswalker on the players battlefield?
So that they would only be able to be played by the AI if there is a creature or planeswalker on the players battlefield?
-

Corwin72 - Posts: 793
- Joined: 15 Sep 2009, 13:26
- Location: Grayson, Ga
- Has thanked: 25 times
- Been thanked: 9 times
Re: New SVar: NeedsToPlay
by cc-drake » 26 May 2011, 12:33
And similar checks for cards like Torch Slinger / Flametongue Kavu, Planar Collapse / Serenity.
Re: New SVar: NeedsToPlay
by Sloth » 26 May 2011, 12:51
If I remember correctly Sol tried to improve the AI of these two cards, but I'm not sure he finished. NeedsToPlay variables like Creature.YouDontCtrl would help if needed.Corwin72 wrote:could Oblivion Ring and Journey to Nowhere be updated to use this?
So that they would only be able to be played by the AI if there is a creature or planeswalker on the players battlefield?
Flametongue Kavu and Serenity can be improved now. Torch Slinger and Planar Collapse would need some more coding.cc-drake wrote:And similar checks for cards like Torch Slinger / Flametongue Kavu, Planar Collapse / Serenity.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New SVar: NeedsToPlay
by Chris H. » 26 May 2011, 13:25
`Sloth wrote:Flametongue Kavu and Serenity can be improved now. Torch Slinger and Planar Collapse would need some more coding.
I tested the lair lands and they seem to work correctly for the AI. Thank you.
Yeah, checks for this SVar will need to be added here and there to the code base. You mentioned Cavern Harpy in another topic. Even with this SVar, the AI might still target the same Cavern Harpy rather than the other valid creature.
-

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: New SVar: NeedsToPlay
by friarsol » 26 May 2011, 15:01
Any Permanent with an ETB trigger, that uses a DB for it's Trigger will run through the trigger as optional. If the "simulated" trigger returns false, and the actual trigger is mandatory, the card will not be played. These covers a lot of cases that this new SVar could cover. This should already work. I tested with Foul Imp, and I believe I did some testing with Oblivion Ring, but someone else can do more as well just to confirm.Sloth wrote:If I remember correctly Sol tried to improve the AI of these two cards, but I'm not sure he finished. NeedsToPlay variables like Creature.YouDontCtrl would help if needed.Corwin72 wrote:could Oblivion Ring and Journey to Nowhere be updated to use this?
So that they would only be able to be played by the AI if there is a creature or planeswalker on the players battlefield?
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: New SVar: NeedsToPlay
by friarsol » 27 May 2011, 01:41
Ok I just tested Oblivion Ring and the AI is indeed waiting to cast it when he's the only one with the legitimate targets. We should make sure any cards with an ETB effect are using DB instead of AB as the top SpellAbility in the Trigger, this is the only way my "test the waters" code will work. We can also convert etbLoseLife over to Triggers (I've already tested Foul Imp as I mentioned above)friarsol wrote:Any Permanent with an ETB trigger, that uses a DB for it's Trigger will run through the trigger as optional. If the "simulated" trigger returns false, and the actual trigger is mandatory, the card will not be played. These covers a lot of cases that this new SVar could cover. This should already work. I tested with Foul Imp, and I believe I did some testing with Oblivion Ring, but someone else can do more as well just to confirm.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: New SVar: NeedsToPlay
by Sloth » 27 May 2011, 09:23
I did some testing as well and cards like Flametongue Kavu and Lava Hounds work well with their etb AF's converted to DB's.
I will search for more cards that can be improved by any of the two methods. Propositions are welcome.
I will search for more cards that can be improved by any of the two methods. Propositions are welcome.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: New SVar: NeedsToPlay
by Chris H. » 30 May 2011, 02:10
`friarsol wrote:Ok I just tested Oblivion Ring and the AI is indeed waiting to cast it when he's the only one with the legitimate targets. We should make sure any cards with an ETB effect are using DB instead of AB as the top SpellAbility in the Trigger, this is the only way my "test the waters" code will work. We can also convert etbLoseLife over to Triggers (I've already tested Foul Imp as I mentioned above)friarsol wrote:Any Permanent with an ETB trigger, that uses a DB for it's Trigger will run through the trigger as optional. If the "simulated" trigger returns false, and the actual trigger is mandatory, the card will not be played. These covers a lot of cases that this new SVar could cover. This should already work. I tested with Foul Imp, and I believe I did some testing with Oblivion Ring, but someone else can do more as well just to confirm.
Should all of the permanents with an etb trigger be converted to DB?
Accursed Centaur should be converted I guess or the AI will risk having to sac this card to itself.
What about AEther Adept? Will the code check to see if the human has a creature in play?
Akki Rockspeaker? The AI does not yet have a mana pool but I guess in this case converting the card now will prepare us for the future?
Akoum Refuge? I guess that this simulated trigger is fairly simple at this time. Will the code always return true for gianing life?
Ambassador Oak is in a similar position. That is, I guess that the simulated trigger will return true and a token will be created.
So, to wrap this up. Should we convert all of the permanents with an etb trigger to DB? Or should we limit this to just the few that could make the best use of the simulated trigger testing.
-

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: New SVar: NeedsToPlay
by Sloth » 30 May 2011, 06:29
The DB AI usually checks for bad things only (like having no targets, killing one of your own permanents or going down to critical life). So converting them all is not necessary I guess.Chris H. wrote:Should all of the permanents with an etb trigger be converted to DB?
Accursed Centaur should be converted I guess or the AI will risk having to sac this card to itself.
What about AEther Adept? Will the code check to see if the human has a creature in play?
Akki Rockspeaker? The AI does not yet have a mana pool but I guess in this case converting the card now will prepare us for the future?
Akoum Refuge? I guess that this simulated trigger is fairly simple at this time. Will the code always return true for gianing life?
Ambassador Oak is in a similar position. That is, I guess that the simulated trigger will return true and a token will be created.
So, to wrap this up. Should we convert all of the permanents with an etb trigger to DB? Or should we limit this to just the few that could make the best use of the simulated trigger testing.
Accursed Centaur for example will always return false. The only card here that should get converted is AEther Adept.
-

Sloth - Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
10 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 25 guests