Slowtrips
Post MTG Forge Related Programming Questions Here
	Moderators: timmermac, Agetian, friarsol, Blacksmith, KrazyTheFox, CCGHQ Admins
			9 posts
			 • Page 1 of 1
		
	
Slowtrips
 by Sloth » 07 Nov 2010, 17:12
by Sloth » 07 Nov 2010, 17:12 
I've added the keyword "Draw a card at the beginning of the next turn's upkeep." (Known as Slowtrips back in the days).
It uses the player class to store the number of cards to draw next turn. (I hope this is the right place).
They are delayed abilities and thus don't use the stack (I hope someone can confirm that this is correct).
			
		It uses the player class to store the number of cards to draw next turn. (I hope this is the right place).
They are delayed abilities and thus don't use the stack (I hope someone can confirm that this is correct).
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
- 
				 
 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: Slowtrips
 by lord of 13 » 07 Nov 2010, 20:35
by lord of 13 » 07 Nov 2010, 20:35 
The abilities do use the stack... In judge vernacular, it's called a "delayed trigger", much like the delayed trigger on Ball Lightning. The effects trigger (for slowtrips) at the beginning of the next upkeep, or for Ball Lightning, at the beginning of the next end step.
			><><><><><><><
Currently developing Mindgames, for playing a rules-enforced game of MtG.
RECENT PROJECTS
->XMLScript
->Zwiel Platformer
		Currently developing Mindgames, for playing a rules-enforced game of MtG.
RECENT PROJECTS
->XMLScript
->Zwiel Platformer
- 
				 
 lord of 13
- DEVELOPER
- Posts: 79
- Joined: 06 Jan 2010, 01:36
- Has thanked: 0 time
- Been thanked: 0 time
Re: Slowtrips
 by Sloth » 07 Nov 2010, 20:58
by Sloth » 07 Nov 2010, 20:58 
Uh, I see. Thank you lord of 13. This is bad though, since the effect has to remember from which card it came from. It will get very complicated. I don't know if I'm able to get this right. Has anyone a good idea how to handle this?lord of 13 wrote:The abilities do use the stack... In judge vernacular, it's called a "delayed trigger", much like the delayed trigger on Ball Lightning. The effects trigger (for slowtrips) at the beginning of the next upkeep, or for Ball Lightning, at the beginning of the next end step.
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Slowtrips
 by Hellfish » 07 Nov 2010, 21:07
by Hellfish » 07 Nov 2010, 21:07 
The method I used to code Mana Drain could prolly be used, though that's probably not great programming practice. I just kept a static CardList for each player in whatever class was handy for the source cards. An upkeep_X method in GameActionUtil with accompanying CardLists could work?
EDIT: CardLists,not ArrayLists. Though ArrayList<Card> would work too
			EDIT: CardLists,not ArrayLists. Though ArrayList<Card> would work too

So now you're
Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
		Screaming for the blood of the cookie monster
Evil puppet demon of obesity
Time to change the tune of his fearful ballad
C is for "Lettuce," that's good enough for me
- 
				 
 Hellfish
- Programmer
- Posts: 1297
- Joined: 07 Jun 2009, 10:41
- Location: South of the Pumphouse
- Has thanked: 110 times
- Been thanked: 169 times
Re: Slowtrips
 by Sloth » 07 Nov 2010, 21:31
by Sloth » 07 Nov 2010, 21:31 
Sounds not too bad. I will look at your Mana Drain code tomorrow. Thanks Hellfish.Hellfish wrote:The method I used to code Mana Drain could prolly be used, though that's probably not great programming practice. I just kept a static CardList for each player in whatever class was handy for the source cards. An upkeep_X method in GameActionUtil with accompanying CardLists could work?
EDIT: CardLists,not ArrayLists. Though ArrayList<Card> would work too
- 
				 
 Sloth
- Programmer
- Posts: 3498
- Joined: 23 Jun 2009, 19:40
- Has thanked: 125 times
- Been thanked: 507 times
Re: Slowtrips
 by lord of 13 » 07 Nov 2010, 21:33
by lord of 13 » 07 Nov 2010, 21:33 
What about using events to register delayed triggers for each phase/step change?
			><><><><><><><
Currently developing Mindgames, for playing a rules-enforced game of MtG.
RECENT PROJECTS
->XMLScript
->Zwiel Platformer
		Currently developing Mindgames, for playing a rules-enforced game of MtG.
RECENT PROJECTS
->XMLScript
->Zwiel Platformer
- 
				 
 lord of 13
- DEVELOPER
- Posts: 79
- Joined: 06 Jan 2010, 01:36
- Has thanked: 0 time
- Been thanked: 0 time
Re: Slowtrips
 by friarsol » 08 Nov 2010, 00:15
by friarsol » 08 Nov 2010, 00:15 
I don't think we need to have one for each phase/step change. We can just create a delay trigger queue, and attach when the trigger happens. 
When those triggers could go on the stack, just check the queue for anything appropriate, and add each one on the stack.
			
		When those triggers could go on the stack, just check the queue for anything appropriate, and add each one on the stack.
- friarsol
- Global Moderator
- Posts: 7593
- Joined: 15 May 2010, 04:20
- Has thanked: 243 times
- Been thanked: 965 times
Re: Slowtrips
 by lord of 13 » 08 Nov 2010, 01:49
by lord of 13 » 08 Nov 2010, 01:49 
I meant like (in C#-pseudocode)
EventHandler<StepChangeEventArgs> stepChange;
And StepChangeEventArgs has three fields: object sender, TurnStep prev, TurnStep current
Where the sender can be a Card (the source of the trigger) or a Plane card or anything else, for that matter.
			EventHandler<StepChangeEventArgs> stepChange;
And StepChangeEventArgs has three fields: object sender, TurnStep prev, TurnStep current
Where the sender can be a Card (the source of the trigger) or a Plane card or anything else, for that matter.
><><><><><><><
Currently developing Mindgames, for playing a rules-enforced game of MtG.
RECENT PROJECTS
->XMLScript
->Zwiel Platformer
		Currently developing Mindgames, for playing a rules-enforced game of MtG.
RECENT PROJECTS
->XMLScript
->Zwiel Platformer
- 
				 
 lord of 13
- DEVELOPER
- Posts: 79
- Joined: 06 Jan 2010, 01:36
- Has thanked: 0 time
- Been thanked: 0 time
			9 posts
			 • Page 1 of 1
		
	
Who is online
Users browsing this forum: No registered users and 26 guests
