Page 1 of 1

New SVar: NeedsToPlay

PostPosted: 26 May 2011, 11:31
by Sloth
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)

Re: New SVar: NeedsToPlay

PostPosted: 26 May 2011, 12:20
by Corwin72
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?

Re: New SVar: NeedsToPlay

PostPosted: 26 May 2011, 12:33
by cc-drake
And similar checks for cards like Torch Slinger / Flametongue Kavu, Planar Collapse / Serenity.

Re: New SVar: NeedsToPlay

PostPosted: 26 May 2011, 12:51
by Sloth
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.

Re: New SVar: NeedsToPlay

PostPosted: 26 May 2011, 13:25
by Chris H.
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.

Re: New SVar: NeedsToPlay

PostPosted: 26 May 2011, 15:01
by friarsol
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.

Re: New SVar: NeedsToPlay

PostPosted: 27 May 2011, 01:41
by friarsol
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)

Re: New SVar: NeedsToPlay

PostPosted: 27 May 2011, 09:23
by Sloth
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.

Re: New SVar: NeedsToPlay

PostPosted: 30 May 2011, 02:10
by Chris H.
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.

Re: New SVar: NeedsToPlay

PostPosted: 30 May 2011, 06:29
by Sloth
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.