It is currently 29 Oct 2025, 00:46
   
Text Size

New SVar: NeedsToPlay

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins

New SVar: NeedsToPlay

Postby 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:
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
Any comments? (The name is pretty random)
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: New SVar: NeedsToPlay

Postby 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?
User avatar
Corwin72
 
Posts: 793
Joined: 15 Sep 2009, 13:26
Location: Grayson, Ga
Has thanked: 25 times
Been thanked: 9 times

Re: New SVar: NeedsToPlay

Postby cc-drake » 26 May 2011, 12:33

And similar checks for cards like Torch Slinger / Flametongue Kavu, Planar Collapse / Serenity.
cc-drake
 
Posts: 570
Joined: 14 Aug 2010, 07:15
Has thanked: 29 times
Been thanked: 6 times

Re: New SVar: NeedsToPlay

Postby Sloth » 26 May 2011, 12:51

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?
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.

cc-drake wrote:And similar checks for cards like Torch Slinger / Flametongue Kavu, Planar Collapse / Serenity.
Flametongue Kavu and Serenity can be improved now. Torch Slinger and Planar Collapse would need some more coding.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: New SVar: NeedsToPlay

Postby 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. =D>

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.
User avatar
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

Postby friarsol » 26 May 2011, 15:01

Sloth wrote:
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?
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.
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

Postby friarsol » 27 May 2011, 01:41

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.
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
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: New SVar: NeedsToPlay

Postby 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.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: New SVar: NeedsToPlay

Postby Chris H. » 30 May 2011, 02:10

friarsol wrote:
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.
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)
`
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.
User avatar
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

Postby Sloth » 30 May 2011, 06:29

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.
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.
Accursed Centaur for example will always return false. The only card here that should get converted is AEther Adept.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 25 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 25 users online :: 0 registered, 0 hidden and 25 guests (based on users active over the past 10 minutes)
Most users ever online was 9298 on 10 Oct 2025, 12:54

Users browsing this forum: No registered users and 25 guests

Login Form