Page 1 of 1
		
			
				LeavesPlayCommand not working
				
Posted: 
22 May 2011, 08:19 
				by Sloth
				It seems to me that all LeavesPlayCommand aren't working any more. All the reports concerning auras not unenchanting when leaving the battlefield are result of this. I also tested other cards like Lightning Crafter and their LeavesPlayCommand won't happen.
I tried to look into how it works, but the code is all over the place. Can anyone else try to fix this?
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
22 May 2011, 13:49 
				by friarsol
				Yea this is an important bug that needs to be fixed. It'd be nice to know about when it broke, so we can hunt down the changes that broke it and get the code fixed.
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
22 May 2011, 14:41 
				by Hellfish
				I just tested Turn to Slag ing a Lightning Crafter that championed an Akki Avalancher and is enchanted with AEther Web. I put a breakpoint in Card.leavesPlay() and found that leavesPlay commands *are* run, but Lightning Crafter doesn't return the championed creature because it tries to get the target from it's first ability (Comes Into Play championing) but only gets null.The AEther Web correctly falls off the Lightning Crafter and subsequently goes to the graveyard. So that sucks, apparently only some auras are affected. 

Lightning Crafter is missing it's championing rules text,btw.
 
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
22 May 2011, 14:45 
				by friarsol
				Looks like this is in GameAction in the moveTo functions. I'll try to rewrite this block to work properly. If I can get LastKnownInfo working at the same time that'll be awesome, but otherwise I'll be content with getting Auras working.
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
22 May 2011, 15:07 
				by friarsol
				Ok, I just rewrote this whole function and my Auratog was properly losing its pump from Rancor. I also changed the ordering about when the Triggers happen, and tested with Altar of Dementia in the same deck. I believe Last Known Info works properly now, but I'd like more testing before declaring that the case. Can someone retest the Champion thing? But I think all should be working now.
Hellfish, it looks like when I sacrifice my Rancor to my Auratog, the Rancor's effect wasn't being placed on the stack until after the Auratog ability resolved (instead of after it hit the stack). Seems related to the Forbidden Orchard problem I noticed the other day. I'm guessing when something is being added to the stack, the triggers aren't being flushed properly? This might be an easier test case for you to debug the issue with.
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
22 May 2011, 15:48 
				by friarsol
				Ok and r8908 has a bugfix for not copying tokens, and actually copying when cards change zones, instead of copying when cards stay in the same zone.
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
22 May 2011, 15:49 
				by Sloth
				I would have been happy if one of the most reported bugs would have been fixed, but fixing both at the same time is just great! Thumbs up Sol!
I did test Holy Strength with Disenchant, Glorious Anthem with Diamond Valley and Lightning Crafter. Everything worked as expected.
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
22 May 2011, 16:55 
				by Hellfish
				The problem with some triggers not going on the stack when they should is related to when priority is passed (As that's currently the only time simultaneous triggers are flushed, which AFAIU is correct). I'm trying to stay as authentic as possible with this, but worst case scenario I'll simply manually flush simultaneous triggers at certain extra points.
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
22 May 2011, 16:59 
				by friarsol
				Hellfish wrote:The problem with some triggers not going on the stack when they should is related to when priority is passed (As that's currently the only time simultaneous triggers are flushed, which AFAIU is correct). I'm trying to stay as authentic as possible with this, but worst case scenario I'll simply manually flush simultaneous triggers at certain extra points.
Ahhh interesting. Priority isn't passed when a player activates an ability (they hold onto Priority) and when Priority passes to the AI they (usually) pass it right back to resolve the ability faster than the Triggers can hit the Stack. Sounds like we need a flush right in MagicStack.AddAndUnfreezeStack (or whatever my awesome naming convention was)
 
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
23 May 2011, 06:36 
				by Hellfish
				I've tried manually flushing the simultaneous triggers in various places around the stack code without success (including both add() methods,addAndUnfreeze() and unfreezeStack()). Once I get some time, I'll step through the entire process to get a better eye for things.
			 
			
		
			
				Re: LeavesPlayCommand not working
				
Posted: 
23 May 2011, 11:57 
				by friarsol
				Hellfish wrote:I've tried manually flushing the simultaneous triggers in various places around the stack code without success (including both add() methods,addAndUnfreeze() and unfreezeStack()). Once I get some time, I'll step through the entire process to get a better eye for things.
Yea one of the things I sorta need to do before I can fix the targeting issues is centralize all of these functionalities. We have too many paths that come into here and too many remaining cards on the old Cost/Target system. Once every hardcoded card uses the new Cost/Target system then I can actually get started getting the issue fixed.