tag:blogger.com,1999:blog-889604442512373664.post753410056373703767..comments2023-10-31T08:28:52.391-07:00Comments on Computer Programming and Magic: The Gathering: Zone Events - Part 1Forgehttp://www.blogger.com/profile/15838286606081721333noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-889604442512373664.post-39297384763950817022009-06-09T10:27:37.755-07:002009-06-09T10:27:37.755-07:00Incantus,
Replacement effects are very hard. H...Incantus, <br /><br />Replacement effects are very hard. How does your program implement them?Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-16981386318192732052009-06-04T20:44:51.010-07:002009-06-04T20:44:51.010-07:00Rares -
Actually, moving from hand to graveyard ...Rares - <br /><br />Actually, moving from hand to graveyard and discarding a card are 2 different events (especially if you consider replacement effects).<br /><br />Also, that's the way Incantus does it. Everytime a card moves from one zone to another, the zone sends 2 events, and LeaveZoneEvent(zone, card) and an EnterZoneEvent(zone, card). Anybody who's interested can listen to those events and do something in response. This captures all the possible zone change events, including the ones that look back in time - for example, "Whenever a creature card enters graveyard from play", looks back to see if the card was a creature in play (this way it fires for things like animated lands).Incantusnoreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-6699145637703638802009-06-04T11:03:51.658-07:002009-06-04T11:03:51.658-07:00I've been thinking a lot about these sorts of ...I've been thinking a lot about these sorts of things too. a "Comes into play" event, shouldn't necessarily be different from a "when another card comes into play" event <br /><br />I see these two events being the same.<br /><br />Moxy,<br />And yes MTG Forge needs more phases.Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-8759945196806779662009-06-04T10:59:27.815-07:002009-06-04T10:59:27.815-07:00Am I wrong if I say that "moving a card from ...Am I wrong if I say that "moving a card from your hand to your graveyard" is equivalent to "discard".<br /><br />Yes I agree but this post only talks about events that affect a single zone, addCard() and removeCard(). The next post talks about events that affect two zones, such as discard.Forgehttps://www.blogger.com/profile/15838286606081721333noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-46766662840424028872009-06-04T00:27:23.683-07:002009-06-04T00:27:23.683-07:00@Rob Cashwalker:you should think in a more generic...@Rob Cashwalker:you should think in a more generic way.<br />I think you don't need a "come into play" event.<br />You just need an event "changedZone", with 3 attributes. The card, the "from" zone, and the "to" zone.<br />If "toZone" is "inPlay", then it is a "come Into Play" event.<br />Please have look at what I did in wagic, I think it works well enough: <br />Have a look at the following code in the <a href="http://code.google.com/p/wagic/source/browse/trunk/projects/mtg/src/MTGGameZones.cpp#118" rel="nofollow">Wagic svn</a>. The function "putInZone" is of course called whenever a card needs to move from one zone to another. Look at the event creation on line 144. I create an event and send it to the "gameObserver". The abilities in play then do whatever they want of the event.willowhttp://wololo.net/wagicnoreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-64712370615727030162009-06-03T21:14:42.525-07:002009-06-03T21:14:42.525-07:00I've been thinking a lot about these sorts of ...I've been thinking a lot about these sorts of things too. a "Comes into play" event, shouldn't necessarily be different from a "when another card comes into play" event - they should really be the same event, but the card-specific code just checks to see if the card that came into play was itself or another card. Similarly, a generic "card leaves play event" should be triggered on any card that registers as having such and event handler. Then the event handler checks, is it myself going to the graveyard, or some other card?<br />Currently there's a "comes into play" Command object implemented in the Card object. Each card should have not one Command object, but a list of Commands for each type of event. Some cards do more than one thing when an event occurs. The thing that they do may be generically defined by keyworded abilities, so mixing and matching needs to be supported, without having to explicitly code both actions into a single Command object. Plus, each Command object may have different actions depending on the circumstance....<br />This way the following pseudo code could be coded in three generic objects, and each will get executed.<br />if (Card comes into play and condition a is true)<br /> do x<br />...<br />if (Card comes into play and condition b is true)<br /> do y<br />...<br />if (Card comes into play)<br /> do zUnknownhttps://www.blogger.com/profile/15178010996656985441noreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-21354317929657725552009-06-03T19:08:19.804-07:002009-06-03T19:08:19.804-07:00Am I wrong if I say that "moving a card from ...Am I wrong if I say that "moving a card from your hand to your graveyard" is equivalent to "discard". your events should be classes that inherit an abstract "Event" class. Then, a "move" event would have information regarding the card that was moved, which zone it was moved from and which zone it was moved to. To check if the card is discarded, you just have to ask the event if the "from" zone was a hand and the "to" zone was a graveyard.<br />Again, this is assuming these are equivalent, which I believe they arewillowhttp://wololo.net/wagicnoreply@blogger.comtag:blogger.com,1999:blog-889604442512373664.post-87236730016977268012009-06-03T13:17:59.016-07:002009-06-03T13:17:59.016-07:00generically any zone change needs an event.
Some...generically any zone change needs an event. <br /><br />Something that is sorely missing from the current version is giving the user a chance to respond to the start and end of any phase and or step. I can't currently use Elvish Piper (or flash) at the beginning of the declare blockers (or end of declare attackers) step so that I can "sneak block"Moxynoreply@blogger.com