It is currently 31 Oct 2025, 13:36
   
Text Size

Rev 4410: Initial code for AF_ChangeZone

Post MTG Forge Related Programming Questions Here

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

Rev 4410: Initial code for AF_ChangeZone

Postby Chris H. » 16 Dec 2010, 01:13

When you get a chance Sol can you explain what this will mean. Will we convert the Bounce, Retrieve and Fetch AFs to this new AF when it is finished?
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: Rev 4410: Initial code for AF_ChangeZone

Postby friarsol » 16 Dec 2010, 04:50

We had a discussion on another thread that basically came down to Bounce Retrieve and Fetch are all basically the same. It takes one (or more) card and moves it to a different Zone.
The Paramaters are all pretty similar, but the logic is split in two ways: one for hidden cards changing zone (Origins: Library and Hand) and known cards changing zone (Origins: Graveyard and Battlefield).

For Bounce and Retrieve it's pretty much a c/p to ChangeZone. The only thing that needs to be added is the Origin.

Bounce to ChangeZone
Code: Select all
A:AB$Bounce| Cost$ U U U T | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | Destination$ Hand | SpellDescription$ Return target permanent to its owner's hand.

converts to

A:AB$ChangeZone | Cost$ U U U T | ValidTgts$ Permanent | TgtPrompt$ Select target permanent | Origin$ Battlefield | Destination$ Hand | SpellDescription$ Return target permanent to its owner's hand.
For Fetch there is a little bit more changes, since FetchType and FetchNum are now ChangeType and ChangeNum. Other than that the addition of the Origin needs to happen as well.

With these changes cards like Elvish Piper are now able to use an AF (and cards like Burning Wish in the future will be able to as well.) The new AF also has a SubAbility so it's better for new cards to just use ChangeZone. There's not anything wrong with the other three, and I'm sure if we had planned out the AbilityFactories we wouldn't need to have done a second conversion so quickly to the first, so I wouldn't rush into moving them over. But at some point we should probably do that.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Rev 4410: Initial code for AF_ChangeZone

Postby zerker2000 » 16 Dec 2010, 11:48

What I don't get is why any existing cards need to be converted. Can't we parse e.g. "AB$Bounce" as "AB$ChangeZone | Origin$ Battlefield", etc.?
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Rev 4410: Initial code for AF_ChangeZone

Postby friarsol » 16 Dec 2010, 14:48

That seems like a good way to have confusing and undocumented features that aren't streamlined. Also that wouldn't work for Fetch as stated above.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Rev 4410: Initial code for AF_ChangeZone

Postby Chris H. » 17 Dec 2010, 20:19

I remember that message now. The AI for all three are the same, have the AI choose the best card or in some cases, a random card.

I am currently working on converting over the bounce cards. Hope to finish them today or tomorrow.
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: Rev 4410: Initial code for AF_ChangeZone

Postby friarsol » 17 Dec 2010, 20:40

Sorry for all the duplicate work Chris.

The difference comes in whether the card(s) is targeted or decided as the card resolves. But they all finish basically lke this:

moveTo(destinationZone, card)
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Rev 4410: Initial code for AF_ChangeZone

Postby Chris H. » 18 Dec 2010, 01:05

No problem, I just finished the Bounce to ChangeZone cards. The Retrieve cards should also be easy, they will need Origin$ Graveyard. I will try to get to them this weekend.
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: Rev 4410: Initial code for AF_ChangeZone

Postby zerker2000 » 18 Dec 2010, 03:13

Any chance you could get Origin$ Exile while you're at it?
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Rev 4410: Initial code for AF_ChangeZone

Postby friarsol » 18 Dec 2010, 03:27

zerker2000 wrote:Any chance you could get Origin$ Exile while you're at it?
Is there any sample cards that use it? It should work out of the box I think though?

Code: Select all
   private static void changeZoneResolve(AbilityFactory af, SpellAbility sa){
      HashMap<String,String> params = af.getMapParams();
      String origin = params.get("Origin");
      if (origin.equals("Library") || origin.equals("Hand") || origin.equals("Sideboard")){
         changeHiddenOriginResolve(af, sa);
      }
      else if (origin.equals("Graveyard") || origin.equals("Exile") || origin.equals("Battlefield")){
         changeKnownOriginResolve(af, sa);
      }
   }
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Rev 4410: Initial code for AF_ChangeZone

Postby RedSypher » 18 Dec 2010, 05:47

Pull From Eternity would presumably use it (although i have no idea why it refuses to reveal it in the scroll over).
RedSypher
 
Posts: 25
Joined: 31 Oct 2010, 06:48
Has thanked: 0 time
Been thanked: 0 time

Re: Rev 4410: Initial code for AF_ChangeZone

Postby zerker2000 » 18 Dec 2010, 09:32

You need to put a character before it, and the from is lowercase. But yeah, Pull from Eternity, and Riftsweeper if/when we move Whenever's into AF.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Re: Rev 4410: Initial code for AF_ChangeZone

Postby friarsol » 18 Dec 2010, 15:22

Yea there's plenty of cards that do it as a trigger, but that isn't ready in AFs yet. Never even heard of Pull From Eternity.

I just tested it and it works, although it currently doesn't look for the "Face Up" part, since I don't think we really track that in zones other than the Battlefield. Since it doesn't have that Face Up restriction, I'm not going to submit the card at this time.

We probably should start tracking that at some point. And we also should probably add Face-Up and Face-Down to hasProperty() since there is a fair amount of caring for those properties in Morph related cards.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Rev 4410: Initial code for AF_ChangeZone

Postby Chris H. » 18 Dec 2010, 15:26

Chris H. wrote:The Retrieve cards should also be easy, they will need Origin$ Graveyard. I will try to get to them this weekend.
`
I finished the Retrieve to ChangeZone cards. The only ones left are the Fetch cards.
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: Rev 4410: Initial code for AF_ChangeZone

Postby Chris H. » 19 Dec 2010, 03:13

Chris H. wrote:The only ones left are the Fetch cards.
`
These are now done.
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: Rev 4410: Initial code for AF_ChangeZone

Postby zerker2000 » 20 Dec 2010, 09:13

friarsol wrote:Yea there's plenty of cards that do it as a trigger, but that isn't ready in AFs yet. Never even heard of Pull From Eternity.

I just tested it and it works, although it currently doesn't look for the "Face Up" part, since I don't think we really track that in zones other than the Battlefield. Since it doesn't have that Face Up restriction, I'm not going to submit the card at this time.

We probably should start tracking that at some point. And we also should probably add Face-Up and Face-Down to hasProperty() since there is a fair amount of caring for those properties in Morph related cards.
I'd say add it, since I don't think we have many "exile face-down" cards at the moment.
O forest, hold thy wand'ring son
Though fears assail the door.
O foliage, cloak thy ravaged one
In vestments cut for war.


--Eladamri, the Seed of Freyalise
zerker2000
Programmer
 
Posts: 569
Joined: 09 May 2009, 21:40
Location: South Pasadena, CA
Has thanked: 0 time
Been thanked: 0 time

Next

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 34 guests

Main Menu

User Menu

Our Partners


Who is online

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

Login Form