It is currently 31 Oct 2025, 01:23
   
Text Size

Rev 4410: Initial code for AF_ChangeZone

Post MTG Forge Related Programming Questions Here

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

Re: Rev 4410: Initial code for AF_ChangeZone

Postby Sloth » 20 Dec 2010, 13:28

friarsol wrote: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.
Face-Down can already be checked by hasProperty() (for example creature.faceDown).

What we have to do is not displaying exiled face down cards to the opponent (like with morph). But exiled face down cards are pretty rare anyway (Bottled Cloister, Colfenor's Plans, Duplicity etc.)

EDIT: I just noticed, the only card we have that should use exiled face down cards is Necropotence.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Rev 4410: Initial code for AF_ChangeZone

Postby friarsol » 20 Dec 2010, 15:06

zerker2000 wrote:I'd say add it, since I don't think we have many "exile face-down" cards at the moment.
I've gone to a lot of effort fixing cards that worked incorrectly and getting infrastructure in place that would streamline cards so they can be correct. I don't like the idea of adding cards because they are "close enough." Is this singleton card really in that high of a demand?
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 Sloth » 20 Dec 2010, 15:28

friarsol wrote:I've gone to a lot of effort fixing cards that worked incorrectly and getting infrastructure in place that would streamline cards so they can be correct. I don't like the idea of adding cards because they are "close enough." Is this singleton card really in that high of a demand?
Pull from Eternity can be added with ValidTgt$ Card.faceUp and it will be fine now (besides with Necropotence) and work correct in the future.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Rev 4410: Initial code for AF_ChangeZone

Postby slapshot5 » 26 Dec 2010, 06:41

What about abilities where Origin$ and Destination$ are both library? This would be for cards like Congregation at Dawn . The shuffle happens after the cards are placed in Destination. Which screws up top of library. Can this be made so that the shuffle happens before the cards are placed in the destination?

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Rev 4410: Initial code for AF_ChangeZone

Postby Chris H. » 29 Dec 2010, 02:30

slapshot5 wrote:What about abilities where Origin$ and Destination$ are both library? This would be for cards like Congregation at Dawn . The shuffle happens after the cards are placed in Destination. Which screws up top of library. Can this be made so that the shuffle happens before the cards are placed in the destination?
`
slapshot5 wrote:Does that work when ChangeNum > 1?
`
I took the liberty of moving my bug fix here so as not to overwhelm the users with too much java code.

I see the problem referred to in the second quote. I think that this minor mod will address the "ChangeNum > 1" problem:

Code: Select all
        for (int i=0; i < changeNum; i++) {
            if (fetchList.size() == 0 || destination == null)
                break;
               
            Object o = AllZone.Display.getChoiceOptional("Select a card", fetchList.toArray());
           
            if (o != null) {
                origZone.remove(o);
                Card c = (Card) o;
                fetchList.remove(c);

                if (destination.equals("Library")) {
                    // this needs to be zero indexed. Top = 0, Third = 2
                    int libraryPos = params.containsKey("LibraryPosition") ? Integer.parseInt(params.get("LibraryPosition")) : 0;
                    // do not shuffle the library once we have placed a fetched card on top.
                    if (origin.equals("Library") && i < 1) {
                        player.shuffle();
                    }
                    destZone.add(c, libraryPos);
                }
                else {
                    destZone.add(c);
                    if (destination.equals("Battlefield") && params.containsKey("Tapped"))
                        c.tap();
                }
            }
        }
       
        if (origin.equals("Library") && !destination.equals("Library"))
            player.shuffle();
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 slapshot5 » 29 Dec 2010, 06:09

Looks to me like it works. Thanks Chris.

-slapshot5
slapshot5
Programmer
 
Posts: 1391
Joined: 03 Jan 2010, 17:47
Location: Mac OS X
Has thanked: 25 times
Been thanked: 68 times

Re: Rev 4410: Initial code for AF_ChangeZone

Postby friarsol » 30 Dec 2010, 06:11

Good stuff Chris. I figured there had to be a few things that weren't accounted for when I was creating those functions, but didn't really have enough time to test them more thoroughly.
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. » 30 Dec 2010, 13:35

Thank you Slapshot5 and Sol. Yeah, one more missing piece to the AbilityFactory jigsaw puzzle added.
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

Previous

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 21 guests

Main Menu

User Menu

Our Partners


Who is online

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

Login Form