It is currently 21 May 2025, 12:10
   
Text Size

Card Development Questions

Post MTG Forge Related Programming Questions Here

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

Re: Card Development Questions

Postby Hellfish » 27 May 2013, 19:45

Just ran a few tests and it looks really good. Havn't found any faults as of yet. :)

Mindslaver was an easy add, too.

NOTEDIT: Wrote the above before Marc posted. I'm not getting that problem at all. :/ As for the OK button, I had to enlarge the Prompt to find the OK and cancel buttons but they're there. :)
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: Card Development Questions

Postby Max mtg » 27 May 2013, 20:05

Thanks, Hellfish.
Mindslaver was not supposed to be hard when you have the effect to control other player. I just wanted someone to test the very effect.
It's good to learn that the issues described by Mark are only related to vmessage layout.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Card Development Questions

Postby moomarc » 28 May 2013, 05:46

Okay, all seems to be working this morning and so far no issues to report.. Thanks Max. Many people are going to love you for both these cards as well as the AIvsAI/hotseat. =D>
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: Card Development Questions

Postby swordshine » 29 May 2013, 15:42

Aphetto Dredging can be implemented by "Announce$ CreatureType", but I'm not familar with the annouce code.
The script might be:
Aphetto Dredging | Open
Code: Select all
Name:Aphetto Dredging
ManaCost:3 B
Types:Sorcery
A:SP$ ChangeZone | Cost$ 3 B | Announce$ CreatureType | ValidTgts$ Creature.YouCtrl+ChosenType | TargetMin$ 0 | TargetMax$ 3 | AILogic$ MostProminentInComputerGraveyard | Origin$ Graveyard | Destination$ Hand | TgtPrompt$ Choose target creature card with the chosen type in your graveyard | SpellDescription$ Return up to three target creature cards of the creature type of your choice from your graveyard to your hand.
SVar:Rarity:Common
SVar:Picture:http://www.wizards.com/global/images/magic/general/aphetto_dredging.jpg
I don't know how to make AI correctly use announce and target the creatures.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby Max mtg » 29 May 2013, 15:54

Announce wont' work this way.
You'll need to use AB$ ChooseType | Type$ Creature, and exec ChangeZone after that.
Last edited by Max mtg on 29 May 2013, 15:56, edited 1 time in total.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Card Development Questions

Postby friarsol » 29 May 2013, 15:55

Max mtg wrote:Announce wont' work this way.
You'll need to use AB$ ChooseType , and append ChangeZone to it.
Except the timing isn't right for that either, since you need to Target before Spell Resolution.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: Card Development Questions

Postby moomarc » 29 May 2013, 15:57

Max mtg wrote:Announce wont' work this way.
You'll need to use AB$ ChooseType , and append ChangeZone to it.
The problem is that the targeting happens before choosing a type this way which is why the card was never implemented before. I think that's why Swordshine wanted to use announce, as the targeting could then be based on the announced type.
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: Card Development Questions

Postby Max mtg » 29 May 2013, 16:00

Announce is known to work only for human - in this way:
forge.card.spellability.HumanPlaySpellAbility.announceRequirements() | Open
Code: Select all
    private boolean announceRequirements() {
        // Announcing Requirements like Choosing X or Multikicker
        // SA Params as comma delimited list
        String announce = ability.getParam("Announce");
        if (announce != null) {
            for(String aVar : announce.split(",")) {
                String varName = aVar.trim();

                boolean isX = "X".equalsIgnoreCase(varName);
                CostPartMana manaCost = ability.getPayCosts().getCostMana();
                boolean allowZero = !isX || manaCost == null || manaCost.canXbe0();

                Integer value = ability.getActivatingPlayer().getController().announceRequirements(ability, varName, allowZero);
                if ( null == value )
                    return false;

                ability.setSVar(varName, value.toString());
                if( "Multikicker".equals(varName) ) {
                    ability.getSourceCard().setKickerMagnitude(value);
                } else {
                    ability.getSourceCard().setSVar(varName, value.toString());
                }
            }
        }
        return true;
    }
It's not supported by AI at all
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Card Development Questions

Postby Sloth » 29 May 2013, 17:32

Max mtg wrote:Announce is known to work only for human - in this way:
forge.card.spellability.HumanPlaySpellAbility.announceRequirements() | Open
Code: Select all
    private boolean announceRequirements() {
        // Announcing Requirements like Choosing X or Multikicker
        // SA Params as comma delimited list
        String announce = ability.getParam("Announce");
        if (announce != null) {
            for(String aVar : announce.split(",")) {
                String varName = aVar.trim();

                boolean isX = "X".equalsIgnoreCase(varName);
                CostPartMana manaCost = ability.getPayCosts().getCostMana();
                boolean allowZero = !isX || manaCost == null || manaCost.canXbe0();

                Integer value = ability.getActivatingPlayer().getController().announceRequirements(ability, varName, allowZero);
                if ( null == value )
                    return false;

                ability.setSVar(varName, value.toString());
                if( "Multikicker".equals(varName) ) {
                    ability.getSourceCard().setKickerMagnitude(value);
                } else {
                    ability.getSourceCard().setSVar(varName, value.toString());
                }
            }
        }
        return true;
    }
It's not supported by AI at all
The AI part is no problem. I can add it once it's commited.
User avatar
Sloth
Programmer
 
Posts: 3498
Joined: 23 Jun 2009, 19:40
Has thanked: 125 times
Been thanked: 507 times

Re: Card Development Questions

Postby swordshine » 30 May 2013, 00:26

FORGE.CARD.SPELLABILITY.HUMANPLAYSPELLABILITY.ANNOUNCEREQUIREMENTS() | Open
Code: Select all
    private boolean announceRequirements() {
        // Announcing Requirements like Choosing X or Multikicker
        // SA Params as comma delimited list
        String announce = ability.getParam("Announce");
        if (announce != null) {
            for(String aVar : announce.split(",")) {
                String varName = aVar.trim();
                if ("CreatureType".equals(varName)) {
                    String choice = ability.getActivatingPlayer().getController().chooseSomeType("Creature",
                            ability.getParam("AILogic"), CardType.getCreatureTypes(), new ArrayList<String>());
                    ability.getSourceCard().setChosenType(choice);
                    return true;
                }
               
                boolean isX = "X".equalsIgnoreCase(varName);
                CostPartMana manaCost = ability.getPayCosts().getCostMana();
                boolean allowZero = !isX || manaCost == null || manaCost.canXbe0();

                Integer value = ability.getActivatingPlayer().getController().announceRequirements(ability, varName, allowZero);
                if ( null == value )
                    return false;

                ability.setSVar(varName, value.toString());
                if( "Multikicker".equals(varName) ) {
                    ability.getSourceCard().setKickerMagnitude(value);
                } else {
                    ability.getSourceCard().setSVar(varName, value.toString());
                }
            }
        }
        return true;
    }
The issue for AI is that AI can choose a creature type but the spell force me to choose the targets.
swordshine
 
Posts: 682
Joined: 11 Jul 2010, 02:37
Has thanked: 116 times
Been thanked: 87 times

Re: Card Development Questions

Postby Hanmac » 30 May 2013, 15:28

sorry if i am wrong, but did forge ship this infos as textfiles too or was that only in older versions?
i wanted to use them for some kind of statistics
Hanmac
 
Posts: 954
Joined: 06 May 2013, 18:44
Has thanked: 229 times
Been thanked: 158 times

Re: Card Development Questions

Postby moomarc » 30 May 2013, 15:37

Hanmac wrote:sorry if i am wrong, but did forge ship this infos as textfiles too or was that only in older versions?
i wanted to use them for some kind of statistics
The card scripts are in a zip file in the beta and snapshot releases and has been that way as far back as I can remember. I think its named cardsfolder.zip
-Marc
User avatar
moomarc
Pixel Commander
 
Posts: 2091
Joined: 04 Jun 2010, 15:22
Location: Johannesburg, South Africa
Has thanked: 371 times
Been thanked: 372 times

Re: Card Development Questions

Postby Hanmac » 30 May 2013, 15:58

AH thanks i miss the zip file
Hanmac
 
Posts: 954
Joined: 06 May 2013, 18:44
Has thanked: 229 times
Been thanked: 158 times

Re: Card Development Questions

Postby Max mtg » 31 May 2013, 00:06

* Sphinx of Jwar Isle is hardcoded now. Can I implement its ability as {0}: Dig 1 card ?
The only problem appears to be not to use stack for this action - could add a global parameter for all SAs to skip stack.

By the way, what if (sub)abilities marked with skipstack flag resolve right after costs are paid, and non-marked do as usual? That'll let us easily script that card that requires color before it is aded to stack
Last edited by Max mtg on 31 May 2013, 00:12, edited 1 time in total.
Single class for single responsibility.
Max mtg
Programmer
 
Posts: 1997
Joined: 02 Jul 2011, 14:26
Has thanked: 173 times
Been thanked: 334 times

Re: Card Development Questions

Postby friarsol » 31 May 2013, 00:10

Max mtg wrote:* Sphinx of Jwar Isle is hardcoded now. Can I implement its ability as {0}: Dig 1 card ?
The only problem appears to be 'skip stack' for this action.
I'm not sure that really helps, you should be able to do this when you don't have priority. Additionally that would not interact with things that prevented you from activating abilities, or raised cost on abilities.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

PreviousNext

Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 10 guests


Who is online

In total there are 10 users online :: 0 registered, 0 hidden and 10 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 10 guests

Login Form