It is currently 28 Oct 2025, 20:39
   
Text Size

canPlayAI

Post MTG Forge Related Programming Questions Here

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

canPlayAI

Postby Sloth » 12 Dec 2010, 17:00

I noticed that the AI cast Tivadar of Thorn even though it already had one in play. I looked into etbDestroyTgt and found that canPlayAI() sometimes returns true without checking super.canPlayAI(). So I replaced "return true" with "return super.canPlayAI()" and the AI won't cast a second Tivadar of Thorn any more.

I don't know so much about this part of the code. So if someone thinks this is a bad idea please help. If not, should I try to find other instances of canPlayAI() not checking super.canPlayAI() and do the same?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: canPlayAI

Postby Rob Cashwalker » 12 Dec 2010, 20:44

I'd say put a check near the beginning of canPlayAI, which just checks if super.canPlayAI is False, if it is, return False, but otherwise, let the ability AI do its thing.
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: canPlayAI

Postby Sloth » 12 Dec 2010, 20:49

Rob Cashwalker wrote:I'd say put a check near the beginning of canPlayAI, which just checks if super.canPlayAI is False, if it is, return False, but otherwise, let the ability AI do its thing.
The result is the same, for more complicated canPlayAI() functions I did just that. I don't know if super.canPlayAI takes more into consideration, but at least fighting against Leyline of Singularity .deck is now possible.
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 30 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 30 users online :: 0 registered, 0 hidden and 30 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 30 guests

Login Form