ptisan35700 wrote:It seems like the cards that are supposed to bestow "Hexproof" aren't really doing that. The token indicating "Hexproof" shows up, but the creatures are still able to be targeted.
I don't know if this problem is related to your code or not.
I can only think of two cards I've coded w/ hexproof at the moment -
Asceticism and
Vines of Vastwood. I haven't tested vines very much, but I am certain I've never seen AI cast against my critters while
Asceticism was down. I guess I must not have tested vastwood beyond noting that the badge appeared. After reading your post, I went back and tried to get the AI to "counter" a spell w/ vastwood and it did indeed fail. Thank you for finding a bug. I will very much require help to find all of them.
I will have to give some though, and probably request some help, to figure this one out. It seems that the game checks to see if a card is valid (and fires the CARD_CONSIDERED_FOR_TARGETTING trigger) only at the time a spell is cast and that shrouding a card (as Vastwood seems to be properly doing) doesn't force the game to reevaluate targets. We could perhaps remove the target from play and return it, but that would trigger comes-into-play effects. We could check for damage and remove it, but that wouldn't prevent stuff like
Act of Treason or the case where you cast vastwood on an opponent's creatures to prevent a
Giant Growth or something. There may be facilities built into the game for manipulating spells on the stack (I know
Precursor Golem waits until it gets hit w/ a spell to start copying it) I will have to do some studying to see if I can find a good solution.
Thanks again for bringing this to my attention - definitely on the TODO list, 'cause
Vines of Vastwood is a great card.
update: I noticed today that there was, in fact, a slight error in
Asceticism (missing ()). It doesn't seem to have any significant impact, as it was used in a redundant sanity check. As an experiment, I also tried using the Protection() function on
Vines of Vastwood to give the target card protection from /everything/ belonging to an opponent until the end of turn. This allowed a 1/1 creature to block anything without damage, so the protection is working. Unfortunately, it still failed to protect from anything that was already on the stack at the time Vines was cast. The only thing I can think of to try at this point is to <filter> everything in ZONE_STACK and check to see if it targets the card that vines is targeting, countering it if so. This, coupled with protection from everything belonging to opponents until end of phase/step (to protect from activated abilities), might do the trick. This might have unintended consequences if vines is cast during a combat phase, though - I'm not sure if the protection would die before combat damage was resolved. Either way, I'll try it out soon and see what happens.