It is currently 31 Oct 2025, 15:34
   
Text Size

Slowtrips

Post MTG Forge Related Programming Questions Here

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

Slowtrips

Postby 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).
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Slowtrips

Postby Chris H. » 07 Nov 2010, 17:58

Thank you for the new keyword, Sloth.
User avatar
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

Postby 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
User avatar
lord of 13
DEVELOPER
 
Posts: 79
Joined: 06 Jan 2010, 01:36
Has thanked: 0 time
Been thanked: 0 time

Re: Slowtrips

Postby Sloth » 07 Nov 2010, 20:58

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.
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?
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Slowtrips

Postby 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 :P
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
User avatar
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

Postby Sloth » 07 Nov 2010, 21:31

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 :P
Sounds not too bad. I will look at your Mana Drain code tomorrow. Thanks Hellfish.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Slowtrips

Postby 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
User avatar
lord of 13
DEVELOPER
 
Posts: 79
Joined: 06 Jan 2010, 01:36
Has thanked: 0 time
Been thanked: 0 time

Re: Slowtrips

Postby 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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Slowtrips

Postby 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.
><><><><><><><
Currently developing Mindgames, for playing a rules-enforced game of MtG.
RECENT PROJECTS
->XMLScript
->Zwiel Platformer
User avatar
lord of 13
DEVELOPER
 
Posts: 79
Joined: 06 Jan 2010, 01:36
Has thanked: 0 time
Been thanked: 0 time


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 26 guests

Main Menu

User Menu

Our Partners


Who is online

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

Login Form